Expand description
§Internet Computer (IC) vetKeys
This crate contains a set of tools designed to help canister developers integrate vetKeys into their Internet Computer (ICP) applications.
The current Minimum Supported Rust Version (MSRV) of this crate is 1.85. Any future increase in the MSRV will be accompanied by a bump in the minor version number.
§Key Manager
A canister library for derivation of encrypted vetkeys from arbitrary strings. It can be used in combination with the frontend key manager library.
§Encrypted Maps
An efficient canister library facilitating access control and encrypted storage for a collection of maps contatining key-value pairs. It can be used in combination with the frontend encrypted maps library.
§Ready-made EncryptedMaps canister
The export_encrypted_maps_canister! macro generates a complete EncryptedMaps canister — the #[init]/#[post_upgrade], the stable state, and every endpoint the @icp-sdk/vetkeys frontend expects — in a few lines instead of ~200 of hand-written boilerplate:
ic_vetkeys::export_encrypted_maps_canister!(
"my_app_domain_separator",
[memory(0), memory(1), memory(2), memory(3)],
);
ic_cdk::export_candid!();If your canister keeps state linked to each value (e.g. a metadata row per entry) and must own the value read/write endpoints, pass custom_value_endpoints: the macro then generates the control-plane endpoints, state, lifecycle hooks, and with_encrypted_maps/with_encrypted_maps_mut accessors, but omits the value endpoints so you can provide your own. See the macro documentation for the full setup and rationale.
§Utils
For obtaining and decrypting verifiably-encrypted threshold keys via the Internet Computer vetKD system API. The API is located in the crate root.
§Cross-language library
If Motoko better suits your needs, take a look at the Motoko equivalent of this library.
Modules§
- encrypted_
maps - See
EncryptedMapsfor the main documentation. - key_
manager - See
KeyManagerfor the main documentation. - management_
canister - This module contains functions for calling the ICP management canister’s
vetkd_derive_keyendpoint from within a canister. - types
Macros§
- export_
encrypted_ maps_ canister - Generates an EncryptedMaps canister in the calling crate.
Structs§
- Derived
KeyMaterial - Key material derived from a VetKey
- Derived
Public Key - A derived public key
- Encrypted
VetKey - An encrypted VetKey
- IbeCiphertext
- An IBE (identity based encryption) ciphertext
- IbeIdentity
- An identity, used for identity based encryption (IBE)
- IbeSeed
- A random seed, used for identity based encryption
- Master
Public Key - A master VetKD public key
- Transport
Secret Key - Secret key of the transport key pair
- VetKey
- A verifiably encrypted threshold key derived by the VetKD protocol
- VrfOutput
- VRF (Verifiable Random Function) Output
Enums§
- Decryption
Error - An error while decrypting
- Encrypted
VetKey Deserialization Error - Error indicating that deserializing an encrypted key failed
- Encryption
Error - An error while encrypting
- Invalid
VrfOutput - An error occured while decoding or checking a VrfOutput
- Public
KeyDeserialization Error - Error indicating deserializing a derived public key failed
Functions§
- derive_
symmetric_ key - Derive a symmetric key using HKDF-SHA256
- is_
valid_ transport_ public_ key_ encoding - Return true iff the argument is a valid encoding of a transport public key
- verify_
bls_ signature - Verify an augmented BLS signature