轴-不相干-被子
WebAssembly 构建 AXIAM OPAQUE (RFC 9807) 客户端,发布于 npm 为
@axiam/opaque-wasm 并被TypeScript SDK和React admin UI所消耗.
为什么会这样
sdks/CONTRACT.md §23.1禁止SDK自己执行OPAQUE. SRP曾经是
手写11次,因为它是模块算术和每种语言
有大名; OPAQUE 需要一个忽略的PRF, hash_to_curve, (中文(简体) ),
expand_message_xmd信封构造和三通信息AKE 就这样
是一个执行—— crates/axiam-opaque 这个箱子就是JavaScript
到达它.
大楼
wasm-pack build --target web --release crates/axiam-opaque-wasm
不是故意的货运工作空间成员:它只为 wasm32,以及
包括它会是一个平地 cargo test 在寄存器根尝试
编译 wasm-bindgen 为宿主.
使用量
import init, { OpaqueLogin, OpaqueKsf } from "@axiam/opaque-wasm";
await init();
// 1. Blind the password and start the exchange.
const login = new OpaqueLogin(password);
const started = await postJson("/api/v1/auth/opaque/login/start", {
org_slug, tenant_slug, username_or_email, ke1: login.ke1,
});
// 2. Build the KSF from what the SERVER named — never from local defaults.
const ksf = started.ksf === "argon2id"
? OpaqueKsf.argon2id(started.memory_kib, started.iterations, started.parallelism)
: OpaqueKsf.scrypt(started.log_n, started.r, started.p);
// 3. Open the envelope. A throw here means wrong password, unknown account,
// or a server that does not hold the record — indistinguishable by design,
// and nothing further may be posted.
const finished = login.finish(password, started.ke2, ksf);
await postJson("/api/v1/auth/opaque/login/finish", {
opaque_session: started.opaque_session,
ke3: finished.ke3,
});
login 实值 消费 以 finish: 第二通电话投出而不是重用
一次OPRF盲从两次交流.
这不起作用
它没有执行HTTP。 端点选择、饼干处理和错误映射 属于SDK或称为SDK的应用程序——见Contract §23.4和§23.5.