Documentation ¶
Index ¶
- Constants
- Variables
- func AuthenticateJWT(jwt string, options *thirdwebauth.AuthenticateOptions, ...) (*thirdwebauth.User, error)
- func BuildAndSignLoginPayload(signVerifier thirdwebauth.SignVerifier, options *thirdwebauth.LoginOptions) (*thirdwebauth.LoginPayload, error)
- func BuildJWT(signVerifier thirdwebauth.SignVerifier, ...) (string, error)
- func BuildLoginPayload(options *thirdwebauth.LoginOptions) *thirdwebauth.LoginPayloadData
- func CreateLoginMessage(payload *thirdwebauth.LoginPayloadData) string
- func GenerateJWT(signVerifier thirdwebauth.SignVerifier, payload *thirdwebauth.LoginPayload, ...) (string, error)
- func HashMessage(message []byte) common.Hash
- func ParseJWT(jwt string) (*thirdwebauth.AuthenticationPayload, error)
- func RefreshJWT(signVerifier thirdwebauth.SignVerifier, jwt string, ...) (string, error)
- func SignLoginPayload(signVerifier thirdwebauth.SignVerifier, payload *thirdwebauth.LoginPayloadData) (*thirdwebauth.LoginPayload, error)
- func VerifyLoginPayload(payload *thirdwebauth.LoginPayload, options *thirdwebauth.VerifyOptions, ...) (string, error)
- func VerifySignature(message, signature, address string, clientID, secretKey string) (bool, error)
Constants ¶
View Source
const EthereumMessagePrefix = "\x19Ethereum Signed Message:\n"
Variables ¶
View Source
var ( InvalidJWTFormatError = errors.New("invalid JWT format") InvalidTokenIdError = errors.New("invalid token id") JWTDomainMismatchError = errors.New("invalid domain in JWT") JWTInvalidBeforeError = errors.New("request time is JWT nbf") JWTExpiredError = errors.New("jWT has expired") JWTInvalidIssuerError = errors.New("invalid JWT issuer") JWTInvalidSignatureError = errors.New("invalid JWT signature") )
View Source
var ( PayloadDomainMismatchError = errors.New("payload domain does not match the domain in the options") PayloadStatementMismatchError = errors.New("payload statement does not match the statement in the options") PayloadURIMismatchError = errors.New("payload URI does not match the URI in the options") PayloadVersionMismatchError = errors.New("payload version does not match the version in the options") PayloadChainIDMismatchError = errors.New("payload chainID does not match the chainID in the options") PayloadNonceError = errors.New("login request nonce is invalid") PayloadInvalidBeforeError = errors.New("payload invalid_before is invalid") PayloadNotYetValidError = errors.New("login request is not yet valid") PayloadExpirationTimeError = errors.New("payload expiration_time is invalid") PayloadExpiredError = errors.New("login request has expired") PayloadMissingResourcesError = errors.New("login request is missing required resources") PayloadInvalidSignatureError = errors.New("login request signature is invalid") )
Functions ¶
func AuthenticateJWT ¶
func AuthenticateJWT( jwt string, options *thirdwebauth.AuthenticateOptions, clientOptions *thirdwebauth.ThirdwebAuthOptions, ) (*thirdwebauth.User, error)
Validate a JWT and extract the user's info
func BuildAndSignLoginPayload ¶
func BuildAndSignLoginPayload( signVerifier thirdwebauth.SignVerifier, options *thirdwebauth.LoginOptions, ) (*thirdwebauth.LoginPayload, error)
func BuildJWT ¶
func BuildJWT( signVerifier thirdwebauth.SignVerifier, input *thirdwebauth.AuthenticationPayloadDataInput, ) (string, error)
Build JWT token based on the authentication payload
func BuildLoginPayload ¶
func BuildLoginPayload(options *thirdwebauth.LoginOptions) *thirdwebauth.LoginPayloadData
func CreateLoginMessage ¶
func CreateLoginMessage(payload *thirdwebauth.LoginPayloadData) string
Create an EIP-4361 & CAIP-122 compliant message to sign based on the login payload
func GenerateJWT ¶
func GenerateJWT( signVerifier thirdwebauth.SignVerifier, payload *thirdwebauth.LoginPayload, options *thirdwebauth.GenerateOptions, clientOptions *thirdwebauth.ThirdwebAuthOptions, ) (string, error)
Generate a new JWT uing a login payload
func HashMessage ¶
func ParseJWT ¶
func ParseJWT(jwt string) (*thirdwebauth.AuthenticationPayload, error)
Parse data from an encoded auth JWT
func RefreshJWT ¶
func RefreshJWT( signVerifier thirdwebauth.SignVerifier, jwt string, options *thirdwebauth.RefreshOptions, ) (string, error)
Refresh an existing JWT
func SignLoginPayload ¶
func SignLoginPayload( signVerifier thirdwebauth.SignVerifier, payload *thirdwebauth.LoginPayloadData, ) (*thirdwebauth.LoginPayload, error)
func VerifyLoginPayload ¶
func VerifyLoginPayload( payload *thirdwebauth.LoginPayload, options *thirdwebauth.VerifyOptions, clientOptions *thirdwebauth.ThirdwebAuthOptions, ) (string, error)
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.