@holochain/client 0.11.8 → 0.11.9
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 +0 -12
- package/lib/api/admin/websocket.d.ts +42 -38
- package/lib/api/admin/websocket.js +49 -25
- package/lib/api/admin/websocket.js.map +1 -1
- package/lib/api/app/websocket.d.ts +1 -0
- package/lib/api/app/websocket.js +29 -2
- package/lib/api/app/websocket.js.map +1 -1
- package/lib/api/zome-call-signing.d.ts +11 -18
- package/lib/api/zome-call-signing.js +12 -60
- package/lib/api/zome-call-signing.js.map +1 -1
- package/lib/environments/launcher.js +1 -1
- package/lib/environments/launcher.js.map +1 -1
- package/lib/hdk/capabilities.d.ts +10 -1
- package/lib/hdk/capabilities.js +5 -1
- package/lib/hdk/capabilities.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -34,12 +34,6 @@ npm install --save-exact @holochain/client
|
|
|
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
|
-
|
|
43
37
|
const TIMEOUT = 12000
|
|
44
38
|
// default timeout is set to 12000
|
|
45
39
|
const client = await AppWebsocket.connect(`ws://127.0.0.1:${appPort}`, TIMEOUT, signalCb)
|
|
@@ -61,12 +55,6 @@ npm install --save-exact @holochain/client
|
|
|
61
55
|
resolve()
|
|
62
56
|
}
|
|
63
57
|
|
|
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
|
-
|
|
70
58
|
const TIMEOUT = 12000
|
|
71
59
|
// default timeout is set to 12000
|
|
72
60
|
const appWs = await AppWebsocket.connect(`ws://127.0.0.1:${appPort}`, 12000, signalCb)
|
|
@@ -1,45 +1,49 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* Conductor Admin API
|
|
4
|
-
*
|
|
5
|
-
* const client = AdminWebsocket.connect(
|
|
6
|
-
* 'ws://127.0.0.1:9000'
|
|
7
|
-
* )
|
|
8
|
-
*
|
|
9
|
-
* client.generateAgentPubKey()
|
|
10
|
-
* .then(agentPubKey => {
|
|
11
|
-
* console.log('Agent successfully generated:', agentPubKey)
|
|
12
|
-
* })
|
|
13
|
-
* .catch(err => {
|
|
14
|
-
* console.error('problem generating agent:', err)
|
|
15
|
-
* })
|
|
16
|
-
*/
|
|
17
|
-
import * as Api from "./types.js";
|
|
1
|
+
import { CapSecret, GrantedFunctions } from "../../hdk/capabilities.js";
|
|
2
|
+
import type { AgentPubKey, CellId } from "../../types.js";
|
|
18
3
|
import { WsClient } from "../client.js";
|
|
19
|
-
import {
|
|
20
|
-
|
|
4
|
+
import { Requester, Transformer } from "../common.js";
|
|
5
|
+
import { AddAgentInfoRequest, AddAgentInfoResponse, AdminApi, AgentInfoRequest, AgentInfoResponse, AttachAppInterfaceRequest, AttachAppInterfaceResponse, DeleteCloneCellRequest, DeleteCloneCellResponse, DisableAppRequest, DisableAppResponse, DumpFullStateRequest, DumpFullStateResponse, DumpStateRequest, DumpStateResponse, EnableAppRequest, EnableAppResponse, GenerateAgentPubKeyRequest, GenerateAgentPubKeyResponse, GetDnaDefinitionRequest, GetDnaDefinitionResponse, GrantZomeCallCapabilityRequest, GrantZomeCallCapabilityResponse, InstallAppRequest, InstallAppResponse, ListAppInterfacesRequest, ListAppInterfacesResponse, ListAppsRequest, ListAppsResponse, ListCellIdsRequest, ListCellIdsResponse, ListDnasRequest, ListDnasResponse, RegisterDnaRequest, RegisterDnaResponse, StartAppRequest, StartAppResponse, UninstallAppRequest, UninstallAppResponse } from "./types.js";
|
|
6
|
+
export declare class AdminWebsocket implements AdminApi {
|
|
21
7
|
readonly client: WsClient;
|
|
22
8
|
defaultTimeout: number;
|
|
23
9
|
private constructor();
|
|
24
10
|
static connect(url: string, defaultTimeout?: number): Promise<AdminWebsocket>;
|
|
25
11
|
_requester: <ReqO, ReqI, ResI, ResO>(tag: string, transformer?: Transformer<ReqO, ReqI, ResI, ResO> | undefined) => (req: ReqO, timeout?: number | undefined) => Promise<ResO>;
|
|
26
|
-
attachAppInterface: Requester<
|
|
27
|
-
enableApp: Requester<
|
|
28
|
-
disableApp: Requester<
|
|
29
|
-
startApp: Requester<
|
|
30
|
-
dumpState: Requester<
|
|
31
|
-
dumpFullState: Requester<
|
|
32
|
-
generateAgentPubKey: Requester<
|
|
33
|
-
registerDna: Requester<
|
|
34
|
-
getDnaDefinition: Requester<
|
|
35
|
-
uninstallApp: Requester<
|
|
36
|
-
installApp: Requester<
|
|
37
|
-
listDnas: Requester<
|
|
38
|
-
listCellIds: Requester<
|
|
39
|
-
listApps: Requester<
|
|
40
|
-
listAppInterfaces: Requester<
|
|
41
|
-
agentInfo: Requester<
|
|
42
|
-
addAgentInfo: Requester<
|
|
43
|
-
deleteCloneCell: Requester<
|
|
44
|
-
grantZomeCallCapability: Requester<
|
|
12
|
+
attachAppInterface: Requester<AttachAppInterfaceRequest, AttachAppInterfaceResponse>;
|
|
13
|
+
enableApp: Requester<EnableAppRequest, EnableAppResponse>;
|
|
14
|
+
disableApp: Requester<DisableAppRequest, DisableAppResponse>;
|
|
15
|
+
startApp: Requester<StartAppRequest, StartAppResponse>;
|
|
16
|
+
dumpState: Requester<DumpStateRequest, DumpStateResponse>;
|
|
17
|
+
dumpFullState: Requester<DumpFullStateRequest, DumpFullStateResponse>;
|
|
18
|
+
generateAgentPubKey: Requester<GenerateAgentPubKeyRequest, GenerateAgentPubKeyResponse>;
|
|
19
|
+
registerDna: Requester<RegisterDnaRequest, RegisterDnaResponse>;
|
|
20
|
+
getDnaDefinition: Requester<GetDnaDefinitionRequest, GetDnaDefinitionResponse>;
|
|
21
|
+
uninstallApp: Requester<UninstallAppRequest, UninstallAppResponse>;
|
|
22
|
+
installApp: Requester<InstallAppRequest, InstallAppResponse>;
|
|
23
|
+
listDnas: Requester<ListDnasRequest, ListDnasResponse>;
|
|
24
|
+
listCellIds: Requester<ListCellIdsRequest, ListCellIdsResponse>;
|
|
25
|
+
listApps: Requester<ListAppsRequest, ListAppsResponse>;
|
|
26
|
+
listAppInterfaces: Requester<ListAppInterfacesRequest, ListAppInterfacesResponse>;
|
|
27
|
+
agentInfo: Requester<AgentInfoRequest, AgentInfoResponse>;
|
|
28
|
+
addAgentInfo: Requester<AddAgentInfoRequest, AddAgentInfoResponse>;
|
|
29
|
+
deleteCloneCell: Requester<DeleteCloneCellRequest, DeleteCloneCellResponse>;
|
|
30
|
+
grantZomeCallCapability: Requester<GrantZomeCallCapabilityRequest, GrantZomeCallCapabilityResponse>;
|
|
31
|
+
/**
|
|
32
|
+
* Grant a capability for signing zome calls.
|
|
33
|
+
*
|
|
34
|
+
* @param cellId - The cell to grant the capability for.
|
|
35
|
+
* @param functions - The zome functions to grant the capability for.
|
|
36
|
+
* @param signingKey - The assignee of the capability.
|
|
37
|
+
* @returns The cap secret of the created capability.
|
|
38
|
+
*/
|
|
39
|
+
grantSigningKey: (cellId: CellId, functions: GrantedFunctions, signingKey: AgentPubKey) => Promise<CapSecret>;
|
|
40
|
+
/**
|
|
41
|
+
* Generate and authorize a new key pair for signing zome calls.
|
|
42
|
+
*
|
|
43
|
+
* @param cellId - The cell id to create the capability grant for.
|
|
44
|
+
* @param functions - Zomes and functions to authorize the signing key for
|
|
45
|
+
* (optional). When no functions are specified, the capability will be
|
|
46
|
+
* granted for all zomes and functions.
|
|
47
|
+
*/
|
|
48
|
+
authorizeSigningCredentials: (cellId: CellId, functions?: GrantedFunctions) => Promise<void>;
|
|
45
49
|
}
|
|
@@ -1,24 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Defines AdminWebsocket, an easy-to-use websocket implementation of the
|
|
3
|
-
* Conductor Admin API
|
|
4
|
-
*
|
|
5
|
-
* const client = AdminWebsocket.connect(
|
|
6
|
-
* 'ws://127.0.0.1:9000'
|
|
7
|
-
* )
|
|
8
|
-
*
|
|
9
|
-
* client.generateAgentPubKey()
|
|
10
|
-
* .then(agentPubKey => {
|
|
11
|
-
* console.log('Agent successfully generated:', agentPubKey)
|
|
12
|
-
* })
|
|
13
|
-
* .catch(err => {
|
|
14
|
-
* console.error('problem generating agent:', err)
|
|
15
|
-
* })
|
|
16
|
-
*/
|
|
17
|
-
import * as Api from "./types.js";
|
|
18
|
-
import { WsClient } from "../client.js";
|
|
19
|
-
import { catchError, promiseTimeout, DEFAULT_TIMEOUT } from "../common.js";
|
|
20
|
-
import { requesterTransformer } from "../common.js";
|
|
21
1
|
import { getLauncherEnvironment } from "../../environments/launcher.js";
|
|
2
|
+
import { GrantedFunctionsType, } from "../../hdk/capabilities.js";
|
|
3
|
+
import { WsClient } from "../client.js";
|
|
4
|
+
import { catchError, DEFAULT_TIMEOUT, promiseTimeout, requesterTransformer, } from "../common.js";
|
|
5
|
+
import { generateSigningKeyPair, randomCapSecret, setSigningCredentials, } from "../zome-call-signing.js";
|
|
6
|
+
import { AppStatusFilter, } from "./types.js";
|
|
22
7
|
export class AdminWebsocket {
|
|
23
8
|
client;
|
|
24
9
|
defaultTimeout;
|
|
@@ -58,6 +43,45 @@ export class AdminWebsocket {
|
|
|
58
43
|
addAgentInfo = this._requester("add_agent_info");
|
|
59
44
|
deleteCloneCell = this._requester("delete_clone_cell");
|
|
60
45
|
grantZomeCallCapability = this._requester("grant_zome_call_capability");
|
|
46
|
+
// zome call signing related methods
|
|
47
|
+
/**
|
|
48
|
+
* Grant a capability for signing zome calls.
|
|
49
|
+
*
|
|
50
|
+
* @param cellId - The cell to grant the capability for.
|
|
51
|
+
* @param functions - The zome functions to grant the capability for.
|
|
52
|
+
* @param signingKey - The assignee of the capability.
|
|
53
|
+
* @returns The cap secret of the created capability.
|
|
54
|
+
*/
|
|
55
|
+
grantSigningKey = async (cellId, functions, signingKey) => {
|
|
56
|
+
const capSecret = randomCapSecret();
|
|
57
|
+
await this.grantZomeCallCapability({
|
|
58
|
+
cell_id: cellId,
|
|
59
|
+
cap_grant: {
|
|
60
|
+
tag: "zome-call-signing-key",
|
|
61
|
+
functions,
|
|
62
|
+
access: {
|
|
63
|
+
Assigned: {
|
|
64
|
+
secret: capSecret,
|
|
65
|
+
assignees: [signingKey],
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
return capSecret;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Generate and authorize a new key pair for signing zome calls.
|
|
74
|
+
*
|
|
75
|
+
* @param cellId - The cell id to create the capability grant for.
|
|
76
|
+
* @param functions - Zomes and functions to authorize the signing key for
|
|
77
|
+
* (optional). When no functions are specified, the capability will be
|
|
78
|
+
* granted for all zomes and functions.
|
|
79
|
+
*/
|
|
80
|
+
authorizeSigningCredentials = async (cellId, functions) => {
|
|
81
|
+
const [keyPair, signingKey] = generateSigningKeyPair();
|
|
82
|
+
const capSecret = await this.grantSigningKey(cellId, functions || { [GrantedFunctionsType.All]: null }, signingKey);
|
|
83
|
+
setSigningCredentials(cellId, { capSecret, keyPair, signingKey });
|
|
84
|
+
};
|
|
61
85
|
}
|
|
62
86
|
const listAppsTransform = {
|
|
63
87
|
input: (req) => {
|
|
@@ -77,23 +101,23 @@ const dumpStateTransform = {
|
|
|
77
101
|
};
|
|
78
102
|
function getAppStatusInApiForm(status_filter) {
|
|
79
103
|
switch (status_filter) {
|
|
80
|
-
case
|
|
104
|
+
case AppStatusFilter.Running:
|
|
81
105
|
return {
|
|
82
106
|
Running: null,
|
|
83
107
|
};
|
|
84
|
-
case
|
|
108
|
+
case AppStatusFilter.Enabled:
|
|
85
109
|
return {
|
|
86
110
|
Enabled: null,
|
|
87
111
|
};
|
|
88
|
-
case
|
|
112
|
+
case AppStatusFilter.Paused:
|
|
89
113
|
return {
|
|
90
114
|
Paused: null,
|
|
91
115
|
};
|
|
92
|
-
case
|
|
116
|
+
case AppStatusFilter.Disabled:
|
|
93
117
|
return {
|
|
94
118
|
Disabled: null,
|
|
95
119
|
};
|
|
96
|
-
case
|
|
120
|
+
case AppStatusFilter.Stopped:
|
|
97
121
|
return {
|
|
98
122
|
Stopped: null,
|
|
99
123
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"websocket.js","sourceRoot":"","sources":["../../../src/api/admin/websocket.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"websocket.js","sourceRoot":"","sources":["../../../src/api/admin/websocket.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAGL,oBAAoB,GACrB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EACL,UAAU,EACV,eAAe,EACf,cAAc,EAEd,oBAAoB,GAErB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,sBAAsB,EACtB,eAAe,EACf,qBAAqB,GACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAML,eAAe,GAmChB,MAAM,YAAY,CAAC;AAEpB,MAAM,OAAO,cAAc;IAChB,MAAM,CAAW;IAC1B,cAAc,CAAS;IAEvB,YAAoB,MAAgB,EAAE,cAAuB;QAC3D,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,cAAc;YACjB,cAAc,KAAK,SAAS,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,cAAc,CAAC;IACpE,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,OAAO,CAClB,GAAW,EACX,cAAuB;QAEvB,2FAA2F;QAC3F,MAAM,GAAG,GAAG,sBAAsB,EAAE,CAAC;QAErC,IAAI,GAAG,EAAE;YACP,GAAG,GA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ACX,CAAC;QACF,qBAAqB,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,CAAC;IACpE,CAAC,CAAC;CACH;AAWD,MAAM,iBAAiB,GAKnB;IACF,KAAK,EAAE,CAAC,GAAG,EAAE,EAAE;QACb,MAAM,IAAI,GAA4B,EAAE,CAAC;QAEzC,IAAI,GAAG,CAAC,aAAa,EAAE;YACrB,IAAI,CAAC,aAAa,GAAG,qBAAqB,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;SAC/D;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG;CACrB,CAAC;AAEF,MAAM,kBAAkB,GAKpB;IACF,KAAK,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG;IACnB,MAAM,EAAE,CAAC,GAAW,EAAqB,EAAE;QACzC,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC;CACF,CAAC;AAEF,SAAS,qBAAqB,CAAC,aAA8B;IAC3D,QAAQ,aAAa,EAAE;QACrB,KAAK,eAAe,CAAC,OAAO;YAC1B,OAAO;gBACL,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,KAAK,eAAe,CAAC,OAAO;YAC1B,OAAO;gBACL,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,KAAK,eAAe,CAAC,MAAM;YACzB,OAAO;gBACL,MAAM,EAAE,IAAI;aACb,CAAC;QACJ,KAAK,eAAe,CAAC,QAAQ;YAC3B,OAAO;gBACL,QAAQ,EAAE,IAAI;aACf,CAAC;QACJ,KAAK,eAAe,CAAC,OAAO;YAC1B,OAAO;gBACL,OAAO,EAAE,IAAI;aACd,CAAC;KACL;AACH,CAAC"}
|
|
@@ -27,3 +27,4 @@ export interface CallZomeRequestUnsigned extends CallZomeRequest {
|
|
|
27
27
|
export interface CallZomeRequestSigned extends CallZomeRequestUnsigned {
|
|
28
28
|
signature: Uint8Array;
|
|
29
29
|
}
|
|
30
|
+
export declare const signZomeCall: (request: CallZomeRequest) => Promise<CallZomeRequestSigned>;
|
package/lib/api/app/websocket.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { hashZomeCall } from "@holochain/serialization";
|
|
2
|
+
import { decode, encode } from "@msgpack/msgpack";
|
|
2
3
|
import Emittery from "emittery";
|
|
4
|
+
import nacl from "tweetnacl";
|
|
3
5
|
import { getLauncherEnvironment, isLauncher, signZomeCallTauri, } from "../../environments/launcher.js";
|
|
4
6
|
import { WsClient } from "../client.js";
|
|
5
7
|
import { catchError, DEFAULT_TIMEOUT, promiseTimeout, requesterTransformer, } from "../common.js";
|
|
6
|
-
import {
|
|
8
|
+
import { getNonceExpiration, getSigningCredentials, randomNonce, } from "../zome-call-signing.js";
|
|
7
9
|
export class AppWebsocket extends Emittery {
|
|
8
10
|
client;
|
|
9
11
|
defaultTimeout;
|
|
@@ -60,4 +62,29 @@ const appInfoTransform = (appWs) => ({
|
|
|
60
62
|
},
|
|
61
63
|
output: (response) => response,
|
|
62
64
|
});
|
|
65
|
+
export const signZomeCall = async (request) => {
|
|
66
|
+
const signingCredentialsForCell = getSigningCredentials(request.cell_id);
|
|
67
|
+
if (!signingCredentialsForCell) {
|
|
68
|
+
throw new Error(`cannot sign zome call: no signing credentials have been authorized for cell ${request.cell_id}`);
|
|
69
|
+
}
|
|
70
|
+
const unsignedZomeCallPayload = {
|
|
71
|
+
cap_secret: signingCredentialsForCell.capSecret,
|
|
72
|
+
cell_id: request.cell_id,
|
|
73
|
+
zome_name: request.zome_name,
|
|
74
|
+
fn_name: request.fn_name,
|
|
75
|
+
provenance: signingCredentialsForCell.signingKey,
|
|
76
|
+
payload: encode(request.payload),
|
|
77
|
+
nonce: randomNonce(),
|
|
78
|
+
expires_at: getNonceExpiration(),
|
|
79
|
+
};
|
|
80
|
+
const hashedZomeCall = await hashZomeCall(unsignedZomeCallPayload);
|
|
81
|
+
const signature = nacl
|
|
82
|
+
.sign(hashedZomeCall, signingCredentialsForCell.keyPair.secretKey)
|
|
83
|
+
.subarray(0, nacl.sign.signatureLength);
|
|
84
|
+
const signedZomeCall = {
|
|
85
|
+
...unsignedZomeCallPayload,
|
|
86
|
+
signature,
|
|
87
|
+
};
|
|
88
|
+
return signedZomeCall;
|
|
89
|
+
};
|
|
63
90
|
//# sourceMappingURL=websocket.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"websocket.js","sourceRoot":"","sources":["../../../src/api/app/websocket.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"websocket.js","sourceRoot":"","sources":["../../../src/api/app/websocket.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EACL,sBAAsB,EACtB,UAAU,EACV,iBAAiB,GAClB,MAAM,gCAAgC,CAAC;AAGxC,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EACL,UAAU,EACV,eAAe,EACf,cAAc,EAEd,oBAAoB,GAErB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EAErB,WAAW,GACZ,MAAM,yBAAyB,CAAC;AAmBjC,MAAM,OAAO,YAAa,SAAQ,QAAQ;IAC/B,MAAM,CAAW;IAC1B,cAAc,CAAS;IACvB,sBAAsB,CAAkB;IAExC,YACE,MAAgB,EAChB,cAAuB,EACvB,sBAAuC;QAEvC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,cAAc;YACjB,cAAc,K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I,KAAK,CACb,+EAA+E,OAAO,CAAC,OAAO,EAAE,CACjG,CAAC;KACH;IACD,MAAM,uBAAuB,GAA4B;QACvD,UAAU,EAAE,yBAAyB,CAAC,SAAS;QAC/C,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,UAAU,EAAE,yBAAyB,CAAC,UAAU;QAChD,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC;QAChC,KAAK,EAAE,WAAW,EAAE;QACpB,UAAU,EAAE,kBAAkB,EAAE;KACjC,CAAC;IACF,MAAM,cAAc,GAAG,MAAM,YAAY,CAAC,uBAAuB,CAAC,CAAC;IACnE,MAAM,SAAS,GAAG,IAAI;SACnB,IAAI,CAAC,cAAc,EAAE,yBAAyB,CAAC,OAAO,CAAC,SAAS,CAAC;SACjE,QAAQ,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAE1C,MAAM,cAAc,GAA0B;QAC5C,GAAG,uBAAuB;QAC1B,SAAS;KACV,CAAC;IACF,OAAO,cAAc,CAAC;AACxB,CAAC,CAAC"}
|
|
@@ -1,32 +1,26 @@
|
|
|
1
1
|
import nacl from "tweetnacl";
|
|
2
2
|
import { CapSecret } from "../hdk/capabilities.js";
|
|
3
3
|
import { AgentPubKey, CellId } from "../types.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { CallZomeRequest } from "./app/types.js";
|
|
7
|
-
import { CallZomeRequestSigned } from "./app/websocket.js";
|
|
8
|
-
export interface SigningCredentials {
|
|
4
|
+
export declare type Nonce256Bit = Uint8Array;
|
|
5
|
+
interface SigningCredentials {
|
|
9
6
|
capSecret: CapSecret;
|
|
10
7
|
keyPair: nacl.SignKeyPair;
|
|
11
8
|
signingKey: AgentPubKey;
|
|
12
9
|
}
|
|
13
|
-
export declare type Nonce256Bit = Uint8Array;
|
|
14
10
|
/**
|
|
15
|
-
*
|
|
11
|
+
* Get credentials for signing zome calls.
|
|
16
12
|
*
|
|
17
|
-
* @param
|
|
18
|
-
*
|
|
19
|
-
* @param cellId - The cell id to create the capability grant for.
|
|
20
|
-
* @param functions - Zomes and functions to authorize the signing key for.
|
|
13
|
+
* @param cellId - Cell id to get credentials of.
|
|
14
|
+
* @returns The keys and cap secret required for signing a zome call.
|
|
21
15
|
*/
|
|
22
|
-
export declare const
|
|
16
|
+
export declare const getSigningCredentials: (cellId: CellId) => SigningCredentials | undefined;
|
|
23
17
|
/**
|
|
24
|
-
*
|
|
18
|
+
* Set credentials for signing zome calls.
|
|
25
19
|
*
|
|
26
|
-
* @param cellId - Cell id to
|
|
27
|
-
* @
|
|
20
|
+
* @param cellId - Cell id to set credentials for.
|
|
21
|
+
* @param cellId - Cell id to set credentials for.
|
|
28
22
|
*/
|
|
29
|
-
export declare const
|
|
23
|
+
export declare const setSigningCredentials: (cellId: CellId, credentials: SigningCredentials) => void;
|
|
30
24
|
/**
|
|
31
25
|
* Generates a key pair for signing zome calls.
|
|
32
26
|
*
|
|
@@ -40,5 +34,4 @@ export declare const randomCapSecret: () => CapSecret;
|
|
|
40
34
|
export declare const randomNonce: () => Nonce256Bit;
|
|
41
35
|
export declare const randomByteArray: (length: number) => Uint8Array;
|
|
42
36
|
export declare const getNonceExpiration: () => number;
|
|
43
|
-
export
|
|
44
|
-
export declare const signZomeCall: (request: CallZomeRequest) => Promise<CallZomeRequestSigned>;
|
|
37
|
+
export {};
|
|
@@ -1,32 +1,26 @@
|
|
|
1
|
-
import { hashZomeCall } from "@holochain/serialization";
|
|
2
|
-
import { encode } from "@msgpack/msgpack";
|
|
3
1
|
import crypto from "crypto";
|
|
4
2
|
import nacl from "tweetnacl";
|
|
5
3
|
import { encodeHashToBase64 } from "../utils/base64.js";
|
|
6
|
-
const
|
|
4
|
+
const signingCredentials = new Map();
|
|
7
5
|
/**
|
|
8
|
-
*
|
|
6
|
+
* Get credentials for signing zome calls.
|
|
9
7
|
*
|
|
10
|
-
* @param
|
|
11
|
-
*
|
|
12
|
-
* @param cellId - The cell id to create the capability grant for.
|
|
13
|
-
* @param functions - Zomes and functions to authorize the signing key for.
|
|
8
|
+
* @param cellId - Cell id to get credentials of.
|
|
9
|
+
* @returns The keys and cap secret required for signing a zome call.
|
|
14
10
|
*/
|
|
15
|
-
export const
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
const cellIdBase64 = encodeHashToBase64(cellId[0]).concat(encodeHashToBase64(cellId[1]));
|
|
19
|
-
signingProps.set(cellIdBase64, { capSecret, keyPair, signingKey });
|
|
11
|
+
export const getSigningCredentials = (cellId) => {
|
|
12
|
+
const cellIdB64 = encodeHashToBase64(cellId[0]).concat(encodeHashToBase64(cellId[1]));
|
|
13
|
+
return signingCredentials.get(cellIdB64);
|
|
20
14
|
};
|
|
21
15
|
/**
|
|
22
|
-
*
|
|
16
|
+
* Set credentials for signing zome calls.
|
|
23
17
|
*
|
|
24
|
-
* @param cellId - Cell id to
|
|
25
|
-
* @
|
|
18
|
+
* @param cellId - Cell id to set credentials for.
|
|
19
|
+
* @param cellId - Cell id to set credentials for.
|
|
26
20
|
*/
|
|
27
|
-
export const
|
|
21
|
+
export const setSigningCredentials = (cellId, credentials) => {
|
|
28
22
|
const cellIdB64 = encodeHashToBase64(cellId[0]).concat(encodeHashToBase64(cellId[1]));
|
|
29
|
-
|
|
23
|
+
signingCredentials.set(cellIdB64, credentials);
|
|
30
24
|
};
|
|
31
25
|
/**
|
|
32
26
|
* Generates a key pair for signing zome calls.
|
|
@@ -51,46 +45,4 @@ export const randomByteArray = (length) => {
|
|
|
51
45
|
}
|
|
52
46
|
};
|
|
53
47
|
export const getNonceExpiration = () => (Date.now() + 5 * 60 * 1000) * 1000; // 5 mins from now in microseconds
|
|
54
|
-
export const grantSigningKey = async (admin, cellId, functions, signingKey) => {
|
|
55
|
-
const capSecret = randomCapSecret();
|
|
56
|
-
await admin.grantZomeCallCapability({
|
|
57
|
-
cell_id: cellId,
|
|
58
|
-
cap_grant: {
|
|
59
|
-
tag: "zome-call-signing-key",
|
|
60
|
-
functions,
|
|
61
|
-
access: {
|
|
62
|
-
Assigned: {
|
|
63
|
-
secret: capSecret,
|
|
64
|
-
assignees: [signingKey],
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
});
|
|
69
|
-
return capSecret;
|
|
70
|
-
};
|
|
71
|
-
export const signZomeCall = async (request) => {
|
|
72
|
-
const signingCredentialsForCell = getSigningCredentials(request.cell_id);
|
|
73
|
-
if (!signingCredentialsForCell) {
|
|
74
|
-
throw new Error(`cannot sign zome call: no signing credentials have been authorized for cell ${request.cell_id}`);
|
|
75
|
-
}
|
|
76
|
-
const unsignedZomeCallPayload = {
|
|
77
|
-
cap_secret: signingCredentialsForCell.capSecret,
|
|
78
|
-
cell_id: request.cell_id,
|
|
79
|
-
zome_name: request.zome_name,
|
|
80
|
-
fn_name: request.fn_name,
|
|
81
|
-
provenance: signingCredentialsForCell.signingKey,
|
|
82
|
-
payload: encode(request.payload),
|
|
83
|
-
nonce: randomNonce(),
|
|
84
|
-
expires_at: getNonceExpiration(),
|
|
85
|
-
};
|
|
86
|
-
const hashedZomeCall = await hashZomeCall(unsignedZomeCallPayload);
|
|
87
|
-
const signature = nacl
|
|
88
|
-
.sign(hashedZomeCall, signingCredentialsForCell.keyPair.secretKey)
|
|
89
|
-
.subarray(0, nacl.sign.signatureLength);
|
|
90
|
-
const signedZomeCall = {
|
|
91
|
-
...unsignedZomeCallPayload,
|
|
92
|
-
signature,
|
|
93
|
-
};
|
|
94
|
-
return signedZomeCall;
|
|
95
|
-
};
|
|
96
48
|
//# sourceMappingURL=zome-call-signing.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zome-call-signing.js","sourceRoot":"","sources":["../../src/api/zome-call-signing.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"zome-call-signing.js","sour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UAAU,CAAC,CAAC;AAC/B,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAoB,GAAG,EAAE,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;AAE1E,MAAM,CAAC,MAAM,WAAW,GAAsB,GAAG,EAAE,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;AAExE,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,MAAc,EAAE,EAAE;IAChD,IACE,OAAO,MAAM,KAAK,WAAW;QAC7B,QAAQ,IAAI,MAAM;QAClB,iBAAiB,IAAI,MAAM,CAAC,MAAM,EAClC;QACA,OAAO,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;KAC9D;SAAM;QACL,OAAO,IAAI,UAAU,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;KACnD;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC,kCAAkC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { invoke } from "@tauri-apps/api/tauri";
|
|
2
2
|
import { getNonceExpiration, randomNonce, } from "../api/index.js";
|
|
3
|
-
import { encode } from "
|
|
3
|
+
import { encode } from "@msgpack/msgpack";
|
|
4
4
|
const __HC_LAUNCHER_ENV__ = "__HC_LAUNCHER_ENV__";
|
|
5
5
|
export const isLauncher = typeof window === "object" && __HC_LAUNCHER_ENV__ in window;
|
|
6
6
|
export const getLauncherEnvironment = () => isLauncher ? window[__HC_LAUNCHER_ENV__] : undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"launcher.js","sourceRoot":"","sources":["../../src/environments/launcher.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,uBA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AC;IAEF,MAAM,mBAAmB,GAA+B,MAAM,MAAM,CAClE,gBAAgB,EAChB,EAAE,gBAAgB,EAAE,CACrB,CAAC;IAEF,MAAM,cAAc,GAA0B;QAC5C,UAAU,EAAE,UAAU,CAAC,IAAI,CAAC,mBAAmB,CAAC,UAAU,CAAC;QAC3D,UAAU,EAAE,IAAI;QAChB,OAAO,EAAE;YACP,UAAU,CAAC,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YAC/C,UAAU,CAAC,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;SAChD;QACD,SAAS,EAAE,mBAAmB,CAAC,SAAS;QACxC,OAAO,EAAE,mBAAmB,CAAC,OAAO;QACpC,OAAO,EAAE,UAAU,CAAC,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC;QACrD,SAAS,EAAE,UAAU,CAAC,IAAI,CAAC,mBAAmB,CAAC,SAAS,CAAC;QACzD,UAAU,EAAE,mBAAmB,CAAC,UAAU;QAC1C,KAAK,EAAE,UAAU,CAAC,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC;KAClD,CAAC;IAEF,OAAO,cAAc,CAAC;AACxB,CAAC,CAAC"}
|
|
@@ -6,10 +6,19 @@ export interface CapClaim {
|
|
|
6
6
|
grantor: AgentPubKey;
|
|
7
7
|
secret: CapSecret;
|
|
8
8
|
}
|
|
9
|
+
export declare enum GrantedFunctionsType {
|
|
10
|
+
All = "All",
|
|
11
|
+
Listed = "Listed"
|
|
12
|
+
}
|
|
13
|
+
export declare type GrantedFunctions = {
|
|
14
|
+
[GrantedFunctionsType.All]: null;
|
|
15
|
+
} | {
|
|
16
|
+
[GrantedFunctionsType.Listed]: [ZomeName, FunctionName][];
|
|
17
|
+
};
|
|
9
18
|
export interface ZomeCallCapGrant {
|
|
10
19
|
tag: string;
|
|
11
20
|
access: CapAccess;
|
|
12
|
-
functions:
|
|
21
|
+
functions: GrantedFunctions;
|
|
13
22
|
}
|
|
14
23
|
export declare type CapAccess = "Unrestricted" | {
|
|
15
24
|
Transferable: {
|
package/lib/hdk/capabilities.js
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
export
|
|
1
|
+
export var GrantedFunctionsType;
|
|
2
|
+
(function (GrantedFunctionsType) {
|
|
3
|
+
GrantedFunctionsType["All"] = "All";
|
|
4
|
+
GrantedFunctionsType["Listed"] = "Listed";
|
|
5
|
+
})(GrantedFunctionsType || (GrantedFunctionsType = {}));
|
|
2
6
|
//# sourceMappingURL=capabilities.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capabilities.js","sourceRoot":"","sources":["../../src/hdk/capabilities.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"capabilities.js","sourceRoot":"","sources":["../../src/hdk/capabilities.ts"],"names":[],"mappings":"AAWA,MAAM,CAAN,IAAY,oBAGX;AAHD,WAAY,oBAAoB;IAC9B,mCAAW,CAAA;IACX,yCAAiB,CAAA;AACnB,CAAC,EAHW,oBAAoB,KAApB,oBAAoB,QAG/B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@holochain/client",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.9",
|
|
4
4
|
"description": "A JavaScript client for the Holochain Conductor API",
|
|
5
5
|
"author": "Holochain Foundation <info@holochain.org> (http://holochain.org)",
|
|
6
6
|
"license": "CAL-1.0",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"build": "rimraf ./lib && tsc -p tsconfig.build.json"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@holochain/serialization": "^0.1.0-beta-rc.
|
|
42
|
+
"@holochain/serialization": "^0.1.0-beta-rc.3",
|
|
43
43
|
"@msgpack/msgpack": "^2.7.2",
|
|
44
44
|
"@tauri-apps/api": "^1.2.0",
|
|
45
45
|
"emittery": "^1.0.1",
|