Passkey Flex Rust SDK

Create transactions and manage Passage users with Rust.

Crates version

Prerequisites

Passage App ID and API Key from Passage Console

Install

Install the passage_flex crate.

cargo add passage_flex

Initialize

Initialize a Passage Passkey Flex instance using your app ID found in Passage Console.

main.rs
use passage_flex::PassageFlex;
 
let passage = PassageFlex::new(
    std::env::var("PASSAGE_APP_ID").unwrap(),
    std::env::var("PASSAGE_API_KEY").unwrap(),
);

Create transactions

The Passkey Flex Rust 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 Rust 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
let nonce = req.nonce;
 
let external_id = passage.auth.verify_nonce(nonce).await?;
 
// The external_id should match your user's unique identifier
let user = repo.get_user_by_id(external_id).await;

User management

The Passkey Flex Rust 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