UNPKG

decent-sdk

Version:

SDK for the Decent API

34 lines (33 loc) 1.51 kB
import { Logout, User } from '../types/Api'; import { BaseParams, VerifySiweParams } from './common/params'; /** * Fetches a nonce for signing messages. * @param params - The parameters for fetching the nonce. * @param params.apiUrl - Optional API URL override. * @returns {Promise<string>} A promise that resolves to a nonce string. */ export declare const getNonce: (params?: BaseParams) => Promise<string>; /** * Verifies a signed message (e.g., SIWE) to authenticate the user. * @param params - The parameters for verification. * @param params.message - The message to verify. * @param params.signature - The signature to verify. * @param params.apiUrl - Optional API URL override. * @returns {Promise<User>} A promise with the authenticated user data. */ export declare const verify: (params: VerifySiweParams) => Promise<User>; /** * Fetches the currently authenticated user's information. * Requires a valid session/cookie. * @param params - The parameters for fetching the user data. * @param params.apiUrl - Optional API URL override. * @returns {Promise<User>} A promise with the authenticated user data. */ export declare const me: (params?: BaseParams) => Promise<User>; /** * Logs the current user out by clearing the session/cookie. * @param params - The parameters for logging out. * @param params.apiUrl - Optional API URL override. * @returns {Promise<Logout>} A promise with the "ok" message. */ export declare const logout: (params?: BaseParams) => Promise<Logout>;