Skip to main content

configuration/AuthAdapter

Type Aliases

AuthAdapter

AuthAdapter: Web2AuthAdapter | Web3AuthAdapter

The auth adapter for web2 or web3 authentication.


LoginParams

LoginParams: {origin: string; }

The parameters required to create a new auth adapter.

Type declaration

origin?

optional origin: string

optionally overwrite the website origin to login present to the user


Web2AuthAdapter

Web2AuthAdapter: {isAuthenticated: () => Promise\<boolean> | boolean;login: (params?) => Promise\<AuthSession>;type: "web2"; }

The auth adapter for web2 authentication.

This adapter is used to authenticate users using a web2 login flow.

Type declaration

isAuthenticated()

isAuthenticated: () => Promise\<boolean> | boolean

check if the user is authenticated

Returns

Promise\<boolean> | boolean

login()

login: (params?) => Promise\<AuthSession>

strategy to log the user in

Parameters

params?: LoginParams

Returns

Promise\<AuthSession>

type

type: "web2"

type guard


Web3AuthAdapter

Web3AuthAdapter: {getBlockchainId: () => Promise\<BlockchainId> | BlockchainId;isAuthenticated: () => Promise\<boolean> | boolean;login: (params?) => Promise\<AuthSession>;sendTransaction: (params) => Promise\<TxHash | undefined>;signMessage: (params) => Promise\<WalletSignatureResponse>;type: "web3"; }

The auth adapter for web3 authentication.

This adapter is used to authenticate users using a web3 wallet.

Type declaration

getBlockchainId()?

optional getBlockchainId: () => Promise\<BlockchainId> | BlockchainId

get the blockchain id

Returns

Promise\<BlockchainId> | BlockchainId

isAuthenticated()

isAuthenticated: () => Promise\<boolean> | boolean

check if the user is authenticated

Returns

Promise\<boolean> | boolean

login()

login: (params?) => Promise\<AuthSession>

strategy to log the user in

Parameters

params?: LoginParams

Returns

Promise\<AuthSession>

sendTransaction()?

optional sendTransaction: (params) => Promise\<TxHash | undefined>

send a transaction using the wallet

Parameters

params

params.data: TransactionData

Returns

Promise\<TxHash | undefined>

signMessage()

signMessage: (params) => Promise\<WalletSignatureResponse>

sign a message using the wallet

Parameters

params

params.message: string

Returns

Promise\<WalletSignatureResponse>

type

type: "web3"

type guard

Variables

AuthAdapter

AuthAdapter: ZodType\<AuthAdapter, ZodTypeDef, AuthAdapter>


LoginParams

LoginParams: ZodType\<LoginParams, ZodTypeDef, LoginParams>


Web2AuthAdapter

Web2AuthAdapter: ZodType\<Web2AuthAdapter, ZodTypeDef, Web2AuthAdapter>


Web3AuthAdapter

Web3AuthAdapter: ZodType\<Web3AuthAdapter, ZodTypeDef, Web3AuthAdapter>

Functions

isWeb2AuthAdapter()

isWeb2AuthAdapter(adapter): adapter is Web2AuthAdapter

Check if the adapter is a web2 auth adapter.

Parameters

adapter: AuthAdapter

the adapter to check

Returns

adapter is Web2AuthAdapter


isWeb3AuthAdapter()

isWeb3AuthAdapter(adapter): adapter is Web3AuthAdapter

Check if the adapter is a web3 auth adapter.

Parameters

adapter: AuthAdapter

the adapter to check

Returns

adapter is Web3AuthAdapter