Skip to content

docs: vetKeys concept and encryption guide#158

Merged
marc0olo merged 4 commits into
mainfrom
docs/concepts-vetkeys-encryption
Apr 28, 2026
Merged

docs: vetKeys concept and encryption guide#158
marc0olo merged 4 commits into
mainfrom
docs/concepts-vetkeys-encryption

Conversation

@marc0olo
Copy link
Copy Markdown
Member

Summary

  • docs/concepts/vetkeys.md: new concept page explaining the vetKD protocol, the V/E/T/K properties, the transport key flow, use cases (encrypted storage, DKMS, IBE, timelock, BLS, VRF), API overview with key names and cycle costs, and current status
  • docs/guides/security/encryption.mdx: new how-to guide covering the 4-step key derivation flow (backend canister setup in Motoko and Rust, transport key generation, vetKey decryption, AES-GCM encryption), the EncryptedMaps higher-level pattern, IBE, common mistakes, and local testing
  • Renamed encryption.mdencryption.mdx to support Motoko/Rust language tabs

Closes #112, closes #113

Notes

  • All code adapted from the vetkd icskill and portal source material (9 files under vetkeys/)
  • Motoko code uses mo:core imports (not mo:base)
  • Uses icp CLI commands throughout
  • Build passes (npm run build): 153 pages, 0 errors

Sync recommendation

informed by dfinity/portal docs/building-apps/network-features/vetkeys/ (introduction, api, encrypted-onchain-storage, dkms, identity-based-encryption, timelock-encryption); dfinity/icskills vetkd

The portal content is the authoritative upstream reference but targets a different audience and uses JSX components incompatible with Starlight. These pages are hand-written syntheses that track the portal for factual accuracy. Review the portal vetkeys section when bumping the portal submodule.

Add docs/concepts/vetkeys.md explaining the vetKD protocol, the V/E/T/K
properties, use cases, and API overview. Add
docs/guides/security/encryption.mdx with a full how-to covering the
4-step key derivation flow, EncryptedMaps, and IBE patterns in
Motoko/Rust/TypeScript.

Closes #112, #113
Bump dfinity/examples submodule from 954d208 to d4ea422. The vetkeys
examples (password_manager, encrypted_notes_dapp_vetkd, basic_ibe,
basic_timelock_ibe, encrypted_chat, basic_bls_signing,
password_manager_with_metadata) are now canonical under
rust/vetkeys/ in this repo.

Update all docs links that pointed to
github.com/dfinity/vetkeys/tree/main/examples/... to their new
paths at github.com/dfinity/examples/tree/master/rust/vetkeys/...

Also add links to new examples (password_manager_with_metadata,
basic_timelock_ibe) in the encryption guide, and separate the
library and examples links in Next steps.
- Rust: replace unused `use candid::Principal` import with inline
  `candid::Principal` usage; add `caller_context()` that prefixes the
  domain separator with the caller's principal bytes; use it in both
  `get_public_key` and `get_encrypted_vetkey` so each caller's keys
  are cryptographically isolated
- Motoko: same pattern via `callerContext()` using mo:core Array/Blob
- Frontend Step 2: replace `TransportSecretKey.fromSeed` + `.publicKey()`
  with `.random()` + `.publicKeyBytes()` — `.publicKeyBytes()` returns
  the Uint8Array the canister endpoint expects; `.publicKey()` returns
  a DerivedPublicKey object and would produce incorrect Candid encoding
- Update surrounding prose and Common mistakes to match
@marc0olo marc0olo merged commit 2c4adea into main Apr 28, 2026
2 checks passed
@marc0olo marc0olo deleted the docs/concepts-vetkeys-encryption branch April 28, 2026 14:23
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.

docs: guides/security/encryption.md docs: concepts/vetkeys.md

1 participant