Have a list of constants for supported character sets for password generation recipe
edif2008 opened this issue · 0 comments
edif2008 commented
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 theGeneratorRecipe
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.