1.0.21 • Published 1 year ago

@nexeraid/web-onboarding-sdk v1.0.21

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

Nexera Web3 User SDK

Usage

To install the Web3 User SDK you need to navigate inside of your client-side application and run the following command:

yarn add @nexeraid/web-onboarding-sdk

Initialize

import { Web3User } from "@nexeraid/web-onboarding-sdk";

const web3User = new Web3User({
  chainId: 80001, // Mumbai
  clientId, // PROVIDE THE CLIENT_ID RECEIVED FROM NEXERA TEAM
  verifier, // PROVIDE THE VERIFIER RECEIVED FROM NEXERA TEAM
  rpc: "https://rpc-mumbai.maticvigil.com" // Mumbai RPC (optional)
})

const web3auth = await web3User.getInstance()

Generate a new Private Key

Generates a new Private Key based on your JWT Token. The Verifier Id Field argument should be included in the jwt token which maps to verifier id, where possible values are sub or email. Domain argument is the url of your web server (i.e.: http://localhost:3002/).

const userProvider = await web3User.connect(jwtToken, verifierIdField, domain);

Signing messages

Allows the user to sign a message using their Private Key. The message must have this type.

export type TypedDataInput = {
  domain: any,
  message: any,
  types: { SponsoredCallERC2771: any }
}
const signature = await web3User.sign(msg);

Retrieve PrivateKey

This method reconstructs the Private Key from its Shares and allows the user to retrieve his private key.

const privateKey = await web3User.retrievePrivateKey();

Get Address

This method allows the user to retrieve his public address.

const address = await web3User.getAddress();

Send transaction

Sign and send a transaction.

const txHash = await web3User.sendTransaction(to, data, gasLimit);
1.0.19

1 year ago

1.0.18

1 year ago

1.0.17

1 year ago

1.0.16

1 year ago

1.0.5-dev

1 year ago

1.0.9

1 year ago

1.0.9-dev

1 year ago

1.0.21

1 year ago

1.0.20

1 year ago

1.0.8-dev

1 year ago

1.0.7-dev

1 year ago

1.0.6-dev

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.4-dev

1 year ago

1.0.3-dev

1 year ago

1.0.2-dev

1 year ago

1.0.1-dev

1 year ago

1.0.0-dev

1 year ago

1.0.0

1 year ago