@ethernity-cloud/sdk-js 1.2.0 → 1.4.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/nodenithy/build/securelock/src/README-keygen.md +41 -0
- package/nodenithy/build/securelock/src/etny_exec.js +46 -18
- package/nodenithy/build/securelock/src/models.js +275 -261
- package/nodenithy/build/securelock/src/securelock.js.tmpl +444 -421
- package/nodenithy/build/securelock/src/self_sign.js +76 -0
- package/nodenithy/build/securelock/src/sgx_report.js +50 -0
- package/nodenithy/build/securelock/src/sgx_report.node +0 -0
- package/nodenithy/build/securelock/src/task_status.js +3 -0
- package/nodenithy/build.js +22 -0
- package/nodenithy/build.mjs +36 -0
- package/package.json +50 -48
- package/test.js +204 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# SGX key-gen module (`sgx_report.node`)
|
|
2
|
+
|
|
3
|
+
The JS SDK ships this module **only as a prebuilt N-API addon**
|
|
4
|
+
(`sgx_report.node`) — never the C source (`get_sgx_report.c`,
|
|
5
|
+
`sgx_report_napi.c`). The identity-key derivation (SGX EREPORT + obfuscated
|
|
6
|
+
MR_SIGNER + HKDF-SHA512 domain-separated derivation) lives entirely in the
|
|
7
|
+
compiled binary, so a developer inspecting the package or build tree never sees
|
|
8
|
+
the algorithm. `get_sgx_report.c` and `sgx_report_napi.c` are gitignored here
|
|
9
|
+
so they can never be committed.
|
|
10
|
+
|
|
11
|
+
## Where the source lives
|
|
12
|
+
|
|
13
|
+
The source of truth is the runtime repo, not this package:
|
|
14
|
+
|
|
15
|
+
- `etny-nodenithy` → `v3/build/{securelock,trustedzone,validator}/src/`
|
|
16
|
+
(`get_sgx_report.c` + `sgx_report_napi.c`)
|
|
17
|
+
|
|
18
|
+
## How the `.node` is produced
|
|
19
|
+
|
|
20
|
+
`sgx_report.node` is a **build artifact of the etny-nodenithy pipeline** — its
|
|
21
|
+
Dockerfile compiles `sgx_report_napi.c` (which `#include`s `get_sgx_report.c`)
|
|
22
|
+
into the addon with a single gcc command against node's `node_api.h`. To refresh
|
|
23
|
+
the copy the SDK ships, take the `sgx_report.node` that pipeline produces and
|
|
24
|
+
commit it here as `securelock/src/sgx_report.node`.
|
|
25
|
+
|
|
26
|
+
The JS wrappers `sgx_report.js` (loader) and `self_sign.js` (calls
|
|
27
|
+
`deriveIdentityScalar`) ship as source — they contain no algorithm, only calls
|
|
28
|
+
into the addon.
|
|
29
|
+
|
|
30
|
+
## Why not compile it in the SDK build
|
|
31
|
+
|
|
32
|
+
The securelock Dockerfile bakes `src/` into binary-fs but does **not** compile
|
|
33
|
+
the addon, so the SDK must carry the prebuilt `.node`. `build.mjs` fails fast if
|
|
34
|
+
`src/sgx_report.node` is missing.
|
|
35
|
+
|
|
36
|
+
## Honest scope
|
|
37
|
+
|
|
38
|
+
This hides the SOURCE, not the algorithm: the `.node` still contains the
|
|
39
|
+
executable logic and the enclave image is public. On testnet (no attestation)
|
|
40
|
+
the derived key is reproducible by anyone who runs the image. Key exclusivity
|
|
41
|
+
comes from attestation, not from shipping only the binary.
|
|
@@ -2,34 +2,62 @@ const fs = require('fs');
|
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const { TaskStatus } = require('./task_status');
|
|
4
4
|
|
|
5
|
-
// Load
|
|
6
|
-
//
|
|
7
|
-
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
|
|
5
|
+
// Load EVERY export of ./serverless/backend into the payload's scope. The
|
|
6
|
+
// backend is copied next to this file by ecld-build (and staged the same way
|
|
7
|
+
// by ecld-test locally), so one code path serves both the enclave and local
|
|
8
|
+
// testing. Previously only a function literally named `hello` was reachable
|
|
9
|
+
// (hardcoded destructure); any other exported function threw ReferenceError.
|
|
10
|
+
// A missing backend leaves only ___etny_result___ in scope, which is the
|
|
11
|
+
// stock-enclave behaviour.
|
|
12
|
+
let backendFunctions = {};
|
|
13
|
+
// If the backend fails to load, remember WHY. A silently-swallowed failure
|
|
14
|
+
// (missing npm module, bad require inside backend.js) makes every task die
|
|
15
|
+
// later with a misleading "X is not defined". Only a genuinely absent backend
|
|
16
|
+
// stays silent — that is the stock-enclave configuration.
|
|
17
|
+
let backendImportError = null;
|
|
18
|
+
try {
|
|
19
|
+
backendFunctions = { ...require('./serverless/backend') };
|
|
20
|
+
} catch (e) {
|
|
21
|
+
backendFunctions = {};
|
|
22
|
+
// MODULE_NOT_FOUND messages embed the whole require stack (which always
|
|
23
|
+
// mentions serverless/backend.js), so parse out WHICH module is missing:
|
|
24
|
+
// only a missing backend module itself means "no backend shipped".
|
|
25
|
+
const m = /Cannot find module '([^']+)'/.exec(e.message || '');
|
|
26
|
+
const missingBackendItself =
|
|
27
|
+
e.code === 'MODULE_NOT_FOUND' && m && /serverless[\\/]backend/.test(m[1]);
|
|
28
|
+
if (!missingBackendItself) {
|
|
29
|
+
backendImportError = `${e.name || 'Error'}: ${(e.message || '').split('\n')[0]}`;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
17
32
|
|
|
18
33
|
function ___etny_result___(data) {
|
|
19
34
|
return [0, data];
|
|
20
35
|
}
|
|
36
|
+
|
|
21
37
|
function executeTask(payload, input) {
|
|
22
|
-
|
|
38
|
+
if (backendImportError !== null) {
|
|
39
|
+
return [
|
|
40
|
+
TaskStatus.IMPORT_ERROR,
|
|
41
|
+
'BACKEND IMPORT ERROR: ' + backendImportError +
|
|
42
|
+
' | The serverless backend failed to load inside the enclave, so none of its' +
|
|
43
|
+
' functions are available. Common causes: a module missing from the enclave' +
|
|
44
|
+
' image dependencies, or a bad require() inside backend.js.'
|
|
45
|
+
];
|
|
46
|
+
}
|
|
47
|
+
return exec(payload, input, { '___etny_result___': ___etny_result___, ...backendFunctions });
|
|
23
48
|
}
|
|
49
|
+
|
|
24
50
|
function exec(payload, input, globals = null) {
|
|
25
51
|
try {
|
|
26
52
|
if (payload && payload !== "") {
|
|
53
|
+
const scope = globals || {};
|
|
27
54
|
if (input && input !== "") {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
55
|
+
scope['___etny_data_set___'] = input;
|
|
56
|
+
}
|
|
57
|
+
// `with` exposes every backend function and ___etny_data_set___ to
|
|
58
|
+
// the payload by bare name — matching how payloads are written
|
|
59
|
+
// (e.g. `processData(___etny_data_set___)`).
|
|
60
|
+
with (scope) {
|
|
33
61
|
return ___etny_result___(eval(payload));
|
|
34
62
|
}
|
|
35
63
|
} else {
|
|
@@ -1,261 +1,275 @@
|
|
|
1
|
-
class Order {
|
|
2
|
-
constructor(req, order_id) {
|
|
3
|
-
this.id = order_id;
|
|
4
|
-
this.do_owner = req[0];
|
|
5
|
-
this.dproc = req[1];
|
|
6
|
-
this.do_req = req[2];
|
|
7
|
-
this.dp_req = req[3];
|
|
8
|
-
this.status = req[4];
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
class MetadataBase {
|
|
13
|
-
constructor(metadata, version) {
|
|
14
|
-
this.metadata = metadata;
|
|
15
|
-
this._version = version;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
get version() {
|
|
19
|
-
return this._version;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
get ipfs_hash() {
|
|
23
|
-
throw new Error("Subclass must implement this method");
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
checksum() {
|
|
27
|
-
throw new Error("Subclass must implement this method");
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
if (metadata.startsWith("
|
|
42
|
-
return new
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
this._checksum
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
this._checksum
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
this._checksum
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
this.
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
this.
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
this.
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
this.
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
1
|
+
class Order {
|
|
2
|
+
constructor(req, order_id) {
|
|
3
|
+
this.id = order_id;
|
|
4
|
+
this.do_owner = req[0];
|
|
5
|
+
this.dproc = req[1];
|
|
6
|
+
this.do_req = req[2];
|
|
7
|
+
this.dp_req = req[3];
|
|
8
|
+
this.status = req[4];
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
class MetadataBase {
|
|
13
|
+
constructor(metadata, version) {
|
|
14
|
+
this.metadata = metadata;
|
|
15
|
+
this._version = version;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
get version() {
|
|
19
|
+
return this._version;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
get ipfs_hash() {
|
|
23
|
+
throw new Error("Subclass must implement this method");
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
checksum() {
|
|
27
|
+
throw new Error("Subclass must implement this method");
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// True when this metadata carries a real checksum to validate. Empty input
|
|
31
|
+
// carries no checksum (checksum is null), so callers can skip validation
|
|
32
|
+
// without inspecting raw metadata strings themselves.
|
|
33
|
+
get has_checksum() {
|
|
34
|
+
return this.checksum != null;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
class PayloadFactory {
|
|
39
|
+
static create_payload_metadata(metadata) {
|
|
40
|
+
if (metadata.includes(":")) {
|
|
41
|
+
if (metadata.startsWith("v1")) {
|
|
42
|
+
return new PayloadMetadataV1(metadata);
|
|
43
|
+
}
|
|
44
|
+
if (metadata.startsWith("v2")) {
|
|
45
|
+
return new PayloadMetadataV2(metadata);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (metadata.startsWith("v3")) {
|
|
49
|
+
return new PayloadMetadataV3(metadata);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
throw new Error("Invalid payload metadata type");
|
|
53
|
+
} else {
|
|
54
|
+
return new PayloadMetadataV0(metadata);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
class InputFactory {
|
|
60
|
+
static create_input_metadata(metadata) {
|
|
61
|
+
if (metadata.includes(":")) {
|
|
62
|
+
if (metadata.startsWith("v1")) {
|
|
63
|
+
return new InputMetadataV1(metadata);
|
|
64
|
+
}
|
|
65
|
+
if (metadata.startsWith("v2")) {
|
|
66
|
+
return new InputMetadataV2(metadata);
|
|
67
|
+
}
|
|
68
|
+
if (metadata.startsWith("v3")) {
|
|
69
|
+
return new InputMetadataV3(metadata);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
throw new Error("Invalid payload metadata type");
|
|
73
|
+
} else {
|
|
74
|
+
return new InputMetadataV0(metadata);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
class InputMetadataV0 extends MetadataBase {
|
|
80
|
+
constructor(metadata) {
|
|
81
|
+
super(metadata, "v0");
|
|
82
|
+
this._ipfs_hash = metadata;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
get ipfs_hash() {
|
|
86
|
+
return this._ipfs_hash;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
get checksum() {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
class PayloadMetadataV0 extends MetadataBase {
|
|
95
|
+
constructor(metadata) {
|
|
96
|
+
super(metadata, "v0");
|
|
97
|
+
this._ipfs_hash = metadata;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
get ipfs_hash() {
|
|
101
|
+
return this._ipfs_hash;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
get checksum() {
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
class PayloadMetadataV1 extends MetadataBase {
|
|
110
|
+
constructor(metadata) {
|
|
111
|
+
super(metadata, "v1");
|
|
112
|
+
this._checksum = metadata.split(":")[2];
|
|
113
|
+
this._ipfs_hash = metadata.split(":")[1];
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
get ipfs_hash() {
|
|
117
|
+
return this._ipfs_hash;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
get checksum() {
|
|
121
|
+
return this._checksum;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
class InputMetadataV1 extends MetadataBase {
|
|
126
|
+
constructor(metadata) {
|
|
127
|
+
super(metadata, "v1");
|
|
128
|
+
this._checksum = metadata.split(":")[2];
|
|
129
|
+
this._ipfs_hash = metadata.split(":")[1];
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
get ipfs_hash() {
|
|
133
|
+
return this._ipfs_hash;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
get checksum() {
|
|
137
|
+
return this._checksum !== "0" ? this._checksum : this._checksum;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
class PayloadMetadataV2 extends MetadataBase {
|
|
142
|
+
constructor(metadata) {
|
|
143
|
+
super(metadata, "v2");
|
|
144
|
+
this._checksum = metadata.split(":")[2];
|
|
145
|
+
this._ipfs_hash = metadata.split(":")[1];
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
get ipfs_hash() {
|
|
149
|
+
return this._ipfs_hash;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
get checksum() {
|
|
153
|
+
return this._checksum;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
class PayloadMetadataV3 extends MetadataBase {
|
|
158
|
+
constructor(metadata) {
|
|
159
|
+
super(metadata, "v3");
|
|
160
|
+
// An absent checksum (empty or "0" third field) is normalized to null so
|
|
161
|
+
// the rest of the code can rely on `has_checksum` instead of special-
|
|
162
|
+
// casing empty strings.
|
|
163
|
+
const c = (metadata.split(":")[2] || "").trim();
|
|
164
|
+
this._checksum = (c && c !== "0") ? c : null;
|
|
165
|
+
this._ipfs_hash = metadata.split(":")[1];
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
get ipfs_hash() {
|
|
169
|
+
return this._ipfs_hash;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
get checksum() {
|
|
173
|
+
return this._checksum;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
class InputMetadataV2 extends MetadataBase {
|
|
178
|
+
constructor(metadata) {
|
|
179
|
+
super(metadata, "v2");
|
|
180
|
+
this._checksum = metadata.split(":")[2];
|
|
181
|
+
this._ipfs_hash = metadata.split(":")[1];
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
get ipfs_hash() {
|
|
185
|
+
return this._ipfs_hash;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
get checksum() {
|
|
189
|
+
return this._checksum !== "0" ? this._checksum : this._checksum;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
class InputMetadataV3 extends MetadataBase {
|
|
194
|
+
constructor(metadata) {
|
|
195
|
+
super(metadata, "v3");
|
|
196
|
+
// Empty input carries an empty (or "0") checksum field; normalize it to
|
|
197
|
+
// null so `has_checksum` is false and validation is skipped.
|
|
198
|
+
const c = (metadata.split(":")[2] || "").trim();
|
|
199
|
+
this._checksum = (c && c !== "0") ? c : null;
|
|
200
|
+
this._ipfs_hash = metadata.split(":")[1];
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
get ipfs_hash() {
|
|
204
|
+
return this._ipfs_hash;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
get checksum() {
|
|
208
|
+
return this._checksum;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
class DOReqMetadata {
|
|
213
|
+
constructor(req, do_req) {
|
|
214
|
+
this._do_req_id = do_req;
|
|
215
|
+
this._do_owner = req[0];
|
|
216
|
+
this._metadata1 = req[1];
|
|
217
|
+
this._metadata2 = req[2];
|
|
218
|
+
this._metadata3 = req[3];
|
|
219
|
+
this._metadata4 = req[4];
|
|
220
|
+
this._payload_metadata_obj = PayloadFactory.create_payload_metadata(this.payload_metadata);
|
|
221
|
+
this._input_metadata_obj = InputFactory.create_input_metadata(this.input_metadata);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
get do_req_id() {
|
|
225
|
+
return this._do_req_id;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
get do_owner() {
|
|
229
|
+
return this._do_owner;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
get image_metadata() {
|
|
233
|
+
return this._metadata1;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
get public_key() {
|
|
237
|
+
return this.image_metadata.split(':')[5];
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
get image_hash() {
|
|
241
|
+
return this.image_metadata.split(':')[1];
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
get payload_metadata() {
|
|
245
|
+
return this._metadata2;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
get payload_metadata_obj() {
|
|
249
|
+
return this._payload_metadata_obj;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
get input_metadata_obj() {
|
|
253
|
+
return this._input_metadata_obj;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
get input_metadata() {
|
|
257
|
+
return this._metadata3;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
get node_address() {
|
|
261
|
+
return this._metadata4;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
module.exports = {
|
|
266
|
+
Order,
|
|
267
|
+
MetadataBase,
|
|
268
|
+
PayloadFactory,
|
|
269
|
+
InputFactory,
|
|
270
|
+
InputMetadataV0,
|
|
271
|
+
PayloadMetadataV0,
|
|
272
|
+
InputMetadataV1,
|
|
273
|
+
PayloadMetadataV1,
|
|
274
|
+
DOReqMetadata
|
|
275
|
+
}
|