Commit 19dea9d
feat(vetkeys): adopt custom_value_endpoints in password_manager_with_metadata (Rust) (#1474)
* feat(vetkeys): adopt custom_value_endpoints in password_manager_with_metadata
ic-vetkeys 0.9.0 adds a `custom_value_endpoints` form to
`export_encrypted_maps_canister!`, closing dfinity/vetkeys#423. It generates the
stable state, the `#[init]`/`#[post_upgrade]` hooks, the 8 control-plane
endpoints and the `with_encrypted_maps`/`_mut` accessors, but none of the 7
endpoints that read or write encrypted values.
That is exactly what `password_manager_with_metadata` needs: it keeps a
backend-authoritative metadata row per encrypted value, so the raw
`insert_encrypted_value`/`remove_encrypted_value` mutators must not be exposed —
they would write a value with no metadata row and desync the two stores. The
backend drops to 193 lines (from 343): the hand-written EncryptedMaps
thread-local, lifecycle hooks, redundant key-name cell and 8 passthrough
endpoints are all generated now, leaving only the three `*_with_metadata`
endpoints written against the accessors.
Also hardens the metadata read path: it looked metadata up by zipping two
ordered iterators, guarded only by a `debug_assert_eq!` that compiles out in
release, so a divergence would have silently paired a password with the wrong
metadata. It now looks up per key and reports a missing row as an error.
Domain separators renamed to match their examples: the metadata example used
`password_manager_app` (which reads as if it belonged to the plain example) and
the plain example used the library-flavoured `encrypted_maps_app`. They are now
`password_manager_with_metadata_app` and `password_manager_app`. The separator is
persisted in the EncryptedMaps config cell, so an upgraded canister keeps its
old value; only fresh installs pick up the new names.
Bumps ic-vetkeys 0.8.1 -> 0.9.0 across all five Rust examples that pin it. The
release is additive, so basic_ibe, basic_bls_signing and basic_timelock_ibe are
pin-only changes.
Verified: all five build for wasm32-unknown-unknown; clippy -Dwarnings clean;
backend.did byte-identical for every example with committed candid (so no
frontend or icp.yaml change); local icp deploy e2e on both password managers —
create/read/update/remove with metadata, vault sharing to a second identity,
decryption after upgrade, and `insert_encrypted_value` correctly absent from the
metadata canister (IC0536).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* docs(vetkeys): make the Rust password manager file headers module docs
Review feedback on #1474: the header comment describing the canister belongs in
`//!` module docs rather than a plain `//` comment. Applied to both password
managers so the pair stays consistent.
The same suggestion for the comment above the macro invocation does not work:
`///` there triggers rustc's `unused_doc_comment` warning, because rustdoc does
not document macro invocations. Left as a plain comment.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent 15fb083 commit 19dea9d
8 files changed
Lines changed: 90 additions & 240 deletions
File tree
- rust/vetkeys
- basic_bls_signing/backend
- basic_ibe/backend
- basic_timelock_ibe/backend
- password_manager_with_metadata
- backend
- src
- password_manager
- backend/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
| 60 | + | |
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
0 commit comments