Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Have a list of constants for supported character sets for password generation recipe #71

Open
3 tasks
edif2008 opened this issue Aug 8, 2022 · 0 comments

Comments

@edif2008
Copy link
Member

edif2008 commented Aug 8, 2022

Summary

Currently, when making a password recipe, you need to specify the character sets that can be used when generating the password (e.g. SYMBOLS, LETTERS, DIGITS). However, it can be tricky to know by heart the supported character sets.

Also, it would be nice to have a sort of validation of the recipe before sending the request to Connect. As a starting inspiration, you can check the validRecipe function from Node SDK.

Tasks to be done

  • Add a new type that will be used as a field purpose, along with the constants that represent the supported character sets. Add this in onepassword/items/go. Please ensure that all constants are set by checking out this part of the Connect API documentation
    Note: Feel free to change the name of the type, as well as the constant names. This is just a sample code of what it can look like.
    type CharacterSets string
    
    const (
        Letters CharacterSets = "LETTERS"
        Symbols CharacterSets = "SYMBOLS"
        Digits  CharacterSets = "DIGITS"
    )
  • Change the CharacterSets property of the GeneratorRecipe struct to use the new type. (line 132)
    // GeneratorRecipe Representation of a "recipe" used to generate a field
    type GeneratorRecipe struct {
        Length            int             `json:"length,omitempty"`
        CharacterSets     []CharacterSets `json:"characterSets,omitempty"`
        ExcludeCharacters string          `json:"excludeCharacters,omitempty"`
    }
  • If needed, add a validator function that validates the provided list of character sets. If this is added, also add tests that make sure the validator works as expected.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant