Skip to main content

Crate rustlavel_webauthn

Crate rustlavel_webauthn 

Source
Expand description

rustlavel-webauthn: passkeys, written on the W3C WebAuthn specification.

A password is a shared secret: the server holds something that can be stolen from it, and the user types something that can be phished out of them. A passkey is neither. The authenticator keeps a private key that never leaves it, the server stores only the public half, and the signature covers the origin — so a convincing copy of your login page at a different address gets nothing, because the browser will not sign for it.

That last property is the one worth the work. Every other second factor can be relayed by a good enough phishing page; this one cannot.

Everything here is written from scratch except the signature verification. CBOR, COSE framing, the ceremonies, the challenge handling — all ours. The elliptic-curve maths is not, and should not be: a subtly wrong verifier accepts forged assertions, which is the single failure this package exists to prevent.

Re-exports§

pub use cbor::Cbor;
pub use cose::CoseKey;
pub use cose::SignatureAlgorithm;
pub use ceremony::AttestedCredential;
pub use ceremony::AuthenticatorAttachment;
pub use ceremony::AuthenticatorData;
pub use ceremony::AuthenticatorFlags;
pub use ceremony::ClientData;
pub use ceremony::RelyingParty;
pub use ceremony::ResidentKey;
pub use ceremony::UserEntity;
pub use ceremony::UserVerification;
pub use challenge::Ceremony;
pub use challenge::Challenge;
pub use challenge::ChallengeStore;
pub use challenge::MemoryChallengeStore;
pub use challenge::SharedChallengeStore;
pub use credential::Credential;
pub use credential::CredentialStore;
pub use credential::MemoryCredentialStore;
pub use credential::SharedCredentialStore;
pub use authentication::Authentication;
pub use authentication::AuthenticationResponse;
pub use authentication::PublicKeyCredentialRequestOptions;
pub use registration::AttestationStatement;
pub use registration::PublicKeyCredentialCreationOptions;
pub use registration::Registration;
pub use registration::RegistrationResponse;

Modules§

authentication
Authentication: the ceremony that proves the private key is still there.
cbor
Just enough CBOR to read what an authenticator sends, and to write it back.
ceremony
What registration and authentication agree on.
challenge
The value that makes a signature mean “now”, and only once.
cose
COSE keys, and the one thing this package must never get wrong.
credential
The half of a passkey the server is allowed to keep.
prelude
What a controller finishing either ceremony imports.
registration
Registration: the ceremony that hands the server a public key.

Enums§

Error
Every failure the framework itself can produce.
Json
A parsed JSON value.

Type Aliases§

Result
The framework-wide result type.