feat: allow managing invite code in secret generators (#12109)

# Which Problems Are Solved

Zitadel exposes the secrets generator configuration through its admin
api. This allows instance admins to manage them on their own and they
can create overwrite the system / runtime defaults (incl. expiration).
This very much needed in multi-instance scenarios such as zitadel.cloud.
Currently the invite code configuration was not manageable through the
API, but only runtime config.

# How the Problems Are Solved

- added the `invite_code` type to the API allowing it to be set and
retrieved.
- added the type to console's management list
- added the type to be stored on instance setup
- change the `GetSecretGenerator` endpoint to fall back to the runtime
config if no config is stored on the instance itself
- ensure the `length` and at least one charset is enabled, return an
error otherwise
- expiry is not enforced, so 0 allows codes with no expiry (current
state)

# Additional Changes

None

# Additional Context

- closes https://github.com/zitadel/zitadel/issues/10474

(cherry picked from commit 1e0b810dca)
This commit is contained in:
Livio Spring committed 2026-07-10 07:34:08 +02:00
1 parent fa916e7659
commit 915586a40f
39 files changed
+293 -60

No files matched your search

+10
View File
@@ -23,6 +23,16 @@ type GeneratorConfig struct {
IncludeSymbols bool
}
func (c *GeneratorConfig) Valid() error {
if c.Length < 1 {
return zerrors.ThrowInvalidArgument(nil, "CRYPTO-FVJ2x", "Errors.InvalidArgument")
}
if !c.IncludeLowerLetters && !c.IncludeUpperLetters && !c.IncludeDigits && !c.IncludeSymbols {
return zerrors.ThrowInvalidArgument(nil, "CRYPTO-Ckl2s", "Errors.InvalidArgument")
}
return nil
}
//go:generate mockgen -source code.go -destination ./code_mock.go -package crypto
type Generator interface {