AuthServerClient

The AuthServerClient provides a set of methods to interact with the authentication server.

AuthServerClient

How To Use

Import the Wallet Service:

import Wallet from '@sdk/src/services/Wallet';

Initialize the wallet and custom storage:

The custom storage is needed by Wallet SDK to check storage.

const storage = new SecureStorage();
const wallet = Wallet.create('YOUR_AUTH_SERVER_BASE_URL', storage);
const authServerClient = wallet.authServerClient;

Examples:

Get Challenge

Requests a challenge from the authentication server.

const resultChallenge = await authServerClient.getChallenge({
    deviceId,
    spk,
});

Distribute Shares

Distributes shares to the authentication server. Normally, this function is used by WalletCreation only.

const resultShares = await authServerClient.distributeShares({
    deviceId,
    loginToken,
    spk,
    shares,
    WalletType.IMPORT,
});

Retrieve Shares

Retrieves shares from the authentication server. Normally, this function is used by WalletCreation only.

const resultShares = await authServerClient.retrieveShares({
    deviceId,
    loginToken,
    spk,
});

Delete Shares

Delete shares from the authentication server. Normally, this function is used when a user deletes wallet.

const resultShares = await authServerClient.deleteShares({
    deviceId,
    loginToken,
    shares,
});

Associated Interface

IAuthServerClient

Last updated