Skip to main content

Class: Siwe

Represents the Sign-In with Ethereum (SIWE) functionality, providing methods to initiate and verify challenges.

Example

import { JustaName } from '@justaname.id/sdk';

const configuration = {
apiKey: 'your-api-key'
};

const justaName = JustaName.init(configuration);

const requestChallengeResponse = await justaName.siwe.requestChallenge({
chainId: 1,
origin: 'http://localhost:3333',
address: '0x59c44836630760F97b74b569B379ca94c37B93ca',
domain: 'localhost',
ttl?: 120000,
});

Constructors

constructor

new Siwe(): Siwe

Returns

Siwe

Methods

requestChallenge

requestChallenge(params): Promise<RequestChallengeResponse>

Sends a request to initiate a challenge.

Parameters

NameTypeDescription
paramsRequestChallengeRequestThe request parameters.

Returns

Promise<RequestChallengeResponse>

  • A promise that resolves with the response.

Defined in

lib/features/siwe/index.ts:43


verifyMessage

verifyMessage(params): Promise<VerifyChallengeResponse>

Sends a request to verify a specific address using SIWE.

Parameters

NameTypeDescription
paramsVerifyChallengeRequestThe request parameters.

Returns

Promise<VerifyChallengeResponse>

  • A promise that resolves with the response.

Defined in

lib/features/siwe/index.ts:56