Documentation
¶
Index ¶
- func NewExportCommand() *cobra.Command
- func NewGenerateCommand() *cobra.Command
- func NewImportCommand() *cobra.Command
- func NewUserCommand() *cobra.Command
- func RegisterCommands(parent *cobra.Command)
- type Emails
- type ImportOTPSecret
- type ImportOrExportEmail
- type ImportOrExportEntry
- type ImportOrExportList
- type ImportPasswordCredential
- type ImportWebauthnCredential
- type ImportWebauthnCredentials
- type Importer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewExportCommand ¶ added in v0.9.0
func NewGenerateCommand ¶
func NewImportCommand ¶
func NewUserCommand ¶
func RegisterCommands ¶
Types ¶
type ImportOTPSecret ¶ added in v1.3.0
type ImportOTPSecret struct {
// Secret of the TOTP credential. TOTP credential must be generated for a period of 30 seconds and SHA1 hash algorithm.
Secret string `json:"secret" yaml:"secret" validate:"required"`
// CreatedAt optional timestamp when the otp secret was created. Will be set to the import date if not provided.
CreatedAt *time.Time `json:"created_at,omitempty" yaml:"created_at" validate:"omitempty"`
// UpdatedAt optional timestamp of the last update to the otp secret. Will be set to the import date if not provided.
UpdatedAt *time.Time `json:"updated_at,omitempty" yaml:"updated_at" validate:"omitempty"`
}
type ImportOrExportEmail ¶ added in v0.9.0
type ImportOrExportEmail struct {
// Address Valid email address
Address string `json:"address" yaml:"address" jsonschema:"format=email" validate:"email"`
// IsPrimary indicates if this is the primary email of the users. In the Emails array there has to be exactly one primary email.
IsPrimary bool `json:"is_primary" yaml:"is_primary"`
// IsVerified indicates if the email address was previously verified.
IsVerified bool `json:"is_verified" yaml:"is_verified"`
}
ImportOrExportEmail The import/export format for a user's email
func (ImportOrExportEmail) JSONSchemaExtend ¶ added in v1.0.1
func (ImportOrExportEmail) JSONSchemaExtend(schema *jsonschema.Schema)
type ImportOrExportEntry ¶ added in v0.9.0
type ImportOrExportEntry struct {
// UserID optional uuid.v4. If not provided a new one will be generated for the user
UserID string `json:"user_id,omitempty" yaml:"user_id" validate:"omitempty,uuid4"`
// Emails optional list of emails
Emails Emails `json:"emails" yaml:"emails" jsonschema:"type=array,minItems=1" validate:"required_if=Username 0,unique=Address,dive"`
// Username optional username of the user
Username *string `json:"username,omitempty" yaml:"username" validate:"required_if=Emails 0,omitempty,gte=1"`
// WebauthnCredentials optional list of WebAuthn credentials of a user. Includes passkeys and MFA credentials.
WebauthnCredentials ImportWebauthnCredentials `json:"webauthn_credentials,omitempty" yaml:"webauthn_credentials" validate:"omitempty,unique=ID,dive"`
// Password optional password.
Password *ImportPasswordCredential `json:"password" yaml:"password" validate:"omitempty"`
// OTPSecret optional TOTP secret for MFA.
OTPSecret *ImportOTPSecret `json:"otp_secret" yaml:"otp_secret" validate:"omitempty"`
// CreatedAt optional timestamp of the users' creation. Will be set to the import date if not provided.
CreatedAt *time.Time `json:"created_at,omitempty" yaml:"created_at" validate:"omitempty"`
// UpdatedAt optional timestamp of the last update to the user. Will be set to the import date if not provided.
UpdatedAt *time.Time `json:"updated_at,omitempty" yaml:"updated_at" validate:"omitempty"`
}
ImportOrExportEntry represents a user to be imported/export to the Hanko database
func (ImportOrExportEntry) JSONSchemaExtend ¶ added in v1.0.1
func (ImportOrExportEntry) JSONSchemaExtend(schema *jsonschema.Schema)
type ImportOrExportList ¶ added in v0.9.0
type ImportOrExportList []ImportOrExportEntry
ImportOrExportList a list of ImportEntries
func (ImportOrExportList) JSONSchemaExtend ¶ added in v1.0.1
func (ImportOrExportList) JSONSchemaExtend(schema *jsonschema.Schema)
type ImportPasswordCredential ¶ added in v1.3.0
type ImportPasswordCredential struct {
// Password hash of the password in bcrypt format.
Password string `json:"password" yaml:"password" validate:"required,startswith=$2a$"`
// CreatedAt optional timestamp when the password was created. Will be set to the import date if not provided.
CreatedAt *time.Time `json:"created_at,omitempty" yaml:"created_at" validate:"omitempty"`
// UpdatedAt optional timestamp of the last update to the password. Will be set to the import date if not provided.
UpdatedAt *time.Time `json:"updated_at,omitempty" yaml:"updated_at" validate:"omitempty"`
}
type ImportWebauthnCredential ¶ added in v1.3.0
type ImportWebauthnCredential struct {
// ID of the WebAuthn credential.
ID string `json:"id" yaml:"id" validate:"required"`
// Optional Name of the WebAuthn credential.
Name *string `json:"name" yaml:"name" validate:"omitempty"`
// The PublicKey of the credential.
PublicKey string `json:"public_key" yaml:"public_key" validate:"required"`
// The AttestationType the credential was created with.
AttestationType string `json:"attestation_type" yaml:"attestation_type" validate:"required"`
// Optional AAGUID of the authenticator on which the credential was created on.
AAGUID uuid.UUID `json:"aaguid" yaml:"aaguid" validate:"omitempty,uuid4"`
// Optional SignCount of the WebAuthn credential.
SignCount int `json:"sign_count" yaml:"sign_count"`
// LastUsedAt optional timestamp when the WebAuthn credential was last used.
LastUsedAt *time.Time `json:"last_used_at" yaml:"last_used_at" validate:"omitempty"`
// CreatedAt optional timestamp of the WebAuthn credentials' creation. Will be set to the import date if not provided.
CreatedAt *time.Time `json:"created_at" yaml:"created_at" validate:"omitempty"`
// UpdatedAt optional timestamp of the last update to the WebAuthn credential. Will be set to the import date if not provided.
UpdatedAt *time.Time `json:"updated_at" yaml:"updated_at" validate:"omitempty"`
// Optional list of supported Transports by the authenticator.
Transports []string `json:"transports" yaml:"transports" validate:"omitempty,unique"`
// BackupEligible flag indicates if the WebAuthn credential can be backed up (e.g. in Apple KeyChain, ...). If the information is not available set it to false.
BackupEligible bool `json:"backup_eligible" yaml:"backup_eligible"`
// BackupState flag indicates if the WebAuthn credential is backed up (e.g. in Apple KeyChain, ...). If the information is not available set it to false.
BackupState bool `json:"backup_state" yaml:"backup_state"`
// MFAOnly flag indicates if the WebAuthn credential can only be used in combination with another login factor (e.g. password, ...).
MFAOnly bool `json:"mfa_only" yaml:"mfa_only"`
// UserHandle optional user id which was used to create the credential with.
// Populate only when user id was not an uuid v4 and the WebAuthn credential is not an MFAOnly credential.
UserHandle *string `json:"user_handle" yaml:"user_handle" validate:"omitempty,excluded_if=MFAOnly true"`
}
type ImportWebauthnCredentials ¶ added in v1.3.0
type ImportWebauthnCredentials []ImportWebauthnCredential
Click to show internal directories.
Click to hide internal directories.