feat: static passcode generator for tests - #2793
Open
pvanek wants to merge 1 commit into
Open
Conversation
New type of passcode charset is created: "static". It always returns a predefined code - `123456` for now. This code generator is not targeted to real usage, its main purpose is to serve static codes in tests using Hanko in e.g. Docker compose with custom applications.
lfleischmann
marked this pull request as ready for review
August 13, 2026 15:49
lfleischmann
requested changes
Aug 13, 2026
lfleischmann
left a comment
Member
There was a problem hiding this comment.
Hope you don't mind I undrafted this. We decided to go ahead with this, just added some minor suggestions
| } | ||
|
|
||
| func (g *staticPasscodeGenerator) Generate() (string, error) { | ||
| // this is just a POC for now. I can imagine config option for it, or an env variable... |
Member
There was a problem hiding this comment.
Suggested change
| // this is just a POC for now. I can imagine config option for it, or an env variable... |
Member
There was a problem hiding this comment.
Suggested change
| PasscodeCharset PasscodeCharset `yaml:"passcode_charset" json:"passcode_charset" koanf:"passcode_charset" jsonschema:"default=numeric,enum=numeric,enum=alphanumeric,enum=static"` |
Comment on lines
23
to
24
| // `passcode_charset` specifies the characters that can be used in passcodes. | ||
| // E.g. `numeric` allows only numbers, `alphanumeric` allows both numbers and letters. |
Member
There was a problem hiding this comment.
Suggested change
| // `passcode_charset` specifies the characters that can be used in passcodes. | |
| // E.g. `numeric` allows only numbers, `alphanumeric` allows both numbers and letters. `static` returns always the same passcode 123456, it SHOULD ONLY BE USED FOR DEVELOPMENT/DEBUG/TESTING PURPOSES. |
Just felt like blowing that up a bit 🙈
| "static" | ||
| ], | ||
| "description": "`passcode_charset` specifies the characters that can be used in passcodes.\nE.g. `numeric` allows only numbers, `alphanumeric` allows both numbers and letters.", | ||
| "description": "`passcode_charset` specifies the characters that can be used in passcodes.\nE.g. `numeric` allows only numbers, `alphanumeric` allows both numbers and letters, `static` returns always the same passcode 123456.\nThe `static` should be used in local test runs only.", |
Member
There was a problem hiding this comment.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
New type of passcode charset is created: "static". It always returns a predefined code -
123456for now.This code generator is not targeted to real usage, its main purpose is to serve static codes in tests using Hanko in e.g. Docker compose with custom applications.
I want to run our integration test suite based on Hanko's docker compose file + additional containers for with our stack. The problem is with user registration tests. The verification code (email|) obviously always different and sent in the email body to MailSlurper.
Implementation
new "enum" value
staticforpasscode_charsetwhich returns123456for now.Todos
This PR is a proposal for now, I'm pretty sure the team will have strong opinions about it.