@sovrano-io/auth-sdk
Version:
Sovrano wallet auth sdk for koinos dapps
73 lines (72 loc) • 1.84 kB
TypeScript
/**
* The request data for the wallet connect
*/
export interface ConnectRequest {
/** The name of the dapp requesting the connection */
appName: string;
/** The URL to redirect to after connection */
redirectUrl: string;
}
/**
* Represents the response from the connection request
*/
export type ConnectResponse = {
/** Indicates a successful connection */
type: "success";
/** The address of the user */
address: string;
/** The nickname of the user */
nickname: string;
} | {
/** Indicates an error during connection */
type: "error";
/** The error code */
errorCode: number;
/** The error message */
errorMessage: string;
};
export declare class Connector {
/**
* Get the URL to redirect to for connection
* @param data
* @returns
*/
static getRequestUrl(data: ConnectRequest): string;
/**
* Get the URL to redirect to after connection
* @param data
* @param url
* @returns
*/
static getResponseUrl(data: ConnectResponse, url: string): string;
/**
* Encode the connection request data
* @param data
* @returns
*/
static encodeRequest(data: ConnectRequest): string;
/**
* Decode the connection request data
* @param data
* @returns
*/
static decodeRequest(data: string): ConnectRequest;
/**
* Encode the connection response data
* @param data
* @returns
*/
static encodeResponse(data: ConnectResponse): string;
/**
* Decode the connection response data
* @param data
* @returns
*/
static decodeResponse(data: string): ConnectResponse;
/**
* Get the response from the URL
* @param responseUrl
* @returns
*/
static getResponse(responseUrl: string): ConnectResponse;
}