Passkey wallet is API for signing a new wallet key using https://github.com/near/near-api-js/tree/master/packages/biometric-ed25519. Here is some available chain that we've integrated:
In the further, we will integrate more chains.
The package is using monorepo pattern to provide more chains. The easiest way to implement this package is installing sub-packages for specific usage, instead of installing whole package.
yarn add @yuesth/passkey-wallet-stellar
npm install @yuesth/passkey-wallet-stellar
You have to create an instance from the package.
import PasskeyWallet from '@yuesth/passkey-wallet-stellar'
...
//the private key must be provided in order to create new wallet on stellar ledger
const instance = new PasskeyWallet('testnet', <YOUR_PARENT_PRIVATE_KEY>, <RANDOM_PHRASE>, 5)
After you create an instance, you are able to call createFromCreatingPasskey()
method to use simplest key creation from biometric passkey.
...
const onClickButton = async () => {
//the private key must be provided in order to create new wallet on stellar ledger
const instance = new PasskeyWallet('testnet', <YOUR_PARENT_PRIVATE_KEY>, <RANDOM_PHRASE>, 5)
await wallet.createFromCreatingPasskey()
}
return(
<button onClick={onClickButton}>Create a key</button>
)
or if you are confident that you already have created a key, then you can call the createFromExistingPasskey()
method.
...
const onClickButton = async () => {
//the private key must be provided in order to create new wallet on stellar ledger
const instance = new PasskeyWallet('testnet', <YOUR_PARENT_PRIVATE_KEY>, <RANDOM_PHRASE>, 5)
await wallet.createFromExistingPasskey()
}
return(
<button onClick={onClickButton}>Get a key</button>
)
-
finalPublicKey
--> to retrieve the public key after creating or getting the key. -
keyPair
--> retrieve keyPair creating or getting the key. -
createAccountStellarLedger(childPubKey: string)
--> method for upload the new key to stellar ledger