authn

package
v0.15.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TokenKindUser              = "user"
	TokenKindAgent             = "agent"
	TokenKindEvidenceSignature = "evidence_signature"
)

Variables

This section is empty.

Functions

func GenerateAgentJWTToken

func GenerateAgentJWTToken(agent *relational.Agent, key *relational.AgentServiceAccountKey, privateKey *rsa.PrivateKey) (*string, error)

func GenerateJWTToken

func GenerateJWTToken(user *relational.User, privateKey *rsa.PrivateKey) (*string, error)

func GeneratePasswordResetToken added in v0.6.0

func GeneratePasswordResetToken(email string, privateKey *rsa.PrivateKey) (*string, error)

func PublicKeyToPEM

func PublicKeyToPEM(pubKey *rsa.PublicKey) (string, error)

Types

type AgentClaims

type AgentClaims struct {
	jwt.RegisteredClaims
	TokenKind    string `json:"token_kind"`
	AgentID      string `json:"agent_id"`
	CredentialID string `json:"credential_id"`
	AuthMethod   string `json:"auth_method"`
}

func VerifyAgentJWTToken

func VerifyAgentJWTToken(tokenString string, publicKey *rsa.PublicKey) (*AgentClaims, error)

type JWK

type JWK struct {
	Kty string `json:"kty"`
	N   string `json:"n"`
	E   string `json:"e"`
	Alg string `json:"alg,omitempty"`
	Use string `json:"use,omitempty"`
	KID string `json:"kid,omitempty"`
}

func (*JWK) MarshalPublicKey

func (j *JWK) MarshalPublicKey() (*rsa.PublicKey, error)

func (*JWK) UnmarshalPublicKey

func (j *JWK) UnmarshalPublicKey(pubKey *rsa.PublicKey) (*JWK, error)

type PasswordResetClaims added in v0.6.0

type PasswordResetClaims struct {
	jwt.RegisteredClaims
	Email string `json:"email"`
}

func VerifyPasswordResetToken added in v0.6.0

func VerifyPasswordResetToken(tokenString string, publicKey *rsa.PublicKey) (*PasswordResetClaims, error)

type UserClaims

type UserClaims struct {
	jwt.RegisteredClaims
	TokenKind  string `json:"token_kind"`
	GivenName  string `json:"given_name"`
	FamilyName string `json:"family_name"`
}

func VerifyJWTToken

func VerifyJWTToken(tokenString string, publicKey *rsa.PublicKey) (*UserClaims, error)

Jump to

Keyboard shortcuts

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