@holochain/client 0.19.0-dev.2 → 0.19.0-dev.3
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/lib/api/app/types.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export type RoleNameCallZomeRequestSigned = Omit<CallZomeRequestSigned, "cell_id
|
|
|
19
19
|
/**
|
|
20
20
|
* @public
|
|
21
21
|
*/
|
|
22
|
-
export type AppCallZomeRequest = NonProvenanceCallZomeRequest | RoleNameCallZomeRequest |
|
|
22
|
+
export type AppCallZomeRequest = NonProvenanceCallZomeRequest | RoleNameCallZomeRequest | CallZomeRequest;
|
|
23
23
|
/**
|
|
24
24
|
* @public
|
|
25
25
|
*/
|
|
@@ -45,7 +45,7 @@ export interface AppEvents {
|
|
|
45
45
|
/**
|
|
46
46
|
* @public
|
|
47
47
|
*/
|
|
48
|
-
export interface
|
|
48
|
+
export interface CallZomeRequestParams extends CallZomeRequest {
|
|
49
49
|
cap_secret: CapSecret | null;
|
|
50
50
|
nonce: Nonce256Bit;
|
|
51
51
|
expires_at: number;
|
|
@@ -53,7 +53,8 @@ export interface CallZomeRequestUnsigned extends CallZomeRequest {
|
|
|
53
53
|
/**
|
|
54
54
|
* @public
|
|
55
55
|
*/
|
|
56
|
-
export interface CallZomeRequestSigned
|
|
56
|
+
export interface CallZomeRequestSigned {
|
|
57
|
+
bytes: Uint8Array;
|
|
57
58
|
signature: Uint8Array;
|
|
58
59
|
}
|
|
59
60
|
/**
|
package/lib/api/app/websocket.js
CHANGED
|
@@ -6,9 +6,9 @@ import { getHostZomeCallSigner, getLauncherEnvironment, } from "../../environmen
|
|
|
6
6
|
import { decode, encode } from "@msgpack/msgpack";
|
|
7
7
|
import { getNonceExpiration, getSigningCredentials, randomNonce, } from "../zome-call-signing.js";
|
|
8
8
|
import { encodeHashToBase64 } from "../../utils/index.js";
|
|
9
|
-
import { hashZomeCall } from "@holochain/serialization";
|
|
10
9
|
import _sodium from "libsodium-wrappers";
|
|
11
10
|
import { WsClient } from "../client.js";
|
|
11
|
+
import { sha512 } from "js-sha512";
|
|
12
12
|
/**
|
|
13
13
|
* A class to establish a websocket connection to an App interface, for a
|
|
14
14
|
* specific agent and app.
|
|
@@ -355,14 +355,15 @@ export const signZomeCall = async (request) => {
|
|
|
355
355
|
nonce: await randomNonce(),
|
|
356
356
|
expires_at: getNonceExpiration(),
|
|
357
357
|
};
|
|
358
|
-
const
|
|
358
|
+
const bytes = encode(unsignedZomeCallPayload);
|
|
359
|
+
const bytesHash = new Uint8Array(sha512.array(bytes));
|
|
359
360
|
await _sodium.ready;
|
|
360
361
|
const sodium = _sodium;
|
|
361
362
|
const signature = sodium
|
|
362
|
-
.crypto_sign(
|
|
363
|
+
.crypto_sign(bytesHash, signingCredentialsForCell.keyPair.privateKey)
|
|
363
364
|
.subarray(0, sodium.crypto_sign_BYTES);
|
|
364
365
|
const signedZomeCall = {
|
|
365
|
-
|
|
366
|
+
bytes,
|
|
366
367
|
signature,
|
|
367
368
|
};
|
|
368
369
|
return signedZomeCall;
|
package/lib/api/index.d.ts
CHANGED
package/lib/api/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AppAuthenticationToken, CallZomeRequest } from "../api/index.js";
|
|
2
|
-
import { CallZomeRequestSigned,
|
|
2
|
+
import { CallZomeRequestSigned, CallZomeRequestParams } from "../api/index.js";
|
|
3
3
|
import { InstalledAppId } from "../types.js";
|
|
4
4
|
export interface LauncherEnvironment {
|
|
5
5
|
APP_INTERFACE_PORT?: number;
|
|
@@ -32,7 +32,7 @@ interface CallZomeRequestSignedElectron extends Omit<CallZomeRequestSigned, "cap
|
|
|
32
32
|
nonce: Array<number>;
|
|
33
33
|
expiresAt: number;
|
|
34
34
|
}
|
|
35
|
-
interface CallZomeRequestUnsignedElectron extends Omit<
|
|
35
|
+
interface CallZomeRequestUnsignedElectron extends Omit<CallZomeRequestParams, "cap_secret" | "cell_id" | "provenance" | "nonce" | "zome_name" | "fn_name" | "expires_at"> {
|
|
36
36
|
cellId: [Array<number>, Array<number>];
|
|
37
37
|
provenance: Array<number>;
|
|
38
38
|
zomeName: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@holochain/client",
|
|
3
|
-
"version": "0.19.0-dev.
|
|
3
|
+
"version": "0.19.0-dev.3",
|
|
4
4
|
"description": "A JavaScript client for the Holochain Conductor API",
|
|
5
5
|
"author": "Holochain Foundation <info@holochain.org> (https://holochain.org)",
|
|
6
6
|
"license": "CAL-1.0",
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@bitgo/blake2b": "^3.2.4",
|
|
46
|
-
"@holochain/serialization": "^0.1.0-beta-rc.3",
|
|
47
46
|
"@msgpack/msgpack": "^2.8.0",
|
|
48
47
|
"emittery": "^1.0.1",
|
|
49
48
|
"isomorphic-ws": "^5.0.0",
|
|
50
49
|
"js-base64": "^3.7.5",
|
|
50
|
+
"js-sha512": "^0.9.0",
|
|
51
51
|
"libsodium-wrappers": "^0.7.13",
|
|
52
52
|
"lodash-es": "^4.17.21",
|
|
53
53
|
"ws": "^8.14.2"
|
|
@@ -72,4 +72,4 @@
|
|
|
72
72
|
"tsx": "^4.7.2",
|
|
73
73
|
"typescript": "^4.9.5"
|
|
74
74
|
}
|
|
75
|
-
}
|
|
75
|
+
}
|