@hyprjs/hypr-fido2-sdk
v0.2.2
Published
HYPR SDK for FIDO2 Browser
Downloads
21
Maintainers
Readme
HYPR SDK for FIDO2 Browser
A small, no-dependencies SDK that provides utility functions to assist in interacting with the JavaScript WebAuthn API.
Requirements
You will need a relying party server to handle registering and authenticating a user via the SDK. For assistance with this, contact the HYPR Sales team.
Installation
ECMAScript module
npm install @hyprjs/hypr-fido2-sdk
import HYPRFido2Client from "@hyprjs/hypr-fido2-sdk";
Script Tag (jsDelivr CDN)
<script src="https://cdn.jsdelivr.net/npm/@hyprjs/hypr-fido2-sdk/dist/hyprfido2sdk.min.js"></script>
Script Tag (unpkg CDN)
<script src="https://unpkg.com/@hyprjs/hypr-fido2-sdk/dist/hyprfido2sdk.min.js"></script>
Usage
Register a User
// Create attestation options
const options = HYPRFido2Client.createAttestationOptions(...)
// Process options with RP server and get result
const result = fetch("/rp/server/url", { method: "POST", body: JSON.stringify(options) })
// Create credentials
HYPRFido2Client.createFido2Credential(result, () => {})
Authenticate a User
// Create assertion options
const options = HYPRFido2Client.createAssertionOptions(...)
// Process options with RP server and get result
const result = fetch("/rp/server/url", { method: "POST", body: JSON.stringify(options) })
// Use credentials
HYPRFido2Client.useFido2Credential(result, () => {})