@microsoft/ccf-app 5.0.0-dev17 → 5.0.0-dev18
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/converters.js +2 -1
- package/global.d.ts +17 -24
- package/global.js +0 -1
- package/kv.d.ts +26 -1
- package/kv.js +48 -0
- package/package.json +1 -1
- package/polyfill.js +0 -6
- package/openenclave.d.ts +0 -5
- package/openenclave.js +0 -12
package/converters.js
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* This module provides converters to and from `ArrayBuffer` objects.
|
|
5
5
|
*
|
|
6
|
-
* Converters are commonly used as {@linkcode kv.typedKv}
|
|
6
|
+
* Converters are commonly used as {@linkcode kv.typedKv} or
|
|
7
|
+
* {@linkcode kv.typedKvSet} arguments.
|
|
7
8
|
* Another use case is {@linkcode crypto.wrapKey} to convert
|
|
8
9
|
* PEM-encoded keys to `ArrayBuffer`.
|
|
9
10
|
*
|
package/global.d.ts
CHANGED
|
@@ -32,6 +32,22 @@ export interface KvMap {
|
|
|
32
32
|
forEach(callback: (value: ArrayBuffer, key: ArrayBuffer, kvmap: KvMap) => void): void;
|
|
33
33
|
size: number;
|
|
34
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* A set in the Key Value Store.
|
|
37
|
+
*
|
|
38
|
+
* `KVSet` is modelled after JavaScript's `Set` object,
|
|
39
|
+
* except that keys must be of type `ArrayBuffer`
|
|
40
|
+
* and no guarantees on iteration order are provided.
|
|
41
|
+
*/
|
|
42
|
+
export interface KvSet {
|
|
43
|
+
has(key: ArrayBuffer): boolean;
|
|
44
|
+
getVersionOfPreviousWrite(key: ArrayBuffer): number | undefined;
|
|
45
|
+
add(key: ArrayBuffer): KvSet;
|
|
46
|
+
delete(key: ArrayBuffer): void;
|
|
47
|
+
clear(): void;
|
|
48
|
+
forEach(callback: (value: ArrayBuffer, kvset: KvSet) => void): void;
|
|
49
|
+
size: number;
|
|
50
|
+
}
|
|
35
51
|
/**
|
|
36
52
|
* @inheritDoc CCF.kv
|
|
37
53
|
*/
|
|
@@ -107,7 +123,7 @@ export interface HistoricalState {
|
|
|
107
123
|
/**
|
|
108
124
|
* An object that provides access to the maps of the Key-Value Store
|
|
109
125
|
* associated with the historic transaction.
|
|
110
|
-
* Fields are map names and values are {@linkcode KvMap}
|
|
126
|
+
* Fields are map names and values are {@linkcode KvMap} objects.
|
|
111
127
|
*/
|
|
112
128
|
kv: KvMaps;
|
|
113
129
|
}
|
|
@@ -592,29 +608,6 @@ export interface CCF {
|
|
|
592
608
|
*/
|
|
593
609
|
enableMetricsLogging(enable: boolean): boolean;
|
|
594
610
|
}
|
|
595
|
-
export declare const openenclave: OpenEnclave;
|
|
596
|
-
export interface EvidenceClaims {
|
|
597
|
-
claims: {
|
|
598
|
-
[name: string]: ArrayBuffer;
|
|
599
|
-
};
|
|
600
|
-
customClaims: {
|
|
601
|
-
[name: string]: ArrayBuffer;
|
|
602
|
-
};
|
|
603
|
-
}
|
|
604
|
-
export interface OpenEnclave {
|
|
605
|
-
/**
|
|
606
|
-
* Verifies Open Enclave evidence and returns the claims of the evidence.
|
|
607
|
-
*
|
|
608
|
-
* @param format The optional format id of the evidence to be verified as
|
|
609
|
-
* a UUID of the form "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".
|
|
610
|
-
* If this parameter is `undefined`, the evidence and endorsement
|
|
611
|
-
* must either contain data with an attestation header holding a valid
|
|
612
|
-
* format id, or be an Open Enclave report generated by the legacy API function
|
|
613
|
-
* `oe_get_report()`. Otherwise, this parameter must be a valid format id, and
|
|
614
|
-
* the evidence and endorsements data must not be wrapped with an attestation header.
|
|
615
|
-
*/
|
|
616
|
-
verifyOpenEnclaveEvidence(format: string | undefined, evidence: ArrayBuffer, endorsements?: ArrayBuffer): EvidenceClaims;
|
|
617
|
-
}
|
|
618
611
|
export interface TcbVersion {
|
|
619
612
|
boot_loader: number;
|
|
620
613
|
tee: number;
|
package/global.js
CHANGED
package/kv.d.ts
CHANGED
|
@@ -49,6 +49,18 @@ export declare class TypedKvMap<K, V> {
|
|
|
49
49
|
forEach(callback: (value: V, key: K, table: TypedKvMap<K, V>) => void): void;
|
|
50
50
|
get size(): number;
|
|
51
51
|
}
|
|
52
|
+
export declare class TypedKvSet<K> {
|
|
53
|
+
private kv;
|
|
54
|
+
private kt;
|
|
55
|
+
constructor(kv: KvMap, kt: DataConverter<K>);
|
|
56
|
+
has(key: K): boolean;
|
|
57
|
+
getVersionOfPreviousWrite(key: K): number | undefined;
|
|
58
|
+
add(key: K): TypedKvSet<K>;
|
|
59
|
+
delete(key: K): void;
|
|
60
|
+
clear(): void;
|
|
61
|
+
forEach(callback: (key: K, table: TypedKvSet<K>) => void): void;
|
|
62
|
+
get size(): number;
|
|
63
|
+
}
|
|
52
64
|
/**
|
|
53
65
|
* Returns a typed view of a map in the Key-Value Store,
|
|
54
66
|
* where keys and values are automatically converted
|
|
@@ -63,8 +75,21 @@ export declare class TypedKvMap<K, V> {
|
|
|
63
75
|
* @param vt The converter to use for map values.
|
|
64
76
|
*/
|
|
65
77
|
export declare function typedKv<K, V>(nameOrMap: string | KvMap, kt: DataConverter<K>, vt: DataConverter<V>): TypedKvMap<K, V>;
|
|
78
|
+
/**
|
|
79
|
+
* Returns a typed view of a set in the Key-Value Store,
|
|
80
|
+
* where keys are automatically converted
|
|
81
|
+
* to and from ``ArrayBuffer`` based on the given key
|
|
82
|
+
* converter.
|
|
83
|
+
*
|
|
84
|
+
* See the {@linkcode converters} module for available converters.
|
|
85
|
+
*
|
|
86
|
+
* @param nameOrMap Either the map name in the Key-Value Store,
|
|
87
|
+
* or a ``KvMap`` object.
|
|
88
|
+
* @param kt The converter to use for map keys.
|
|
89
|
+
*/
|
|
90
|
+
export declare function typedKvSet<K, V>(nameOrMap: string | KvMap, kt: DataConverter<K>): TypedKvSet<K>;
|
|
66
91
|
/**
|
|
67
92
|
* @inheritDoc global!CCF.kv
|
|
68
93
|
*/
|
|
69
94
|
export declare const rawKv: import("./global.js").KvMaps;
|
|
70
|
-
export { KvMap, KvMaps } from "./global";
|
|
95
|
+
export { KvMap, KvSet, KvMaps } from "./global";
|
package/kv.js
CHANGED
|
@@ -74,6 +74,38 @@ export class TypedKvMap {
|
|
|
74
74
|
return this.kv.size;
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
+
export class TypedKvSet {
|
|
78
|
+
constructor(kv, kt) {
|
|
79
|
+
this.kv = kv;
|
|
80
|
+
this.kt = kt;
|
|
81
|
+
}
|
|
82
|
+
has(key) {
|
|
83
|
+
return this.kv.has(this.kt.encode(key));
|
|
84
|
+
}
|
|
85
|
+
getVersionOfPreviousWrite(key) {
|
|
86
|
+
return this.kv.getVersionOfPreviousWrite(this.kt.encode(key));
|
|
87
|
+
}
|
|
88
|
+
add(key) {
|
|
89
|
+
this.kv.set(this.kt.encode(key), new ArrayBuffer(8));
|
|
90
|
+
return this;
|
|
91
|
+
}
|
|
92
|
+
delete(key) {
|
|
93
|
+
this.kv.delete(this.kt.encode(key));
|
|
94
|
+
}
|
|
95
|
+
clear() {
|
|
96
|
+
this.kv.clear();
|
|
97
|
+
}
|
|
98
|
+
forEach(callback) {
|
|
99
|
+
let kt = this.kt;
|
|
100
|
+
let typedSet = this;
|
|
101
|
+
this.kv.forEach(function (raw_v, raw_k, table) {
|
|
102
|
+
callback(kt.decode(raw_k), typedSet);
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
get size() {
|
|
106
|
+
return this.kv.size;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
77
109
|
/**
|
|
78
110
|
* Returns a typed view of a map in the Key-Value Store,
|
|
79
111
|
* where keys and values are automatically converted
|
|
@@ -91,6 +123,22 @@ export function typedKv(nameOrMap, kt, vt) {
|
|
|
91
123
|
const kvMap = typeof nameOrMap === "string" ? ccf.kv[nameOrMap] : nameOrMap;
|
|
92
124
|
return new TypedKvMap(kvMap, kt, vt);
|
|
93
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* Returns a typed view of a set in the Key-Value Store,
|
|
128
|
+
* where keys are automatically converted
|
|
129
|
+
* to and from ``ArrayBuffer`` based on the given key
|
|
130
|
+
* converter.
|
|
131
|
+
*
|
|
132
|
+
* See the {@linkcode converters} module for available converters.
|
|
133
|
+
*
|
|
134
|
+
* @param nameOrMap Either the map name in the Key-Value Store,
|
|
135
|
+
* or a ``KvMap`` object.
|
|
136
|
+
* @param kt The converter to use for map keys.
|
|
137
|
+
*/
|
|
138
|
+
export function typedKvSet(nameOrMap, kt) {
|
|
139
|
+
const kvMap = typeof nameOrMap === "string" ? ccf.kv[nameOrMap] : nameOrMap;
|
|
140
|
+
return new TypedKvSet(kvMap, kt);
|
|
141
|
+
}
|
|
94
142
|
/**
|
|
95
143
|
* @inheritDoc global!CCF.kv
|
|
96
144
|
*/
|
package/package.json
CHANGED
package/polyfill.js
CHANGED
|
@@ -524,12 +524,6 @@ class CCFPolyfill {
|
|
|
524
524
|
}
|
|
525
525
|
}
|
|
526
526
|
globalThis.ccf = new CCFPolyfill();
|
|
527
|
-
class OpenEnclavePolyfill {
|
|
528
|
-
verifyOpenEnclaveEvidence(format, evidence, endorsements) {
|
|
529
|
-
throw new Error("Method not implemented.");
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
globalThis.openenclave = new OpenEnclavePolyfill();
|
|
533
527
|
class SnpAttestationPolyfill {
|
|
534
528
|
verifySnpAttestation(evidence, endorsements, uvm_endorsements, endorsed_tcb) {
|
|
535
529
|
throw new Error("Method not implemented.");
|
package/openenclave.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @inheritDoc global!OpenEnclave.verifyOpenEnclaveEvidence
|
|
3
|
-
*/
|
|
4
|
-
export declare const verifyOpenEnclaveEvidence: (format: string | undefined, evidence: ArrayBuffer, endorsements?: ArrayBuffer | undefined) => import("./global").EvidenceClaims;
|
|
5
|
-
export { EvidenceClaims } from "./global";
|
package/openenclave.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
-
// Licensed under the Apache 2.0 License.
|
|
3
|
-
/**
|
|
4
|
-
* The `openenclave` module provides access to Open Enclave functionality.
|
|
5
|
-
*
|
|
6
|
-
* @module
|
|
7
|
-
*/
|
|
8
|
-
import { openenclave } from "./global";
|
|
9
|
-
/**
|
|
10
|
-
* @inheritDoc global!OpenEnclave.verifyOpenEnclaveEvidence
|
|
11
|
-
*/
|
|
12
|
-
export const verifyOpenEnclaveEvidence = openenclave.verifyOpenEnclaveEvidence;
|