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
Methods
requestChallenge
▸ requestChallenge(params
): Promise
<RequestChallengeResponse
>
Sends a request to initiate a challenge.
Parameters
Name | Type | Description |
---|---|---|
params | RequestChallengeRequest | The 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
Name | Type | Description |
---|---|---|
params | VerifyChallengeRequest | The request parameters. |
Returns
Promise
<VerifyChallengeResponse
>
- A promise that resolves with the response.
Defined in
lib/features/siwe/index.ts:56