@sevenlinelabs/aa-passkey-client
v0.6.0
Published
[TEST] Passkey (WebAuthn) client library for Account Abstraction wallets
Readme
@sevenlinelabs/aa-passkey-client
WARNING: This is a TEST package. Not intended for production use.
Passkey (WebAuthn) client library for Account Abstraction wallets.
Installation
npm install @sevenlinelabs/aa-passkey-clientFeatures
- WebAuthn credential creation and authentication
- P256/ES256 signature handling for AA wallets
- Framework-agnostic core module
- NestJS integration (optional)
- React hooks (optional)
Usage
Core (Framework-agnostic)
import {
createPasskeyCredential,
signWithPasskey,
encodeWebAuthnSignature
} from '@sevenlinelabs/aa-passkey-client';
// Create a new passkey credential
const credential = await createPasskeyCredential({
rpId: 'example.com',
rpName: 'Example App',
userName: '[email protected]',
userDisplayName: 'User',
});
// Sign a challenge
const signature = await signWithPasskey({
credentialId: credential.id,
challenge: '0x...',
});NestJS Integration
import { PasskeyModule } from '@sevenlinelabs/aa-passkey-client/nestjs';
@Module({
imports: [
PasskeyModule.forRoot({
rpId: 'example.com',
rpName: 'Example App',
}),
],
})
export class AppModule {}React Hooks
import { usePasskeyAuth } from '@sevenlinelabs/aa-passkey-client/react';
function LoginComponent() {
const { register, authenticate, isLoading } = usePasskeyAuth();
const handleRegister = async () => {
const credential = await register({
userName: '[email protected]',
userDisplayName: 'User',
});
};
return <button onClick={handleRegister}>Register Passkey</button>;
}Exports
| Path | Description |
|------|-------------|
| @sevenlinelabs/aa-passkey-client | Core functions (framework-agnostic) |
| @sevenlinelabs/aa-passkey-client/nestjs | NestJS module and services |
| @sevenlinelabs/aa-passkey-client/react | React hooks |
Requirements
- Node.js >= 18.0.0
- Browser with WebAuthn support
License
MIT
