Passkey Flex Node.js SDK
Create transactions and manage Passage users with Node.js.
Prerequisites
Passage App ID and API Key from Passage Console
Install
Install the passage-flex-node package.
npm i @passageidentity/passage-flex-node
Initialize
Initialize a Passage Passkey Flex instance using your app ID found in Passage Console.
import { PassageFlex } from '@passageidentity/passage-flex-node';
const passage = new PassageFlex({
appId: process.env.PASSAGE_APP_ID!,
apiKey: process.env.PASSAGE_API_KEY!,
});
Create transactions
The Passkey Flex Node.js SDK provides a way to create transactions, which are used to kick off a registration or authentication user flow. To learn more, see our implementation guides for registration and authentication.
Verify nonce
In addition to creating transactions, the Passkey Flex Node.js SDK also provides a way to verify the successful registration or authentication of a user’s passkey.
// The nonce should come from your client upon successful registration or authentication of the user's passkey
const nonce = req.nonce;
const externalId: string = await passage.auth.verifyNonce(nonce);
// The externalId should match your user's unique identifier
const user = this.repo.getUserById(externalId);
User management
The Passkey Flex Node.js SDK also provides a way to securely manage users and their WebAuthn devices.
The functionality currently available on a user is:
- Get a user’s information
- List all devices for a user
- Revoke a particular device from a user