@bitgo-beta/deser-lib 1.0.1-beta.6 → 1.0.1-beta.60
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/CHANGELOG.md +34 -0
- package/dist/package.json +46 -0
- package/dist/src/cbor.d.ts +26 -0
- package/dist/src/cbor.d.ts.map +1 -0
- package/dist/src/cbor.js +213 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +5 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +2 -2
- package/.prettierignore +0 -2
- package/.prettierrc.yml +0 -3
- package/src/cbor.ts +0 -216
- package/src/index.ts +0 -1
- package/test/cbor/fixtures.json +0 -96
- package/test/unit/deser-lib.ts +0 -326
- package/tsconfig.json +0 -8
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,40 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# 1.5.0 (2024-01-30)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- **deser-lib:** add .npmignore to deser-lib ([8572427](https://github.com/BitGo/BitGoJS/commit/857242748d28c1d27c85578091d902701ce6f41e))
|
|
11
|
+
- **deser-lib:** add deser-lib path to tsconfig.packages ([0e5ef65](https://github.com/BitGo/BitGoJS/commit/0e5ef654b78214b7cc6086ce05c305d4d7425d64))
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
- **deser-lib:** add serialization/deserialization module ([95c0308](https://github.com/BitGo/BitGoJS/commit/95c03088faa890604880dae770c4a720850f9275))
|
|
16
|
+
- **deser-lib:** support escaped strings ([95cd394](https://github.com/BitGo/BitGoJS/commit/95cd39476895b2fd3e766683eb5e7129c200d516))
|
|
17
|
+
|
|
18
|
+
# 1.4.0 (2024-01-26)
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
- **deser-lib:** add deser-lib path to tsconfig.packages ([0e5ef65](https://github.com/BitGo/BitGoJS/commit/0e5ef654b78214b7cc6086ce05c305d4d7425d64))
|
|
23
|
+
|
|
24
|
+
### Features
|
|
25
|
+
|
|
26
|
+
- **deser-lib:** add serialization/deserialization module ([95c0308](https://github.com/BitGo/BitGoJS/commit/95c03088faa890604880dae770c4a720850f9275))
|
|
27
|
+
- **deser-lib:** support escaped strings ([95cd394](https://github.com/BitGo/BitGoJS/commit/95cd39476895b2fd3e766683eb5e7129c200d516))
|
|
28
|
+
|
|
29
|
+
# 1.3.0 (2024-01-26)
|
|
30
|
+
|
|
31
|
+
### Bug Fixes
|
|
32
|
+
|
|
33
|
+
- **deser-lib:** add deser-lib path to tsconfig.packages ([0e5ef65](https://github.com/BitGo/BitGoJS/commit/0e5ef654b78214b7cc6086ce05c305d4d7425d64))
|
|
34
|
+
|
|
35
|
+
### Features
|
|
36
|
+
|
|
37
|
+
- **deser-lib:** add serialization/deserialization module ([95c0308](https://github.com/BitGo/BitGoJS/commit/95c03088faa890604880dae770c4a720850f9275))
|
|
38
|
+
- **deser-lib:** support escaped strings ([95cd394](https://github.com/BitGo/BitGoJS/commit/95cd39476895b2fd3e766683eb5e7129c200d516))
|
|
39
|
+
|
|
6
40
|
# 1.2.0 (2024-01-25)
|
|
7
41
|
|
|
8
42
|
### Features
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@bitgo-beta/deser-lib",
|
|
3
|
+
"version": "1.0.1-beta.60",
|
|
4
|
+
"description": "BitGo serialization and deseralization library",
|
|
5
|
+
"main": "./dist/src/index.js",
|
|
6
|
+
"types": "./dist/src/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"test": "yarn unit-test",
|
|
9
|
+
"unit-test": "nyc -- mocha --recursive test",
|
|
10
|
+
"build": "yarn tsc --build --incremental --verbose .",
|
|
11
|
+
"fmt": "prettier --write .",
|
|
12
|
+
"check-fmt": "prettier --check .",
|
|
13
|
+
"clean": "rm -r ./dist",
|
|
14
|
+
"lint": "eslint --quiet .",
|
|
15
|
+
"prepare": "npm run build"
|
|
16
|
+
},
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/BitGo/BitGoJS.git",
|
|
20
|
+
"directory": "modules/deser-lib"
|
|
21
|
+
},
|
|
22
|
+
"author": "BitGo SDK Team <sdkteam@bitgo.com>",
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"bugs": {
|
|
25
|
+
"url": "https://github.com/bitgo/bitgojs/issues"
|
|
26
|
+
},
|
|
27
|
+
"homepage": "https://github.com/bitgo/bitgojs#readme",
|
|
28
|
+
"nyc": {
|
|
29
|
+
"extension": [
|
|
30
|
+
".ts"
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
"lint-staged": {
|
|
34
|
+
"*.{js,ts}": [
|
|
35
|
+
"yarn prettier --write",
|
|
36
|
+
"yarn eslint --fix"
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"cbor": "^9.0.1"
|
|
44
|
+
},
|
|
45
|
+
"gitHead": "ededf8f264151d057e083299120151eb618ee939"
|
|
46
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/**
|
|
3
|
+
* Transform value into its canonical, serializable form.
|
|
4
|
+
* @param value - Value to transform.
|
|
5
|
+
* @returns Canonical, serializable form of value.
|
|
6
|
+
*/
|
|
7
|
+
export declare function transform<T>(value: T): T | Buffer;
|
|
8
|
+
/**
|
|
9
|
+
* Untransform value into its human readable form.
|
|
10
|
+
* @param value - Value to untransform.
|
|
11
|
+
* @returns Untransformed, human readable form of value.
|
|
12
|
+
*/
|
|
13
|
+
export declare function untransform<T>(value: T): T | string;
|
|
14
|
+
/**
|
|
15
|
+
* Serialize a value.
|
|
16
|
+
* @param value - Value to serialize.
|
|
17
|
+
* @returns Buffer representing serialized value.
|
|
18
|
+
*/
|
|
19
|
+
export declare function serialize<T>(value: T): Buffer;
|
|
20
|
+
/**
|
|
21
|
+
* Deserialize a value.
|
|
22
|
+
* @param value - Buffer to deserialize.
|
|
23
|
+
* @returns Deserialized value.
|
|
24
|
+
*/
|
|
25
|
+
export declare function deserialize(value: Buffer): unknown;
|
|
26
|
+
//# sourceMappingURL=cbor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cbor.d.ts","sourceRoot":"","sources":["../../src/cbor.ts"],"names":[],"mappings":";AAiIA;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,GAAG,MAAM,CA6BjD;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,GAAG,MAAM,CA2BnD;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,MAAM,CAE7C;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAElD"}
|
package/dist/src/cbor.js
ADDED
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deserialize = exports.serialize = exports.untransform = exports.transform = void 0;
|
|
4
|
+
const cbor_1 = require("cbor");
|
|
5
|
+
/**
|
|
6
|
+
* Return a string describing value as a type.
|
|
7
|
+
* @param value - Any javascript value to type.
|
|
8
|
+
* @returns String describing value type.
|
|
9
|
+
*/
|
|
10
|
+
function getType(value) {
|
|
11
|
+
if (value === null || value === undefined) {
|
|
12
|
+
return 'null';
|
|
13
|
+
}
|
|
14
|
+
if (value instanceof Array) {
|
|
15
|
+
const types = value.map(getType);
|
|
16
|
+
if (!types.slice(1).every((value) => value === types[0])) {
|
|
17
|
+
throw new Error('Array elements are not of the same type');
|
|
18
|
+
}
|
|
19
|
+
return JSON.stringify([types[0]]);
|
|
20
|
+
}
|
|
21
|
+
if (value instanceof Object) {
|
|
22
|
+
const properties = Object.getOwnPropertyNames(value);
|
|
23
|
+
properties.sort();
|
|
24
|
+
return JSON.stringify(properties.reduce((acc, name) => {
|
|
25
|
+
acc[name] = getType(value[name]);
|
|
26
|
+
return acc;
|
|
27
|
+
}, {}));
|
|
28
|
+
}
|
|
29
|
+
if (typeof value === 'string') {
|
|
30
|
+
if (value.startsWith('0x')) {
|
|
31
|
+
return 'bytes';
|
|
32
|
+
}
|
|
33
|
+
return 'string';
|
|
34
|
+
}
|
|
35
|
+
return JSON.stringify(typeof value);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Compare two buffers for sorting.
|
|
39
|
+
* @param a - left buffer to compare to right buffer.
|
|
40
|
+
* @param b - right buffer to compare to left buffer.
|
|
41
|
+
* @returns Negative if a < b, positive if b > a, 0 if equal.
|
|
42
|
+
*/
|
|
43
|
+
function bufferCompare(a, b) {
|
|
44
|
+
let i = 0;
|
|
45
|
+
while (i < a.length && i < b.length && a[i] == b[i]) {
|
|
46
|
+
i++;
|
|
47
|
+
}
|
|
48
|
+
if (i === a.length && i === b.length) {
|
|
49
|
+
return 0;
|
|
50
|
+
}
|
|
51
|
+
if (i === a.length || i === b.length) {
|
|
52
|
+
return a.length - b.length;
|
|
53
|
+
}
|
|
54
|
+
return a[i] - b[i];
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Type check for sortable array element.
|
|
58
|
+
* @param value - Value to type check.
|
|
59
|
+
* @returns True if value is a sortable array element.
|
|
60
|
+
*/
|
|
61
|
+
function isSortable(value) {
|
|
62
|
+
return value instanceof Object && 'weight' in value && typeof value.weight === 'number';
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Convert number to base 256 and return as a big-endian Buffer.
|
|
66
|
+
* @param value - Value to convert.
|
|
67
|
+
* @returns Buffer representation of the number.
|
|
68
|
+
*/
|
|
69
|
+
function numberToBufferBE(value) {
|
|
70
|
+
// Normalize value so that negative numbers aren't compared higher
|
|
71
|
+
// than positive numbers when accounting for two's complement.
|
|
72
|
+
value += Math.pow(2, 52);
|
|
73
|
+
const byteCount = Math.floor((value.toString(2).length + 7) / 8);
|
|
74
|
+
const buffer = Buffer.alloc(byteCount);
|
|
75
|
+
let i = 0;
|
|
76
|
+
while (value) {
|
|
77
|
+
buffer[i++] = value % 256;
|
|
78
|
+
value = Math.floor(value / 256);
|
|
79
|
+
}
|
|
80
|
+
return buffer.reverse();
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Compare two array elements for sorting.
|
|
84
|
+
* @param a - left element to compare to right element.
|
|
85
|
+
* @param b - right element to compare to left element.
|
|
86
|
+
* @returns Negative if a < b, positive if b > a, 0 if equal.
|
|
87
|
+
*/
|
|
88
|
+
function elementCompare(a, b) {
|
|
89
|
+
if (!isSortable(a) || !isSortable(b)) {
|
|
90
|
+
throw new Error('Array elements must be sortable');
|
|
91
|
+
}
|
|
92
|
+
if (a.weight === b.weight) {
|
|
93
|
+
if (a.value === undefined && b.value === undefined) {
|
|
94
|
+
throw new Error('Array elements must be sortable');
|
|
95
|
+
}
|
|
96
|
+
const aVal = transform(a.value);
|
|
97
|
+
const bVal = transform(b.value);
|
|
98
|
+
if ((!Buffer.isBuffer(aVal) && typeof aVal !== 'string' && typeof aVal !== 'number') ||
|
|
99
|
+
(!Buffer.isBuffer(bVal) && typeof bVal !== 'string' && typeof bVal !== 'number')) {
|
|
100
|
+
throw new Error('Array element value cannot be compared');
|
|
101
|
+
}
|
|
102
|
+
let aBuf, bBuf;
|
|
103
|
+
if (typeof aVal === 'number') {
|
|
104
|
+
aBuf = numberToBufferBE(aVal);
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
aBuf = Buffer.from(aVal);
|
|
108
|
+
}
|
|
109
|
+
if (typeof bVal === 'number') {
|
|
110
|
+
bBuf = numberToBufferBE(bVal);
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
bBuf = Buffer.from(bVal);
|
|
114
|
+
}
|
|
115
|
+
return bufferCompare(aBuf, bBuf);
|
|
116
|
+
}
|
|
117
|
+
return a.weight - b.weight;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Transform value into its canonical, serializable form.
|
|
121
|
+
* @param value - Value to transform.
|
|
122
|
+
* @returns Canonical, serializable form of value.
|
|
123
|
+
*/
|
|
124
|
+
function transform(value) {
|
|
125
|
+
if (value === null || value === undefined) {
|
|
126
|
+
return value;
|
|
127
|
+
}
|
|
128
|
+
if (typeof value === 'string') {
|
|
129
|
+
// Transform hex strings to buffers.
|
|
130
|
+
if (value.startsWith('0x')) {
|
|
131
|
+
if (!value.match(/^0x([0-9a-fA-F]{2})*$/)) {
|
|
132
|
+
throw new Error('0x prefixed string contains non-hex characters.');
|
|
133
|
+
}
|
|
134
|
+
return Buffer.from(value.slice(2), 'hex');
|
|
135
|
+
}
|
|
136
|
+
else if (value.startsWith('\\0x')) {
|
|
137
|
+
return value.slice(1);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
else if (value instanceof Array) {
|
|
141
|
+
// Enforce array elements are same type.
|
|
142
|
+
getType(value);
|
|
143
|
+
value = [...value];
|
|
144
|
+
value.sort(elementCompare);
|
|
145
|
+
return value.map(transform);
|
|
146
|
+
}
|
|
147
|
+
else if (value instanceof Object) {
|
|
148
|
+
const properties = Object.getOwnPropertyNames(value);
|
|
149
|
+
properties.sort();
|
|
150
|
+
return properties.reduce((acc, name) => {
|
|
151
|
+
acc[name] = transform(value[name]);
|
|
152
|
+
return acc;
|
|
153
|
+
}, {});
|
|
154
|
+
}
|
|
155
|
+
return value;
|
|
156
|
+
}
|
|
157
|
+
exports.transform = transform;
|
|
158
|
+
/**
|
|
159
|
+
* Untransform value into its human readable form.
|
|
160
|
+
* @param value - Value to untransform.
|
|
161
|
+
* @returns Untransformed, human readable form of value.
|
|
162
|
+
*/
|
|
163
|
+
function untransform(value) {
|
|
164
|
+
if (Buffer.isBuffer(value)) {
|
|
165
|
+
return '0x' + value.toString('hex');
|
|
166
|
+
}
|
|
167
|
+
else if (typeof value === 'string') {
|
|
168
|
+
if (value.startsWith('0x')) {
|
|
169
|
+
return '\\' + value;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
else if (value instanceof Array && value.length > 1) {
|
|
173
|
+
for (let i = 1; i < value.length; i++) {
|
|
174
|
+
if (value[i - 1].weight > value[i].weight) {
|
|
175
|
+
throw new Error('Array elements are not in canonical order');
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
return value.map(untransform);
|
|
179
|
+
}
|
|
180
|
+
else if (value instanceof Object) {
|
|
181
|
+
const properties = Object.getOwnPropertyNames(value);
|
|
182
|
+
for (let i = 1; i < properties.length; i++) {
|
|
183
|
+
if (properties[i - 1].localeCompare(properties[i]) > 0) {
|
|
184
|
+
throw new Error('Object properties are not in canonical order');
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return properties.reduce((acc, name) => {
|
|
188
|
+
acc[name] = untransform(value[name]);
|
|
189
|
+
return acc;
|
|
190
|
+
}, {});
|
|
191
|
+
}
|
|
192
|
+
return value;
|
|
193
|
+
}
|
|
194
|
+
exports.untransform = untransform;
|
|
195
|
+
/**
|
|
196
|
+
* Serialize a value.
|
|
197
|
+
* @param value - Value to serialize.
|
|
198
|
+
* @returns Buffer representing serialized value.
|
|
199
|
+
*/
|
|
200
|
+
function serialize(value) {
|
|
201
|
+
return cbor_1.encode(transform(value));
|
|
202
|
+
}
|
|
203
|
+
exports.serialize = serialize;
|
|
204
|
+
/**
|
|
205
|
+
* Deserialize a value.
|
|
206
|
+
* @param value - Buffer to deserialize.
|
|
207
|
+
* @returns Deserialized value.
|
|
208
|
+
*/
|
|
209
|
+
function deserialize(value) {
|
|
210
|
+
return untransform(cbor_1.decodeFirstSync(value));
|
|
211
|
+
}
|
|
212
|
+
exports.deserialize = deserialize;
|
|
213
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2Jvci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jYm9yLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLCtCQUErQztBQUUvQzs7OztHQUlHO0FBQ0gsU0FBUyxPQUFPLENBQUMsS0FBYztJQUM3QixJQUFJLEtBQUssS0FBSyxJQUFJLElBQUksS0FBSyxLQUFLLFNBQVMsRUFBRTtRQUN6QyxPQUFPLE1BQU0sQ0FBQztLQUNmO0lBQ0QsSUFBSSxLQUFLLFlBQVksS0FBSyxFQUFFO1FBQzFCLE1BQU0sS0FBSyxHQUFHLEtBQUssQ0FBQyxHQUFHLENBQUMsT0FBTyxDQUFDLENBQUM7UUFDakMsSUFBSSxDQUFDLEtBQUssQ0FBQyxLQUFLLENBQUMsQ0FBQyxDQUFDLENBQUMsS0FBSyxDQUFDLENBQUMsS0FBSyxFQUFFLEVBQUUsQ0FBQyxLQUFLLEtBQUssS0FBSyxDQUFDLENBQUMsQ0FBQyxDQUFDLEVBQUU7WUFDeEQsTUFBTSxJQUFJLEtBQUssQ0FBQyx5Q0FBeUMsQ0FBQyxDQUFDO1NBQzVEO1FBQ0QsT0FBTyxJQUFJLENBQUMsU0FBUyxDQUFDLENBQUMsS0FBSyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQztLQUNuQztJQUNELElBQUksS0FBSyxZQUFZLE1BQU0sRUFBRTtRQUMzQixNQUFNLFVBQVUsR0FBRyxNQUFNLENBQUMsbUJBQW1CLENBQUMsS0FBSyxDQUFDLENBQUM7UUFDckQsVUFBVSxDQUFDLElBQUksRUFBRSxDQUFDO1FBQ2xC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Root":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Cbor = void 0;
|
|
4
|
+
exports.Cbor = require("./cbor");
|
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsaUNBQStCIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0ICogYXMgQ2JvciBmcm9tICcuL2Nib3InO1xuIl19
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"program":{"fileNames":["../../../node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../../node_modules/@types/node/ts4.8/assert.d.ts","../../../node_modules/@types/node/ts4.8/assert/strict.d.ts","../../../node_modules/buffer/index.d.ts","../../../node_modules/undici-types/header.d.ts","../../../node_modules/undici-types/readable.d.ts","../../../node_modules/undici-types/file.d.ts","../../../node_modules/undici-types/fetch.d.ts","../../../node_modules/undici-types/formdata.d.ts","../../../node_modules/undici-types/connector.d.ts","../../../node_modules/undici-types/client.d.ts","../../../node_modules/undici-types/errors.d.ts","../../../node_modules/undici-types/dispatcher.d.ts","../../../node_modules/undici-types/global-dispatcher.d.ts","../../../node_modules/undici-types/global-origin.d.ts","../../../node_modules/undici-types/pool-stats.d.ts","../../../node_modules/undici-types/pool.d.ts","../../../node_modules/undici-types/handlers.d.ts","../../../node_modules/undici-types/balanced-pool.d.ts","../../../node_modules/undici-types/agent.d.ts","../../../node_modules/undici-types/mock-interceptor.d.ts","../../../node_modules/undici-types/mock-agent.d.ts","../../../node_modules/undici-types/mock-client.d.ts","../../../node_modules/undici-types/mock-pool.d.ts","../../../node_modules/undici-types/mock-errors.d.ts","../../../node_modules/undici-types/proxy-agent.d.ts","../../../node_modules/undici-types/api.d.ts","../../../node_modules/undici-types/cookies.d.ts","../../../node_modules/undici-types/patch.d.ts","../../../node_modules/undici-types/filereader.d.ts","../../../node_modules/undici-types/diagnostics-channel.d.ts","../../../node_modules/undici-types/websocket.d.ts","../../../node_modules/undici-types/content-type.d.ts","../../../node_modules/undici-types/cache.d.ts","../../../node_modules/undici-types/interceptors.d.ts","../../../node_modules/undici-types/index.d.ts","../../../node_modules/@types/node/ts4.8/globals.d.ts","../../../node_modules/@types/node/ts4.8/async_hooks.d.ts","../../../node_modules/@types/node/ts4.8/buffer.d.ts","../../../node_modules/@types/node/ts4.8/child_process.d.ts","../../../node_modules/@types/node/ts4.8/cluster.d.ts","../../../node_modules/@types/node/ts4.8/console.d.ts","../../../node_modules/@types/node/ts4.8/constants.d.ts","../../../node_modules/@types/node/ts4.8/crypto.d.ts","../../../node_modules/@types/node/ts4.8/dgram.d.ts","../../../node_modules/@types/node/ts4.8/diagnostics_channel.d.ts","../../../node_modules/@types/node/ts4.8/dns.d.ts","../../../node_modules/@types/node/ts4.8/dns/promises.d.ts","../../../node_modules/@types/node/ts4.8/domain.d.ts","../../../node_modules/@types/node/ts4.8/dom-events.d.ts","../../../node_modules/@types/node/ts4.8/events.d.ts","../../../node_modules/@types/node/ts4.8/fs.d.ts","../../../node_modules/@types/node/ts4.8/fs/promises.d.ts","../../../node_modules/@types/node/ts4.8/http.d.ts","../../../node_modules/@types/node/ts4.8/http2.d.ts","../../../node_modules/@types/node/ts4.8/https.d.ts","../../../node_modules/@types/node/ts4.8/inspector.d.ts","../../../node_modules/@types/node/ts4.8/module.d.ts","../../../node_modules/@types/node/ts4.8/net.d.ts","../../../node_modules/@types/node/ts4.8/os.d.ts","../../../node_modules/@types/node/ts4.8/path.d.ts","../../../node_modules/@types/node/ts4.8/perf_hooks.d.ts","../../../node_modules/@types/node/ts4.8/process.d.ts","../../../node_modules/@types/node/ts4.8/punycode.d.ts","../../../node_modules/@types/node/ts4.8/querystring.d.ts","../../../node_modules/@types/node/ts4.8/readline.d.ts","../../../node_modules/@types/node/ts4.8/readline/promises.d.ts","../../../node_modules/@types/node/ts4.8/repl.d.ts","../../../node_modules/@types/node/ts4.8/stream.d.ts","../../../node_modules/@types/node/ts4.8/stream/promises.d.ts","../../../node_modules/@types/node/ts4.8/stream/consumers.d.ts","../../../node_modules/@types/node/ts4.8/stream/web.d.ts","../../../node_modules/@types/node/ts4.8/string_decoder.d.ts","../../../node_modules/@types/node/ts4.8/test.d.ts","../../../node_modules/@types/node/ts4.8/timers.d.ts","../../../node_modules/@types/node/ts4.8/timers/promises.d.ts","../../../node_modules/@types/node/ts4.8/tls.d.ts","../../../node_modules/@types/node/ts4.8/trace_events.d.ts","../../../node_modules/@types/node/ts4.8/tty.d.ts","../../../node_modules/@types/node/ts4.8/url.d.ts","../../../node_modules/@types/node/ts4.8/util.d.ts","../../../node_modules/@types/node/ts4.8/v8.d.ts","../../../node_modules/@types/node/ts4.8/vm.d.ts","../../../node_modules/@types/node/ts4.8/wasi.d.ts","../../../node_modules/@types/node/ts4.8/worker_threads.d.ts","../../../node_modules/@types/node/ts4.8/zlib.d.ts","../../../node_modules/@types/node/ts4.8/globals.global.d.ts","../../../node_modules/@types/node/ts4.8/index.d.ts","../../../node_modules/nofilter/types/index.d.ts","../../../node_modules/cbor/types/vendor/binary-parse-stream/index.d.ts","../../../node_modules/cbor/types/lib/tagged.d.ts","../../../node_modules/cbor/types/lib/decoder.d.ts","../../../node_modules/cbor/types/lib/commented.d.ts","../../../node_modules/cbor/types/lib/diagnose.d.ts","../../../node_modules/cbor/types/lib/encoder.d.ts","../../../node_modules/cbor/types/lib/simple.d.ts","../../../node_modules/cbor/types/lib/map.d.ts","../../../node_modules/cbor/types/lib/objectRecorder.d.ts","../../../node_modules/cbor/types/lib/sharedValueEncoder.d.ts","../../../node_modules/cbor/types/lib/cbor.d.ts","../src/cbor.ts","../src/index.ts","../package.json","../../../node_modules/@types/archy/index.d.ts","../../../node_modules/@types/bluebird/index.d.ts","../../../node_modules/@types/bn.js/index.d.ts","../../../node_modules/base-x/src/index.d.ts","../../../node_modules/@types/bs58/index.d.ts","../../../node_modules/@types/keyv/index.d.ts","../../../node_modules/@types/http-cache-semantics/index.d.ts","../../../node_modules/@types/responselike/index.d.ts","../../../node_modules/@types/cacheable-request/index.d.ts","../../../node_modules/@types/connect/index.d.ts","../../../node_modules/@types/cookiejar/index.d.ts","../../../node_modules/@types/create-hmac/index.d.ts","../../../node_modules/@types/ms/index.d.ts","../../../node_modules/@types/debug/index.d.ts","../../../node_modules/@types/eccrypto/index.d.ts","../../../node_modules/@types/elliptic/index.d.ts","../../../node_modules/@types/eslint/helpers.d.ts","../../../node_modules/@types/estree/index.d.ts","../../../node_modules/@types/json-schema/index.d.ts","../../../node_modules/@types/eslint/index.d.ts","../../../node_modules/@types/eslint-scope/index.d.ts","../../../node_modules/@types/ethereumjs-util/index.d.ts","../../../node_modules/@types/eventsource/dom-monkeypatch.d.ts","../../../node_modules/@types/eventsource/index.d.ts","../../../node_modules/@types/expect/index.d.ts","../../../node_modules/@types/fs-extra/index.d.ts","../../../node_modules/@types/html-minifier-terser/index.d.ts","../../../node_modules/@types/jasmine/index.d.ts","../../../node_modules/@types/json5/index.d.ts","../../../node_modules/@types/linkify-it/index.d.ts","../../../node_modules/@types/lodash/common/common.d.ts","../../../node_modules/@types/lodash/common/array.d.ts","../../../node_modules/@types/lodash/common/collection.d.ts","../../../node_modules/@types/lodash/common/date.d.ts","../../../node_modules/@types/lodash/common/function.d.ts","../../../node_modules/@types/lodash/common/lang.d.ts","../../../node_modules/@types/lodash/common/math.d.ts","../../../node_modules/@types/lodash/common/number.d.ts","../../../node_modules/@types/lodash/common/object.d.ts","../../../node_modules/@types/lodash/common/seq.d.ts","../../../node_modules/@types/lodash/common/string.d.ts","../../../node_modules/@types/lodash/common/util.d.ts","../../../node_modules/@types/lodash/index.d.ts","../../../node_modules/@types/long/index.d.ts","../../../node_modules/@types/mdurl/encode.d.ts","../../../node_modules/@types/mdurl/decode.d.ts","../../../node_modules/@types/mdurl/parse.d.ts","../../../node_modules/@types/mdurl/format.d.ts","../../../node_modules/@types/mdurl/index.d.ts","../../../node_modules/@types/markdown-it/lib/common/utils.d.ts","../../../node_modules/@types/markdown-it/lib/token.d.ts","../../../node_modules/@types/markdown-it/lib/rules_inline/state_inline.d.ts","../../../node_modules/@types/markdown-it/lib/helpers/parse_link_label.d.ts","../../../node_modules/@types/markdown-it/lib/helpers/parse_link_destination.d.ts","../../../node_modules/@types/markdown-it/lib/helpers/parse_link_title.d.ts","../../../node_modules/@types/markdown-it/lib/helpers/index.d.ts","../../../node_modules/@types/markdown-it/lib/ruler.d.ts","../../../node_modules/@types/markdown-it/lib/rules_block/state_block.d.ts","../../../node_modules/@types/markdown-it/lib/parser_block.d.ts","../../../node_modules/@types/markdown-it/lib/rules_core/state_core.d.ts","../../../node_modules/@types/markdown-it/lib/parser_core.d.ts","../../../node_modules/@types/markdown-it/lib/parser_inline.d.ts","../../../node_modules/@types/markdown-it/lib/renderer.d.ts","../../../node_modules/@types/markdown-it/lib/index.d.ts","../../../node_modules/@types/markdown-it/index.d.ts","../../../node_modules/@types/mime-types/index.d.ts","../../../node_modules/@types/minimatch/index.d.ts","../../../node_modules/@types/minimist/index.d.ts","../../../node_modules/@types/mocha/index.d.ts","../../../node_modules/@types/normalize-package-data/index.d.ts","../../../node_modules/@types/parse-json/index.d.ts","../../../node_modules/@types/pbkdf2/index.d.ts","../../../node_modules/@types/qrcode/index.d.ts","../../../node_modules/@types/raf/index.d.ts","../../../node_modules/@types/randombytes/index.d.ts","../../../node_modules/@types/secp256k1/index.d.ts","../../../node_modules/@types/semver/classes/semver.d.ts","../../../node_modules/@types/semver/functions/parse.d.ts","../../../node_modules/@types/semver/functions/valid.d.ts","../../../node_modules/@types/semver/functions/clean.d.ts","../../../node_modules/@types/semver/functions/inc.d.ts","../../../node_modules/@types/semver/functions/diff.d.ts","../../../node_modules/@types/semver/functions/major.d.ts","../../../node_modules/@types/semver/functions/minor.d.ts","../../../node_modules/@types/semver/functions/patch.d.ts","../../../node_modules/@types/semver/functions/prerelease.d.ts","../../../node_modules/@types/semver/functions/compare.d.ts","../../../node_modules/@types/semver/functions/rcompare.d.ts","../../../node_modules/@types/semver/functions/compare-loose.d.ts","../../../node_modules/@types/semver/functions/compare-build.d.ts","../../../node_modules/@types/semver/functions/sort.d.ts","../../../node_modules/@types/semver/functions/rsort.d.ts","../../../node_modules/@types/semver/functions/gt.d.ts","../../../node_modules/@types/semver/functions/lt.d.ts","../../../node_modules/@types/semver/functions/eq.d.ts","../../../node_modules/@types/semver/functions/neq.d.ts","../../../node_modules/@types/semver/functions/gte.d.ts","../../../node_modules/@types/semver/functions/lte.d.ts","../../../node_modules/@types/semver/functions/cmp.d.ts","../../../node_modules/@types/semver/functions/coerce.d.ts","../../../node_modules/@types/semver/classes/comparator.d.ts","../../../node_modules/@types/semver/classes/range.d.ts","../../../node_modules/@types/semver/functions/satisfies.d.ts","../../../node_modules/@types/semver/ranges/max-satisfying.d.ts","../../../node_modules/@types/semver/ranges/min-satisfying.d.ts","../../../node_modules/@types/semver/ranges/to-comparators.d.ts","../../../node_modules/@types/semver/ranges/min-version.d.ts","../../../node_modules/@types/semver/ranges/valid.d.ts","../../../node_modules/@types/semver/ranges/outside.d.ts","../../../node_modules/@types/semver/ranges/gtr.d.ts","../../../node_modules/@types/semver/ranges/ltr.d.ts","../../../node_modules/@types/semver/ranges/intersects.d.ts","../../../node_modules/@types/semver/ranges/simplify.d.ts","../../../node_modules/@types/semver/ranges/subset.d.ts","../../../node_modules/@types/semver/internals/identifiers.d.ts","../../../node_modules/@types/semver/index.d.ts","../../../node_modules/@types/sha.js/index.d.ts","../../../node_modules/@types/sinon/ts3.1/index.d.ts","../../../node_modules/@types/superagent/index.d.ts","../../../node_modules/@types/urijs/dom-monkeypatch.d.ts","../../../node_modules/@types/urijs/index.d.ts","../../../node_modules/@types/utf8/index.d.ts","../../../node_modules/@types/ws/index.d.ts","../../../node_modules/@types/yargs-parser/index.d.ts","../../../node_modules/@types/yargs/index.d.ts","../../../node_modules/bignumber.js/bignumber.d.ts","../../../types/bignumber.js/index.d.ts","../../../types/express/index.d.ts","../../../types/keccak/index.d.ts","../../../node_modules/should/should.d.ts","../../../types/should-sinon/index.d.ts"],"fileInfos":[{"version":"ac3a8c4040e183ce38da69d23b96939112457d1936198e6542672b7963cf0fce","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","e6b724280c694a9f588847f754198fb96c43d805f065c3a5b28bbc9594541c84","e21c071ca3e1b4a815d5f04a7475adcaeea5d64367e840dd0154096d705c3940",{"version":"1dad4fe1561d99dfd6709127608b99a76e5c2643626c800434f99c48038567ee","affectsGlobalScope":true},{"version":"cce43d02223f8049864f8568bed322c39424013275cd3bcc3f51492d8b546cb3","affectsGlobalScope":true},{"version":"43fb1d932e4966a39a41b464a12a81899d9ae5f2c829063f5571b6b87e6d2f9c","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"8dff1b4c2df638fcd976cbb0e636f23ab5968e836cd45084cc31d47d1ab19c49","affectsGlobalScope":true},{"version":"2bb4b3927299434052b37851a47bf5c39764f2ba88a888a107b32262e9292b7c","affectsGlobalScope":true},{"version":"810627a82ac06fb5166da5ada4159c4ec11978dfbb0805fe804c86406dab8357","affectsGlobalScope":true},{"version":"62d80405c46c3f4c527ee657ae9d43fda65a0bf582292429aea1e69144a522a6","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"8f4c9f651c8294a2eb1cbd12581fe25bfb901ab1d474bb93cd38c7e2f4be7a30","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"12a310447c5d23c7d0d5ca2af606e3bd08afda69100166730ab92c62999ebb9d","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"df9c8a72ca8b0ed62f5470b41208a0587f0f73f0a7db28e5a1272cf92537518e","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"93544ca2f26a48716c1b6c5091842cad63129daac422dfa4bc52460465f22bb1","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"60761e6ea886034af0f294f025a7199360ce4e2c8ba4ec6408bc049cf9b89799","affectsGlobalScope":true},{"version":"7435b75fdf3509622e79622dbe5091cf4b09688410ee2034e4fc17d0c99d0862","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"9f1817f7c3f02f6d56e0f403b927e90bb133f371dcebc36fa7d6d208ef6899da","affectsGlobalScope":true},{"version":"506b80b9951c9381dc5f11897b31fca5e2a65731d96ddefa19687fbc26b23c6e","affectsGlobalScope":true},"09df3b4f1c937f02e7fee2836d4c4d7a63e66db70fd4d4e97126f4542cc21d9d","7394959e5a741b185456e1ef5d64599c36c60a323207450991e7a42e08911419","4967529644e391115ca5592184d4b63980569adf60ee685f968fd59ab1557188","5929864ce17fba74232584d90cb721a89b7ad277220627cc97054ba15a98ea8f","7180c03fd3cb6e22f911ce9ba0f8a7008b1a6ddbe88ccf16a9c8140ef9ac1686","25c8056edf4314820382a5fdb4bb7816999acdcb929c8f75e3f39473b87e85bc","54cb85a47d760da1c13c00add10d26b5118280d44d58e6908d8e89abbd9d7725","3e4825171442666d31c845aeb47fcd34b62e14041bb353ae2b874285d78482aa","c6fd2c5a395f2432786c9cb8deb870b9b0e8ff7e22c029954fabdd692bff6195","a967bfe3ad4e62243eb604bf956101e4c740f5921277c60debaf325c1320bf88","e9775e97ac4877aebf963a0289c81abe76d1ec9a2a7778dbe637e5151f25c5f3","471e1da5a78350bc55ef8cef24eb3aca6174143c281b8b214ca2beda51f5e04a","cadc8aced301244057c4e7e73fbcae534b0f5b12a37b150d80e5a45aa4bebcbd","385aab901643aa54e1c36f5ef3107913b10d1b5bb8cbcd933d4263b80a0d7f20","9670d44354bab9d9982eca21945686b5c24a3f893db73c0dae0fd74217a4c219","db3435f3525cd785bf21ec6769bf8da7e8a776be1a99e2e7efb5f244a2ef5fee","c3b170c45fc031db31f782e612adf7314b167e60439d304b49e704010e7bafe5","40383ebef22b943d503c6ce2cb2e060282936b952a01bea5f9f493d5fb487cc7","4893a895ea92c85345017a04ed427cbd6a1710453338df26881a6019432febdd","3a84b7cb891141824bd00ef8a50b6a44596aded4075da937f180c90e362fe5f6","13f6f39e12b1518c6650bbb220c8985999020fe0f21d818e28f512b7771d00f9","9b5369969f6e7175740bf51223112ff209f94ba43ecd3bb09eefff9fd675624a","4fe9e626e7164748e8769bbf74b538e09607f07ed17c2f20af8d680ee49fc1da","24515859bc0b836719105bb6cc3d68255042a9f02a6022b3187948b204946bd2","33203609eba548914dc83ddf6cadbc0bcb6e8ef89f6d648ca0908ae887f9fcc5","0db18c6e78ea846316c012478888f33c11ffadab9efd1cc8bcc12daded7a60b6","89167d696a849fce5ca508032aabfe901c0868f833a8625d5a9c6e861ef935d2","e53a3c2a9f624d90f24bf4588aacd223e7bec1b9d0d479b68d2f4a9e6011147f","339dc5265ee5ed92e536a93a04c4ebbc2128f45eeec6ed29f379e0085283542c","9f0a92164925aa37d4a5d9dd3e0134cff8177208dba55fd2310cd74beea40ee2","8bfdb79bf1a9d435ec48d9372dc93291161f152c0865b81fc0b2694aedb4578d","2e85db9e6fd73cfa3d7f28e0ab6b55417ea18931423bd47b409a96e4a169e8e6","c46e079fe54c76f95c67fb89081b3e399da2c7d109e7dca8e4b58d83e332e605","d32275be3546f252e3ad33976caf8c5e842c09cb87d468cb40d5f4cf092d1acc","4a0c3504813a3289f7fb1115db13967c8e004aa8e4f8a9021b95285502221bd1",{"version":"4d719cfab49ae4045d15cb6bed0f38ad3d7d6eb7f277d2603502a0f862ca3182","affectsGlobalScope":true},"cce1f5f86974c1e916ec4a8cab6eec9aa8e31e8148845bf07fbaa8e1d97b1a2c",{"version":"5a856afb15f9dc9983faa391dde989826995a33983c1cccb173e9606688e9709","affectsGlobalScope":true},"546ab07e19116d935ad982e76a223275b53bff7771dab94f433b7ab04652936e","7b43160a49cf2c6082da0465876c4a0b164e160b81187caeb0a6ca7a281e85ba",{"version":"aefb5a4a209f756b580eb53ea771cca8aad411603926f307a5e5b8ec6b16dcf6","affectsGlobalScope":true},"a40826e8476694e90da94aa008283a7de50d1dafd37beada623863f1901cb7fb","daece0d85f8783595463f509f7d82b03b2c210cc064cc793096b5f9c73a6db43","b86e1a45b29437f3a99bad4147cb9fe2357617e8008c0484568e5bb5138d6e13","b5b719a47968cd61a6f83f437236bb6fe22a39223b6620da81ef89f5d7a78fb7","42c431e7965b641106b5e25ab3283aa4865ca7bb9909610a2abfa6226e4348be","0b7e732af0a9599be28c091d6bd1cb22c856ec0d415d4749c087c3881ca07a56","b7fe70be794e13d1b7940e318b8770cd1fb3eced7707805318a2e3aaac2c3e9e",{"version":"2c71199d1fc83bf17636ad5bf63a945633406b7b94887612bba4ef027c662b3e","affectsGlobalScope":true},{"version":"bd27e23daf177808fc4b00c86f7d67d64dc42bbc3c855ea41bfed7a529150a1d","affectsGlobalScope":true},"3b4c85eea12187de9929a76792b98406e8778ce575caca8c574f06da82622c54","f788131a39c81e0c9b9e463645dd7132b5bc1beb609b0e31e5c1ceaea378b4df","0c236069ce7bded4f6774946e928e4b3601894d294054af47a553f7abcafe2c1","21894466693f64957b9bd4c80fa3ec7fdfd4efa9d1861e070aca23f10220c9b2","396a8939b5e177542bdf9b5262b4eee85d29851b2d57681fa9d7eae30e225830","21773f5ac69ddf5a05636ba1f50b5239f4f2d27e4420db147fc2f76a5ae598ac",{"version":"6ec93c745c5e3e25e278fa35451bf18ef857f733de7e57c15e7920ac463baa2a","affectsGlobalScope":true},"a5fe4cc622c3bf8e09ababde5f4096ceac53163eefcd95e9cd53f062ff9bb67a","30c2ec6abf6aaa60eb4f32fb1235531506b7961c6d1bdc7430711aec8fd85295","0f05c06ff6196958d76b865ae17245b52d8fe01773626ac3c43214a2458ea7b7",{"version":"603df4e91a0c2fd815c6619927468373fb00b6c13066334982ee684f5c7d40b2","affectsGlobalScope":true},{"version":"d48009cbe8a30a504031cc82e1286f78fed33b7a42abf7602c23b5547b382563","affectsGlobalScope":true},"7aaeb5e62f90e1b2be0fc4844df78cdb1be15c22b427bc6c39d57308785b8f10","3ba30205a029ebc0c91d7b1ab4da73f6277d730ca1fc6692d5a9144c6772c76b","d8dba11dc34d50cb4202de5effa9a1b296d7a2f4a029eec871f894bddfb6430d","8b71dd18e7e63b6f991b511a201fad7c3bf8d1e0dd98acb5e3d844f335a73634","01d8e1419c84affad359cc240b2b551fb9812b450b4d3d456b64cda8102d4f60","458b216959c231df388a5de9dcbcafd4b4ca563bc3784d706d0455467d7d4942","269929a24b2816343a178008ac9ae9248304d92a8ba8e233055e0ed6dbe6ef71","93452d394fdd1dc551ec62f5042366f011a00d342d36d50793b3529bfc9bd633","f8c87b19eae111f8720b0345ab301af8d81add39621b63614dfc2d15fd6f140a","831c22d257717bf2cbb03afe9c4bcffc5ccb8a2074344d4238bf16d3a857bb12",{"version":"24ba151e213906027e2b1f5223d33575a3612b0234a0e2b56119520bbe0e594b","affectsGlobalScope":true},{"version":"cbf046714f3a3ba2544957e1973ac94aa819fa8aa668846fa8de47eb1c41b0b2","affectsGlobalScope":true},"aa34c3aa493d1c699601027c441b9664547c3024f9dbab1639df7701d63d18fa","eae74e3d50820f37c72c0679fed959cd1e63c98f6a146a55b8c4361582fa6a52","7c651f8dce91a927ab62925e73f190763574c46098f2b11fb8ddc1b147a6709a","7440ab60f4cb031812940cc38166b8bb6fbf2540cfe599f87c41c08011f0c1df",{"version":"aed89e3c18f4c659ee8153a76560dffda23e2d801e1e60d7a67abd84bc555f8d","affectsGlobalScope":true},{"version":"527e6e7c1e60184879fe97517f0d51dbfab72c4625cef50179f27f46d7fd69a1","affectsGlobalScope":true},"e393915d3dc385e69c0e2390739c87b2d296a610662eb0b1cb85224e55992250","2f940651c2f30e6b29f8743fae3f40b7b1c03615184f837132b56ea75edad08b","5749c327c3f789f658072f8340786966c8b05ea124a56c1d8d60e04649495a4d",{"version":"c9d62b2a51b2ff166314d8be84f6881a7fcbccd37612442cf1c70d27d5352f50","affectsGlobalScope":true},"e7dbf5716d76846c7522e910896c5747b6df1abd538fee8f5291bdc843461795",{"version":"ab9b9a36e5284fd8d3bf2f7d5fcbc60052f25f27e4d20954782099282c60d23e","affectsGlobalScope":true},"652ee9c5103e89102d87bc20d167a02a0e3e5e53665674466c8cfea8a9e418c7","a5193be78a634ab211a471d41295c21d5f54675a97330b9a1720b8e41887cc10","83c1ba8b6d747485ff09206e7c5d7532f3b44a8bfcb002e48f50f5f051ea9a4a","43b31498c95a593f3f7168b16ff68ea04e2e6c84f0fd68202e356286c79040f9","f76f38c4ccedb027993c1077a86faf5e385a0010a1471e9936ff161834149918","72ae38e969e3e8fb7631f9b8c4974bd18af9b6cd075d11c354a6c41538ff3f86","b78b543da8c56fd11295b7154b6b17478797cf4fd2a236729d2701d166d91f00","98f9f2089fcc21cf8be6bc6d4c0c20b5f6933a7fe36f57b01c4951eb0482bca9","1006c614527de8832eb5f8c6de68ca910b0bac25d931cfb459884b52fc2b9aea","d19103d893cfada4d66b3947d20d14d9e1431d3ba16a66d87985a5668aae2160","172035de856c114189c089c5bcec0dc47716ee562946ac8d4e10a96cd54b16c9","7c559565fe235c8452dc846365e1bd06ad0ebca510a3c4949d89a05d472e204e","9d87d7b67c0ad1cc456e0bed96faab74d68cd16443521dbee249c94d7093bc43",{"version":"70c9489a550926570bc9221f2efa53a4833e8bfb5455993156452dedb11a999d","signature":"875b546e158c428c79b93ac5a518d2618b346829bd3bd9c945bed3728fe10afa"},"d3e650b5e80f003e83a9b959b92a61d494a898703b95d8adb4d418a8e73ae843",{"version":"da002f8b3215d0d7bba093c7eb16ce1250c8dc488c9df78da94a7a6aa2477ff7","signature":"49f562f1b8637be95fa72606652bdca732095d1249a5432e42b52b6cfbdf1a1b","affectsGlobalScope":true},"c31294ba7381e921caa30d4408fa7637053d9cb3456a750f276fd8a9bb0e42d8","338bd7c3518b05b4c473971be0e5f8f854aca7cdb00d1b97192c14860f4ebf2f","01f7828047b5c6703d3c601473618b448f5506a88fcac852638b0715c3abf4eb","e91751abb2372a36a90869d36f6ad5d5e69a84c5513ca99d236554e4dd8b9aa1","5cbc27193321e6ba10f4e9f3c5519649d9e2716cf103efd7eaa7a89e0f8ed1d4","fec943fdb3275eb6e006b35e04a8e2e99e9adf3f4b969ddf15315ac7575a93e4","cab425b5559edac18327eb2c3c0f47e7e9f71b667290b7689faafd28aac69eae","3cfb0cb51cc2c2e1b313d7c4df04dbf7e5bda0a133c6b309bf6af77cf614b971","f992cd6cc0bcbaa4e6c810468c90f2d8595f8c6c3cf050c806397d3de8585562","6d829824ead8999f87b6df21200df3c6150391b894b4e80662caa462bd48d073","8d48b8f8a377ade8dd1f000625bc276eea067f2529cc9cafdf082d17142107d6","f5011428f5bc27b1e1624e627a9c455185a15b762f23e4cdbdaf82e2dff767b9","6a9c5127096b35264eb7cd21b2417bfc1d42cceca9ba4ce2bb0c3410b7816042","78828b06c0d3b586954015e9ebde5480b009e166c71244763bda328ec0920f41","e86f1ef04706b7c7f3955bcb6db09f559ad7b33f08a29f30e03283d53b17750c","b8a427b9fe88504a6fb092e21adfe272d144394a2ced7f9e4adc3de7efa6e216",{"version":"64d4b35c5456adf258d2cf56c341e203a073253f229ef3208fc0d5020253b241","affectsGlobalScope":true},"bee89e1eb6425eb49894f3f25e4562dc2564e84e5aa7610b7e13d8ecddf8f5db","f3e604694b624fa3f83f6684185452992088f5efb2cf136b62474aa106d6f1b6","dea2650c477f53d503a27f78ed17b13d7184c2f922eb4d3367ccf52634765467","e050a0afcdbb269720a900c85076d18e0c1ab73e580202a2bf6964978181222a","085d4c9f010e6f363961dd1939a851d029b97994f705d79f2a72a0c88a5c4bc5",{"version":"16a14d16cdf08b9a913f46e4a0e4d423158065b0ee276378775d5d5616059cfa","affectsGlobalScope":true},"a639a78cbf73be91da5c954684b705e98e3b809d6c8e0026b114cda70802c37c","975f84de013567851d216d78a3a86736bb330cae11fdc907b222dffa148b31d2","ed19da84b7dbf00952ad0b98ce5c194f1903bcf7c94d8103e8e0d63b271543ae","ee65fe452abe1309389c5f50710f24114e08a302d40708101c4aa950a2a7d044",{"version":"51d5f2027771221d30dbb2a45dcd35d06164e1842ad6c2e9058bc6bbe90a02e9","affectsGlobalScope":true},"96d14f21b7652903852eef49379d04dbda28c16ed36468f8c9fa08f7c14c9538","6503fb6addf62f9b10f8564d9869ad824565a914ec1ac3dd7d13da14a3f57036","675e702f2032766a91eeadee64f51014c64688525da99dccd8178f0c599f13a8","458111fc89d11d2151277c822dfdc1a28fa5b6b2493cf942e37d4cd0a6ee5f22","d70c026dd2eeaa974f430ea229230a1897fdb897dc74659deebe2afd4feeb08f","187119ff4f9553676a884e296089e131e8cc01691c546273b1d0089c3533ce42","febf0b2de54781102b00f61653b21377390a048fbf5262718c91860d11ff34a6","98f9d826db9cd99d27a01a59ee5f22863df00ccf1aaf43e1d7db80ebf716f7c3","0aaef8cded245bf5036a7a40b65622dd6c4da71f7a35343112edbe112b348a1e","00baffbe8a2f2e4875367479489b5d43b5fc1429ecb4a4cc98cfc3009095f52a","dcd91d3b697cb650b95db5471189b99815af5db2a1cd28760f91e0b12ede8ed5","3c92b6dfd43cc1c2485d9eba5ff0b74a19bb8725b692773ef1d66dac48cda4bd","3cf0d343c2276842a5b617f22ba82af6322c7cfe8bb52238ffc0c491a3c21019","df996e25faa505f85aeb294d15ebe61b399cf1d1e49959cdfaf2cc0815c203f9",{"version":"f2eff8704452659641164876c1ef0df4174659ce7311b0665798ea3f556fa9ad","affectsGlobalScope":true},"0e60e0cbf2283adfd5a15430ae548cd2f662d581b5da6ecd98220203e7067c70","f313731860257325f13351575f381fef333d4dfe30daf5a2e72f894208feea08","951b37f7d86f6012f09e6b35f1de57c69d75f16908cb0adaa56b93675ea0b853","3816fc03ffd9cbd1a7a3362a264756a4a1d547caabea50ca68303046be40e376","0c417b4ec46b88fb62a43ec00204700b560d01eb5677c7faa8ecd34610f096a8","13d29cdeb64e8496424edf42749bbb47de5e42d201cf958911a4638cbcffbd3f","0f9e381eecc5860f693c31fe463b3ca20a64ca9b8db0cf6208cd4a053f064809","95902d5561c6aac5dfc40568a12b0aca324037749dcd32a81f23423bfde69bab","5dfb2aca4136abdc5a2740f14be8134a6e6b66fd53470bb2e954e40f8abfaf3e","577463167dd69bd81f76697dfc3f7b22b77a6152f60a602a9218e52e3183ad67","b8396e9024d554b611cbe31a024b176ba7116063d19354b5a02dccd8f0118989","4b28e1c5bf88d891e07a1403358b81a51b3ba2eae1ffada51cca7476b5ac6407","7150ad575d28bf98fae321a1c0f10ad17b127927811f488ded6ff1d88d4244e5","8b155c4757d197969553de3762c8d23d5866710301de41e1b66b97c9ed867003","93733466609dd8bf72eace502a24ca7574bd073d934216e628f1b615c8d3cb3c","45e9228761aabcadb79c82fb3008523db334491525bdb8e74e0f26eaf7a4f7f4","aeacac2778c9821512b6b889da79ac31606a863610c8f28da1e483579627bf90","569fdb354062fc098a6a3ba93a029edf22d6fe480cf72b231b3c07832b2e7c97","bf9876e62fb7f4237deafab8c7444770ef6e82b4cad2d5dc768664ff340feeb2","6cf60e76d37faf0fbc2f80a873eab0fd545f6b1bf300e7f0823f956ddb3083e9","6adaa6103086f931e3eee20f0987e86e8879e9d13aa6bd6075ccfc58b9c5681c","ee0af0f2b8d3b4d0baf669f2ff6fcef4a8816a473c894cc7c905029f7505fed0","c757372a092924f5c16eaf11a1475b80b95bb4dae49fe3242d2ad908f97d5abe","8841e2aa774b89bd23302dede20663306dc1b9902431ac64b24be8b8d0e3f649","209e814e8e71aec74f69686a9506dd7610b97ab59dcee9446266446f72a76d05",{"version":"3f6d6465811321abc30a1e5f667feed63e5b3917b3d6c8d6645daf96c75f97ba","affectsGlobalScope":true},"6fa0008bf91a4cc9c8963bace4bba0bd6865cbfa29c3e3ccc461155660fb113a","2b8264b2fefd7367e0f20e2c04eed5d3038831fe00f5efbc110ff0131aab899b","a73a445c1e0a6d0f8b48e8eb22dc9d647896783a7f8991cbbc31c0d94bf1f5a2","e7500c5c071db4d1e20e87166be266f489dd632b738e885b221e6efa6c8efe89","bd85e061719661505dc7c273cb72a4c7fba05fb4e24520e8caca9f9f074462c3","e109f5f766ef2fb64aa3c0a8918ebfb66c011f3f43611b536512675bc1d32834","3dce33e7eb25594863b8e615f14a45ab98190d85953436750644212d8a18c066","2b93035328f7778d200252681c1d86285d501ed424825a18f81e4c3028aa51d9","2ac9c8332c5f8510b8bdd571f8271e0f39b0577714d5e95c1e79a12b2616f069","42c21aa963e7b86fa00801d96e88b36803188018d5ad91db2a9101bccd40b3ff","d31eb848cdebb4c55b4893b335a7c0cca95ad66dee13cbb7d0893810c0a9c301","77c1d91a129ba60b8c405f9f539e42df834afb174fe0785f89d92a2c7c16b77a","7a9e0a564fee396cacf706523b5aeed96e04c6b871a8bebefad78499fbffc5bc","906c751ef5822ec0dadcea2f0e9db64a33fb4ee926cc9f7efa38afe5d5371b2a","5387c049e9702f2d2d7ece1a74836a14b47fbebe9bbeb19f94c580a37c855351","c68391fb9efad5d99ff332c65b1606248c4e4a9f1dd9a087204242b56c7126d6","e9cf02252d3a0ced987d24845dcb1f11c1be5541f17e5daa44c6de2d18138d0c","e8b02b879754d85f48489294f99147aeccc352c760d95a6fe2b6e49cd400b2fe","9f6908ab3d8a86c68b86e38578afc7095114e66b2fc36a2a96e9252aac3998e0","0eedb2344442b143ddcd788f87096961cd8572b64f10b4afc3356aa0460171c6","71405cc70f183d029cc5018375f6c35117ffdaf11846c35ebf85ee3956b1b2a6","c68baff4d8ba346130e9753cefe2e487a16731bf17e05fdacc81e8c9a26aae9d","2cd15528d8bb5d0453aa339b4b52e0696e8b07e790c153831c642c3dea5ac8af","479d622e66283ffa9883fbc33e441f7fc928b2277ff30aacbec7b7761b4e9579","ade307876dc5ca267ca308d09e737b611505e015c535863f22420a11fffc1c54","f8cdefa3e0dee639eccbe9794b46f90291e5fd3989fcba60d2f08fde56179fb9","86c5a62f99aac7053976e317dbe9acb2eaf903aaf3d2e5bb1cafe5c2df7b37a8","2b300954ce01a8343866f737656e13243e86e5baef51bd0631b21dcef1f6e954","a2d409a9ffd872d6b9d78ead00baa116bbc73cfa959fce9a2f29d3227876b2a1","b288936f560cd71f4a6002953290de9ff8dfbfbf37f5a9391be5c83322324898","61178a781ef82e0ff54f9430397e71e8f365fc1e3725e0e5346f2de7b0d50dfa","6a6ccb37feb3aad32d9be026a3337db195979cd5727a616fc0f557e974101a54","c649ea79205c029a02272ef55b7ab14ada0903db26144d2205021f24727ac7a3","38e2b02897c6357bbcff729ef84c736727b45cc152abe95a7567caccdfad2a1d","d6610ea7e0b1a7686dba062a1e5544dd7d34140f4545305b7c6afaebfb348341","3dee35db743bdba2c8d19aece7ac049bde6fa587e195d86547c882784e6ba34c","b15e55c5fa977c2f25ca0b1db52cfa2d1fd4bf0baf90a8b90d4a7678ca462ff1","f41d30972724714763a2698ae949fbc463afb203b5fa7c4ad7e4de0871129a17","843dd7b6a7c6269fd43827303f5cbe65c1fecabc30b4670a50d5a15d57daeeb9","f06d8b8567ee9fd799bf7f806efe93b67683ef24f4dea5b23ef12edff4434d9d","6017384f697ff38bc3ef6a546df5b230c3c31329db84cbfe686c83bec011e2b2","e1a5b30d9248549ca0c0bb1d653bafae20c64c4aa5928cc4cd3017b55c2177b0","a593632d5878f17295bd53e1c77f27bf4c15212822f764a2bfc1702f4b413fa0","a868a534ba1c2ca9060b8a13b0ffbbbf78b4be7b0ff80d8c75b02773f7192c29","da7545aba8f54a50fde23e2ede00158dc8112560d934cee58098dfb03aae9b9d","34baf65cfee92f110d6653322e2120c2d368ee64b3c7981dff08ed105c4f19b0","6aee496bf0ecfbf6731aa8cca32f4b6e92cdc0a444911a7d88410408a45ecc5d","b6a6fb3519346f9cd67d89bb7455138328691b1780688fac1febe03ae3648cd9","168435ab3390620aebf1aa0001b380983582d0849755eeb17f2c501d1fc57587","31c502014e5ba046d5cb060136929b73fd53f0f989aa37b2b0424644cb0d93ef",{"version":"159733de19927f949b83112a45b7c52ebc0bbad1605a668d5c19ba65e0ee9128","affectsGlobalScope":true},{"version":"c16dbaa3868bacd3383a553f462f20fa8fa671dfa1e92ac464a5c7ffcfcc37c9","affectsGlobalScope":true},"a6a80d576cb7beda26af64d1e0a23e382c9986fae214de994870f4cd7b4e0ea1","bc81aff061c53a7140270555f4b22da4ecfe8601e8027cf5aa175fbdc7927c31","70e9a18da08294f75bf23e46c7d69e67634c0765d355887b9b41f0d959e1426e","b7b0003c5404c9cae2d7caf5d6b469b190cea06cce7815ba0e479a4457875290","a2d875a97eeee8872d7a6d30c65fc2c19aee4fca3b98edda1c2f5ce7323c16da","1cf13a0e412ccde6ac154f59ad8e7c04ec603951a090c7799e107e5aff594c5c",{"version":"70f0ddc58f8b7283e1cffa39863938ab694e14fb3dcf0cac4d78b2d002f91255","affectsGlobalScope":true},{"version":"00e7b47f372bb59d96a4d8007f83d389f8e3010617150a256e26e1be8a6a5995","affectsGlobalScope":true},{"version":"79da89e1b61cecf107f52a0c2578f31528bc0accdc73bec7325f468a5706a559","affectsGlobalScope":true},"4de163cf9037509faf9276540c717c0879309ee4e385b5ccfe6de54868d50de1"],"options":{"composite":true,"declaration":true,"declarationMap":true,"inlineSourceMap":true,"inlineSources":true,"module":1,"noFallthroughCasesInSwitch":true,"noImplicitThis":true,"outDir":"./","rootDir":"..","skipLibCheck":true,"strictFunctionTypes":true,"strictNullChecks":true,"strictPropertyInitialization":true,"target":6},"fileIdsList":[[119],[119,138],[119,139],[119,126],[119,145],[89,92,118,119,126,147,148,149],[92,119,126],[82,119,126],[119,154],[119,144],[119,159,161],[119,158,159,160],[119,126,144],[119,164],[90,119,126],[89,119,126],[119,172,174,175,176,177,178,179,180,181,182,183,184],[119,172,173,175,176,177,178,179,180,181,182,183,184],[119,173,174,175,176,177,178,179,180,181,182,183,184],[119,172,173,174,176,177,178,179,180,181,182,183,184],[119,172,173,174,175,177,178,179,180,181,182,183,184],[119,172,173,174,175,176,178,179,180,181,182,183,184],[119,172,173,174,175,176,177,179,180,181,182,183,184],[119,172,173,174,175,176,177,178,180,181,182,183,184],[119,172,173,174,175,176,177,178,179,181,182,183,184],[119,172,173,174,175,176,177,178,179,180,182,183,184],[119,172,173,174,175,176,177,178,179,180,181,183,184],[119,172,173,174,175,176,177,178,179,180,181,182,184],[119,172,173,174,175,176,177,178,179,180,181,182,183],[119,205],[119,190],[119,194,195,196],[119,193],[119,195],[119,171,191,192,197,200,202,203,204],[119,192,198,199,205],[119,198,201],[119,192,193,198,205],[119,192,205],[119,186,187,188,189],[40,119],[76,119],[77,82,110,119],[78,89,90,97,107,118,119],[78,79,89,97,119],[80,119],[81,82,90,98,119],[82,107,115,119],[83,85,89,97,119],[84,119],[85,86,119],[89,119],[87,89,119],[89,90,91,107,118,119],[89,90,91,104,107,110,119],[74,119,123],[85,89,92,97,107,118,119],[89,90,92,93,97,107,115,118,119],[92,94,107,115,118,119],[40,41,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,122,123,124,125],[89,95,119],[96,118,119,123],[85,89,97,107,119],[98,119],[99,119],[76,100,119],[101,117,119,123],[102,119],[103,119],[89,104,105,119],[104,106,119,121],[77,89,107,108,109,110,119],[77,107,109,119],[107,108,119],[110,119],[111,119],[76,107,119],[89,113,114,119],[113,114,119],[82,97,107,115,119],[116,119],[97,117,119],[77,92,103,118,119],[82,119],[107,119,120],[96,119,121],[119,122],[77,82,89,91,100,107,118,119,121,123],[107,119,124],[107,119,126],[92,107,119,126],[119,218,257],[119,218,242,257],[119,257],[119,218],[119,218,243,257],[119,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],[119,243,257],[77,90,92,107,119,126,152],[119,261],[89,92,94,97,107,115,118,119,124,126],[119,265],[119,129,130,131,132,133,134,135,137],[77,107,119,126,127,130],[77,107,119,126,127,128,129],[107,119,130],[77,107,119,126,127],[119,133,136],[107,119,127],[77,107,119,126],[51,55,118,119],[51,107,118,119],[46,119],[48,51,115,118,119],[97,115,119],[46,119,126],[48,51,97,118,119],[43,44,47,50,77,89,107,118,119],[43,49,119],[47,51,77,110,118,119,126],[77,119,126],[67,77,119,126],[45,46,119,126],[51,119],[45,46,47,48,49,50,51,52,53,55,56,57,58,59,60,61,62,63,64,65,66,68,69,70,71,72,73,119],[51,58,59,119],[49,51,59,60,119],[50,119],[43,46,51,119],[51,55,59,60,119],[55,119],[49,51,54,118,119],[43,48,49,51,55,58,119],[77,107,119],[46,51,67,77,119,123,126],[119,267],[119,271]],"referencedMap":[[141,1],[139,2],[140,3],[142,1],[143,1],[144,4],[146,5],[150,6],[151,7],[152,1],[153,8],[155,9],[156,4],[157,10],[162,11],[158,1],[161,12],[159,1],[163,13],[164,1],[165,14],[166,1],[167,15],[168,1],[148,1],[169,1],[160,1],[170,1],[147,16],[171,1],[173,17],[174,18],[172,19],[175,20],[176,21],[177,22],[178,23],[179,24],[180,25],[181,26],[182,27],[183,28],[184,29],[185,1],[206,30],[191,31],[197,32],[195,1],[194,33],[196,34],[205,35],[200,36],[202,37],[203,38],[204,39],[198,1],[199,39],[201,39],[193,39],[192,1],[187,1],[186,1],[189,31],[190,40],[188,31],[207,1],[208,1],[209,1],[210,1],[154,1],[40,41],[41,41],[76,42],[77,43],[78,44],[79,45],[80,46],[81,47],[82,48],[83,49],[84,50],[85,51],[86,51],[88,52],[87,53],[89,52],[90,54],[91,55],[75,56],[125,1],[92,57],[93,58],[94,59],[126,60],[95,61],[96,62],[97,63],[98,64],[99,65],[100,66],[101,67],[102,68],[103,69],[104,70],[105,70],[106,71],[107,72],[109,73],[108,74],[110,75],[111,76],[112,77],[113,78],[114,79],[115,80],[116,81],[117,82],[118,83],[119,84],[120,85],[121,86],[122,87],[123,88],[124,89],[211,1],[212,1],[213,4],[214,90],[215,1],[216,8],[149,91],[217,4],[242,92],[243,93],[218,94],[221,94],[240,92],[241,92],[231,92],[230,95],[228,92],[223,92],[236,92],[234,92],[238,92],[222,92],[235,92],[239,92],[224,92],[225,92],[237,92],[219,92],[226,92],[227,92],[229,92],[233,92],[244,96],[232,92],[220,92],[257,97],[256,1],[251,96],[253,98],[252,96],[245,96],[246,96],[248,96],[250,96],[254,98],[255,98],[247,98],[249,98],[258,8],[259,1],[260,99],[261,1],[262,100],[263,1],[264,101],[265,1],[266,102],[145,4],[267,1],[42,1],[138,103],[131,104],[130,105],[132,106],[133,107],[135,1],[136,1],[137,108],[134,1],[129,1],[128,109],[127,110],[271,1],[8,1],[10,1],[9,1],[2,1],[11,1],[12,1],[13,1],[14,1],[15,1],[16,1],[17,1],[18,1],[3,1],[4,1],[22,1],[19,1],[20,1],[21,1],[23,1],[24,1],[25,1],[5,1],[26,1],[27,1],[28,1],[29,1],[6,1],[30,1],[31,1],[32,1],[33,1],[7,1],[38,1],[34,1],[35,1],[36,1],[37,1],[1,1],[39,1],[58,111],[65,112],[57,111],[72,113],[49,114],[48,115],[71,4],[66,116],[69,117],[51,118],[50,119],[46,120],[45,121],[68,122],[47,123],[52,124],[53,1],[56,124],[43,1],[74,125],[73,124],[60,126],[61,127],[63,128],[59,129],[62,130],[67,4],[54,131],[55,132],[64,133],[44,134],[70,135],[268,136],[269,1],[270,1],[272,137]],"exportedModulesMap":[[140,3],[142,1],[143,1],[144,4],[146,5],[150,6],[151,7],[152,1],[153,8],[155,9],[156,4],[157,10],[162,11],[158,1],[161,12],[159,1],[163,13],[164,1],[165,14],[166,1],[167,15],[168,1],[148,1],[169,1],[160,1],[170,1],[147,16],[171,1],[173,17],[174,18],[172,19],[175,20],[176,21],[177,22],[178,23],[179,24],[180,25],[181,26],[182,27],[183,28],[184,29],[185,1],[206,30],[191,31],[197,32],[195,1],[194,33],[196,34],[205,35],[200,36],[202,37],[203,38],[204,39],[198,1],[199,39],[201,39],[193,39],[192,1],[187,1],[186,1],[189,31],[190,40],[188,31],[207,1],[208,1],[209,1],[210,1],[154,1],[40,41],[41,41],[76,42],[77,43],[78,44],[79,45],[80,46],[81,47],[82,48],[83,49],[84,50],[85,51],[86,51],[88,52],[87,53],[89,52],[90,54],[91,55],[75,56],[125,1],[92,57],[93,58],[94,59],[126,60],[95,61],[96,62],[97,63],[98,64],[99,65],[100,66],[101,67],[102,68],[103,69],[104,70],[105,70],[106,71],[107,72],[109,73],[108,74],[110,75],[111,76],[112,77],[113,78],[114,79],[115,80],[116,81],[117,82],[118,83],[119,84],[120,85],[121,86],[122,87],[123,88],[124,89],[211,1],[212,1],[213,4],[214,90],[215,1],[216,8],[149,91],[217,4],[242,92],[243,93],[218,94],[221,94],[240,92],[241,92],[231,92],[230,95],[228,92],[223,92],[236,92],[234,92],[238,92],[222,92],[235,92],[239,92],[224,92],[225,92],[237,92],[219,92],[226,92],[227,92],[229,92],[233,92],[244,96],[232,92],[220,92],[257,97],[256,1],[251,96],[253,98],[252,96],[245,96],[246,96],[248,96],[250,96],[254,98],[255,98],[247,98],[249,98],[258,8],[259,1],[260,99],[261,1],[262,100],[263,1],[264,101],[265,1],[266,102],[145,4],[267,1],[42,1],[138,103],[131,104],[130,105],[132,106],[133,107],[135,1],[136,1],[137,108],[134,1],[129,1],[128,109],[127,110],[271,1],[8,1],[10,1],[9,1],[2,1],[11,1],[12,1],[13,1],[14,1],[15,1],[16,1],[17,1],[18,1],[3,1],[4,1],[22,1],[19,1],[20,1],[21,1],[23,1],[24,1],[25,1],[5,1],[26,1],[27,1],[28,1],[29,1],[6,1],[30,1],[31,1],[32,1],[33,1],[7,1],[38,1],[34,1],[35,1],[36,1],[37,1],[1,1],[39,1],[58,111],[65,112],[57,111],[72,113],[49,114],[48,115],[71,4],[66,116],[69,117],[51,118],[50,119],[46,120],[45,121],[68,122],[47,123],[52,124],[53,1],[56,124],[43,1],[74,125],[73,124],[60,126],[61,127],[63,128],[59,129],[62,130],[67,4],[54,131],[55,132],[64,133],[44,134],[70,135],[268,136],[269,1],[270,1],[272,137]],"semanticDiagnosticsPerFile":[141,139,140,142,143,144,146,150,151,152,153,155,156,157,162,158,161,159,163,164,165,166,167,168,148,169,160,170,147,171,173,174,172,175,176,177,178,179,180,181,182,183,184,185,206,191,197,195,194,196,205,200,202,203,204,198,199,201,193,192,187,186,189,190,188,207,208,209,210,154,40,41,76,77,78,79,80,81,82,83,84,85,86,88,87,89,90,91,75,125,92,93,94,126,95,96,97,98,99,100,101,102,103,104,105,106,107,109,108,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,211,212,213,214,215,216,149,217,242,243,218,221,240,241,231,230,228,223,236,234,238,222,235,239,224,225,237,219,226,227,229,233,244,232,220,257,256,251,253,252,245,246,248,250,254,255,247,249,258,259,260,261,262,263,264,265,266,145,267,42,138,131,130,132,133,135,136,137,134,129,128,127,271,8,10,9,2,11,12,13,14,15,16,17,18,3,4,22,19,20,21,23,24,25,5,26,27,28,29,6,30,31,32,33,7,38,34,35,36,37,1,39,58,65,57,72,49,48,71,66,69,51,50,46,45,68,47,52,53,56,43,74,73,60,61,63,59,62,67,54,55,64,44,70,268,269,270,272]},"version":"4.3.5"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bitgo-beta/deser-lib",
|
|
3
|
-
"version": "1.0.1-beta.
|
|
3
|
+
"version": "1.0.1-beta.60",
|
|
4
4
|
"description": "BitGo serialization and deseralization library",
|
|
5
5
|
"main": "./dist/src/index.js",
|
|
6
6
|
"types": "./dist/src/index.d.ts",
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"cbor": "^9.0.1"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "ededf8f264151d057e083299120151eb618ee939"
|
|
46
46
|
}
|
package/.prettierignore
DELETED
package/.prettierrc.yml
DELETED
package/src/cbor.ts
DELETED
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
import { decodeFirstSync, encodeCanonical } from 'cbor';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Return a string describing value as a type.
|
|
5
|
-
* @param value - Any javascript value to type.
|
|
6
|
-
* @returns String describing value type.
|
|
7
|
-
*/
|
|
8
|
-
function getType(value: unknown): string {
|
|
9
|
-
if (value === null || value === undefined) {
|
|
10
|
-
return 'null';
|
|
11
|
-
}
|
|
12
|
-
if (value instanceof Array) {
|
|
13
|
-
const types = value.map(getType);
|
|
14
|
-
if (!types.slice(1).every((value) => value === types[0])) {
|
|
15
|
-
throw new Error('Array elements are not of the same type');
|
|
16
|
-
}
|
|
17
|
-
return JSON.stringify([types[0]]);
|
|
18
|
-
}
|
|
19
|
-
if (value instanceof Object) {
|
|
20
|
-
const properties = Object.getOwnPropertyNames(value);
|
|
21
|
-
properties.sort();
|
|
22
|
-
return JSON.stringify(
|
|
23
|
-
properties.reduce((acc, name) => {
|
|
24
|
-
acc[name] = getType(value[name]);
|
|
25
|
-
return acc;
|
|
26
|
-
}, {})
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
if (typeof value === 'string') {
|
|
30
|
-
if (value.startsWith('0x')) {
|
|
31
|
-
return 'bytes';
|
|
32
|
-
}
|
|
33
|
-
return 'string';
|
|
34
|
-
}
|
|
35
|
-
return JSON.stringify(typeof value);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Compare two buffers for sorting.
|
|
40
|
-
* @param a - left buffer to compare to right buffer.
|
|
41
|
-
* @param b - right buffer to compare to left buffer.
|
|
42
|
-
* @returns Negative if a < b, positive if b > a, 0 if equal.
|
|
43
|
-
*/
|
|
44
|
-
function bufferCompare(a: Buffer, b: Buffer): number {
|
|
45
|
-
let i = 0;
|
|
46
|
-
while (i < a.length && i < b.length && a[i] == b[i]) {
|
|
47
|
-
i++;
|
|
48
|
-
}
|
|
49
|
-
if (i === a.length && i === b.length) {
|
|
50
|
-
return 0;
|
|
51
|
-
}
|
|
52
|
-
if (i === a.length || i === b.length) {
|
|
53
|
-
return a.length - b.length;
|
|
54
|
-
}
|
|
55
|
-
return a[i] - b[i];
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/** A sortable array element. */
|
|
59
|
-
type Sortable = {
|
|
60
|
-
weight: number;
|
|
61
|
-
value?: unknown;
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Type check for sortable array element.
|
|
66
|
-
* @param value - Value to type check.
|
|
67
|
-
* @returns True if value is a sortable array element.
|
|
68
|
-
*/
|
|
69
|
-
function isSortable(value: unknown): value is Sortable {
|
|
70
|
-
return value instanceof Object && 'weight' in value && typeof (value as Sortable).weight === 'number';
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Convert number to base 256 and return as a big-endian Buffer.
|
|
75
|
-
* @param value - Value to convert.
|
|
76
|
-
* @returns Buffer representation of the number.
|
|
77
|
-
*/
|
|
78
|
-
function numberToBufferBE(value: number): Buffer {
|
|
79
|
-
// Normalize value so that negative numbers aren't compared higher
|
|
80
|
-
// than positive numbers when accounting for two's complement.
|
|
81
|
-
value += Math.pow(2, 52);
|
|
82
|
-
const byteCount = Math.floor((value.toString(2).length + 7) / 8);
|
|
83
|
-
const buffer = Buffer.alloc(byteCount);
|
|
84
|
-
let i = 0;
|
|
85
|
-
while (value) {
|
|
86
|
-
buffer[i++] = value % 256;
|
|
87
|
-
value = Math.floor(value / 256);
|
|
88
|
-
}
|
|
89
|
-
return buffer.reverse();
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Compare two array elements for sorting.
|
|
94
|
-
* @param a - left element to compare to right element.
|
|
95
|
-
* @param b - right element to compare to left element.
|
|
96
|
-
* @returns Negative if a < b, positive if b > a, 0 if equal.
|
|
97
|
-
*/
|
|
98
|
-
function elementCompare(a: unknown, b: unknown): number {
|
|
99
|
-
if (!isSortable(a) || !isSortable(b)) {
|
|
100
|
-
throw new Error('Array elements must be sortable');
|
|
101
|
-
}
|
|
102
|
-
if (a.weight === b.weight) {
|
|
103
|
-
if (a.value === undefined && b.value === undefined) {
|
|
104
|
-
throw new Error('Array elements must be sortable');
|
|
105
|
-
}
|
|
106
|
-
const aVal = transform(a.value);
|
|
107
|
-
const bVal = transform(b.value);
|
|
108
|
-
if (
|
|
109
|
-
(!Buffer.isBuffer(aVal) && typeof aVal !== 'string' && typeof aVal !== 'number') ||
|
|
110
|
-
(!Buffer.isBuffer(bVal) && typeof bVal !== 'string' && typeof bVal !== 'number')
|
|
111
|
-
) {
|
|
112
|
-
throw new Error('Array element value cannot be compared');
|
|
113
|
-
}
|
|
114
|
-
let aBuf, bBuf;
|
|
115
|
-
if (typeof aVal === 'number') {
|
|
116
|
-
aBuf = numberToBufferBE(aVal);
|
|
117
|
-
} else {
|
|
118
|
-
aBuf = Buffer.from(aVal);
|
|
119
|
-
}
|
|
120
|
-
if (typeof bVal === 'number') {
|
|
121
|
-
bBuf = numberToBufferBE(bVal);
|
|
122
|
-
} else {
|
|
123
|
-
bBuf = Buffer.from(bVal);
|
|
124
|
-
}
|
|
125
|
-
return bufferCompare(aBuf, bBuf);
|
|
126
|
-
}
|
|
127
|
-
return a.weight - b.weight;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Transform value into its canonical, serializable form.
|
|
132
|
-
* @param value - Value to transform.
|
|
133
|
-
* @returns Canonical, serializable form of value.
|
|
134
|
-
*/
|
|
135
|
-
export function transform<T>(value: T): T | Buffer {
|
|
136
|
-
if (value === null || value === undefined) {
|
|
137
|
-
return value;
|
|
138
|
-
}
|
|
139
|
-
if (typeof value === 'string') {
|
|
140
|
-
// Transform hex strings to buffers.
|
|
141
|
-
if (value.startsWith('0x')) {
|
|
142
|
-
if (!value.match(/^0x([0-9a-fA-F]{2})*$/)) {
|
|
143
|
-
throw new Error('0x prefixed string contains non-hex characters.');
|
|
144
|
-
}
|
|
145
|
-
return Buffer.from(value.slice(2), 'hex');
|
|
146
|
-
} else if (value.startsWith('\\0x')) {
|
|
147
|
-
return value.slice(1) as unknown as T;
|
|
148
|
-
}
|
|
149
|
-
} else if (value instanceof Array) {
|
|
150
|
-
// Enforce array elements are same type.
|
|
151
|
-
getType(value);
|
|
152
|
-
value = [...value] as unknown as T;
|
|
153
|
-
(value as unknown as Array<unknown>).sort(elementCompare);
|
|
154
|
-
return (value as unknown as Array<unknown>).map(transform) as unknown as T;
|
|
155
|
-
} else if (value instanceof Object) {
|
|
156
|
-
const properties = Object.getOwnPropertyNames(value);
|
|
157
|
-
properties.sort();
|
|
158
|
-
return properties.reduce((acc, name) => {
|
|
159
|
-
acc[name] = transform(value[name]);
|
|
160
|
-
return acc;
|
|
161
|
-
}, {}) as unknown as T;
|
|
162
|
-
}
|
|
163
|
-
return value;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Untransform value into its human readable form.
|
|
168
|
-
* @param value - Value to untransform.
|
|
169
|
-
* @returns Untransformed, human readable form of value.
|
|
170
|
-
*/
|
|
171
|
-
export function untransform<T>(value: T): T | string {
|
|
172
|
-
if (Buffer.isBuffer(value)) {
|
|
173
|
-
return '0x' + value.toString('hex');
|
|
174
|
-
} else if (typeof value === 'string') {
|
|
175
|
-
if (value.startsWith('0x')) {
|
|
176
|
-
return '\\' + value;
|
|
177
|
-
}
|
|
178
|
-
} else if (value instanceof Array && value.length > 1) {
|
|
179
|
-
for (let i = 1; i < value.length; i++) {
|
|
180
|
-
if (value[i - 1].weight > value[i].weight) {
|
|
181
|
-
throw new Error('Array elements are not in canonical order');
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
return value.map(untransform) as unknown as T;
|
|
185
|
-
} else if (value instanceof Object) {
|
|
186
|
-
const properties = Object.getOwnPropertyNames(value);
|
|
187
|
-
for (let i = 1; i < properties.length; i++) {
|
|
188
|
-
if (properties[i - 1].localeCompare(properties[i]) > 0) {
|
|
189
|
-
throw new Error('Object properties are not in caonical order');
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
return properties.reduce((acc, name) => {
|
|
193
|
-
acc[name] = untransform(value[name]);
|
|
194
|
-
return acc;
|
|
195
|
-
}, {}) as unknown as T;
|
|
196
|
-
}
|
|
197
|
-
return value;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* Serialize a value.
|
|
202
|
-
* @param value - Value to serialize.
|
|
203
|
-
* @returns Buffer representing serialized value.
|
|
204
|
-
*/
|
|
205
|
-
export function serialize<T>(value: T): Buffer {
|
|
206
|
-
return encodeCanonical(transform(value));
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
/**
|
|
210
|
-
* Deserialize a value.
|
|
211
|
-
* @param value - Buffer to deserialize.
|
|
212
|
-
* @returns Deserialized value.
|
|
213
|
-
*/
|
|
214
|
-
export function deserialize(value: Buffer): unknown {
|
|
215
|
-
return untransform(decodeFirstSync(value));
|
|
216
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * as Cbor from './cbor';
|
package/test/cbor/fixtures.json
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"deserialized": {
|
|
4
|
-
"keys": [
|
|
5
|
-
{
|
|
6
|
-
"key": "0x010203",
|
|
7
|
-
"weight": 0
|
|
8
|
-
},
|
|
9
|
-
{
|
|
10
|
-
"key": "0x040506",
|
|
11
|
-
"weight": 1
|
|
12
|
-
}
|
|
13
|
-
]
|
|
14
|
-
},
|
|
15
|
-
"serialized": "a1646b65797382a2636b6579430102036677656967687400a2636b6579430405066677656967687401"
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
"deserialized": {
|
|
19
|
-
"a": "0xffffffff",
|
|
20
|
-
"b": "0x00000000",
|
|
21
|
-
"c": "0xffffffff",
|
|
22
|
-
"d": [
|
|
23
|
-
{
|
|
24
|
-
"weight": 0
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
"weight": 1
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
"weight": 2
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
"weight": 3
|
|
34
|
-
}
|
|
35
|
-
]
|
|
36
|
-
},
|
|
37
|
-
"serialized": "a4616144ffffffff61624400000000616344ffffffff616484a16677656967687400a16677656967687401a16677656967687402a16677656967687403"
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
"deserialized": {
|
|
41
|
-
"a": [
|
|
42
|
-
{
|
|
43
|
-
"value": "a",
|
|
44
|
-
"weight": 0
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
"value": "b",
|
|
48
|
-
"weight": 0
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
"value": "c",
|
|
52
|
-
"weight": 0
|
|
53
|
-
}
|
|
54
|
-
]
|
|
55
|
-
},
|
|
56
|
-
"serialized": "a1616183a26576616c756561616677656967687400a26576616c756561626677656967687400a26576616c756561636677656967687400"
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
"deserialized": {
|
|
60
|
-
"a": [
|
|
61
|
-
{
|
|
62
|
-
"value": "0x0a",
|
|
63
|
-
"weight": 0
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
"value": "0x0b",
|
|
67
|
-
"weight": 0
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
"value": "0x0c",
|
|
71
|
-
"weight": 0
|
|
72
|
-
}
|
|
73
|
-
]
|
|
74
|
-
},
|
|
75
|
-
"serialized": "a1616183a26576616c7565410a6677656967687400a26576616c7565410b6677656967687400a26576616c7565410c6677656967687400"
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
"deserialized": {
|
|
79
|
-
"a": [
|
|
80
|
-
{
|
|
81
|
-
"value": 1,
|
|
82
|
-
"weight": 0
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
"value": 2,
|
|
86
|
-
"weight": 0
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
"value": 3,
|
|
90
|
-
"weight": 0
|
|
91
|
-
}
|
|
92
|
-
]
|
|
93
|
-
},
|
|
94
|
-
"serialized": "a1616183a26576616c7565016677656967687400a26576616c7565026677656967687400a26576616c7565036677656967687400"
|
|
95
|
-
}
|
|
96
|
-
]
|
package/test/unit/deser-lib.ts
DELETED
|
@@ -1,326 +0,0 @@
|
|
|
1
|
-
import { Cbor } from '../..';
|
|
2
|
-
import * as cborFixtures from '../cbor/fixtures.json';
|
|
3
|
-
|
|
4
|
-
describe('deser-lib', function () {
|
|
5
|
-
describe('cbor', function () {
|
|
6
|
-
describe('transform', function () {
|
|
7
|
-
it('orders object properties canonically', function () {
|
|
8
|
-
const res = Cbor.transform({ b: 'second', a: 'first' }) as any;
|
|
9
|
-
const properties = Object.getOwnPropertyNames(res);
|
|
10
|
-
properties[0].should.equal('a');
|
|
11
|
-
properties[1].should.equal('b');
|
|
12
|
-
res.a.should.equal('first');
|
|
13
|
-
res.b.should.equal('second');
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
describe('canonical ordering', function () {
|
|
17
|
-
it('orders by weight', function () {
|
|
18
|
-
const res = Cbor.transform([
|
|
19
|
-
{ weight: 2, value: null },
|
|
20
|
-
{ weight: 1, value: null },
|
|
21
|
-
]) as any;
|
|
22
|
-
res[0].weight.should.equal(1);
|
|
23
|
-
res[1].weight.should.equal(2);
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it('groups equal elements', function () {
|
|
27
|
-
const res = Cbor.transform([
|
|
28
|
-
{
|
|
29
|
-
weight: 2,
|
|
30
|
-
value: 'b',
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
weight: 1,
|
|
34
|
-
value: 'a',
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
weight: 3,
|
|
38
|
-
value: 'c',
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
weight: 2,
|
|
42
|
-
value: 'b',
|
|
43
|
-
},
|
|
44
|
-
]) as any;
|
|
45
|
-
res[0].weight.should.equal(1);
|
|
46
|
-
res[1].weight.should.equal(2);
|
|
47
|
-
res[2].weight.should.equal(2);
|
|
48
|
-
res[3].weight.should.equal(3);
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
it('orders number values', function () {
|
|
52
|
-
const res = Cbor.transform([
|
|
53
|
-
{ weight: 1, value: 2 },
|
|
54
|
-
{ weight: 1, value: 1 },
|
|
55
|
-
]) as any;
|
|
56
|
-
res[0].value.should.equal(1);
|
|
57
|
-
res[1].value.should.equal(2);
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
it('orders string values', function () {
|
|
61
|
-
const res = Cbor.transform([
|
|
62
|
-
{ weight: 1, value: 'ab' },
|
|
63
|
-
{ weight: 1, value: 'aa' },
|
|
64
|
-
]) as any;
|
|
65
|
-
res[0].value.should.equal('aa');
|
|
66
|
-
res[1].value.should.equal('ab');
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
it('orders byte values', function () {
|
|
70
|
-
const res = Cbor.transform([
|
|
71
|
-
{ weight: 1, value: '0x0b' },
|
|
72
|
-
{ weight: 1, value: '0x0a' },
|
|
73
|
-
]) as any;
|
|
74
|
-
res[0].value.equals(Buffer.from([0x0a])).should.equal(true);
|
|
75
|
-
res[1].value.equals(Buffer.from([0x0b])).should.equal(true);
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
it('orders string values of different lengths', function () {
|
|
79
|
-
const res = Cbor.transform([
|
|
80
|
-
{ weight: 1, value: 'ab' },
|
|
81
|
-
{ weight: 1, value: 'a' },
|
|
82
|
-
]) as any;
|
|
83
|
-
res[0].value.should.equal('a');
|
|
84
|
-
res[1].value.should.equal('ab');
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
it('throws for elements without weight', function () {
|
|
88
|
-
(() => Cbor.transform([{}, {}])).should.throw();
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
it('throws for elements without value', function () {
|
|
92
|
-
(() => Cbor.transform([{ weight: 1 }, { weight: 1 }])).should.throw();
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
it('throws for values that cannot be compared', function () {
|
|
96
|
-
(() =>
|
|
97
|
-
Cbor.transform([
|
|
98
|
-
{ weight: 1, value: {} },
|
|
99
|
-
{ weight: 1, value: 1 },
|
|
100
|
-
])).should.throw();
|
|
101
|
-
(() =>
|
|
102
|
-
Cbor.transform([
|
|
103
|
-
{ weight: 1, value: undefined },
|
|
104
|
-
{ weight: 1, value: null },
|
|
105
|
-
])).should.throw();
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
it('throws for elements of mixed type', function () {
|
|
109
|
-
(() =>
|
|
110
|
-
Cbor.transform([
|
|
111
|
-
{ weight: 0, value: '0' },
|
|
112
|
-
{ weight: 0, value: 0 },
|
|
113
|
-
])).should.throw();
|
|
114
|
-
});
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
it('preserves null values', function () {
|
|
118
|
-
const res = Cbor.transform({ value: null }) as any;
|
|
119
|
-
res.should.have.property('value').which.is.null();
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
it('replaces prefixed hex strings with Buffers', function () {
|
|
123
|
-
const hex = '00010203';
|
|
124
|
-
const res = Cbor.transform({ value: '0x' + hex }) as any;
|
|
125
|
-
Buffer.isBuffer(res.value).should.equal(true);
|
|
126
|
-
res.value.equals(Buffer.from(hex, 'hex')).should.equal(true);
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
it('preserves non-prefixed hex strings', function () {
|
|
130
|
-
const string = '00010203';
|
|
131
|
-
const res = Cbor.transform({ value: string }) as any;
|
|
132
|
-
res.value.should.equal(string);
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
it('preserves escaped strings', function () {
|
|
136
|
-
const string = '0xPrefixedString';
|
|
137
|
-
const res = Cbor.transform({ value: '\\' + string }) as any;
|
|
138
|
-
res.value.should.equal(string);
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
it('transforms object recursively', function () {
|
|
142
|
-
const res = Cbor.transform({ value: { b: 'second', a: 'first' } }) as any;
|
|
143
|
-
const properties = Object.getOwnPropertyNames(res.value);
|
|
144
|
-
properties[0].should.equal('a');
|
|
145
|
-
properties[1].should.equal('b');
|
|
146
|
-
res.value.a.should.equal('first');
|
|
147
|
-
res.value.b.should.equal('second');
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
it('transforms array recursively', function () {
|
|
151
|
-
const res = Cbor.transform([{ weight: 0, value: { b: 'second', a: 'first' } }]) as any;
|
|
152
|
-
const properties = Object.getOwnPropertyNames(res[0].value);
|
|
153
|
-
properties[0].should.equal('a');
|
|
154
|
-
properties[1].should.equal('b');
|
|
155
|
-
res[0].value.a.should.equal('first');
|
|
156
|
-
res[0].value.b.should.equal('second');
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
it('throws for invalid hex strings', function () {
|
|
160
|
-
(() => Cbor.transform('0x0g')).should.throw();
|
|
161
|
-
});
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
describe('untransform', function () {
|
|
165
|
-
it('untransforms object', function () {
|
|
166
|
-
const res = Cbor.untransform({ a: 'first', b: 'second' }) as any;
|
|
167
|
-
const properties = Object.getOwnPropertyNames(res);
|
|
168
|
-
properties[0].should.equal('a');
|
|
169
|
-
properties[1].should.equal('b');
|
|
170
|
-
res.a.should.equal('first');
|
|
171
|
-
res.b.should.equal('second');
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
it('enforces canonical object property order', function () {
|
|
175
|
-
(() => Cbor.untransform({ b: 'second', a: 'first' })).should.throw();
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
it('enforces canonical array element order', function () {
|
|
179
|
-
(() => Cbor.untransform([{ weight: 2 }, { weight: 1 }])).should.throw();
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
it('replaces Buffers with prefixed hex strings', function () {
|
|
183
|
-
const hex = '00010203';
|
|
184
|
-
const res = Cbor.untransform({ value: Buffer.from(hex, 'hex') }) as any;
|
|
185
|
-
res.value.should.equal('0x' + hex);
|
|
186
|
-
});
|
|
187
|
-
|
|
188
|
-
it('preserves non-prefixed hex strings', function () {
|
|
189
|
-
const string = '00010203';
|
|
190
|
-
const res = Cbor.untransform({ value: string }) as any;
|
|
191
|
-
res.value.should.equal(string);
|
|
192
|
-
});
|
|
193
|
-
|
|
194
|
-
it('escapes prefixed string', function () {
|
|
195
|
-
const string = '0xPrefixedString';
|
|
196
|
-
const res = Cbor.untransform({ value: string }) as any;
|
|
197
|
-
res.value.should.equal('\\' + string);
|
|
198
|
-
});
|
|
199
|
-
|
|
200
|
-
it('untransforms object recursively', function () {
|
|
201
|
-
const hex = '00010203';
|
|
202
|
-
const res = Cbor.untransform({ value: { value: Buffer.from(hex, 'hex') } }) as any;
|
|
203
|
-
res.value.value.should.equal('0x' + hex);
|
|
204
|
-
});
|
|
205
|
-
|
|
206
|
-
it('untransforms array recursively', function () {
|
|
207
|
-
const hex = '00010203';
|
|
208
|
-
const res = Cbor.untransform([{ value: Buffer.from(hex, 'hex'), weight: 0 }]) as any;
|
|
209
|
-
res[0].value.should.equal('0x' + hex);
|
|
210
|
-
});
|
|
211
|
-
});
|
|
212
|
-
|
|
213
|
-
describe('fixtures', function () {
|
|
214
|
-
xit('creates test vectors', function () {
|
|
215
|
-
const { writeFileSync } = require('fs');
|
|
216
|
-
const deserialized = [
|
|
217
|
-
{
|
|
218
|
-
keys: [
|
|
219
|
-
{
|
|
220
|
-
key: '0x010203',
|
|
221
|
-
weight: 0,
|
|
222
|
-
},
|
|
223
|
-
{
|
|
224
|
-
key: '0x040506',
|
|
225
|
-
weight: 1,
|
|
226
|
-
},
|
|
227
|
-
],
|
|
228
|
-
},
|
|
229
|
-
{
|
|
230
|
-
a: '0xffffffff',
|
|
231
|
-
b: '0x00000000',
|
|
232
|
-
c: '0xffffffff',
|
|
233
|
-
d: [
|
|
234
|
-
{
|
|
235
|
-
weight: 0,
|
|
236
|
-
},
|
|
237
|
-
{
|
|
238
|
-
weight: 1,
|
|
239
|
-
},
|
|
240
|
-
{
|
|
241
|
-
weight: 2,
|
|
242
|
-
},
|
|
243
|
-
{
|
|
244
|
-
weight: 3,
|
|
245
|
-
},
|
|
246
|
-
],
|
|
247
|
-
},
|
|
248
|
-
{
|
|
249
|
-
a: [
|
|
250
|
-
{
|
|
251
|
-
value: 'a',
|
|
252
|
-
weight: 0,
|
|
253
|
-
},
|
|
254
|
-
{
|
|
255
|
-
value: 'b',
|
|
256
|
-
weight: 0,
|
|
257
|
-
},
|
|
258
|
-
{
|
|
259
|
-
value: 'c',
|
|
260
|
-
weight: 0,
|
|
261
|
-
},
|
|
262
|
-
],
|
|
263
|
-
},
|
|
264
|
-
{
|
|
265
|
-
a: [
|
|
266
|
-
{
|
|
267
|
-
weight: 0,
|
|
268
|
-
value: '0x0a',
|
|
269
|
-
},
|
|
270
|
-
{
|
|
271
|
-
weight: 0,
|
|
272
|
-
value: '0x0b',
|
|
273
|
-
},
|
|
274
|
-
{
|
|
275
|
-
weight: 0,
|
|
276
|
-
value: '0x0c',
|
|
277
|
-
},
|
|
278
|
-
],
|
|
279
|
-
},
|
|
280
|
-
{
|
|
281
|
-
a: [
|
|
282
|
-
{
|
|
283
|
-
weight: 0,
|
|
284
|
-
value: 1,
|
|
285
|
-
},
|
|
286
|
-
{
|
|
287
|
-
weight: 0,
|
|
288
|
-
value: 2,
|
|
289
|
-
},
|
|
290
|
-
{
|
|
291
|
-
weight: 0,
|
|
292
|
-
value: 3,
|
|
293
|
-
},
|
|
294
|
-
],
|
|
295
|
-
},
|
|
296
|
-
];
|
|
297
|
-
const serialized = deserialized.map((x) => Cbor.serialize(x).toString('hex'));
|
|
298
|
-
writeFileSync(
|
|
299
|
-
'test/cbor/fixtures.json',
|
|
300
|
-
JSON.stringify(
|
|
301
|
-
deserialized.map((deserialized, i) => ({
|
|
302
|
-
deserialized: Cbor.untransform(Cbor.transform(deserialized)),
|
|
303
|
-
serialized: serialized[i],
|
|
304
|
-
})),
|
|
305
|
-
null,
|
|
306
|
-
2
|
|
307
|
-
)
|
|
308
|
-
);
|
|
309
|
-
});
|
|
310
|
-
|
|
311
|
-
for (let i = 0; i < cborFixtures.length; i++) {
|
|
312
|
-
it(`deserializes vector[${i}]`, function () {
|
|
313
|
-
const { deserialized, serialized } = cborFixtures[i];
|
|
314
|
-
Cbor.serialize(deserialized).equals(Buffer.from(serialized, 'hex')).should.equal(true);
|
|
315
|
-
});
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
for (let i = 0; i < cborFixtures.length; i++) {
|
|
319
|
-
it(`serializes vector[${i}]`, function () {
|
|
320
|
-
const { deserialized, serialized } = cborFixtures[i];
|
|
321
|
-
JSON.stringify(Cbor.deserialize(Buffer.from(serialized, 'hex'))).should.equal(JSON.stringify(deserialized));
|
|
322
|
-
});
|
|
323
|
-
}
|
|
324
|
-
});
|
|
325
|
-
});
|
|
326
|
-
});
|