Skip to content

Instantly share code, notes, and snippets.

@zalary
Created August 20, 2020 20:32
Show Gist options
  • Save zalary/5e60f5f7701baaeb87768d4e7b76e704 to your computer and use it in GitHub Desktop.
Save zalary/5e60f5f7701baaeb87768d4e7b76e704 to your computer and use it in GitHub Desktop.
preserve spaces with transform
vault write transform/alphabet/allow-spaces alphabet="123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+-_ "
vault write transform/alphabet/no-spaces alphabet="123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+-_"
vault write transform/transformation/testing \
type=fpe \
template="spaces-tmpl" \
tweak_source=internal \
allowed_roles=spaces
vault write transform/transformation/spacetest \
type=fpe \
template="spacetest-tmpl" \
tweak_source=internal \
allowed_roles=nospaces
vault read transform/transformation/testing
Key Value
--- -----
allowed_roles [spaces]
templates [preseve-spaces-tmpl] #please ignore that i cannot spell in testing
tweak_source internal
type fpe
vault read transform/transformation/spacetest
Key Value
--- -----
allowed_roles [nospaces]
templates [spacetest-tmpl]
tweak_source internal
type fpe
vault write transform/template/spaces-tmpl \
type=regex \
pattern="([A-Za-z-0-9_+ ]*[A-Za-z0-9+ ]*[A-Za-z0-9_+ ])" \
alphabet=allow-spaces
vault write transform/template/spacetest-tmpl \
type=regex \
pattern="(([A-Za-z-0-9_+])*([A-Za-z0-9+])*([A-Za-z0-9_+]))"\
alphabet=no-spaces
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment