Class: TorqueSDK
@torque-labs/torque-ts-sdk • Docs
@torque-labs/torque-ts-sdk / TorqueSDK
Class: TorqueSDK
The official Torque Typescript SDK.
The TorqueSDK class is used to manage the user and api clients for the Torque API.
Example
Constructors
new TorqueSDK()
Initializes the TorqueSDK with the provided options.
Parameters
Parameter | Type | Description |
---|---|---|
| The options for the TorqueSDK. |
Returns
Throws
Throws an error if the there is no api key or publisher handle provided.
Defined in
Properties
Property | Type |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Methods
initialize()
Initializes the TorqueSDK with the provided options.
Parameters
Parameter | Type | Description |
---|---|---|
|
| The signer used to sign transactions. |
| The function used to sign transactions. If provided, it will override the default signing method. | |
| The login options for the user. |
Returns
Promise
<void
>
Throws
Throws an error if the there is no api key or publisher handle provided.
Defined in
logout()
Logout the user from the Torque API.
Returns
Promise
<void
>
Throws
Throws an error if the client is not initialized or if there is an error logging out the user.
Defined in
constructLoginBody()
Constructs the body for the login API request based on the authentication type.
Parameters
Parameter | Type | Description |
---|---|---|
| The parameters for constructing the login body. |
Returns
{ authType
: "siws"
; payload
: { input
: payload.input
; output
: SolanaSignInOutput
; }; pubKey
: string
; } | { authType
: "basic"
; payload
: { input
: payload.input
; output
: payload.output
; }; pubKey
: string
; }
The constructed body for the verify API request, formatted based on the authentication type.
Defined in
getLoginPayload()
Retrieves a sample SIWS payload for logging into the Torque API.
Parameters
Parameter | Type | Description |
---|---|---|
|
| The API URL to use for the payload. Defaults to the Torque API URL. |
Returns
Promise
<ApiIdentifyPayload
>
A Promise that resolves to the payload containing the identification statement, issued at time, and expiration time.
Throws
Throws an error if the API request is unsuccessful.
Defined in
verifyLogin()
Static method to verify the login options with the Torque API.
Parameters
Parameter | Type | Description |
---|---|---|
| The verification object that is required to authenticate a user with Torque. | |
|
| The API URL to use for the verification. Defaults to the Torque API URL. |
Returns
Promise
<ApiUser
>
A Promise that resolves to an object containing the user information.
Throws
Throws an error if there is an error authenticating the user.
Defined in
Last updated