0.1.0 • Published 7 months ago

@knownothing/browser v0.1.0

Weekly downloads
-
License
MIT
Repository
-
Last release
7 months ago

Install

Using yarn

yarn add @knownothing/browser

Using npm

npm install --save @knownothing/browser

Typescript:

import { ZKPasskeyManager, Chain, Wallet, Passkey } from "zk-passkeys";

/** Register a new passkey and set a recovery method */
const zkPasskeyManager = new ZKPasskeyManager({
  apiKey: "your-api-key-here",
});
// Signs the WebAuthn challenge and generates a proof
const passkey = await zkPasskeyManager.registerNewPasskey({
  challenge: "my-expected-challenge-here",
});
console.log(passkey.publicKey); // save the public key in your application's DB, browser storage, or smart contract

/** Recover their account */
const passkey = zkPasskeyManager.fromPublicKey(publicKey);
const proof = await passkey.signRecoveryChallenge("my-expected-challenge-here");
// Submit proof and expectedChallenge to social recovery wallet function
// ...

Example social recovery wallet

contract ISocialRecoveryWallet {
	function owner() external view returns (address);

	// This calls Verifier.verifyPasskeySignature(owner, proof), and if verified,
	// sets owner equal to newOwner
	function recoverAccount(address newOwner, bytes calldata proof);
}

SDK smart contract

contract PasskeyVerifier {
	function expectedChallenge() external view returns (bytes);

	// Stores the public key for an account
	function registerNewPasskey(address account, bytes proof, bytes expectedChallenge)

	// Makes a call to Verifier checking the proof vs the account's public key
	function verifyPasskeySignature(address account, bytes proof) external returns(bool);
}
0.1.0

7 months ago

0.0.10

7 months ago

0.0.9

7 months ago

0.0.8

7 months ago

0.0.7

7 months ago

0.0.6

7 months ago

0.0.5

7 months ago

0.0.4

7 months ago

0.0.3

7 months ago

0.0.2

7 months ago

0.0.1

7 months ago

0.0.0

7 months ago