Generate passwords from op 1P CLI?

B0rg
B0rg
Community Member

Is it possible to add command to generate random passwords from the 1P CLI?
Add the https://1password.com/password-generator/ web version also to the "op" command.

Like:
~/home>op --genpass aB! 12
Generates a Password with a length of 12 character with lowercase UPPERCASE and symbols.


1Password Version: Not Provided
Extension Version: Not Provided
OS Version: Not Provided

Comments

  • Heya!

    Thank you for reaching out to us!
    Currently, the only way to generate such passwords with the 1Password CLI is with op item create.
    Can you please let us know more about your use-case, that would make use of this feature?
    For what it's worth, we do have an internal ticket that tracks adding such functionality.
    Looking forward to hearing from you!

    Best,
    Horia

  • B0rg
    B0rg
    Community Member

    @Horia.Culea_1P Thank you for your reply.
    I just want to create a password not a item in 1P using the CLI. And make a Alfred workflow so the passwords i create are only made by 1P and not pwgen or other password creator sites/tools.

  • Thanks for the follow-up! We'll make sure to update this thread once we have any developments on this front.

    Best,
    Horia

  • gtirloni
    gtirloni
    Community Member

    Hi, any updates on this? It would be nice to use a password generator blessed by 1Password.

  • andi.t_1P
    edited August 2022

    Hi @gtirloni and thank you for following up on this! As we do not currently support a straight up alternative to pwgen we do provide a (slightly longer but more comprehensive) solution for generating a password AND saving it for future use:

    Use the '--generate-password' option to generate and set a random
    password for a Login or Password item. By default, it will create a
    32-character password made up of letters, numbers, and symbols.

    You can customize the password with a password recipe. Specify the
    password length and which character types to use in a comma-separated
    list. Ingredients are:

    • 'letters' for uppercase and lowercase letters
    • 'digits' for numbers
    • 'symbols' for special characters ('!@.-_*')
    • '1' - '64' for password length

    Example for your use case:

    op item create --title='retrievable generated password' --category=password --generate-password=20,letters,digits | op read op://Private/'retrievable generated password'/password

    This should achieve your desired output and furthermore it will store your password for further retrieval at any later stage using the op read [secret_reference] command.

    Hope this helps!

    All the best,
    Andi

  • gtirloni
    gtirloni
    Community Member

    Thank you, much appreciated.

  • Glad I could help!

This discussion has been closed.