@bitgo-beta/deser-lib 1.0.1-beta.9 → 1.0.1-beta.91
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 +12 -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,18 @@
|
|
|
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
|
+
|
|
6
18
|
# 1.4.0 (2024-01-26)
|
|
7
19
|
|
|
8
20
|
### Bug Fixes
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@bitgo-beta/deser-lib",
|
|
3
|
+
"version": "1.0.1-beta.91",
|
|
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": "c0fcd7082874116509fe21fef2837698f838a78d"
|
|
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 (0, 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((0, cbor_1.decodeFirstSync)(value));
|
|
211
|
+
}
|
|
212
|
+
exports.deserialize = deserialize;
|
|
213
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2Jvci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jYm9yLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLCtCQUErQztBQUUvQzs7OztHQUlHO0FBQ0gsU0FBUyxPQUFPLENBQUMsS0FBYztJQUM3QixJQUFJLEtBQUssS0FBSyxJQUFJLElBQUksS0FBSyxLQUFLLFNBQVMsRUFBRTtRQUN6QyxPQUFPLE1BQU0sQ0FBQztLQUNmO0lBQ0QsSUFBSSxLQUFLLFlBQVksS0FBSyxFQUFFO1FBQzFCLE1BQU0sS0FBSyxHQUFHLEtBQUssQ0FBQyxHQUFHLENBQUMsT0FBTyxDQUFDLENBQUM7UUFDakMsSUFBSSxDQUFDLEtBQUssQ0FBQyxLQUFLLENBQUMsQ0FBQyxDQUFDLENBQUMsS0FBSyxDQUFDLENBQUMsS0FBSyxFQUFFLEVBQUUsQ0FBQyxLQUFLLEtBQUssS0FBSyxDQUFDLENBQUMsQ0FBQyxDQUFDLEVBQUU7WUFDeEQ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IHZhbHVlIC0gQnVmZmVyIHRvIGRlc2VyaWFsaXplLlxuICogQHJldHVybnMgRGVzZXJpYWxpemVkIHZhbHVlLlxuICovXG5leHBvcnQgZnVuY3Rpb24gZGVzZXJpYWxpemUodmFsdWU6IEJ1ZmZlcik6IHVua25vd24ge1xuICByZXR1cm4gdW50cmFuc2Zvcm0oZGVjb2RlRmlyc3RTeW5jKHZhbHVlKSk7XG59XG4iXX0=
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","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.date.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.es2020.number.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":"f5c28122bee592cfaf5c72ed7bcc47f453b79778ffa6e301f45d21a0970719d4","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","e6b724280c694a9f588847f754198fb96c43d805f065c3a5b28bbc9594541c84","1fc5ab7a764205c68fa10d381b08417795fc73111d6dd16b5b1ed36badb743d9",{"version":"3f149f903dd20dfeb7c80e228b659f0e436532de772469980dbd00702cc05cc1","affectsGlobalScope":true},{"version":"adb996790133eb33b33aadb9c09f15c2c575e71fb57a62de8bf74dbf59ec7dfb","affectsGlobalScope":true},{"version":"43fb1d932e4966a39a41b464a12a81899d9ae5f2c829063f5571b6b87e6d2f9c","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"c5c05907c02476e4bde6b7e76a79ffcd948aedd14b6a8f56e4674221b0417398","affectsGlobalScope":true},{"version":"0d5f52b3174bee6edb81260ebcd792692c32c81fd55499d69531496f3f2b25e7","affectsGlobalScope":true},{"version":"810627a82ac06fb5166da5ada4159c4ec11978dfbb0805fe804c86406dab8357","affectsGlobalScope":true},{"version":"181f1784c6c10b751631b24ce60c7f78b20665db4550b335be179217bacc0d5f","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"75ec0bdd727d887f1b79ed6619412ea72ba3c81d92d0787ccb64bab18d261f14","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":"d154ea5bb7f7f9001ed9153e876b2d5b8f5c2bb9ec02b3ae0d239ec769f1f2ae","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"6e7997ef61de3132e4d4b2250e75343f487903ddf5370e7ce33cf1b9db9a63ed","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"09aa50414b80c023553090e2f53827f007a301bc34b0495bfb2c3c08ab9ad1eb","affectsGlobalScope":true},{"version":"d7f680a43f8cd12a6b6122c07c54ba40952b0c8aa140dcfcf32eb9e6cb028596","affectsGlobalScope":true},{"version":"3787b83e297de7c315d55d4a7c546ae28e5f6c0a361b7a1dcec1f1f50a54ef11","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"cd483c056da900716879771893a3c9772b66c3c88f8943b4205aec738a94b1d0","affectsGlobalScope":true},{"version":"b248e32ca52e8f5571390a4142558ae4f203ae2f94d5bac38a3084d529ef4e58","affectsGlobalScope":true},{"version":"c37f8a49593a0030eecb51bbfa270e709bec9d79a6cc3bb851ef348d4e6b26f8","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":"a8eb853132f373fdc28bfbe52ae4c4331f7b00278c49b6b50bf2afa0a8ca924e","signature":"49f562f1b8637be95fa72606652bdca732095d1249a5432e42b52b6cfbdf1a1b"},"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","829c6dfd3224be3b599c64ce7fa9136a3422ac7ab4569cc52469c65574facb23","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,"strictNullChecks":true,"strictPropertyInitialization":true,"target":6},"fileIdsList":[[121],[121,140],[121,141],[121,128],[121,147],[91,94,120,121,128,149,150,151],[94,121,128],[84,121,128],[121,156],[121,146],[121,161,163],[121,160,161,162],[121,128,146],[121,166],[92,121,128],[91,121,128],[121,174,176,177,178,179,180,181,182,183,184,185,186],[121,174,175,177,178,179,180,181,182,183,184,185,186],[121,175,176,177,178,179,180,181,182,183,184,185,186],[121,174,175,176,178,179,180,181,182,183,184,185,186],[121,174,175,176,177,179,180,181,182,183,184,185,186],[121,174,175,176,177,178,180,181,182,183,184,185,186],[121,174,175,176,177,178,179,181,182,183,184,185,186],[121,174,175,176,177,178,179,180,182,183,184,185,186],[121,174,175,176,177,178,179,180,181,183,184,185,186],[121,174,175,176,177,178,179,180,181,182,184,185,186],[121,174,175,176,177,178,179,180,181,182,183,185,186],[121,174,175,176,177,178,179,180,181,182,183,184,186],[121,174,175,176,177,178,179,180,181,182,183,184,185],[121,207],[121,192],[121,196,197,198],[121,195],[121,197],[121,173,193,194,199,202,204,205,206],[121,194,200,201,207],[121,200,203],[121,194,195,200,207],[121,194,207],[121,188,189,190,191],[42,121],[78,121],[79,84,112,121],[80,91,92,99,109,120,121],[80,81,91,99,121],[82,121],[83,84,92,100,121],[84,109,117,121],[85,87,91,99,121],[86,121],[87,88,121],[91,121],[89,91,121],[91,92,93,109,120,121],[91,92,93,106,109,112,121],[76,121,125],[87,91,94,99,109,120,121],[91,92,94,95,99,109,117,120,121],[94,96,109,117,120,121],[42,43,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,126,127],[91,97,121],[98,120,121,125],[87,91,99,109,121],[100,121],[101,121],[78,102,121],[103,119,121,125],[104,121],[105,121],[91,106,107,121],[106,108,121,123],[79,91,109,110,111,112,121],[79,109,111,121],[109,110,121],[112,121],[113,121],[78,109,121],[91,115,116,121],[115,116,121],[84,99,109,117,121],[118,121],[99,119,121],[79,94,105,120,121],[84,121],[109,121,122],[98,121,123],[121,124],[79,84,91,93,102,109,120,121,123,125],[109,121,126],[109,121,128],[94,109,121,128],[121,220,259],[121,220,244,259],[121,259],[121,220],[121,220,245,259],[121,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],[121,245,259],[79,92,94,109,121,128,154],[121,263],[91,94,96,99,120,121,126,128],[121,267],[121,131,132,133,134,135,136,137,139],[79,109,121,128,129,132],[79,109,121,128,129,130,131],[109,121,132],[79,109,121,128,129],[121,135,138],[109,121,129],[79,109,121,128],[53,57,120,121],[53,109,120,121],[48,121],[50,53,117,120,121],[99,117,121],[48,121,128],[50,53,99,120,121],[45,46,49,52,79,91,109,120,121],[45,51,121],[49,53,79,112,120,121,128],[79,121,128],[69,79,121,128],[47,48,121,128],[53,121],[47,48,49,50,51,52,53,54,55,57,58,59,60,61,62,63,64,65,66,67,68,70,71,72,73,74,75,121],[53,60,61,121],[51,53,61,62,121],[52,121],[45,48,53,121],[53,57,61,62,121],[57,121],[51,53,56,120,121],[45,50,51,53,57,60,121],[79,109,121],[48,53,69,79,121,125,128],[121,269,270],[121,273]],"referencedMap":[[143,1],[141,2],[142,3],[144,1],[145,1],[146,4],[148,5],[152,6],[153,7],[154,1],[155,8],[157,9],[158,4],[159,10],[164,11],[160,1],[163,12],[161,1],[165,13],[166,1],[167,14],[168,1],[169,15],[170,1],[150,1],[171,1],[162,1],[172,1],[149,16],[173,1],[175,17],[176,18],[174,19],[177,20],[178,21],[179,22],[180,23],[181,24],[182,25],[183,26],[184,27],[185,28],[186,29],[187,1],[208,30],[193,31],[199,32],[197,1],[196,33],[198,34],[207,35],[202,36],[204,37],[205,38],[206,39],[200,1],[201,39],[203,39],[195,39],[194,1],[189,1],[188,1],[191,31],[192,40],[190,31],[209,1],[210,1],[211,1],[212,1],[156,1],[42,41],[43,41],[78,42],[79,43],[80,44],[81,45],[82,46],[83,47],[84,48],[85,49],[86,50],[87,51],[88,51],[90,52],[89,53],[91,52],[92,54],[93,55],[77,56],[127,1],[94,57],[95,58],[96,59],[128,60],[97,61],[98,62],[99,63],[100,64],[101,65],[102,66],[103,67],[104,68],[105,69],[106,70],[107,70],[108,71],[109,72],[111,73],[110,74],[112,75],[113,76],[114,77],[115,78],[116,79],[117,80],[118,81],[119,82],[120,83],[121,84],[122,85],[123,86],[124,87],[125,88],[126,89],[213,1],[214,1],[215,4],[216,90],[217,1],[218,8],[151,91],[219,4],[244,92],[245,93],[220,94],[223,94],[242,92],[243,92],[233,92],[232,95],[230,92],[225,92],[238,92],[236,92],[240,92],[224,92],[237,92],[241,92],[226,92],[227,92],[239,92],[221,92],[228,92],[229,92],[231,92],[235,92],[246,96],[234,92],[222,92],[259,97],[258,1],[253,96],[255,98],[254,96],[247,96],[248,96],[250,96],[252,96],[256,98],[257,98],[249,98],[251,98],[260,8],[261,1],[262,99],[263,1],[264,100],[265,1],[266,101],[267,1],[268,102],[147,4],[269,1],[44,1],[140,103],[133,104],[132,105],[134,106],[135,107],[137,1],[138,1],[139,108],[136,1],[131,1],[130,109],[129,110],[273,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],[34,1],[39,1],[40,1],[35,1],[36,1],[37,1],[38,1],[1,1],[41,1],[60,111],[67,112],[59,111],[74,113],[51,114],[50,115],[73,4],[68,116],[71,117],[53,118],[52,119],[48,120],[47,121],[70,122],[49,123],[54,124],[55,1],[58,124],[45,1],[76,125],[75,124],[62,126],[63,127],[65,128],[61,129],[64,130],[69,4],[56,131],[57,132],[66,133],[46,134],[72,135],[270,136],[271,1],[272,1],[274,137]],"exportedModulesMap":[[142,3],[144,1],[145,1],[146,4],[148,5],[152,6],[153,7],[154,1],[155,8],[157,9],[158,4],[159,10],[164,11],[160,1],[163,12],[161,1],[165,13],[166,1],[167,14],[168,1],[169,15],[170,1],[150,1],[171,1],[162,1],[172,1],[149,16],[173,1],[175,17],[176,18],[174,19],[177,20],[178,21],[179,22],[180,23],[181,24],[182,25],[183,26],[184,27],[185,28],[186,29],[187,1],[208,30],[193,31],[199,32],[197,1],[196,33],[198,34],[207,35],[202,36],[204,37],[205,38],[206,39],[200,1],[201,39],[203,39],[195,39],[194,1],[189,1],[188,1],[191,31],[192,40],[190,31],[209,1],[210,1],[211,1],[212,1],[156,1],[42,41],[43,41],[78,42],[79,43],[80,44],[81,45],[82,46],[83,47],[84,48],[85,49],[86,50],[87,51],[88,51],[90,52],[89,53],[91,52],[92,54],[93,55],[77,56],[127,1],[94,57],[95,58],[96,59],[128,60],[97,61],[98,62],[99,63],[100,64],[101,65],[102,66],[103,67],[104,68],[105,69],[106,70],[107,70],[108,71],[109,72],[111,73],[110,74],[112,75],[113,76],[114,77],[115,78],[116,79],[117,80],[118,81],[119,82],[120,83],[121,84],[122,85],[123,86],[124,87],[125,88],[126,89],[213,1],[214,1],[215,4],[216,90],[217,1],[218,8],[151,91],[219,4],[244,92],[245,93],[220,94],[223,94],[242,92],[243,92],[233,92],[232,95],[230,92],[225,92],[238,92],[236,92],[240,92],[224,92],[237,92],[241,92],[226,92],[227,92],[239,92],[221,92],[228,92],[229,92],[231,92],[235,92],[246,96],[234,92],[222,92],[259,97],[258,1],[253,96],[255,98],[254,96],[247,96],[248,96],[250,96],[252,96],[256,98],[257,98],[249,98],[251,98],[260,8],[261,1],[262,99],[263,1],[264,100],[265,1],[266,101],[267,1],[268,102],[147,4],[269,1],[44,1],[140,103],[133,104],[132,105],[134,106],[135,107],[137,1],[138,1],[139,108],[136,1],[131,1],[130,109],[129,110],[273,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],[34,1],[39,1],[40,1],[35,1],[36,1],[37,1],[38,1],[1,1],[41,1],[60,111],[67,112],[59,111],[74,113],[51,114],[50,115],[73,4],[68,116],[71,117],[53,118],[52,119],[48,120],[47,121],[70,122],[49,123],[54,124],[55,1],[58,124],[45,1],[76,125],[75,124],[62,126],[63,127],[65,128],[61,129],[64,130],[69,4],[56,131],[57,132],[66,133],[46,134],[72,135],[270,136],[271,1],[272,1],[274,137]],"semanticDiagnosticsPerFile":[143,141,142,144,145,146,148,152,153,154,155,157,158,159,164,160,163,161,165,166,167,168,169,170,150,171,162,172,149,173,175,176,174,177,178,179,180,181,182,183,184,185,186,187,208,193,199,197,196,198,207,202,204,205,206,200,201,203,195,194,189,188,191,192,190,209,210,211,212,156,42,43,78,79,80,81,82,83,84,85,86,87,88,90,89,91,92,93,77,127,94,95,96,128,97,98,99,100,101,102,103,104,105,106,107,108,109,111,110,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,213,214,215,216,217,218,151,219,244,245,220,223,242,243,233,232,230,225,238,236,240,224,237,241,226,227,239,221,228,229,231,235,246,234,222,259,258,253,255,254,247,248,250,252,256,257,249,251,260,261,262,263,264,265,266,267,268,147,269,44,140,133,132,134,135,137,138,139,136,131,130,129,273,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,34,39,40,35,36,37,38,1,41,60,67,59,74,51,50,73,68,71,53,52,48,47,70,49,54,55,58,45,76,75,62,63,65,61,64,69,56,57,66,46,72,270,271,272,274]},"version":"4.7.4"}
|
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.91",
|
|
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": "c0fcd7082874116509fe21fef2837698f838a78d"
|
|
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
|
-
});
|