@icp-sdk/vetkeys 0.5.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,20 @@
1
+ import { a as s, D as r, E as t, I as i, z as y, A as c, M as K, B as d, P as l, T as u, V as b, C as I, G as o, H as P, J as n, K as p, L as M } from "./index-BUXhtQhx.mjs";
2
+ export {
3
+ s as DerivedKeyMaterial,
4
+ r as DerivedPublicKey,
5
+ t as EncryptedVetKey,
6
+ i as IbeCiphertext,
7
+ y as IbeIdentity,
8
+ c as IbeSeed,
9
+ K as MasterPublicKey,
10
+ d as MasterPublicKeyId,
11
+ l as PocketIcMasterPublicKeyId,
12
+ u as TransportSecretKey,
13
+ b as VetKey,
14
+ I as VrfOutput,
15
+ o as augmentedHashToG1,
16
+ P as deriveSymmetricKey,
17
+ n as hashToScalar,
18
+ p as isValidTransportPublicKey,
19
+ M as verifyBlsSignature
20
+ };
@@ -0,0 +1,274 @@
1
+ import { T as u, D as _, E as l } from "./index-BUXhtQhx.mjs";
2
+ import { A as h } from "./actor-4fotMNaR.mjs";
3
+ const g = ({ IDL: e }) => {
4
+ const r = e.Record({ inner: e.Vec(e.Nat8) }), t = e.Variant({ Ok: r, Err: e.Text }), s = e.Variant({
5
+ Read: e.Null,
6
+ ReadWrite: e.Null,
7
+ ReadWriteManage: e.Null
8
+ }), i = e.Variant({
9
+ Ok: e.Vec(e.Tuple(e.Principal, s)),
10
+ Err: e.Text
11
+ }), n = e.Variant({
12
+ Ok: e.Opt(s),
13
+ Err: e.Text
14
+ });
15
+ return e.Service({
16
+ get_accessible_shared_key_ids: e.Func(
17
+ [],
18
+ [e.Vec(e.Tuple(e.Principal, r))],
19
+ ["query"]
20
+ ),
21
+ get_encrypted_vetkey: e.Func(
22
+ [e.Principal, r, r],
23
+ [t],
24
+ []
25
+ ),
26
+ get_shared_user_access_for_key: e.Func(
27
+ [e.Principal, r],
28
+ [i],
29
+ ["query"]
30
+ ),
31
+ get_user_rights: e.Func(
32
+ [e.Principal, r, e.Principal],
33
+ [n],
34
+ ["query"]
35
+ ),
36
+ get_vetkey_verification_key: e.Func([], [r], []),
37
+ remove_user: e.Func(
38
+ [e.Principal, r, e.Principal],
39
+ [n],
40
+ []
41
+ ),
42
+ set_user_rights: e.Func(
43
+ [e.Principal, r, e.Principal, s],
44
+ [n],
45
+ []
46
+ )
47
+ });
48
+ };
49
+ class v {
50
+ canisterId;
51
+ actor;
52
+ verificationKey = void 0;
53
+ constructor(r, t) {
54
+ this.canisterId = t, this.actor = h.createActor(g, {
55
+ agent: r,
56
+ canisterId: t
57
+ });
58
+ }
59
+ get_accessible_shared_key_ids() {
60
+ return this.actor.get_accessible_shared_key_ids();
61
+ }
62
+ set_user_rights(r, t, s, i) {
63
+ return this.actor.set_user_rights(r, t, s, i);
64
+ }
65
+ get_user_rights(r, t, s) {
66
+ return this.actor.get_user_rights(r, t, s);
67
+ }
68
+ remove_user(r, t, s) {
69
+ return this.actor.remove_user(r, t, s);
70
+ }
71
+ async get_encrypted_vetkey(r, t, s) {
72
+ return await this.actor.get_encrypted_vetkey(
73
+ r,
74
+ t,
75
+ s
76
+ );
77
+ }
78
+ async get_vetkey_verification_key() {
79
+ return this.verificationKey ? this.verificationKey : (this.verificationKey = await this.actor.get_vetkey_verification_key(), this.verificationKey);
80
+ }
81
+ }
82
+ class E {
83
+ /**
84
+ * The client instance for interacting with the KeyManager canister.
85
+ */
86
+ canisterClient;
87
+ /**
88
+ * Creates a new instance of the KeyManager.
89
+ *
90
+ * @example
91
+ * ```ts
92
+ * import { KeyManager } from "@icp-sdk/vetkeys/key_manager";
93
+ *
94
+ * const keyManager = new KeyManager(keyManagerClientInstance);
95
+ * ```
96
+ */
97
+ constructor(r) {
98
+ this.canisterClient = r;
99
+ }
100
+ /**
101
+ * Retrieves a list of keys that were shared with the user and the user still has access to.
102
+ *
103
+ * @example
104
+ * ```ts
105
+ * const sharedKeys = await keyManager.getAccessibleSharedKeyIds();
106
+ * console.log("Shared Keys:", sharedKeys);
107
+ * ```
108
+ *
109
+ * @returns Promise resolving to an array of `[Principal, Uint8Array]` pairs representing accessible key identifiers.
110
+ */
111
+ async getAccessibleSharedKeyIds() {
112
+ return (await this.canisterClient.get_accessible_shared_key_ids()).map(
113
+ ([r, t]) => [r, Uint8Array.from(t.inner)]
114
+ );
115
+ }
116
+ /**
117
+ * Fetches and decrypts an encrypted VetKey.
118
+ *
119
+ * @example
120
+ * ```ts
121
+ * const keyOwner = Principal.fromText("aaaaa-aa");
122
+ * const vetkeyName = "my_secure_key";
123
+ *
124
+ * const vetkey = await keyManager.getVetkey(
125
+ * keyOwner,
126
+ * vetkeyName,
127
+ * );
128
+ * console.log("Decrypted VetKey:", vetkey);
129
+ * ```
130
+ *
131
+ * @param keyOwner - The principal of the key owner
132
+ * @param vetkeyName - The name/identifier of the VetKey
133
+ * @returns Promise resolving to the decrypted VetKey bytes
134
+ * @throws Error if the key retrieval or decryption fails
135
+ */
136
+ async getVetkey(r, t) {
137
+ const s = u.random(), i = await this.canisterClient.get_encrypted_vetkey(
138
+ r,
139
+ c(t),
140
+ c(s.publicKeyBytes())
141
+ );
142
+ if ("Err" in i)
143
+ throw Error(i.Err);
144
+ {
145
+ const n = Uint8Array.from(i.Ok.inner), a = await this.getVetkeyVerificationKey(), o = _.deserialize(
146
+ Uint8Array.from(a)
147
+ ), y = new Uint8Array([
148
+ r.toUint8Array().length,
149
+ ...r.toUint8Array(),
150
+ ...t
151
+ ]);
152
+ return l.deserialize(n).decryptAndVerify(
153
+ s,
154
+ o,
155
+ y
156
+ ).signatureBytes();
157
+ }
158
+ }
159
+ /**
160
+ * Retrieves the public verification key for validating encrypted VetKeys.
161
+ * The vetkeys obtained via `getVetkey` are verified using this key,
162
+ * and, therefore, this method is not needed for using `getVetkey`.
163
+ *
164
+ * @example
165
+ * ```ts
166
+ * const verificationKey = await keyManager.getVetkeyVerificationKey();
167
+ * console.log("Verification Key:", verificationKey);
168
+ * ```
169
+ *
170
+ * @returns Promise resolving to the verification key bytes
171
+ */
172
+ async getVetkeyVerificationKey() {
173
+ return Uint8Array.from(
174
+ (await this.canisterClient.get_vetkey_verification_key()).inner
175
+ );
176
+ }
177
+ /**
178
+ * Grants or modifies access rights for a user.
179
+ *
180
+ * @example
181
+ * ```ts
182
+ * const owner = Principal.fromText("aaaaa-aa");
183
+ * const keyName = "my_secure_key";
184
+ * const user = Principal.fromText("bbbbbb-bb");
185
+ * const accessRights = { ReadWrite: null };
186
+ *
187
+ * const result = await keyManager.setUserRights(
188
+ * owner,
189
+ * keyName,
190
+ * user,
191
+ * accessRights,
192
+ * );
193
+ * console.log("Replaced Access Rights:", result);
194
+ * ```
195
+ *
196
+ * @param owner - The principal of the key owner
197
+ * @param vetkeyName - The name/identifier of the VetKey
198
+ * @param user - The principal of the user to grant/modify rights for
199
+ * @param userRights - The access rights to grant
200
+ * @returns Promise resolving to the previous access rights if they existed
201
+ * @throws Error if the operation fails
202
+ */
203
+ async setUserRights(r, t, s, i) {
204
+ const n = await this.canisterClient.set_user_rights(
205
+ r,
206
+ c(t),
207
+ s,
208
+ i
209
+ );
210
+ if ("Err" in n) throw Error(n.Err);
211
+ if (n.Ok.length > 1)
212
+ throw Error("Unexpected result from set_user_rights");
213
+ return n.Ok.length === 0 ? void 0 : n.Ok[0];
214
+ }
215
+ /**
216
+ * Checks a user's access rights.
217
+ *
218
+ * @example
219
+ * ```ts
220
+ * const userRights = await keyManager.getUserRights(owner, keyName, user);
221
+ * console.log("User Access Rights:", userRights);
222
+ * ```
223
+ *
224
+ * @param owner - The principal of the key owner
225
+ * @param vetkeyName - The name/identifier of the VetKey
226
+ * @param user - The principal of the user to check rights for
227
+ * @returns Promise resolving to the user's access rights if they exist
228
+ * @throws Error if the operation fails
229
+ */
230
+ async getUserRights(r, t, s) {
231
+ const i = await this.canisterClient.get_user_rights(
232
+ r,
233
+ c(t),
234
+ s
235
+ );
236
+ if ("Err" in i) throw Error(i.Err);
237
+ if (i.Ok.length > 1)
238
+ throw Error("Unexpected result from set_user_rights");
239
+ return i.Ok.length === 0 ? void 0 : i.Ok[0];
240
+ }
241
+ /**
242
+ * Revokes a user's access.
243
+ *
244
+ * @example
245
+ * ```ts
246
+ * const removalResult = await keyManager.removeUser(owner, keyName, user);
247
+ * console.log("User Removed:", removalResult);
248
+ * ```
249
+ *
250
+ * @param owner - The principal of the key owner
251
+ * @param vetkeyName - The name/identifier of the VetKey
252
+ * @param user - The principal of the user to remove
253
+ * @returns Promise resolving to the previous access rights if they existed
254
+ * @throws Error if the operation fails
255
+ */
256
+ async removeUser(r, t, s) {
257
+ const i = await this.canisterClient.remove_user(
258
+ r,
259
+ c(t),
260
+ s
261
+ );
262
+ if ("Err" in i) throw Error(i.Err);
263
+ if (i.Ok.length > 1)
264
+ throw Error("Unexpected result from set_user_rights");
265
+ return i.Ok.length === 0 ? void 0 : i.Ok[0];
266
+ }
267
+ }
268
+ function c(e) {
269
+ return { inner: e };
270
+ }
271
+ export {
272
+ v as DefaultKeyManagerClient,
273
+ E as KeyManager
274
+ };
@@ -0,0 +1,109 @@
1
+ import { HttpAgentOptions, ActorConfig, Agent, ActorSubclass } from '@icp-sdk/core/agent';
2
+ import { Principal } from '@icp-sdk/core/principal';
3
+ import { _SERVICE } from './ic_vetkeys_encrypted_maps_canister.did';
4
+ export interface Some<T> {
5
+ __kind__: "Some";
6
+ value: T;
7
+ }
8
+ export interface None {
9
+ __kind__: "None";
10
+ }
11
+ export type Option<T> = Some<T> | None;
12
+ export type Result_4 = {
13
+ __kind__: "Ok";
14
+ Ok: AccessRights | null;
15
+ } | {
16
+ __kind__: "Err";
17
+ Err: string;
18
+ };
19
+ export type Result_2 = {
20
+ __kind__: "Ok";
21
+ Ok: ByteBuf;
22
+ } | {
23
+ __kind__: "Err";
24
+ Err: string;
25
+ };
26
+ export type Result = {
27
+ __kind__: "Ok";
28
+ Ok: ByteBuf | null;
29
+ } | {
30
+ __kind__: "Err";
31
+ Err: string;
32
+ };
33
+ export type Result_3 = {
34
+ __kind__: "Ok";
35
+ Ok: Array<[Principal, AccessRights]>;
36
+ } | {
37
+ __kind__: "Err";
38
+ Err: string;
39
+ };
40
+ export interface EncryptedMapData {
41
+ access_control: Array<[Principal, AccessRights]>;
42
+ keyvals: Array<[ByteBuf, ByteBuf]>;
43
+ map_name: ByteBuf;
44
+ map_owner: Principal;
45
+ }
46
+ export type Result_5 = {
47
+ __kind__: "Ok";
48
+ Ok: Array<ByteBuf>;
49
+ } | {
50
+ __kind__: "Err";
51
+ Err: string;
52
+ };
53
+ export interface ByteBuf {
54
+ inner: Uint8Array;
55
+ }
56
+ export type Result_1 = {
57
+ __kind__: "Ok";
58
+ Ok: Array<[ByteBuf, ByteBuf]>;
59
+ } | {
60
+ __kind__: "Err";
61
+ Err: string;
62
+ };
63
+ export declare enum AccessRights {
64
+ Read = "Read",
65
+ ReadWrite = "ReadWrite",
66
+ ReadWriteManage = "ReadWriteManage"
67
+ }
68
+ export interface ic_vetkeys_encrypted_maps_canisterInterface {
69
+ get_accessible_shared_map_names(): Promise<Array<[Principal, ByteBuf]>>;
70
+ get_all_accessible_encrypted_maps(): Promise<Array<EncryptedMapData>>;
71
+ get_all_accessible_encrypted_values(): Promise<Array<[[Principal, ByteBuf], Array<[ByteBuf, ByteBuf]>]>>;
72
+ get_encrypted_value(arg0: Principal, arg1: ByteBuf, arg2: ByteBuf): Promise<Result>;
73
+ get_encrypted_values_for_map(arg0: Principal, arg1: ByteBuf): Promise<Result_1>;
74
+ get_encrypted_vetkey(arg0: Principal, arg1: ByteBuf, arg2: ByteBuf): Promise<Result_2>;
75
+ get_owned_non_empty_map_names(): Promise<Array<ByteBuf>>;
76
+ get_shared_user_access_for_map(arg0: Principal, arg1: ByteBuf): Promise<Result_3>;
77
+ get_user_rights(arg0: Principal, arg1: ByteBuf, arg2: Principal): Promise<Result_4>;
78
+ get_vetkey_verification_key(): Promise<ByteBuf>;
79
+ insert_encrypted_value(arg0: Principal, arg1: ByteBuf, arg2: ByteBuf, arg3: ByteBuf): Promise<Result>;
80
+ remove_encrypted_value(arg0: Principal, arg1: ByteBuf, arg2: ByteBuf): Promise<Result>;
81
+ remove_map_values(arg0: Principal, arg1: ByteBuf): Promise<Result_5>;
82
+ remove_user(arg0: Principal, arg1: ByteBuf, arg2: Principal): Promise<Result_4>;
83
+ set_user_rights(arg0: Principal, arg1: ByteBuf, arg2: Principal, arg3: AccessRights): Promise<Result_4>;
84
+ }
85
+ export declare class Ic_vetkeys_encrypted_maps_canister implements ic_vetkeys_encrypted_maps_canisterInterface {
86
+ private actor;
87
+ constructor(actor: ActorSubclass<_SERVICE>);
88
+ get_accessible_shared_map_names(): Promise<Array<[Principal, ByteBuf]>>;
89
+ get_all_accessible_encrypted_maps(): Promise<Array<EncryptedMapData>>;
90
+ get_all_accessible_encrypted_values(): Promise<Array<[[Principal, ByteBuf], Array<[ByteBuf, ByteBuf]>]>>;
91
+ get_encrypted_value(arg0: Principal, arg1: ByteBuf, arg2: ByteBuf): Promise<Result>;
92
+ get_encrypted_values_for_map(arg0: Principal, arg1: ByteBuf): Promise<Result_1>;
93
+ get_encrypted_vetkey(arg0: Principal, arg1: ByteBuf, arg2: ByteBuf): Promise<Result_2>;
94
+ get_owned_non_empty_map_names(): Promise<Array<ByteBuf>>;
95
+ get_shared_user_access_for_map(arg0: Principal, arg1: ByteBuf): Promise<Result_3>;
96
+ get_user_rights(arg0: Principal, arg1: ByteBuf, arg2: Principal): Promise<Result_4>;
97
+ get_vetkey_verification_key(): Promise<ByteBuf>;
98
+ insert_encrypted_value(arg0: Principal, arg1: ByteBuf, arg2: ByteBuf, arg3: ByteBuf): Promise<Result>;
99
+ remove_encrypted_value(arg0: Principal, arg1: ByteBuf, arg2: ByteBuf): Promise<Result>;
100
+ remove_map_values(arg0: Principal, arg1: ByteBuf): Promise<Result_5>;
101
+ remove_user(arg0: Principal, arg1: ByteBuf, arg2: Principal): Promise<Result_4>;
102
+ set_user_rights(arg0: Principal, arg1: ByteBuf, arg2: Principal, arg3: AccessRights): Promise<Result_4>;
103
+ }
104
+ export interface CreateActorOptions {
105
+ agent?: Agent;
106
+ agentOptions?: HttpAgentOptions;
107
+ actorOptions?: ActorConfig;
108
+ }
109
+ export declare function createActor(canisterId: string, options?: CreateActorOptions): Ic_vetkeys_encrypted_maps_canister;
@@ -0,0 +1,62 @@
1
+ import { ActorMethod } from '@icp-sdk/core/agent';
2
+ import { IDL } from '@icp-sdk/core/candid';
3
+ import { Principal } from '@icp-sdk/core/principal';
4
+ export type AccessRights = { 'Read' : null } |
5
+ { 'ReadWrite' : null } |
6
+ { 'ReadWriteManage' : null };
7
+ export interface ByteBuf { 'inner' : Uint8Array }
8
+ export interface EncryptedMapData {
9
+ 'access_control' : Array<[Principal, AccessRights]>,
10
+ 'keyvals' : Array<[ByteBuf, ByteBuf]>,
11
+ 'map_name' : ByteBuf,
12
+ 'map_owner' : Principal,
13
+ }
14
+ export type Result = { 'Ok' : [] | [ByteBuf] } |
15
+ { 'Err' : string };
16
+ export type Result_1 = { 'Ok' : Array<[ByteBuf, ByteBuf]> } |
17
+ { 'Err' : string };
18
+ export type Result_2 = { 'Ok' : ByteBuf } |
19
+ { 'Err' : string };
20
+ export type Result_3 = { 'Ok' : Array<[Principal, AccessRights]> } |
21
+ { 'Err' : string };
22
+ export type Result_4 = { 'Ok' : [] | [AccessRights] } |
23
+ { 'Err' : string };
24
+ export type Result_5 = { 'Ok' : Array<ByteBuf> } |
25
+ { 'Err' : string };
26
+ export interface _SERVICE {
27
+ 'get_accessible_shared_map_names' : ActorMethod<
28
+ [],
29
+ Array<[Principal, ByteBuf]>
30
+ >,
31
+ 'get_all_accessible_encrypted_maps' : ActorMethod<
32
+ [],
33
+ Array<EncryptedMapData>
34
+ >,
35
+ 'get_all_accessible_encrypted_values' : ActorMethod<
36
+ [],
37
+ Array<[[Principal, ByteBuf], Array<[ByteBuf, ByteBuf]>]>
38
+ >,
39
+ 'get_encrypted_value' : ActorMethod<[Principal, ByteBuf, ByteBuf], Result>,
40
+ 'get_encrypted_values_for_map' : ActorMethod<[Principal, ByteBuf], Result_1>,
41
+ 'get_encrypted_vetkey' : ActorMethod<[Principal, ByteBuf, ByteBuf], Result_2>,
42
+ 'get_owned_non_empty_map_names' : ActorMethod<[], Array<ByteBuf>>,
43
+ 'get_shared_user_access_for_map' : ActorMethod<
44
+ [Principal, ByteBuf],
45
+ Result_3
46
+ >,
47
+ 'get_user_rights' : ActorMethod<[Principal, ByteBuf, Principal], Result_4>,
48
+ 'get_vetkey_verification_key' : ActorMethod<[], ByteBuf>,
49
+ 'insert_encrypted_value' : ActorMethod<
50
+ [Principal, ByteBuf, ByteBuf, ByteBuf],
51
+ Result
52
+ >,
53
+ 'remove_encrypted_value' : ActorMethod<[Principal, ByteBuf, ByteBuf], Result>,
54
+ 'remove_map_values' : ActorMethod<[Principal, ByteBuf], Result_5>,
55
+ 'remove_user' : ActorMethod<[Principal, ByteBuf, Principal], Result_4>,
56
+ 'set_user_rights' : ActorMethod<
57
+ [Principal, ByteBuf, Principal, AccessRights],
58
+ Result_4
59
+ >,
60
+ }
61
+ export declare const idlFactory: IDL.InterfaceFactory;
62
+ export declare const init: (args: { IDL: typeof IDL }) => IDL.Type[];
@@ -0,0 +1,66 @@
1
+ import { HttpAgentOptions, ActorConfig, Agent, ActorSubclass } from '@icp-sdk/core/agent';
2
+ import { Principal } from '@icp-sdk/core/principal';
3
+ import { _SERVICE } from './ic_vetkeys_manager_canister.did';
4
+ export interface Some<T> {
5
+ __kind__: "Some";
6
+ value: T;
7
+ }
8
+ export interface None {
9
+ __kind__: "None";
10
+ }
11
+ export type Option<T> = Some<T> | None;
12
+ export type Result_2 = {
13
+ __kind__: "Ok";
14
+ Ok: AccessRights | null;
15
+ } | {
16
+ __kind__: "Err";
17
+ Err: string;
18
+ };
19
+ export type Result = {
20
+ __kind__: "Ok";
21
+ Ok: ByteBuf;
22
+ } | {
23
+ __kind__: "Err";
24
+ Err: string;
25
+ };
26
+ export interface ByteBuf {
27
+ inner: Uint8Array;
28
+ }
29
+ export type Result_1 = {
30
+ __kind__: "Ok";
31
+ Ok: Array<[Principal, AccessRights]>;
32
+ } | {
33
+ __kind__: "Err";
34
+ Err: string;
35
+ };
36
+ export declare enum AccessRights {
37
+ Read = "Read",
38
+ ReadWrite = "ReadWrite",
39
+ ReadWriteManage = "ReadWriteManage"
40
+ }
41
+ export interface ic_vetkeys_manager_canisterInterface {
42
+ get_accessible_shared_key_ids(): Promise<Array<[Principal, ByteBuf]>>;
43
+ get_encrypted_vetkey(arg0: Principal, arg1: ByteBuf, arg2: ByteBuf): Promise<Result>;
44
+ get_shared_user_access_for_key(arg0: Principal, arg1: ByteBuf): Promise<Result_1>;
45
+ get_user_rights(arg0: Principal, arg1: ByteBuf, arg2: Principal): Promise<Result_2>;
46
+ get_vetkey_verification_key(): Promise<ByteBuf>;
47
+ remove_user(arg0: Principal, arg1: ByteBuf, arg2: Principal): Promise<Result_2>;
48
+ set_user_rights(arg0: Principal, arg1: ByteBuf, arg2: Principal, arg3: AccessRights): Promise<Result_2>;
49
+ }
50
+ export declare class Ic_vetkeys_manager_canister implements ic_vetkeys_manager_canisterInterface {
51
+ private actor;
52
+ constructor(actor: ActorSubclass<_SERVICE>);
53
+ get_accessible_shared_key_ids(): Promise<Array<[Principal, ByteBuf]>>;
54
+ get_encrypted_vetkey(arg0: Principal, arg1: ByteBuf, arg2: ByteBuf): Promise<Result>;
55
+ get_shared_user_access_for_key(arg0: Principal, arg1: ByteBuf): Promise<Result_1>;
56
+ get_user_rights(arg0: Principal, arg1: ByteBuf, arg2: Principal): Promise<Result_2>;
57
+ get_vetkey_verification_key(): Promise<ByteBuf>;
58
+ remove_user(arg0: Principal, arg1: ByteBuf, arg2: Principal): Promise<Result_2>;
59
+ set_user_rights(arg0: Principal, arg1: ByteBuf, arg2: Principal, arg3: AccessRights): Promise<Result_2>;
60
+ }
61
+ export interface CreateActorOptions {
62
+ agent?: Agent;
63
+ agentOptions?: HttpAgentOptions;
64
+ actorOptions?: ActorConfig;
65
+ }
66
+ export declare function createActor(canisterId: string, options?: CreateActorOptions): Ic_vetkeys_manager_canister;
@@ -0,0 +1,33 @@
1
+ import { ActorMethod } from '@icp-sdk/core/agent';
2
+ import { IDL } from '@icp-sdk/core/candid';
3
+ import { Principal } from '@icp-sdk/core/principal';
4
+ export type AccessRights = { 'Read' : null } |
5
+ { 'ReadWrite' : null } |
6
+ { 'ReadWriteManage' : null };
7
+ export interface ByteBuf { 'inner' : Uint8Array }
8
+ export type Result = { 'Ok' : ByteBuf } |
9
+ { 'Err' : string };
10
+ export type Result_1 = { 'Ok' : Array<[Principal, AccessRights]> } |
11
+ { 'Err' : string };
12
+ export type Result_2 = { 'Ok' : [] | [AccessRights] } |
13
+ { 'Err' : string };
14
+ export interface _SERVICE {
15
+ 'get_accessible_shared_key_ids' : ActorMethod<
16
+ [],
17
+ Array<[Principal, ByteBuf]>
18
+ >,
19
+ 'get_encrypted_vetkey' : ActorMethod<[Principal, ByteBuf, ByteBuf], Result>,
20
+ 'get_shared_user_access_for_key' : ActorMethod<
21
+ [Principal, ByteBuf],
22
+ Result_1
23
+ >,
24
+ 'get_user_rights' : ActorMethod<[Principal, ByteBuf, Principal], Result_2>,
25
+ 'get_vetkey_verification_key' : ActorMethod<[], ByteBuf>,
26
+ 'remove_user' : ActorMethod<[Principal, ByteBuf, Principal], Result_2>,
27
+ 'set_user_rights' : ActorMethod<
28
+ [Principal, ByteBuf, Principal, AccessRights],
29
+ Result_2
30
+ >,
31
+ }
32
+ export declare const idlFactory: IDL.InterfaceFactory;
33
+ export declare const init: (args: { IDL: typeof IDL }) => IDL.Type[];
@@ -0,0 +1,66 @@
1
+ import { Principal } from '@icp-sdk/core/principal';
2
+ import { ActorSubclass, HttpAgent } from '@icp-sdk/core/agent';
3
+ import { _SERVICE as _DEFAULT_ENCRYPTED_MAPS_SERVICE, AccessRights, ByteBuf, EncryptedMapData } from '../declarations/ic_vetkeys_encrypted_maps_canister/ic_vetkeys_encrypted_maps_canister.did.js';
4
+ import { EncryptedMapsClient } from './index';
5
+ export declare class DefaultEncryptedMapsClient implements EncryptedMapsClient {
6
+ actor: ActorSubclass<_DEFAULT_ENCRYPTED_MAPS_SERVICE>;
7
+ constructor(agent: HttpAgent, canisterId: string);
8
+ get_accessible_shared_map_names(): Promise<[Principal, ByteBuf][]>;
9
+ get_shared_user_access_for_map(owner: Principal, mapName: ByteBuf): Promise<{
10
+ Ok: Array<[Principal, AccessRights]>;
11
+ } | {
12
+ Err: string;
13
+ }>;
14
+ get_owned_non_empty_map_names(): Promise<Array<ByteBuf>>;
15
+ get_all_accessible_encrypted_values(): Promise<[
16
+ [Principal, ByteBuf],
17
+ [ByteBuf, ByteBuf][]
18
+ ][]>;
19
+ get_all_accessible_encrypted_maps(): Promise<Array<EncryptedMapData>>;
20
+ get_encrypted_value(mapOwner: Principal, mapName: ByteBuf, mapKey: ByteBuf): Promise<{
21
+ Ok: [] | [ByteBuf];
22
+ } | {
23
+ Err: string;
24
+ }>;
25
+ get_encrypted_values_for_map(mapOwner: Principal, mapName: ByteBuf): Promise<{
26
+ Ok: Array<[ByteBuf, ByteBuf]>;
27
+ } | {
28
+ Err: string;
29
+ }>;
30
+ get_encrypted_vetkey(mapOwner: Principal, mapName: ByteBuf, transportKey: ByteBuf): Promise<{
31
+ Ok: ByteBuf;
32
+ } | {
33
+ Err: string;
34
+ }>;
35
+ insert_encrypted_value(mapOwner: Principal, mapName: ByteBuf, mapKey: ByteBuf, data: ByteBuf): Promise<{
36
+ Ok: [] | [ByteBuf];
37
+ } | {
38
+ Err: string;
39
+ }>;
40
+ remove_encrypted_value(mapOwner: Principal, mapName: ByteBuf, mapKey: ByteBuf): Promise<{
41
+ Ok: [] | [ByteBuf];
42
+ } | {
43
+ Err: string;
44
+ }>;
45
+ remove_map_values(mapOwner: Principal, mapName: ByteBuf): Promise<{
46
+ Ok: Array<ByteBuf>;
47
+ } | {
48
+ Err: string;
49
+ }>;
50
+ get_vetkey_verification_key(): Promise<ByteBuf>;
51
+ set_user_rights(owner: Principal, mapName: ByteBuf, user: Principal, userRights: AccessRights): Promise<{
52
+ Ok: [] | [AccessRights];
53
+ } | {
54
+ Err: string;
55
+ }>;
56
+ get_user_rights(owner: Principal, mapName: ByteBuf, user: Principal): Promise<{
57
+ Ok: [] | [AccessRights];
58
+ } | {
59
+ Err: string;
60
+ }>;
61
+ remove_user(owner: Principal, mapName: ByteBuf, user: Principal): Promise<{
62
+ Ok: [] | [AccessRights];
63
+ } | {
64
+ Err: string;
65
+ }>;
66
+ }