You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A canister library for derivation of encrypted vetkeys from arbitrary strings. It can be used in combination with the [frontend key manager library](https://dfinity.github.io/vetkeys/classes/_dfinity_vetkeys_key_manager.KeyManager.html).
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](https://dfinity.github.io/vetkeys/classes/_dfinity_vetkeys_encrypted_maps.EncryptedMaps.html).
8
10
9
-
# Install
10
-
```
11
-
mops add ic-vetkeys
12
-
```
13
-
14
-
# Usage
15
-
```motoko
16
-
import IcVetkeys "mo:ic-vetkeys";
17
-
18
-
// example...
19
-
```
11
+
## Cross-language library
12
+
If Rust better suits your needs, take a look at the [Rust equivalent of this library](https://docs.rs/ic_vetkeys).
Copy file name to clipboardExpand all lines: backend/mo/ic_vetkeys/src/encrypted_maps/EncryptedMaps.mo
+78-15Lines changed: 78 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,41 @@
1
+
/// The **EncryptedMaps** backend is a support library built on top of `KeyManager`.
2
+
///
3
+
/// **EncryptedMaps** is designed to facilitate secure, encrypted data sharing between users on the Internet Computer (ICP) using the **vetKeys** feature. It allows developers to store encrypted key-value pairs (**maps**) securely and to manage fine-grained user access.
4
+
///
5
+
/// For an introduction to **vetKeys**, refer to the [vetKeys Overview](https://internetcomputer.org/docs/building-apps/network-features/encryption/vetkeys).
6
+
///
7
+
/// ## Core Features
8
+
///
9
+
/// The **EncryptedMaps** library provides the following key functionalities:
10
+
///
11
+
/// - **Encrypted Key-Value Storage:** Securely store and manage encrypted key-value pairs within named maps.
12
+
/// - **User-Specific Map Access:** Control precisely which users can read or modify entries in an encrypted map.
13
+
/// - **Integrated Access Control:** Leverages the **KeyManager** library to manage and enforce user permissions.
14
+
/// - **Stable Storage:** Utilizes **OrderedMap** for reliable, persistent storage across canister upgrades.
/// 4. **User A** revokes **User B**'s access as necessary.
29
+
///
30
+
/// ## Security Considerations
31
+
///
32
+
/// - Encrypted values are stored securely with fine-grained access control.
33
+
/// - Access rights and permissions are strictly enforced.
34
+
/// - Data persists securely across canister upgrades through stable storage.
35
+
///
36
+
/// ## Summary
37
+
/// **EncryptedMaps** simplifies secure storage, retrieval, and controlled sharing of encrypted data on the Internet Computer, complementing the robust security and permissions management provided by **KeyManager**.
38
+
1
39
importPrincipal"mo:base/Principal";
2
40
importBlob"mo:base/Blob";
3
41
importBuffer"mo:base/Buffer";
@@ -12,12 +50,22 @@ import Text "mo:base/Text";
12
50
importKeyManager"../key_manager/KeyManager";
13
51
14
52
module {
53
+
/// The caller requesting access to encrypted maps, represented as a Principal.
15
54
publictypeCaller=Principal;
55
+
56
+
/// The name of an encrypted map, used as part of the map identifier.
16
57
publictypeMapName=KeyManager.KeyName;
58
+
59
+
/// A unique identifier for an encrypted map, consisting of the owner and map name.
17
60
publictypeMapId=KeyManager.KeyId;
61
+
62
+
/// A key within an encrypted map, used to identify specific values.
18
63
publictypeMapKey=Blob;
64
+
65
+
/// An encrypted value stored within an encrypted map.
19
66
publictypeEncryptedMapValue=Blob;
20
67
68
+
/// Represents the complete data for an encrypted map, including ownership, contents, and access control.
21
69
publictypeEncryptedMapData<T>= {
22
70
map_owner : Principal;
23
71
map_name : MapName;
@@ -54,22 +102,27 @@ module {
54
102
returnOrderedMap.Make<MapId>(compareMapIds);
55
103
};
56
104
105
+
/// See the module documentation for more information.
57
106
publicclassEncryptedMaps<T>(key_id : { curve : { #bls12_381_g2 }; name : Text }, domainSeparator : Text, accessRightsOperations : Types.AccessControlOperations<T>) {
0 commit comments