Перейти до вмісту

passkey-rs

WebAuthn / passkey relying-party library for Rust (0.2).

passkey-rs — проєкт з відкритим кодом, автор Ярослав Коваль. Основна мова: Rust. Останнє оновлення: 9 серп. 2026 р. Вихідний код доступний на GitHub.

  • Rust
Оновлено
Зірки
0
git clone https://github.com/koval01/passkey-rs.git

README

README показано мовою оригіналу.

passkey-rs

WebAuthn / passkey relying-party library for Rust (0.2).

Pure Rust crypto (p256, sha2, ciborium, x509-parser) — no OpenSSL / C in this crate. No dependency on webauthn-rs.

Finance-strict defaults: __Host- cookies, SameSite=Strict, UV locked Required, 5m/1h sessions, IP-bound ceremonies/sessions, named login only, lockout + rate limits, closed self-registration. See SECURITY.md.

Demo console (JSON + Guide glossary): sibling repo rust-axum-passkey.

Scope

  • ES256 (COSE -7) on NIST P-256; optional Ed25519 / EdDSA (COSE -8) via offer_ed25519 (default true)
  • Attestation none + packed (self / basic), configurable AttestationPolicy (default: ask direct, accept none+packed)
  • Default userVerification: required (enforced; locked unless allow_relaxed_uv)
  • Async stores: UserStore, ChallengeStore, SessionStore, RateLimitStore
  • Optional Redis adapters (challenges, sessions, rate limits)
  • Optional Postgres UserStore (feature = "postgres", sqlx + rustls)
  • Opaque client errors, CAS sign counts, session-gated add-credential

Axum quick start

use passkey_rs::{CookieConfig, PasskeyConfig, RelyingParty, UserVerificationPolicy};
use passkey_rs::axum::{PasskeyState, router};

let rp = RelyingParty::new("example.com", "My App", "https://example.com");
let config = PasskeyConfig::new()
    .user_verification(UserVerificationPolicy::Required)
    .cookies(CookieConfig::new());
let api = router(PasskeyState::with_config(rp, config));

Attestation presets: AttestationPolicy::compatible(), none_only(), require_packed(), require_trusted_packed(anchors).

Production checklist

  • [ ] Durable UserStore — PostgresUserStore (feature = "postgres") or your SQL with atomic CAS
  • [ ] Redis for challenges + sessions (feature = "redis", Redis ≥ 6.2 for GETDEL)
  • [ ] HTTPS termination; cookie Secure=true (__Host- requires it)
  • [ ] trust_forwarded_headers only behind a trusted proxy
  • [ ] Leave allow_open_registration=false unless product needs public signup
  • [ ] Review rate-limit knobs; ship audit logs (audit=true tracing)
  • [ ] Do not lower UV to Preferred for high-value flows without a risk engine

Multi-instance

| Data | Backend | |------|---------| | Users + credentials | PostgresUserStore (or your SQL) | | Challenges | RedisChallengeStore | | Sessions | RedisSessionStore |

[... continued on GitHub]

Інші проєкти

Усі репозиторії: github.com/koval01