@microsoft/ccf-app 2.0.0-dev6 → 2.0.0-rc1

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/endpoints.d.ts CHANGED
@@ -38,14 +38,46 @@ export interface Request<T extends JsonCompatible<T> = any> {
38
38
  };
39
39
  /**
40
40
  * An object mapping URL path parameter names to their values.
41
+ *
42
+ * For example `GET /app/person/bob?fields=all` matched to `/app/person/{name}` becomes `{"name": "bob"}`
41
43
  */
42
44
  params: {
43
45
  [key: string]: string;
44
46
  };
45
47
  /**
46
- * The query string of the requested URL.
48
+ * The full original requested URL.
49
+ *
50
+ * For example `GET /app/person/bob?fields=all` becomes `"/app/person/bob?fields=all"`
51
+ */
52
+ url: string;
53
+ /**
54
+ * The path component of the requested URL.
55
+ *
56
+ * For example `GET /app/person/bob?fields=all` becomes `"/app/person/bob"`
57
+ */
58
+ path: string;
59
+ /**
60
+ * The endpoint name which matched requested URL, potentially containing path parameters.
61
+ *
62
+ * For example `GET /app/person/bob?fields=all` becomes `"/app/person/{name}"`
63
+ */
64
+ route: string;
65
+ /**
66
+ * The query component of the requested URL.
67
+ *
68
+ * For example `GET /app/person/bob?fields=all` becomes `"fields=all"`
47
69
  */
48
70
  query: string;
71
+ /**
72
+ * The HTTP method of the request.
73
+ *
74
+ * For example `GET /app/person/bob?fields=all` becomes `"GET"`
75
+ */
76
+ method: string;
77
+ /**
78
+ * Hostname extracted from Host header, or null if header is missing
79
+ */
80
+ hostname: string;
49
81
  /**
50
82
  * An object to access the request body in various ways.
51
83
  */
@@ -192,4 +224,8 @@ export declare type EndpointFn<A extends JsonCompatible<A> = any, B extends Resp
192
224
  * @inheritDoc CCF.rpc.setApplyWrites
193
225
  */
194
226
  export declare const setApplyWrites: (force: boolean) => void;
227
+ /**
228
+ * @inheritDoc CCF.rpc.setClaimsDigest
229
+ */
230
+ export declare const setClaimsDigest: (digest: ArrayBuffer) => void;
195
231
  export {};
package/endpoints.js CHANGED
@@ -11,3 +11,7 @@ import { ccf } from "./global.js";
11
11
  * @inheritDoc CCF.rpc.setApplyWrites
12
12
  */
13
13
  export const setApplyWrites = ccf.rpc.setApplyWrites.bind(ccf.rpc);
14
+ /**
15
+ * @inheritDoc CCF.rpc.setClaimsDigest
16
+ */
17
+ export const setClaimsDigest = ccf.rpc.setClaimsDigest.bind(ccf.rpc);
package/global.d.ts CHANGED
@@ -48,6 +48,20 @@ export interface ProofElement {
48
48
  */
49
49
  right?: string;
50
50
  }
51
+ export interface LeafComponents {
52
+ /**
53
+ * Hex-encoded hash of transaction's write set.
54
+ */
55
+ write_set_digest: string;
56
+ /**
57
+ * Raw bytes of commit evidence.
58
+ */
59
+ commit_evidence?: string;
60
+ /**
61
+ * Hex-encoded hash of transaction's claims.
62
+ */
63
+ claims_digest?: string;
64
+ }
51
65
  /**
52
66
  * @inheritDoc Receipt.proof
53
67
  */
@@ -66,13 +80,17 @@ export interface Receipt {
66
80
  */
67
81
  proof: Proof;
68
82
  /**
69
- * Hex-encoded Merkle tree leaf hash.
83
+ * Hex-encoded Merkle tree leaf hash, for pre-2.x transactions.
84
+ */
85
+ leaf?: string;
86
+ /**
87
+ * Components of Merkle tree leaf hash, which digest together to replace leaf.
70
88
  */
71
- leaf: string;
89
+ leaf_components?: LeafComponents;
72
90
  /**
73
91
  * ID of the node that signed the Merkle tree root hash.
74
92
  */
75
- nodeId: string;
93
+ node_id: string;
76
94
  }
77
95
  /**
78
96
  * State associated with a specific historic transaction.
@@ -194,6 +212,13 @@ export interface CCFRpc {
194
212
  * The default is `false`.
195
213
  */
196
214
  setApplyWrites(force: boolean): void;
215
+ /**
216
+ * Set a claims digest to be associated with the transaction if it succeeds. This
217
+ * digest can later be accessed from the receipt, and expanded into a full claim.
218
+ *
219
+ * The `digest` argument must be a sha-256 ArrayBuffer, eg. produced by {@link CCF.digest}
220
+ */
221
+ setClaimsDigest(digest: ArrayBuffer): void;
197
222
  }
198
223
  export interface CCFConsensus {
199
224
  /**
@@ -239,7 +264,7 @@ export interface CCFHistorical {
239
264
  * to completely fetch and validate. The call should be repeated later with
240
265
  * the same arguments to retrieve the requested entries. This state is kept
241
266
  * until it is deleted for one of the following reasons:
242
- * - A call to {@linkcode dropCachedStateRange}
267
+ * - A call to {@linkcode dropCachedStates}
243
268
  * - `seconds_until_expiry` seconds elapse without calling this function
244
269
  * - This handle is used to request a different seqno or range
245
270
  *
package/historical.d.ts CHANGED
@@ -7,7 +7,7 @@ export declare const historicalState: import("./global.js").HistoricalState | un
7
7
  */
8
8
  export declare const getStateRange: (handle: number, startSeqno: number, endSeqno: number, secondsUntilExpiry: number) => import("./global.js").HistoricalState[] | null;
9
9
  /**
10
- * @inheritDoc CCFHistorical.dropCachedStateRange
10
+ * @inheritDoc CCFHistorical.dropCachedStates
11
11
  */
12
12
  export declare const dropCachedStates: (handle: number) => boolean;
13
13
  export { HistoricalState, Receipt, Proof, ProofElement } from "./global";
package/historical.js CHANGED
@@ -37,6 +37,6 @@ export const historicalState = ccf.historicalState;
37
37
  */
38
38
  export const getStateRange = ccf.historical.getStateRange.bind(ccf.historical);
39
39
  /**
40
- * @inheritDoc CCFHistorical.dropCachedStateRange
40
+ * @inheritDoc CCFHistorical.dropCachedStates
41
41
  */
42
42
  export const dropCachedStates = ccf.historical.dropCachedStates.bind(ccf.historical);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/ccf-app",
3
- "version": "2.0.0-dev6",
3
+ "version": "2.0.0-rc1",
4
4
  "description": "CCF app support package",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -19,15 +19,16 @@
19
19
  "license": "Apache-2.0",
20
20
  "devDependencies": {
21
21
  "@types/chai": "^4.2.15",
22
- "@types/mocha": "^8.2.2",
23
- "@types/node": "14.17.27",
24
- "@types/node-forge": "^0.9.7",
22
+ "@types/mocha": "^9.0.0",
23
+ "@types/node": "^17.0.8",
24
+ "@types/node-forge": "^1.0.0",
25
25
  "chai": "^4.3.4",
26
+ "colors": "1.4.0",
26
27
  "cross-env": "^7.0.3",
27
28
  "mocha": "^9.1.3",
28
- "node-forge": "^0.10.0",
29
- "ts-node": "^9.1.1",
30
- "typedoc": "^0.20.34",
31
- "typescript": "4.2.4"
29
+ "node-forge": "^1.2.0",
30
+ "ts-node": "^10.4.0",
31
+ "typedoc": "^0.22.7",
32
+ "typescript": "^4.2.4"
32
33
  }
33
34
  }
package/polyfill.js CHANGED
@@ -86,6 +86,9 @@ class CCFPolyfill {
86
86
  setApplyWrites(force) {
87
87
  throw new Error("Not implemented");
88
88
  },
89
+ setClaimsDigest(digest) {
90
+ throw new Error("Not implemented");
91
+ },
89
92
  };
90
93
  this.crypto = {
91
94
  verifySignature(algorithm, key, signature, data) {