Implements
Constructors
Constructor
Parameters
| Parameter | Type | Description |
|---|---|---|
projectId | string | The project ID. |
Returns
AuthManager
Methods
getUser()
Returns
|null
| User
The current user.
Implementation of
IAuthManager.getUser
isSignedIn()
Returns
Promise<boolean>
True if the user is signed in, false otherwise.
Implementation of
IAuthManager.isSignedIn
signOut()
Returns
Promise<void>
Implementation of
IAuthManager.signOut
addAuthStateChangeCallback()
Parameters
| Parameter | Type | Description |
|---|---|---|
callback | OnAuthStateChangeFn | The function to call when the auth state changes. |
Returns
void
Implementation of
IAuthManager.addAuthStateChangeCallback
getToken()
Parameters
| Parameter | Type | Description |
|---|---|---|
options? | { forceRefresh?: boolean; } | The options for getting the token. |
options.forceRefresh? | boolean | Whether to force a refresh of the token. |
Returns
Promise<null | string>
The access token.
Implementation of
IAuthManager.getToken
getTokenExpiration()
Returns
Promise<null | number>
The expiration time of the access token.
Implementation of
IAuthManager.getTokenExpiration
getWalletSecretId()
Returns
Promise<string>
The wallet secret ID.
Implementation of
IAuthManager.getWalletSecretId
getXWalletAuth()
Parameters
| Parameter | Type | Description |
|---|---|---|
options | { requestMethod: string; requestHost: string; requestPath: string; requestData?: Record<string, unknown>; } | The options for the request. |
options.requestMethod | string | The HTTP method of the request. |
options.requestHost | string | The host of the request. |
options.requestPath | string | The path of the request. |
options.requestData? | Record<string, unknown> | The data of the request. |
Returns
Promise<string>
The X-Wallet-Auth header.
Implementation of
IAuthManager.getXWalletAuth
getAuthState()
Returns
|null
| AuthState
The authentication state.
Implementation of
IAuthManager.getAuthState
setAuthState()
Parameters
| Parameter | Type | Description |
|---|---|---|
authState | AuthState | The authentication state. |
Returns
Promise<void>
Implementation of
IAuthManager.setAuthState
clearAuthState()
Returns
Promise<void>
Implementation of
IAuthManager.clearAuthState
ensureInitialized()
Returns
Promise<void>
Implementation of
IAuthManager.ensureInitialized
_doInitialize()
Returns
Promise<void>
shouldRefreshToken()
Returns
boolean
True if the token should be refreshed, false otherwise.
refreshAccessToken()
Returns
Promise<void>
The new access token.
scheduleTokenRefresh()
Returns
void
cancelTokenRefresh()
Returns
void
Properties
| Property | Modifier | Type | Default value |
|---|---|---|---|
projectId | protected | string | undefined |
authState | protected | | null | AuthState | null |
walletSecret | protected | | null | WalletSecret | null |
authStateChangeCallbacks | protected | OnAuthStateChangeFn[] | [] |
initPromise | protected | null | Promise<void> | null |
refreshTimeout | protected | null | Timeout | null |