Creates a new instance of the KeyManager.
Retrieves a list of keys that were shared with the user and the user still has access to.
Promise resolving to an array of [Principal, Uint8Array]
pairs representing accessible key identifiers.
Checks a user's access rights.
The principal of the key owner
The name/identifier of the VetKey
The principal of the user to check rights for
Promise resolving to the user's access rights if they exist
Fetches and decrypts an encrypted VetKey.
The principal of the key owner
The name/identifier of the VetKey
Promise resolving to the decrypted VetKey bytes
Retrieves the public verification key for validating encrypted VetKeys.
The vetkeys obtained via getVetkey
are verified using this key,
and, therefore, this method is not needed for using getVetkey
.
Promise resolving to the verification key bytes
Revokes a user's access.
The principal of the key owner
The name/identifier of the VetKey
The principal of the user to remove
Promise resolving to the previous access rights if they existed
Grants or modifies access rights for a user.
The principal of the key owner
The name/identifier of the VetKey
The principal of the user to grant/modify rights for
The access rights to grant
Promise resolving to the previous access rights if they existed
const owner = Principal.fromText("aaaaa-aa");
const keyName = "my_secure_key";
const user = Principal.fromText("bbbbbb-bb");
const accessRights = { ReadWrite: null };
const result = await keyManager.setUserRights(
owner,
keyName,
user,
accessRights,
);
console.log("Replaced Access Rights:", result);
The
KeyManager
frontend library facilitates interaction with aKeyManager
-enabled canister on the Internet Computer (ICP). It allows web applications to securely request, decrypt, and manage VetKeys while handling access control and key sharing.Core Features
Security Considerations
Example