Mirrors kv-ffi's docs/10 §5 API in WebCore and binds it under the names the web app codes against: setupPayloadForKit, addDevicePayload, revokeEnrollmentTicket, loginWithSetup, joinStart/joinPoll/joinCancel, joinApprove, joinSend, and the free function parseSetupPayload (also callable through the worker client). Unlike kv-ffi, the Secret Key is not persisted: every unlock on the web takes it, so it is kept zeroized in the unlocked state and dropped on lock. loginWithSetup refuses a code for a different server than the configured origin (the browser only talks to its own origin). Tests: ticket enrollment and scan-to-join in both roles against kv-ffi via the kv-sync test server, a swapped-approver rejection, a Chrome test (IndexedDB never holds the Secret Key, JS shapes, error codes) and a Node smoke check of the built package. Co-Authored-By: Claude Opus 5.5 <[email protected]>
66 lines
2.3 KiB
TOML
66 lines
2.3 KiB
TOML
[package]
|
|
name = "kv-wasm"
|
|
description = "WebAssembly build of the Kestrove core for the web vault (IndexedDB store, WebCrypto device key)."
|
|
version.workspace = true
|
|
edition.workspace = true
|
|
license.workspace = true
|
|
publish.workspace = true
|
|
|
|
[lib]
|
|
crate-type = ["cdylib", "rlib"]
|
|
|
|
[dependencies]
|
|
kv-proto.workspace = true
|
|
kv-crypto.workspace = true
|
|
kv-model.workspace = true
|
|
kv-store.workspace = true
|
|
kv-sync.workspace = true
|
|
kv-import.workspace = true
|
|
serde.workspace = true
|
|
serde_json.workspace = true
|
|
thiserror.workspace = true
|
|
uuid.workspace = true
|
|
zeroize.workspace = true
|
|
sha2.workspace = true
|
|
base64.workspace = true
|
|
serde_bytes = "0.11"
|
|
|
|
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
|
wasm-bindgen = "0.2"
|
|
wasm-bindgen-futures = "0.4"
|
|
js-sys = "0.3"
|
|
serde-wasm-bindgen = "0.6"
|
|
# Browser randomness (crypto.getRandomValues) for uuid and rand_core/OsRng.
|
|
uuid = { workspace = true, features = ["js"] }
|
|
getrandom = { version = "0.2", features = ["js"] }
|
|
web-sys = { version = "0.3", features = [
|
|
"Crypto", "SubtleCrypto", "CryptoKey", "CryptoKeyPair", "EcKeyGenParams", "EcdsaParams",
|
|
"IdbFactory", "IdbDatabase", "IdbOpenDbRequest", "IdbRequest", "IdbRequestReadyState", "IdbTransaction",
|
|
"IdbTransactionMode", "IdbObjectStore", "IdbObjectStoreParameters", "IdbVersionChangeEvent", "IdbCursorWithValue",
|
|
"DomException", "DomStringList", "Window", "WorkerGlobalScope", "Event",
|
|
] }
|
|
|
|
[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
|
|
wasm-bindgen-test = "0.3"
|
|
|
|
[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
|
|
kv-ffi = { path = "../kv-ffi" }
|
|
kv-store.workspace = true
|
|
kv-sync = { workspace = true, features = ["test-server"] }
|
|
tokio = { workspace = true }
|
|
tempfile.workspace = true
|
|
|
|
# rustc targets these post-MVP features by default; wasm-opt must be told it may use them.
|
|
# `custom` applies to `--profile wasm-release`.
|
|
[package.metadata.wasm-pack.profile.release]
|
|
wasm-opt = [
|
|
"-Oz", "--enable-bulk-memory", "--enable-nontrapping-float-to-int", "--enable-sign-ext",
|
|
"--enable-mutable-globals", "--enable-reference-types", "--enable-multivalue",
|
|
]
|
|
|
|
[package.metadata.wasm-pack.profile.custom]
|
|
wasm-opt = [
|
|
"-Oz", "--enable-bulk-memory", "--enable-nontrapping-float-to-int", "--enable-sign-ext",
|
|
"--enable-mutable-globals", "--enable-reference-types", "--enable-multivalue",
|
|
]
|