Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Tests

use auth_chad_testing::{MemStore, World, block_on};
use auth_chad::{Store, passkey};

fn a_login_starts() {
    block_on(async {
        let w = World::default();   // memory store, fake clock, repeatable randomness
        let options = passkey::login_start(&w.ctx(), &mut w.draws()).unwrap();
        assert_eq!(options.rp_id, "login.example.com");
        w.clock.advance(301);       // the ceremony is over
        w.store.commit(vec![]).await.unwrap();
    });
}
  • World::passkey(1) is a passkey in software: create and get.
  • HTTP: Auth::new(config, &[1; 32], MemStore::default())?.with_sources(clock, draws) and router.oneshot(request). rust/adapters/axum/tests/http.rs has every step.
  • Browser: rust/examples/minimal/e2e/run.mjs drives Chromium with a virtual passkey and no packages.
  • Never put a real token, key or address in a test.