@chipi-stack/chipi-passkey
v0.1.0
Published
Chipi Passkey SDK - WebAuthn passkey utilities for secure wallet encryption
Readme
@chipi-stack/chipi-passkey
WebAuthn passkey utilities for secure wallet encryption in Chipi SDK.
Features
- 🔐 WebAuthn/Passkey authentication for wallet encryption
- 🔑 PRF (Pseudo-Random Function) extension support for deterministic key derivation
- 🌐 Browser-based biometric authentication
- 🔄 Migration utilities for switching from PIN to passkey
Installation
npm install @chipi-stack/chipi-passkey
# or
pnpm add @chipi-stack/chipi-passkey
# or
yarn add @chipi-stack/chipi-passkeyUsage
Check Passkey Support
import {
isWebAuthnSupported,
hasWalletPasskey,
} from "@chipi-stack/chipi-passkey";
if (isWebAuthnSupported()) {
const hasPasskey = hasWalletPasskey();
console.log("Passkey available:", hasPasskey);
}Create Wallet with Passkey
import { createWalletPasskey } from "@chipi-stack/chipi-passkey";
const result = await createWalletPasskey("user-123", "[email protected]");
// result.encryptKey - Use this as wallet encryption key
// result.credentialId - Passkey credential ID
// result.prfSupported - Whether PRF extension is supportedAuthenticate with Passkey
import { getWalletEncryptKey } from "@chipi-stack/chipi-passkey";
// Prompts user for biometric authentication
const encryptKey = await getWalletEncryptKey();
// Use this encryptKey for transactionsReact Hooks
import { usePasskeySetup, usePasskeyAuth } from "@chipi-stack/chipi-passkey";
function WalletSetup() {
const { setupPasskey, isLoading } = usePasskeySetup();
const handleSetup = async () => {
const { encryptKey } = await setupPasskey("user-123", "[email protected]");
// Create wallet with encryptKey
};
}
function SendTransaction() {
const { authenticate } = usePasskeyAuth();
const handleSend = async () => {
const encryptKey = await authenticate();
// Use encryptKey for transaction
};
}Requirements
- Modern browser with WebAuthn support
- HTTPS (required for WebAuthn)
- React 18+ (for hooks)
License
MIT
