Skip to content

feat(vetkeys): replace vetkd with vetkeys + encrypted-maps skills - #351

Merged
marc0olo merged 4 commits into
mainfrom
chore/rework-vetkeys-skills
Aug 14, 2026
Merged

feat(vetkeys): replace vetkd with vetkeys + encrypted-maps skills#351
marc0olo merged 4 commits into
mainfrom
chore/rework-vetkeys-skills

Conversation

@marc0olo

Copy link
Copy Markdown
Member

Summary

Replaces the outdated vetkd skill with two skills split by abstraction level, updated to the current vetKeys libraries and verified end-to-end.

  • vetkeys — the vetKD management API plus advanced primitives: symmetric key derivation, IBE, timelock encryption, threshold BLS signatures, offline public-key derivation, and VRF. Feature depth lives in references/ibe.md and references/bls-signing.md.
  • encrypted-maps — high-level, access-controlled encrypted key-value storage (the default for password managers / encrypted notes): the Rust export_encrypted_maps_canister! macro, the Motoko EncryptedMapsCanister mixin, the TS EncryptedMaps client, a short KeyManager section, and the metadata / custom-value-endpoint variant in references/metadata.md.

Each skill's description routes to the other, so agents land on the right one (bidirectional routing verified in the trigger evals).

Why replace vetkd?

The shipped vetkd skill was inaccurate against the current libraries. It used the renamed @dfinity/vetkeys (frozen at 0.4), told Motoko developers to hand-roll the management canister (a full Motoko ic-vetkeys library now exists), pinned Rust ic-vetkeys 0.6 (now 0.9), used the deprecated ic-cdk call API, referenced a non-existent toDerivedKeyMaterial(), and misstated cycle costs.

What's corrected

  • @icp-sdk/vetkeys 0.5 (renamed from @dfinity/vetkeys); frontend agent/identity from @icp-sdk/core, not @dfinity/agent
  • Rust ic-vetkeys 0.9 + ic-cdk 0.20 + ic-cdk-management-canister; Motoko ic-vetkeys 0.6 (moc 1.13 / core 2.6.1)
  • Library management helpers (ic-cdk-management-canister, mo:ic-vetkeys/ManagementCanister) instead of hand-rolled Candid + actor "aaaaa-aa"
  • VetKey.asDerivedKeyMaterial()encryptMessage/decryptMessage (the old skill's toDerivedKeyMaterial() does not exist)
  • Correct cycle costs — test_key_1 and key_1 behave the same locally and on mainnet; helpers attach the amount
  • verifyBlsSignature(DerivedPublicKey, …), persistent actor (compiles with or without --default-persistent-actors), and the Motoko-has-no-frontend-crypto asymmetry documented

Verification

Every code block is derived from the canonical dfinity/examples sources (Rust master, Motoko from dfinity/examples#1475, frontends master) and the library source. All Motoko snippets compiled verbatim on moc 1.13.0 / ic-vetkeys 0.6.0 / core 2.6.1, in both mops configurations (bare and --default-persistent-actors). Cycle costs were measured on a local replica. npm run validate passes for both skills.

Honoring prior contributions

This supersedes and builds on prior community work — thank you both:

Closes #73, #272, #285, #286.
Supersedes #158, #162, #308.

Evals

Output evals — all cases pass with the skill; strong with-skill vs baseline deltas

vetkeys

Case WITH skill WITHOUT (baseline)
ibe_encrypt_to_principal 4/4 2/4
symmetric_key_material_api 3/3 1/3
motoko_has_no_low_level_primitives 4/4 0/4
cycle_cost_and_helpers 3/3 0/3
bls_verify_uses_derived_public_key 3/3 0/3

encrypted-maps

Case WITH skill WITHOUT (baseline)
scaffold_backend_with_macro 4/4 1/4
share_map_access_rights_variant 2/2 0/2
scaffold_motoko_backend_mixin 5/5 0/5
derived_key_material_caching 3/3 1/3
Trigger evals — 100% on both skills, including bidirectional routing
  • vetkeys — should_trigger 4/4, should_not_trigger 2/2 (declines the password-manager query → routes to encrypted-maps)
  • encrypted-maps — should_trigger 3/3, should_not_trigger 2/2 (declines the IBE / BLS queries → routes to vetkeys)

🤖 Generated with Claude Code

Replace the outdated single `vetkd` skill with two skills split by
abstraction level:

- vetkeys: vetKD management API, symmetric key derivation, IBE, timelock,
  threshold BLS, offline public-key derivation, VRF (feature references
  ibe.md, bls-signing.md)
- encrypted-maps: high-level access-controlled encrypted key-value storage
  (Rust macro / Motoko mixin), KeyManager, metadata variant

Update to current libraries: @icp-sdk/vetkeys 0.5 (renamed from
@dfinity/vetkeys), ic-vetkeys 0.9 (Rust) / 0.6 (Motoko), @icp-sdk/core
frontend, modern ic-cdk API, correct cycle costs, library management
helpers instead of hand-rolled Candid.

Every code block verified against dfinity/examples and library source;
Motoko snippets compiled on moc 1.13 / ic-vetkeys 0.6; cycle costs
measured on a local replica.

Closes #73, #272, #285, #286
Supersedes #158, #162, #308
@marc0olo
marc0olo requested review from a team and JoshDFN as code owners August 12, 2026 14:45
@marc0olo
marc0olo requested a balanced review from Copilot August 12, 2026 14:46
@github-actions

Copy link
Copy Markdown

Skill Validation Report

Project Checks


✓ Project checks passed for 2 skills (0 warnings)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Replaces the outdated vetkd skill with current, abstraction-specific vetKeys guidance.

Changes:

  • Adds low-level vetkeys and high-level encrypted-maps skills.
  • Adds IBE, BLS, metadata, and deployment guidance.
  • Adds routing and output evaluations for both skills.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
.claude/CLAUDE.md Clarifies dependency documentation conventions.
skills/vetkd/SKILL.md Removes obsolete vetKD guidance.
skills/vetkeys/SKILL.md Adds updated core vetKeys guidance.
skills/vetkeys/references/ibe.md Documents IBE and timelock flows.
skills/vetkeys/references/bls-signing.md Documents threshold BLS signing.
skills/encrypted-maps/SKILL.md Adds encrypted storage guidance.
skills/encrypted-maps/references/metadata.md Covers custom metadata endpoints.
evaluations/vetkeys.json Adds vetKeys behavior and routing evaluations.
evaluations/encrypted-maps.json Adds EncryptedMaps behavior and routing evaluations.
Suppressed comments (1)

skills/vetkeys/SKILL.md:210

  • A context/input mismatch is reported as a verification or decryption error; it is not silent. This wording can lead consumers to ignore or misdiagnose the rejected promise/result.
6. **`context` and `input` must match end to end.** A different `context` (or a different `input`) produces a different key; decryption then fails silently. Keep them byte-identical across public-key, derive, and client verify/decrypt.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread skills/vetkeys/SKILL.md Outdated
Comment thread skills/vetkeys/SKILL.md Outdated
Comment thread skills/vetkeys/SKILL.md Outdated
Comment thread skills/vetkeys/references/bls-signing.md Outdated
Comment thread skills/encrypted-maps/SKILL.md
Comment thread skills/vetkeys/SKILL.md
- Scope the "no canister sees the raw key" guarantee to the client-delivery
  pattern (threshold BLS and in-canister timelock intentionally expose key
  material to the canister)
- context/input mismatch: decryptAndVerify throws (Rust returns an error) —
  reword the "fails silently" claims in the concept and pitfall
- Standalone Motoko canisters: plain `let keyName` (frozen at first install,
  matching basic_vetkd) with an accurate immutability comment; drop the
  misleading `transient` re-read framing
- BLS verify snippet: encode the message once and verify the same bytes; use
  the Motoko backend's signMessage/getMyVerificationKey names
- encrypted-maps: resolve rootKey via safeGetCanisterEnv() (was referenced but
  never declared)
- CODEOWNERS: retarget /skills/vetkd/ -> /skills/vetkeys/ and add
  /skills/encrypted-maps/ (@andreacerulli)
- Add public/_redirects 301s for the vetkd -> vetkeys rename
…tocol

@andreacerulli has left dfinity; retarget the renamed vetkd owner to the
core-protocol team (credit for the original design remains in the PR).
@marc0olo
marc0olo requested a balanced review from Copilot August 12, 2026 15:11
Comment thread .github/CODEOWNERS


Per review on #351: https-outcalls, multi-canister, and stable-memory move
from @derlerd-dfinity to the @dfinity/core-protocol team.
@marc0olo
marc0olo enabled auto-merge (squash) August 14, 2026 14:42
@marc0olo
marc0olo merged commit 089d898 into main Aug 14, 2026
6 checks passed
@marc0olo
marc0olo deleted the chore/rework-vetkeys-skills branch August 14, 2026 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

vetkd skill needs to be reviewed for accuracy

4 participants