identity

package
v0.1.0-rc.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 16, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateTOTPSecret

func GenerateTOTPSecret() (string, error)

func HashPassword

func HashPassword(password string) (string, error)

func PublicJWK

func PublicJWK(kid string, key *rsa.PublicKey) map[string]any

func Sign

func Sign(privatePEM []byte, kid string, claims Claims) (string, error)

func VerifyPassword

func VerifyPassword(encoded, password string) bool

func VerifyTOTP

func VerifyTOTP(secret, code string, now time.Time) bool

Types

type Actor

type Actor struct {
	Subject string `json:"sub"`
	Type    string `json:"type"`
}

type Claims

type Claims struct {
	Issuer        string         `json:"iss"`
	Subject       string         `json:"sub"`
	Audience      []string       `json:"aud"`
	ExpiresAt     int64          `json:"exp"`
	IssuedAt      int64          `json:"iat"`
	NotBefore     int64          `json:"nbf"`
	JWTID         string         `json:"jti"`
	SessionID     string         `json:"sid,omitempty"`
	ApplicationID string         `json:"application_id,omitempty"`
	ClientID      string         `json:"client_id,omitempty"`
	TokenKind     string         `json:"token_kind"`
	ActorType     string         `json:"actor_type"`
	Scope         string         `json:"scope,omitempty"`
	Roles         RoleClaims     `json:"roles"`
	Email         string         `json:"email,omitempty"`
	Locale        string         `json:"locale,omitempty"`
	EmailVerified bool           `json:"email_verified,omitempty"`
	IsOrgVerified bool           `json:"is_org_verified,omitempty"`
	CustomClaims  map[string]any `json:"custom_claims,omitempty"`
	AMR           []string       `json:"amr,omitempty"`
	Actor         *Actor         `json:"act,omitempty"`
}

func Verify

func Verify(token string, resolve func(kid string) (*rsa.PublicKey, error), issuer, audience string, now time.Time) (Claims, error)

type KeyPair

type KeyPair struct {
	PrivatePEM []byte
	PublicJWK  map[string]any
	KID        string
}

func GenerateKeyPair

func GenerateKeyPair() (KeyPair, error)

type RoleClaims

type RoleClaims struct {
	Application []string            `json:"application"`
	Workspaces  map[string][]string `json:"workspaces"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL