#credential-exchange #encoding #credentials #account

credential-exchange-format

Credential Exchange Format (CXF) rust types

1 unstable release

new 0.1.0 Apr 18, 2025

#591 in Authentication


Used in credential-exchange-proto…

Custom license

70KB
1K SLoC

Credential Exchange Format (CXF)

This crate contains type definitions for the FIDO Alliance’s credential exchange format specification. It's targeting the Review Draft, March 13, 2025 revision.

The Credential Exchange Format defines standardized data structures and format of credentials that can be exchanged between two applications.

For more information about the credential exchange protocol, please read the Bitwarden blog post or the Fido Alliance announcement.

Disclaimer

This library does not automatically clear sensitive values from memory. It is heavily encouraged to use it alongside a zeroizing global allocator like zeroizing-alloc. We may be open to pull requests that adds native zeroize support depending on the developer ergonomics.

This library is still in early development and as the specification evolves so will this library.

Usage

use credential_exchange_format::Account;

fn import(data: &str) {
    let account: Result<Account, _> = serde_json::from_str(&data);
}

fn export() -> Result<String, serde_json::Error> {
    let account: Account = Account {
        id: vec![1,2,3,4].as_slice().into(),
        username: "".to_owned(),
        email: "".to_owned(),
        full_name: None,
        collections: vec![],
        items: vec![],
        extensions: None,
    };

    serde_json::to_string(&account)
}

Dependencies

~1.7–2.8MB
~52K SLoC