@open-passkey/authenticator
v0.1.2
Published
Software WebAuthn authenticator for credential creation and assertion
Maintainers
Readme
@open-passkey/authenticator
Software WebAuthn authenticator for testing and CI. Produces attestationObject, clientDataJSON, authenticatorData, and signature outputs -- the same structures a hardware authenticator would generate.
This is a testing tool, not a production library. Use it to write integration tests for your passkey server without needing a real browser or hardware authenticator.
Install
npm install @open-passkey/authenticator --save-devUsage
Create a credential (registration)
import { createCredential } from "@open-passkey/authenticator";
const result = await createCredential({
rpId: "example.com",
rpName: "My App",
userId: "user-123",
userName: "[email protected]",
challenge: challengeBytes, // Uint8Array
origin: "https://example.com",
alg: -7, // ES256
});
// result: {
// credentialId, rawId, clientDataJSON, attestationObject,
// publicKey, publicKeyCose, storedCredential
// }Get an assertion (authentication)
import { getAssertion } from "@open-passkey/authenticator";
const result = await getAssertion({
rpId: "example.com",
challenge: challengeBytes,
origin: "https://example.com",
credential: storedCredential, // from createCredential
});
// result: {
// credentialId, rawId, clientDataJSON,
// authenticatorData, signature, userHandle
// }API
| Function | Description |
|----------|-------------|
| createCredential(input) | Simulates navigator.credentials.create() |
| getAssertion(input) | Simulates navigator.credentials.get() |
Related Packages
| Package | Description | |---------|-------------| | @open-passkey/core | Core protocol verification (verify what this generates) | | @open-passkey/server | Server handler logic |
License
MIT
