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
Returns
Throws
Throws an error if the there is no api key or publisher handle provided.
Defined in
Properties
Methods
initialize()
Initializes the TorqueSDK with the provided options.
Parameters
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
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
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
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