token

package
v1.9.6 Latest Latest
Warning

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

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

Documentation

Overview

Package token provides policy wrappers / getters for queries and mutations during password reset, sign-up

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrIncorrectEmail   = errors.New("privacy token has incorrect email")
	ErrInvalidTokenType = errors.New("invalid token type")
)

Functions

func NewContextWithDownloadToken added in v0.39.2

func NewContextWithDownloadToken(parent context.Context, downloadToken string) context.Context

NewContextWithDownloadToken returns a new context with the verify token inside

func NewContextWithJobRunnerRegistrationToken added in v0.14.1

func NewContextWithJobRunnerRegistrationToken(parent context.Context, token string) context.Context

NewContextWithJobRunnerRegistrationToken returns a new context with the job runner registration token

func NewContextWithOauthTooToken

func NewContextWithOauthTooToken(parent context.Context, email string) context.Context

NewContextWithOauthTooToken creates a new context with a oauth2 token. It takes a parent context and a oauth2 token as parameters and returns a new context with the oauth2 token added

func NewContextWithOrgInviteToken

func NewContextWithOrgInviteToken(parent context.Context, orgInviteToken string) context.Context

NewContextWithOrgInviteToken returns a new context with the reset token inside

func NewContextWithResetToken

func NewContextWithResetToken(parent context.Context, resetToken string) context.Context

NewContextWithResetToken returns a new context with the reset token inside

func NewContextWithSignUpToken

func NewContextWithSignUpToken(parent context.Context, email string) context.Context

NewContextWithSignUpToken creates a new context with a sign-up token. It takes a parent context and a sign-up token as parameters and returns a new context with the sign-up token added

func NewContextWithVerifyToken

func NewContextWithVerifyToken(parent context.Context, verifyToken string) context.Context

NewContextWithVerifyToken returns a new context with the verify token inside

func NewContextWithWebauthnCreationContextKey added in v0.28.0

func NewContextWithWebauthnCreationContextKey(parent context.Context) context.Context

Types

type DownloadToken added in v0.39.2

type DownloadToken struct {
	PrivacyToken
	// contains filtered or unexported fields
}

DownloadToken that implements the PrivacyToken interface

func DownloadTokenFromContext added in v0.39.2

func DownloadTokenFromContext(ctx context.Context) *DownloadToken

DownloadTokenFromContext parses a context for a verify token and returns the token

func NewDownloadTokenWithToken added in v0.39.2

func NewDownloadTokenWithToken(token string) DownloadToken

NewDownloadTokenWithToken creates a new PrivacyToken of type SignUpToken with email set

func (*DownloadToken) GetToken added in v0.39.2

func (token *DownloadToken) GetToken() string

GetToken from verify token

func (*DownloadToken) SetToken added in v0.39.2

func (token *DownloadToken) SetToken(t string)

SetToken on the verify token

type JobRunnerRegistrationToken added in v0.14.1

type JobRunnerRegistrationToken struct {
	PrivacyToken
	// contains filtered or unexported fields
}

JobRunnerRegistrationToken implements the PrivacyToken interface

func JobRunnerRegistrationTokenFromContext added in v0.14.1

func JobRunnerRegistrationTokenFromContext(ctx context.Context) *JobRunnerRegistrationToken

JobRunnerRegistrationTokenFromContext returns the registration token if available from the context

func NewJobRunnerRegistrationToken added in v0.14.1

func NewJobRunnerRegistrationToken(token string) JobRunnerRegistrationToken

NewJobRunnerRegistrationToken creates a new PrivacyToken of type JobRunnerRegistrationToken

func (*JobRunnerRegistrationToken) GetToken added in v0.14.1

func (token *JobRunnerRegistrationToken) GetToken() string

GetToken from the registration token

func (*JobRunnerRegistrationToken) SetToken added in v0.14.1

func (token *JobRunnerRegistrationToken) SetToken(s string)

SetToken sets the token

type OauthTooToken

type OauthTooToken struct {
	PrivacyToken
	// contains filtered or unexported fields
}

OauthTooToken that implements the PrivacyToken interface

func NewOauthTooWithEmail

func NewOauthTooWithEmail(email string) OauthTooToken

NewOauthTooWithEmail creates a new PrivacyToken of type OauthTooToken with email set

func OauthTooTokenFromContext

func OauthTooTokenFromContext(ctx context.Context) *OauthTooToken

OauthTooTokenFromContext retrieves the value associated with the oauthTooTokenKey key from the context. It then type asserts the value to an OauthTooToken and returns it. If the value is not of type OauthTooToken, it returns nil

func (*OauthTooToken) GetEmail

func (token *OauthTooToken) GetEmail() string

GetEmail from oauth2 token

func (*OauthTooToken) SetEmail

func (token *OauthTooToken) SetEmail(email string)

SetEmail on the oauth2 token

type OrgInviteToken

type OrgInviteToken struct {
	PrivacyToken
	// contains filtered or unexported fields
}

OrgInviteToken that implements the PrivacyToken interface

func NewOrgInviteTokenWithToken

func NewOrgInviteTokenWithToken(token string) OrgInviteToken

NewOrgInviteTokenWithToken creates a new PrivacyToken of type OrgInviteToken with token set

func OrgInviteTokenFromContext

func OrgInviteTokenFromContext(ctx context.Context) *OrgInviteToken

OrgInviteTokenFromContext parses a context for a reset token and returns the token

func (*OrgInviteToken) GetToken

func (token *OrgInviteToken) GetToken() string

GetToken from invite token

func (*OrgInviteToken) SetToken

func (token *OrgInviteToken) SetToken(t string)

SetToken on the invite token

type PrivacyToken

type PrivacyToken interface {
	WhereToken(string) any
}

PrivacyToken interface

type ResetToken

type ResetToken struct {
	PrivacyToken
	// contains filtered or unexported fields
}

ResetToken that implements the PrivacyToken interface

func NewResetTokenWithToken

func NewResetTokenWithToken(token string) ResetToken

NewResetTokenWithToken creates a new PrivacyToken of type ResetToken with token set

func ResetTokenFromContext

func ResetTokenFromContext(ctx context.Context) *ResetToken

ResetTokenFromContext parses a context for a reset token and returns the token

func (*ResetToken) GetToken

func (token *ResetToken) GetToken() string

GetToken from reset token

func (*ResetToken) SetToken

func (token *ResetToken) SetToken(t string)

SetToken on the reset token

type SignUpToken

type SignUpToken struct {
	PrivacyToken
	// contains filtered or unexported fields
}

SignUpToken that implements the PrivacyToken interface

func EmailSignUpTokenFromContext

func EmailSignUpTokenFromContext(ctx context.Context) *SignUpToken

EmailSignUpTokenFromContext retrieves the value associated with the signUpTokenKey key from the context. It then type asserts the value to an EmailSignUpToken and returns it. If the value is not of type EmailSignUpToken, it returns nil

func NewSignUpTokenWithEmail

func NewSignUpTokenWithEmail(email string) SignUpToken

NewSignUpTokenWithEmail creates a new PrivacyToken of type SignUpToken with email set

func (*SignUpToken) GetEmail

func (token *SignUpToken) GetEmail() string

GetEmail from sign-up token

func (*SignUpToken) SetEmail

func (token *SignUpToken) SetEmail(email string)

SetEmail on the sign-up token

type VerifyToken

type VerifyToken struct {
	PrivacyToken
	// contains filtered or unexported fields
}

VerifyToken that implements the PrivacyToken interface

func NewVerifyTokenWithToken

func NewVerifyTokenWithToken(token string) VerifyToken

NewVerifyTokenWithToken creates a new PrivacyToken of type SignUpToken with email set

func VerifyTokenFromContext

func VerifyTokenFromContext(ctx context.Context) *VerifyToken

VerifyTokenFromContext parses a context for a verify token and returns the token

func (*VerifyToken) GetToken

func (token *VerifyToken) GetToken() string

GetToken from verify token

func (*VerifyToken) SetToken

func (token *VerifyToken) SetToken(t string)

SetToken on the verify token

type WebauthnCreationContextKey added in v0.28.0

type WebauthnCreationContextKey struct {
}

func NewWebauthnCreationContextKeyWithEmail added in v0.28.0

func NewWebauthnCreationContextKeyWithEmail() WebauthnCreationContextKey

func WebauthnCreationContextKeyFromContext added in v0.30.10

func WebauthnCreationContextKeyFromContext(ctx context.Context) *WebauthnCreationContextKey

Jump to

Keyboard shortcuts

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