SiweServiceClient

The SiweServiceClient is designed to facilitate the integration of the SIWE (Sign in with Ethereum) protocol into applications.

How To Use

Prequisites:

  • siwe

  • axios

  • Ethers

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 siweServiceClient = wallet.siweServiceClient;

Examples:

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

// Initialize the service
await siweServiceClient.init(key, domain, baseUri, did, qr);

// Connect to Issuer using SIWE
const verifiedMessage = await siweServiceClient.connectToIssuer();

// Request to get Credential
const qrDownloadResult = await siweServiceClient.requestCredential();

Associated Interface

https://github.com/GDP-ADMIN/didPass-Wallet/blob/development/sdk/docs/interfaces/isiweserviceclient.md

Last updated