Skip to content

shimunn/wasm-webauthn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Webauthn for wasm

Usage example

use wasm_webauthn::*;

async fn register() -> Credential {
    let MakeCredentialResponse { credential } = MakeCredentialArgsBuilder::default()
        .rp_id(Some("example.com".to_string()))
        .challenge([42u8; 32].to_vec())
        .uv(UserVerificationRequirement::Required)
        .build().expect("invalid args")
        .make_credential().await
        .expect("make credential");
    credential
}

async fn get_assertion(credential: Credential) {
    let GetAssertionResponse {
        signature,
        client_data_json,
        flags,
        counter,
    } = GetAssertionArgsBuilder::default()
        .credentials(Some(vec![credential.into()]))
        .challenge("Hello World".as_bytes().to_vec())
        .build()
        .expect("invalid args")
        .get_assertion().await
        .expect("get assertion");
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published