Class: AuthModule
The AuthModule class provides methods for interacting with an authentication API. It allows clients to retrieve a nonce, verify a message signature, validate tokens, and sign out from the authenticati
Constructors
new AuthModule()
new AuthModule(
config
):AuthModule
Initializes the AuthModule
instance.
Parameters
config
Config
An object containing the configuration for the authentication module. The authApiUrl
field in the config is required to initialize the client.
Returns
AuthModule
Defined in
Methods
getClient()
getClient():
undefined
|Client
<paths
, `${string}/${string}`>
Returns the OpenAPI client instance if it is initialized.
Returns
undefined
| Client
<paths
, `${string}/${string}`>
The instance or undefined
if not initialized.
Defined in
getNonce()
getNonce():
undefined
|Promise
<FetchResponse
<{},undefined
|FetchOptions
<{}>, `${string}/${string}`>>
Retrieves a nonce from the authentication API.
The nonce can be used for generating and signing authentication messages.
Returns
undefined
| Promise
<FetchResponse
<{}, undefined
| FetchOptions
<{}>, `${string}/${string}`>>
A Promise
that resolves with the server's response, or undefined
if the client is not initialized.
Defined in
signOut()
signOut():
undefined
|Promise
<FetchResponse
<{},undefined
|FetchOptions
<{}>, `${string}/${string}`>>
Signs out the current session using the authentication API.
This function invalidates the authentication session on the backend.
Returns
undefined
| Promise
<FetchResponse
<{}, undefined
| FetchOptions
<{}>, `${string}/${string}`>>
A Promise
that resolves with the sign-out response, or undefined
if the client is not initialized.
Defined in
validateToken()
validateToken(
token
):undefined
|Promise
<FetchResponse
<{}, {params
: {path
: {token
:string
; }; }; }, `${string}/${string}`>>
Validates an authentication token using the authentication API.
Parameters
token
string
= ''
The token to be validated. Defaults to an empty string if not provided.
Returns
undefined
| Promise
<FetchResponse
<{}, { params
: { path
: { token
: string
; }; }; }, `${string}/${string}`>>
A Promise
that resolves with the validation result, or undefined
if the client is not initialized.
Defined in
verify()
verify(
message
,signature
):undefined
|Promise
<FetchResponse
<{}, {body
: {message
:string
;signature
:string
; }; }, `${string}/${string}`>>
Verifies a given signature against a message using the authentication API.
Parameters
message
string
The original message to be verified.
signature
string
The signature to verify against the message.
Returns
undefined
| Promise
<FetchResponse
<{}, { body
: { message
: string
; signature
: string
; }; }, `${string}/${string}`>>
A Promise
that resolves with the verification result, or undefined
if the client is not initialized.
Defined in
Last updated