@holochain/client 0.10.3 → 0.11.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.
package/README.md CHANGED
@@ -17,34 +17,39 @@ To install from NPM, run
17
17
  npm install --save-exact @holochain/client
18
18
  ```
19
19
 
20
- > This code is still under alpha development and npm releases are pre-releases with `dev` tags meaning they will not use full semantic versioning, and you may wish to lock to an exact version of the library for that reason, as shown in the above command.
20
+ > This code is under beta development and you may wish to lock to an exact version of the library for that reason, as shown in the above command.
21
21
 
22
22
  ## Sample usage
23
23
 
24
24
  ### Use AdminWebsocket
25
25
  ```typescript
26
- const admin = await AdminWebsocket.connect(`ws://localhost:8000`, TIMEOUT)
27
- await admin.generateAgentPubKey()
26
+ const admin = await AdminWebsocket.connect(`ws://127.0.0.1:8000`, TIMEOUT)
27
+ const agentPubKey = await admin.generateAgentPubKey()
28
28
  ```
29
29
 
30
- ### Use AppWebsocket
30
+ ### Use AppWebsocket with implicit zome call signing
31
31
  ```typescript
32
32
  const signalCb = (signal: AppSignal) => {
33
33
  // impl...
34
34
  resolve()
35
35
  }
36
36
 
37
+ // generate and authorize new key pair for signing zome calls,
38
+ // specifying zomes and functions to be authorized
39
+ await authorizeNewSigningKeyPair(admin, cell_id, [
40
+ ["test_zome", "test_emitter_fn"],
41
+ ]);
42
+
37
43
  const TIMEOUT = 12000
38
44
  // default timeout is set to 12000
39
- const client = await AppWebsocket.connect(`ws://localhost:${appPort}`, 12000, signalCb)
45
+ const client = await AppWebsocket.connect(`ws://127.0.0.1:${appPort}`, TIMEOUT, signalCb)
40
46
 
41
47
  // default timeout set here (30000) will overwrite the defaultTimeout(12000) set above
42
48
  await client.callZome({
43
- cap: null,
44
49
  cell_id,
45
50
  zome_name: "test_zome",
46
51
  fn_name: 'test_emitter_fn',
47
- provenance: fakeAgentPubKey('TODO'),
52
+ provenance: agentPubKey,
48
53
  payload: null,
49
54
  }, 30000)
50
55
  ```
@@ -56,19 +61,24 @@ npm install --save-exact @holochain/client
56
61
  resolve()
57
62
  }
58
63
 
64
+ // generate and authorize new key pair for signing zome calls,
65
+ // specifying zomes and functions to be authorized
66
+ await authorizeNewSigningKeyPair(admin, cell_id, [
67
+ ["test_zome", "test_emitter_fn"],
68
+ ]);
69
+
59
70
  const TIMEOUT = 12000
60
71
  // default timeout is set to 12000
61
- const appWs = await AppWebsocket.connect(`ws://localhost:${appPort}`, 12000, signalCb)
72
+ const appWs = await AppWebsocket.connect(`ws://127.0.0.1:${appPort}`, 12000, signalCb)
62
73
 
63
74
  const client = new AppAgentWebsocket(appWs, 'installed_app_id')
64
75
 
65
76
  // default timeout set here (30000) will overwrite the defaultTimeout(12000) set above
66
77
  await client.callZome({
67
- cap: null,
68
- role_name: 'dnas_role_name', // role_name is unique per app, so you can unambiguously identify your dna with role_name in this client,
78
+ role_name: 'dnas_role_name', // role_name is unique per app, so you can unambiguously identify your dna with role_name in this client
69
79
  zome_name: "test_zome",
70
80
  fn_name: 'test_emitter_fn',
71
- provenance: fakeAgentPubKey('TODO'),
81
+ provenance: agentPubKey,
72
82
  payload: null,
73
83
  }, 30000)
74
84
  ```
@@ -107,7 +117,7 @@ Holochain is an open source project. We welcome all sorts of participation and
107
117
 
108
118
  [![License: CAL 1.0](https://img.shields.io/badge/License-CAL%201.0-blue.svg)](https://github.com/holochain/cryptographic-autonomy-license)
109
119
 
110
- Copyright (C) 2020-2022, Holochain Foundation
120
+ Copyright (C) 2020-2023, Holochain Foundation
111
121
 
112
122
  This program is free software: you can redistribute it and/or modify it under the terms of the license
113
123
  provided in the LICENSE file (CAL-1.0). This program is distributed in the hope that it will be useful,
@@ -1,8 +1,8 @@
1
1
  /// <reference types="node" />
2
- import { AgentPubKey, CellId, DnaHash, DnaProperties, ActionHash, HoloHash, InstalledAppId, InstalledCell, KitsuneAgent, KitsuneSpace, RoleName as RoleName, Signature, Timestamp, WasmHash } from "../../types.js";
3
- import { DhtOp, Entry, Action, ZomeCallCapGrant } from "../../hdk/index.js";
2
+ import { Action, DhtOp, Entry, ZomeCallCapGrant } from "../../hdk/index.js";
3
+ import { ActionHash, AgentPubKey, CellId, DnaHash, DnaProperties, HoloHash, InstalledAppId, KitsuneAgent, KitsuneSpace, RoleName, Signature, Timestamp, WasmHash } from "../../types.js";
4
4
  import { Requester } from "../common.js";
5
- import { ArchiveCloneCellRequest, CreateCloneCellResponse } from "../app/types.js";
5
+ import { DisableCloneCellRequest } from "../index.js";
6
6
  export declare type AttachAppInterfaceRequest = {
7
7
  port: number;
8
8
  };
@@ -19,7 +19,7 @@ export declare type EnableAppRequest = {
19
19
  installed_app_id: InstalledAppId;
20
20
  };
21
21
  export declare type EnableAppResponse = {
22
- app: InstalledAppInfo;
22
+ app: AppInfo;
23
23
  errors: Array<[CellId, string]>;
24
24
  };
25
25
  export declare type DeactivationReason = {
@@ -52,9 +52,28 @@ export declare type InstalledAppInfoStatus = {
52
52
  } | {
53
53
  running: null;
54
54
  };
55
- export declare type InstalledAppInfo = {
55
+ export interface StemCell {
56
+ dna: DnaHash;
57
+ name?: string;
58
+ dna_modifiers: DnaModifiers;
59
+ }
60
+ export interface Cell {
61
+ cell_id: CellId;
62
+ clone_id?: RoleName;
63
+ dna_modifiers: DnaModifiers;
64
+ name: string;
65
+ enabled: boolean;
66
+ }
67
+ export declare type CellInfo = {
68
+ Provisioned: Cell;
69
+ } | {
70
+ Cloned: Cell;
71
+ } | {
72
+ Stem: StemCell;
73
+ };
74
+ export declare type AppInfo = {
56
75
  installed_app_id: InstalledAppId;
57
- cell_data: Array<InstalledCell>;
76
+ cell_info: Record<RoleName, Array<CellInfo>>;
58
77
  status: InstalledAppInfoStatus;
59
78
  };
60
79
  export declare type MembraneProof = Buffer;
@@ -89,7 +108,7 @@ export declare type DnaModifiers = {
89
108
  properties: DnaProperties;
90
109
  origin_time: Timestamp;
91
110
  };
92
- export declare type FnName = string;
111
+ export declare type FunctionName = string;
93
112
  export declare type ZomeName = string;
94
113
  export declare type ZomeDefinition = [
95
114
  ZomeName,
@@ -108,12 +127,6 @@ export declare type DnaDefinition = {
108
127
  };
109
128
  export declare type GetDnaDefinitionRequest = DnaHash;
110
129
  export declare type GetDnaDefinitionResponse = DnaDefinition;
111
- export declare type InstallAppRequest = {
112
- installed_app_id: InstalledAppId;
113
- agent_key: AgentPubKey;
114
- dnas: Array<InstallAppDnaPayload>;
115
- };
116
- export declare type InstallAppResponse = InstalledAppInfo;
117
130
  export declare type UninstallAppRequest = {
118
131
  installed_app_id: InstalledAppId;
119
132
  };
@@ -175,7 +188,7 @@ export declare type AppBundleSource = {
175
188
  path: string;
176
189
  };
177
190
  export declare type NetworkSeed = string;
178
- export declare type InstallAppBundleRequest = {
191
+ export declare type InstallAppRequest = {
179
192
  agent_key: AgentPubKey;
180
193
  installed_app_id?: InstalledAppId;
181
194
  membrane_proofs: {
@@ -183,7 +196,7 @@ export declare type InstallAppBundleRequest = {
183
196
  };
184
197
  network_seed?: NetworkSeed;
185
198
  } & AppBundleSource;
186
- export declare type InstallAppBundleResponse = InstalledAppInfo;
199
+ export declare type InstallAppResponse = AppInfo;
187
200
  export declare type ListDnasRequest = void;
188
201
  export declare type ListDnasResponse = Array<string>;
189
202
  export declare type ListCellIdsRequest = void;
@@ -200,30 +213,24 @@ export declare enum AppStatusFilter {
200
213
  export declare type ListAppsRequest = {
201
214
  status_filter?: AppStatusFilter;
202
215
  };
203
- export declare type ListAppsResponse = Array<InstalledAppInfo>;
216
+ export declare type ListAppsResponse = Array<AppInfo>;
204
217
  export declare type ListAppInterfacesRequest = void;
205
218
  export declare type ListAppInterfacesResponse = Array<number>;
206
219
  export declare type AgentInfoSigned = any;
207
- export declare type RequestAgentInfoRequest = {
220
+ export declare type AgentInfoRequest = {
208
221
  cell_id: CellId | null;
209
222
  };
210
- export declare type RequestAgentInfoResponse = Array<AgentInfoSigned>;
223
+ export declare type AgentInfoResponse = Array<AgentInfoSigned>;
211
224
  export declare type AddAgentInfoRequest = {
212
225
  agent_infos: Array<AgentInfoSigned>;
213
226
  };
214
227
  export declare type AddAgentInfoResponse = any;
215
- export declare type RestoreCloneCellRequest = ArchiveCloneCellRequest;
216
- export declare type RestoreCloneCellResponse = CreateCloneCellResponse;
217
- export interface DeleteArchivedCloneCellsRequest {
218
- app_id: InstalledAppId;
219
- role_name: RoleName;
220
- }
221
- export declare type DeleteArchivedCloneCellsResponse = void;
222
- export interface GrantZomeCallCapabilityPayload {
228
+ export declare type DeleteCloneCellRequest = DisableCloneCellRequest;
229
+ export declare type DeleteCloneCellResponse = void;
230
+ export interface GrantZomeCallCapabilityRequest {
223
231
  cell_id: CellId;
224
232
  cap_grant: ZomeCallCapGrant;
225
233
  }
226
- export declare type GrantZomeCallCapabilityRequest = GrantZomeCallCapabilityPayload;
227
234
  export declare type GrantZomeCallCapabilityResponse = void;
228
235
  export interface AdminApi {
229
236
  attachAppInterface: Requester<AttachAppInterfaceRequest, AttachAppInterfaceResponse>;
@@ -237,18 +244,16 @@ export interface AdminApi {
237
244
  generateAgentPubKey: Requester<GenerateAgentPubKeyRequest, GenerateAgentPubKeyResponse>;
238
245
  registerDna: Requester<RegisterDnaRequest, RegisterDnaResponse>;
239
246
  getDnaDefinition: Requester<GetDnaDefinitionRequest, GetDnaDefinitionResponse>;
240
- installApp: Requester<InstallAppRequest, InstallAppResponse>;
241
247
  uninstallApp: Requester<UninstallAppRequest, UninstallAppResponse>;
242
- installAppBundle: Requester<InstallAppBundleRequest, InstallAppBundleResponse>;
248
+ installApp: Requester<InstallAppRequest, InstallAppResponse>;
243
249
  listDnas: Requester<ListDnasRequest, ListDnasResponse>;
244
250
  listCellIds: Requester<ListCellIdsRequest, ListCellIdsResponse>;
245
251
  listActiveApps: Requester<ListActiveAppsRequest, ListActiveAppsResponse>;
246
252
  listApps: Requester<ListAppsRequest, ListAppsResponse>;
247
253
  listAppInterfaces: Requester<ListAppInterfacesRequest, ListAppInterfacesResponse>;
248
- requestAgentInfo: Requester<RequestAgentInfoRequest, RequestAgentInfoResponse>;
254
+ agentInfo: Requester<AgentInfoRequest, AgentInfoResponse>;
249
255
  addAgentInfo: Requester<AddAgentInfoRequest, AddAgentInfoResponse>;
250
- restoreCloneCell: Requester<RestoreCloneCellRequest, RestoreCloneCellResponse>;
251
- deleteArchivedCloneCells: Requester<DeleteArchivedCloneCellsRequest, DeleteArchivedCloneCellsResponse>;
256
+ deleteCloneCell: Requester<DeleteCloneCellRequest, DeleteCloneCellResponse>;
252
257
  grantZomeCallCapability: Requester<GrantZomeCallCapabilityRequest, GrantZomeCallCapabilityResponse>;
253
258
  }
254
259
  export declare type InstallAppDnaPayload = {
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/api/admin/types.ts"],"names":[],"mappings":"AA8OA,MAAM,CAAN,IAAY,eAMX;AAND,WAAY,eAAe;IACzB,sCAAmB,CAAA;IACnB,wCAAqB,CAAA;IACrB,sCAAmB,CAAA;IACnB,sCAAmB,CAAA;IACnB,oCAAiB,CAAA;AACnB,CAAC,EANW,eAAe,KAAf,eAAe,QAM1B"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/api/admin/types.ts"],"names":[],"mappings":"AAwPA,MAAM,CAAN,IAAY,eAMX;AAND,WAAY,eAAe;IACzB,sCAAmB,CAAA;IACnB,wCAAqB,CAAA;IACrB,sCAAmB,CAAA;IACnB,sCAAmB,CAAA;IACnB,oCAAiB,CAAA;AACnB,CAAC,EANW,eAAe,KAAf,eAAe,QAM1B"}
@@ -3,7 +3,7 @@
3
3
  * Conductor Admin API
4
4
  *
5
5
  * const client = AdminWebsocket.connect(
6
- * 'ws://localhost:9000'
6
+ * 'ws://127.0.0.1:9000'
7
7
  * )
8
8
  *
9
9
  * client.generateAgentPubKey()
@@ -34,17 +34,15 @@ export declare class AdminWebsocket implements Api.AdminApi {
34
34
  generateAgentPubKey: Requester<Api.GenerateAgentPubKeyRequest, Api.GenerateAgentPubKeyResponse>;
35
35
  registerDna: Requester<Api.RegisterDnaRequest, Api.RegisterDnaResponse>;
36
36
  getDnaDefinition: Requester<Api.GetDnaDefinitionRequest, Api.GetDnaDefinitionResponse>;
37
- installApp: Requester<Api.InstallAppRequest, Api.InstallAppResponse>;
38
37
  uninstallApp: Requester<Api.UninstallAppRequest, Api.UninstallAppResponse>;
39
- installAppBundle: Requester<Api.InstallAppBundleRequest, Api.InstallAppBundleResponse>;
38
+ installApp: Requester<Api.InstallAppRequest, Api.InstallAppResponse>;
40
39
  listDnas: Requester<Api.ListDnasRequest, Api.ListDnasResponse>;
41
40
  listCellIds: Requester<Api.ListCellIdsRequest, Api.ListCellIdsResponse>;
42
41
  listActiveApps: Requester<Api.ListActiveAppsRequest, Api.ListActiveAppsResponse>;
43
42
  listApps: Requester<Api.ListAppsRequest, Api.ListAppsResponse>;
44
43
  listAppInterfaces: Requester<Api.ListAppInterfacesRequest, Api.ListAppInterfacesResponse>;
45
- requestAgentInfo: Requester<Api.RequestAgentInfoRequest, Api.RequestAgentInfoResponse>;
44
+ agentInfo: Requester<Api.AgentInfoRequest, Api.AgentInfoResponse>;
46
45
  addAgentInfo: Requester<Api.AddAgentInfoRequest, Api.AddAgentInfoResponse>;
47
- restoreCloneCell: Requester<Api.RestoreCloneCellRequest, Api.RestoreCloneCellResponse>;
48
- deleteArchivedCloneCells: Requester<Api.DeleteArchivedCloneCellsRequest, Api.DeleteArchivedCloneCellsResponse>;
46
+ deleteCloneCell: Requester<Api.DeleteCloneCellRequest, Api.DeleteCloneCellResponse>;
49
47
  grantZomeCallCapability: Requester<Api.GrantZomeCallCapabilityRequest, Api.GrantZomeCallCapabilityResponse>;
50
48
  }
@@ -3,7 +3,7 @@
3
3
  * Conductor Admin API
4
4
  *
5
5
  * const client = AdminWebsocket.connect(
6
- * 'ws://localhost:9000'
6
+ * 'ws://127.0.0.1:9000'
7
7
  * )
8
8
  *
9
9
  * client.generateAgentPubKey()
@@ -29,9 +29,9 @@ export class AdminWebsocket {
29
29
  }
30
30
  static async connect(url, defaultTimeout) {
31
31
  // Check if we are in the launcher's environment, and if so, redirect the url to connect to
32
- const env = await getLauncherEnvironment();
32
+ const env = getLauncherEnvironment();
33
33
  if (env) {
34
- url = `ws://localhost:${env.ADMIN_INTERFACE_PORT}`;
34
+ url = `ws://127.0.0.1:${env.ADMIN_INTERFACE_PORT}`;
35
35
  }
36
36
  const wsClient = await WsClient.connect(url);
37
37
  return new AdminWebsocket(wsClient, defaultTimeout);
@@ -52,19 +52,17 @@ export class AdminWebsocket {
52
52
  generateAgentPubKey = this._requester("generate_agent_pub_key");
53
53
  registerDna = this._requester("register_dna");
54
54
  getDnaDefinition = this._requester("get_dna_definition");
55
- installApp = this._requester("install_app");
56
55
  uninstallApp = this._requester("uninstall_app");
57
- installAppBundle = this._requester("install_app_bundle");
56
+ installApp = this._requester("install_app");
58
57
  listDnas = this._requester("list_dnas");
59
58
  listCellIds = this._requester("list_cell_ids");
60
59
  // Deprecated
61
60
  listActiveApps = this._requester("list_active_apps");
62
61
  listApps = this._requester("list_apps", listAppsTransform);
63
62
  listAppInterfaces = this._requester("list_app_interfaces");
64
- requestAgentInfo = this._requester("request_agent_info");
63
+ agentInfo = this._requester("agent_info");
65
64
  addAgentInfo = this._requester("add_agent_info");
66
- restoreCloneCell = this._requester("restore_clone_cell");
67
- deleteArchivedCloneCells = this._requester("delete_archived_clone_cells");
65
+ deleteCloneCell = this._requester("delete_clone_cell");
68
66
  grantZomeCallCapability = this._requester("grant_zome_call_capability");
69
67
  }
70
68
  const listAppsTransform = {
@@ -1 +1 @@
1
- {"version":3,"file":"websocket.js","sourceRoot":"","sources":["../../../src/api/admin/websocket.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,GAAG,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC3E,OAAO,EAAe,oBAAoB,E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AAI;aACd,CAAC;KACL;AACH,CAAC"}
@@ -1,3 +1,4 @@
1
1
  export * from "./types.js";
2
2
  export * from "./websocket.js";
3
+ // export * from "@holochain/serialization/holochain_serialization_js.js";
3
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/app/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/app/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAE/B,0EAA0E"}
@@ -1,12 +1,10 @@
1
- import { CapSecret } from "../../hdk/capabilities.js";
2
- import { AgentPubKey, CellId, DnaProperties, InstalledAppId, InstalledCell, RoleName, Timestamp, DnaHash, DnaGossipInfo } from "../../types.js";
1
+ import { AgentPubKey, CellId, DnaProperties, InstalledAppId, InstalledCell, RoleName, Timestamp, DnaHash, NetworkInfo } from "../../types.js";
3
2
  import { Requester } from "../common.js";
4
- import { InstalledAppInfo, MembraneProof, NetworkSeed } from "../admin/index.js";
3
+ import { FunctionName, AppInfo, MembraneProof, NetworkSeed, ZomeName } from "../admin/index.js";
5
4
  export declare type CallZomeRequestGeneric<Payload> = {
6
- cap_secret: CapSecret | null;
7
5
  cell_id: CellId;
8
- zome_name: string;
9
- fn_name: string;
6
+ zome_name: ZomeName;
7
+ fn_name: FunctionName;
10
8
  payload: Payload;
11
9
  provenance: AgentPubKey;
12
10
  };
@@ -16,7 +14,7 @@ export declare type CallZomeResponse = CallZomeResponseGeneric<any>;
16
14
  export declare type AppInfoRequest = {
17
15
  installed_app_id: InstalledAppId;
18
16
  };
19
- export declare type AppInfoResponse = InstalledAppInfo;
17
+ export declare type AppInfoResponse = AppInfo;
20
18
  export interface CreateCloneCellRequest {
21
19
  /**
22
20
  * The app id that the DNA to clone belongs to
@@ -62,11 +60,13 @@ export interface CreateCloneCellRequest {
62
60
  name?: string;
63
61
  }
64
62
  export declare type CreateCloneCellResponse = InstalledCell;
65
- export interface ArchiveCloneCellRequest {
63
+ export interface DisableCloneCellRequest {
66
64
  app_id: InstalledAppId;
67
65
  clone_cell_id: RoleName | CellId;
68
66
  }
69
- export declare type ArchiveCloneCellResponse = void;
67
+ export declare type DisableCloneCellResponse = void;
68
+ export declare type EnableCloneCellRequest = DisableCloneCellRequest;
69
+ export declare type EnableCloneCellResponse = CreateCloneCellResponse;
70
70
  export declare type AppSignal = {
71
71
  type: string;
72
72
  data: {
@@ -74,14 +74,16 @@ export declare type AppSignal = {
74
74
  payload: any;
75
75
  };
76
76
  };
77
- export interface GossipInfoRequest {
78
- /** The DNAs for which to get gossip info */
77
+ export interface NetworkInfoRequest {
78
+ /** The DNAs for which to get network info */
79
79
  dnas: DnaHash[];
80
80
  }
81
- export declare type GossipInfoResponse = DnaGossipInfo[];
81
+ export declare type NetworkInfoResponse = NetworkInfo[];
82
82
  export declare type AppSignalCb = (signal: AppSignal) => void;
83
83
  export declare type SignalResponseGeneric<Payload> = Payload;
84
84
  export interface AppApi {
85
85
  appInfo: Requester<AppInfoRequest, AppInfoResponse>;
86
86
  callZome: Requester<CallZomeRequest, CallZomeResponse>;
87
+ enableCloneCell: Requester<EnableCloneCellRequest, EnableCloneCellResponse>;
88
+ disableCloneCell: Requester<DisableCloneCellRequest, DisableCloneCellResponse>;
87
89
  }
@@ -0,0 +1,18 @@
1
+ import nacl from "tweetnacl";
2
+ import { CapSecret } from "../../hdk/capabilities.js";
3
+ import { AgentPubKey, CellId } from "../../types.js";
4
+ import { FunctionName, ZomeName } from "../admin/types.js";
5
+ import { AdminWebsocket } from "../admin/websocket.js";
6
+ import { CallZomeRequestSigned, Nonce256Bit } from "./websocket.js";
7
+ /**
8
+ * Generates a key pair for signing zome calls.
9
+ *
10
+ * @returns The signing key pair and an agent pub key based on the public key.
11
+ */
12
+ export declare const generateSigningKeyPair: () => [nacl.SignKeyPair, Uint8Array];
13
+ export declare const randomCapSecret: () => CapSecret;
14
+ export declare const randomNonce: () => Nonce256Bit;
15
+ export declare const getNonceExpiration: () => number;
16
+ export declare const grantSigningKey: (admin: AdminWebsocket, cellId: CellId, functions: Array<[ZomeName, FunctionName]>, signingKey: AgentPubKey) => Promise<CapSecret>;
17
+ export declare const signZomeCall: (capSecret: CapSecret, signingKey: AgentPubKey, keyPair: nacl.SignKeyPair, payload: any) => Promise<CallZomeRequestSigned>;
18
+ export declare const grantSigningKeyAndSignZomeCall: (admin: AdminWebsocket, payload: any) => Promise<CallZomeRequestSigned>;
@@ -0,0 +1,74 @@
1
+ import { hashZomeCall } from "@holochain/serialization";
2
+ import { encode } from "@msgpack/msgpack";
3
+ import crypto from "crypto";
4
+ import nacl from "tweetnacl";
5
+ /**
6
+ * Generates a key pair for signing zome calls.
7
+ *
8
+ * @returns The signing key pair and an agent pub key based on the public key.
9
+ */
10
+ export const generateSigningKeyPair = () => {
11
+ const keyPair = nacl.sign.keyPair();
12
+ const signingKey = new Uint8Array([132, 32, 36].concat(...keyPair.publicKey).concat(...[0, 0, 0, 0]));
13
+ const keys = [keyPair, signingKey];
14
+ return keys;
15
+ };
16
+ export const randomCapSecret = () => randomByteArray(64);
17
+ export const randomNonce = () => randomByteArray(32);
18
+ const randomByteArray = (length) => {
19
+ if (typeof window !== "undefined" &&
20
+ "crypto" in window &&
21
+ "getRandomValues" in window.crypto) {
22
+ return window.crypto.getRandomValues(new Uint8Array(length));
23
+ }
24
+ else {
25
+ return new Uint8Array(crypto.randomBytes(length));
26
+ }
27
+ };
28
+ export const getNonceExpiration = () => (Date.now() + 5 * 60 * 1000) * 1000; // 5 mins from now in microseconds
29
+ export const grantSigningKey = async (admin, cellId, functions, signingKey) => {
30
+ const capSecret = randomCapSecret();
31
+ await admin.grantZomeCallCapability({
32
+ cell_id: cellId,
33
+ cap_grant: {
34
+ tag: "zome-call-signing-key",
35
+ functions,
36
+ access: {
37
+ Assigned: {
38
+ secret: capSecret,
39
+ assignees: [signingKey],
40
+ },
41
+ },
42
+ },
43
+ });
44
+ return capSecret;
45
+ };
46
+ export const signZomeCall = async (capSecret, signingKey, keyPair, payload) => {
47
+ const unsignedZomeCallPayload = {
48
+ cap_secret: capSecret,
49
+ cell_id: payload.cell_id,
50
+ zome_name: payload.zome_name,
51
+ fn_name: payload.fn_name,
52
+ provenance: signingKey,
53
+ payload: encode(payload.payload),
54
+ nonce: randomNonce(),
55
+ expires_at: getNonceExpiration(),
56
+ };
57
+ const hashedZomeCall = await hashZomeCall(unsignedZomeCallPayload);
58
+ const signature = nacl
59
+ .sign(hashedZomeCall, keyPair.secretKey)
60
+ .subarray(0, nacl.sign.signatureLength);
61
+ const signedZomeCall = {
62
+ ...unsignedZomeCallPayload,
63
+ signature,
64
+ };
65
+ return signedZomeCall;
66
+ };
67
+ export const grantSigningKeyAndSignZomeCall = async (admin, payload) => {
68
+ const [keyPair, signingKey] = generateSigningKeyPair();
69
+ const capSecret = await grantSigningKey(admin, payload.cell_id, [[payload.zome_name, payload.fn_name]], signingKey);
70
+ payload = { ...payload, cap_secret: capSecret };
71
+ const signedZomeCall = signZomeCall(capSecret, signingKey, keyPair, payload);
72
+ return signedZomeCall;
73
+ };
74
+ //# sourceMappingURL=util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.js","sourceRoot":"","sources":["../../../src/api/app/util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,IAAI,MAAM,WAAW,CAAC;AAW7B;;;;GAIG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,EAAE;IACzC,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;IACpC,MAAM,UAAU,GAAG,IAAI,UAAU,CAC/B,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,UAAU,CACX,CAAC;IACF,OAAO,GAAG,EAAE,GAAG,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC;IAChD,MAAM,cAAc,GAAG,YAAY,CAAC,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC7E,OAAO,cAAc,CAAC;AACxB,CAAC,CAAC"}
@@ -1,18 +1,29 @@
1
1
  import Emittery from "emittery";
2
+ import { CapSecret } from "../../hdk/capabilities.js";
2
3
  import { InstalledAppId } from "../../types.js";
3
4
  import { WsClient } from "../client.js";
4
5
  import { Requester, Transformer } from "../common.js";
5
- import { AppApi, AppInfoRequest, AppInfoResponse, AppSignalCb, CallZomeRequestGeneric, CallZomeResponseGeneric, ArchiveCloneCellRequest, CreateCloneCellRequest, CreateCloneCellResponse, ArchiveCloneCellResponse, GossipInfoRequest, GossipInfoResponse } from "./types.js";
6
+ import { AppApi, AppInfoRequest, AppInfoResponse, AppSignalCb, CallZomeRequest, CallZomeResponse, CreateCloneCellRequest, CreateCloneCellResponse, DisableCloneCellRequest, DisableCloneCellResponse, EnableCloneCellRequest, EnableCloneCellResponse, NetworkInfoRequest, NetworkInfoResponse } from "./types.js";
6
7
  export declare class AppWebsocket extends Emittery implements AppApi {
7
8
  client: WsClient;
8
9
  defaultTimeout: number;
9
10
  overrideInstalledAppId?: InstalledAppId;
10
11
  constructor(client: WsClient, defaultTimeout?: number, overrideInstalledAppId?: InstalledAppId);
11
12
  static connect(url: string, defaultTimeout?: number, signalCb?: AppSignalCb): Promise<AppWebsocket>;
12
- _requester: <ReqO, ReqI, ResI, ResO>(tag: string, transformer?: Transformer<ReqO, ReqI, ResI, ResO> | undefined) => (req: ReqO, timeout?: number | undefined) => Promise<ResO>;
13
+ _requester: <ReqI, ReqO, ResI, ResO>(tag: string, transformer?: Transformer<ReqI, ReqO, ResI, ResO> | undefined) => (req: ReqI, timeout?: number | undefined) => Promise<ResO>;
13
14
  appInfo: Requester<AppInfoRequest, AppInfoResponse>;
14
- callZome: Requester<CallZomeRequestGeneric<any>, CallZomeResponseGeneric<any>>;
15
+ callZome: Requester<CallZomeRequest | CallZomeRequestSigned, CallZomeResponse>;
15
16
  createCloneCell: Requester<CreateCloneCellRequest, CreateCloneCellResponse>;
16
- archiveCloneCell: Requester<ArchiveCloneCellRequest, ArchiveCloneCellResponse>;
17
- gossipInfo: Requester<GossipInfoRequest, GossipInfoResponse>;
17
+ enableCloneCell: Requester<EnableCloneCellRequest, EnableCloneCellResponse>;
18
+ disableCloneCell: Requester<DisableCloneCellRequest, DisableCloneCellResponse>;
19
+ networkInfo: Requester<NetworkInfoRequest, NetworkInfoResponse>;
20
+ }
21
+ export declare type Nonce256Bit = Uint8Array;
22
+ export interface CallZomeRequestUnsigned extends CallZomeRequest {
23
+ cap_secret: CapSecret | null;
24
+ nonce: Nonce256Bit;
25
+ expires_at: number;
26
+ }
27
+ export interface CallZomeRequestSigned extends CallZomeRequestUnsigned {
28
+ signature: Uint8Array;
18
29
  }