@bitgo-beta/deser-lib 1.0.1-beta.2 → 1.0.1-beta.200
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 +41 -0
- package/README.md +1 -1
- 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,47 @@
|
|
|
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
|
+
|
|
40
|
+
# 1.2.0 (2024-01-25)
|
|
41
|
+
|
|
42
|
+
### Features
|
|
43
|
+
|
|
44
|
+
- **deser-lib:** add serialization/deserialization module ([95c0308](https://github.com/BitGo/BitGoJS/commit/95c03088faa890604880dae770c4a720850f9275))
|
|
45
|
+
- **deser-lib:** support escaped strings ([95cd394](https://github.com/BitGo/BitGoJS/commit/95cd39476895b2fd3e766683eb5e7129c200d516))
|
|
46
|
+
|
|
6
47
|
# 1.1.0 (2024-01-22)
|
|
7
48
|
|
|
8
49
|
### Features
|
package/README.md
CHANGED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@bitgo-beta/deser-lib",
|
|
3
|
+
"version": "1.0.1-beta.200",
|
|
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": "df88ff597fa1b24262dccb232c6ef24e30e1fac0"
|
|
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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2Jvci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jYm9yLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLCtCQUErQztBQUUvQzs7OztHQUlHO0FBQ0gsU0FBUyxPQUFPLENBQUMsS0FBYztJQUM3QixJQUFJLEtBQUssS0FBSyxJQUFJLElBQUksS0FBSyxLQUFLLFNBQVMsRUFBRTtRQUN6QyxPQUFPLE1BQU0sQ0FBQztLQUNmO0lBQ0QsSUFBSSxLQUFLLFlBQVksS0FBSyxFQUFFO1FBQzFCLE1BQU0sS0FBSyxHQUFHLEtBQUssQ0FBQyxHQUFHLENBQUMsT0FBTyxDQUFDLENBQUM7UUFDakMsSUFBSSxDQUFDLEtBQUssQ0FBQyxLQUFLLENBQUMsQ0FBQyxDQUFDLENBQUMsS0FBSyxDQUFDLENBQUMsS0FBSyxFQUFFLEVBQUUsQ0FBQyxLQUFLLEtBQUssS0FBSyxDQUFDLENBQUMsQ0FBQyxDQUFDLEVBQUU7WUFDeEQsTUFBTSxJQUFJLEtBQUssQ0FBQyx5Q0FBeUMsQ0FBQyxDQ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ldHVybnMgRGVzZXJpYWxpemVkIHZhbHVlLlxuICovXG5leHBvcnQgZnVuY3Rpb24gZGVzZXJpYWxpemUodmFsdWU6IEJ1ZmZlcik6IHVua25vd24ge1xuICByZXR1cm4gdW50cmFuc2Zvcm0oZGVjb2RlRmlyc3RTeW5jKHZhbHVlKSk7XG59XG4iXX0=
|
|
@@ -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/assert.d.ts","../../../node_modules/@types/node/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/globals.d.ts","../../../node_modules/@types/node/async_hooks.d.ts","../../../node_modules/@types/node/buffer.d.ts","../../../node_modules/@types/node/child_process.d.ts","../../../node_modules/@types/node/cluster.d.ts","../../../node_modules/@types/node/console.d.ts","../../../node_modules/@types/node/constants.d.ts","../../../node_modules/@types/node/crypto.d.ts","../../../node_modules/@types/node/dgram.d.ts","../../../node_modules/@types/node/diagnostics_channel.d.ts","../../../node_modules/@types/node/dns.d.ts","../../../node_modules/@types/node/dns/promises.d.ts","../../../node_modules/@types/node/domain.d.ts","../../../node_modules/@types/node/dom-events.d.ts","../../../node_modules/@types/node/events.d.ts","../../../node_modules/@types/node/fs.d.ts","../../../node_modules/@types/node/fs/promises.d.ts","../../../node_modules/@types/node/http.d.ts","../../../node_modules/@types/node/http2.d.ts","../../../node_modules/@types/node/https.d.ts","../../../node_modules/@types/node/inspector.d.ts","../../../node_modules/@types/node/module.d.ts","../../../node_modules/@types/node/net.d.ts","../../../node_modules/@types/node/os.d.ts","../../../node_modules/@types/node/path.d.ts","../../../node_modules/@types/node/perf_hooks.d.ts","../../../node_modules/@types/node/process.d.ts","../../../node_modules/@types/node/punycode.d.ts","../../../node_modules/@types/node/querystring.d.ts","../../../node_modules/@types/node/readline.d.ts","../../../node_modules/@types/node/readline/promises.d.ts","../../../node_modules/@types/node/repl.d.ts","../../../node_modules/@types/node/sea.d.ts","../../../node_modules/@types/node/stream.d.ts","../../../node_modules/@types/node/stream/promises.d.ts","../../../node_modules/@types/node/stream/consumers.d.ts","../../../node_modules/@types/node/stream/web.d.ts","../../../node_modules/@types/node/string_decoder.d.ts","../../../node_modules/@types/node/test.d.ts","../../../node_modules/@types/node/timers.d.ts","../../../node_modules/@types/node/timers/promises.d.ts","../../../node_modules/@types/node/tls.d.ts","../../../node_modules/@types/node/trace_events.d.ts","../../../node_modules/@types/node/tty.d.ts","../../../node_modules/@types/node/url.d.ts","../../../node_modules/@types/node/util.d.ts","../../../node_modules/@types/node/v8.d.ts","../../../node_modules/@types/node/vm.d.ts","../../../node_modules/@types/node/wasi.d.ts","../../../node_modules/@types/node/worker_threads.d.ts","../../../node_modules/@types/node/zlib.d.ts","../../../node_modules/@types/node/globals.global.d.ts","../../../node_modules/@types/node/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/keyv/src/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/keyv/index.d.ts","../../../node_modules/@types/linkify-it/build/index.cjs.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/build/index.cjs.d.ts","../../../node_modules/@types/mdurl/index.d.ts","../../../node_modules/@types/markdown-it/dist/index.cjs.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/sjcl/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},"2db0dd3aaa2ed285950273ce96ae8a450b45423aa9da2d10e194570f1233fa6b","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":"e7be367719c613d580d4b27fdf8fe64c9736f48217f4b322c0d63b2971460918","affectsGlobalScope":true},"3d77c73be94570813f8cadd1f05ebc3dc5e2e4fdefe4d340ca20cd018724ee36",{"version":"392eadc2af403dd10b4debfbc655c089a7fa6a9750caeb770cfb30051e55e848","affectsGlobalScope":true},"62f1c00d3d246e0e3cf0224f91e122d560428ec1ccc36bb51d4574a84f1dbad0","53f0960fdcc53d097918adfd8861ffbe0db989c56ffc16c052197bf115da5ed6",{"version":"662163e5327f260b23ca0a1a1ad8a74078aabb587c904fcb5ef518986987eaff","affectsGlobalScope":true},"a40826e8476694e90da94aa008283a7de50d1dafd37beada623863f1901cb7fb",{"version":"c48c503c6b3f63baf18257e9a87559b5602a4e960107c762586d2a6a62b64a18","affectsGlobalScope":true},"b0c0d1d13be149f790a75b381b413490f98558649428bb916fd2d71a3f47a134","3c884d9d9ec454bdf0d5a0b8465bf8297d2caa4d853851d92cc417ac6f30b969","0364f8bb461d6e84252412d4e5590feda4eb582f77d47f7a024a7a9ff105dfdc","5433f7f77cd1fd53f45bd82445a4e437b2f6a72a32070e907530a4fea56c30c8","d0ca5d7df114035258a9d01165be309371fcccf0cccd9d57b1453204686d1ed0",{"version":"ee1ee365d88c4c6c0c0a5a5701d66ebc27ccd0bcfcfaa482c6e2e7fe7b98edf7","affectsGlobalScope":true},{"version":"9a30b7fefd7f8abbca4828d481c61c18e40fe5ff107e113b1c1fcd2c8dcf2743","affectsGlobalScope":true},"173b6275a81ebdb283b180654890f46516c21199734fed01a773b1c168b8c45c","304f66274aa8119e8d65a49b1cff84cbf803def6afe1b2cc987386e9a9890e22","1b9adafe8a7fefaeaf9099a0e06f602903f6268438147b843a33a5233ac71745","98273274f2dbb79b0b2009b20f74eca4a7146a3447c912d580cd5d2d94a7ae30","c933f7ba4b201c98b14275fd11a14abb950178afd2074703250fe3654fc10cd2","2eaa31492906bc8525aff3c3ec2236e22d90b0dfeee77089f196cd0adf0b3e3b",{"version":"ea455cc68871b049bcecd9f56d4cf27b852d6dafd5e3b54468ca87cc11604e4d","affectsGlobalScope":true},"8f5814f29dbaf8bacd1764aebdf1c8a6eb86381f6a188ddbac0fcbaab855ce52","a63d03de72adfb91777784015bd3b4125abd2f5ef867fc5a13920b5649e8f52b","d20e003f3d518a7c1f749dbe27c6ab5e3be7b3c905a48361b04a9557de4a6900",{"version":"1d4d78c8b23c9ddaaaa49485e6adc2ec01086dfe5d8d4d36ca4cdc98d2f7e74a","affectsGlobalScope":true},{"version":"44fc16356b81c0463cc7d7b2b35dcf324d8144136f5bc5ce73ced86f2b3475b5","affectsGlobalScope":true},"575fb200043b11b464db8e42cc64379c5fd322b6d787638e005b5ee98a64486d","6de2f225d942562733e231a695534b30039bdf1875b377bb7255881f0df8ede8","56249fd3ef1f6b90888e606f4ea648c43978ef43a7263aafad64f8d83cd3b8aa","139ad1dc93a503da85b7a0d5f615bddbae61ad796bc68fedd049150db67a1e26","7b166975fdbd3b37afb64707b98bca88e46577bbc6c59871f9383a7df2daacd1","9eece5e586312581ccd106d4853e861aaaa1a39f8e3ea672b8c3847eedd12f6e","81505c54d7cad0009352eaa21bd923ab7cdee7ec3405357a54d9a5da033a2084","269929a24b2816343a178008ac9ae9248304d92a8ba8e233055e0ed6dbe6ef71","93452d394fdd1dc551ec62f5042366f011a00d342d36d50793b3529bfc9bd633","3c1f19c7abcda6b3a4cf9438a15c7307a080bd3b51dfd56b198d9f86baf19447","2ee1645e0df9d84467cfe1d67b0ad3003c2f387de55874d565094464ee6f2927",{"version":"071d4b4af5755e1a081aa3b785b5526d09276af5a50e4725dea26edd4e7deb31","affectsGlobalScope":true},{"version":"9cf780e96b687e4bdfd1907ed26a688c18b89797490a00598fa8b8ab683335dd","affectsGlobalScope":true},"98e00f3613402504bc2a2c9a621800ab48e0a463d1eed062208a4ae98ad8f84c","9ae88ce9f73446c24b2d2452e993b676da1b31fca5ceb7276e7f36279f693ed1","e49d7625faff2a7842e4e7b9b197f972633fca685afcf6b4403400c97d087c36","b82c38abc53922b1b3670c3af6f333c21b735722a8f156e7d357a2da7c53a0a0",{"version":"b423f53647708043299ded4daa68d95c967a2ac30aa1437adc4442129d7d0a6c","affectsGlobalScope":true},{"version":"7245af181218216bacb01fbdf51095617a51661f20d77178c69a377e16fb69ed","affectsGlobalScope":true},"4f0fc7b7f54422bd97cfaf558ddb4bca86893839367b746a8f86b60ac7619673","4cdd8b6b51599180a387cc7c1c50f49eca5ce06595d781638fd0216520d98246","d91a7d8b5655c42986f1bdfe2105c4408f472831c8f20cf11a8c3345b6b56c8c",{"version":"8704423bf338bff381ebc951ed819935d0252d90cd6de7dffe5b0a5debb65d07","affectsGlobalScope":true},"7c6929fd7cbf38499b6a600b91c3b603d1d78395046dc3499b2b92d01418b94b",{"version":"ab9b9a36e5284fd8d3bf2f7d5fcbc60052f25f27e4d20954782099282c60d23e","affectsGlobalScope":true},"a42be67ed1ddaec743582f41fc219db96a1b69719fccac6d1464321178d610fc","a5193be78a634ab211a471d41295c21d5f54675a97330b9a1720b8e41887cc10","83c1ba8b6d747485ff09206e7c5d7532f3b44a8bfcb002e48f50f5f051ea9a4a","43b31498c95a593f3f7168b16ff68ea04e2e6c84f0fd68202e356286c79040f9","f76f38c4ccedb027993c1077a86faf5e385a0010a1471e9936ff161834149918","72ae38e969e3e8fb7631f9b8c4974bd18af9b6cd075d11c354a6c41538ff3f86","b78b543da8c56fd11295b7154b6b17478797cf4fd2a236729d2701d166d91f00","98f9f2089fcc21cf8be6bc6d4c0c20b5f6933a7fe36f57b01c4951eb0482bca9","1006c614527de8832eb5f8c6de68ca910b0bac25d931cfb459884b52fc2b9aea","d19103d893cfada4d66b3947d20d14d9e1431d3ba16a66d87985a5668aae2160","172035de856c114189c089c5bcec0dc47716ee562946ac8d4e10a96cd54b16c9","7c559565fe235c8452dc846365e1bd06ad0ebca510a3c4949d89a05d472e204e","9d87d7b67c0ad1cc456e0bed96faab74d68cd16443521dbee249c94d7093bc43",{"version":"70c9489a550926570bc9221f2efa53a4833e8bfb5455993156452dedb11a999d","signature":"875b546e158c428c79b93ac5a518d2618b346829bd3bd9c945bed3728fe10afa"},"d3e650b5e80f003e83a9b959b92a61d494a898703b95d8adb4d418a8e73ae843",{"version":"c00281f7f2c129170949759e2cb95eede1a3ebaa24174963b913632b2e5cc881","signature":"49f562f1b8637be95fa72606652bdca732095d1249a5432e42b52b6cfbdf1a1b"},"c31294ba7381e921caa30d4408fa7637053d9cb3456a750f276fd8a9bb0e42d8","ee3a39a0de7a80b8f3637977bdba57bfc48c87877aac70011ddc391c5a91ab5c","8aceb205dcc6f814ad99635baf1e40b6e01d06d3fe27b72fd766c6d0b8c0c600","e91751abb2372a36a90869d36f6ad5d5e69a84c5513ca99d236554e4dd8b9aa1","721e7b8ccbcdb0599123bcc94b18ca247bc329cda0a4028703cf5610b4c3f90a","42baf4ca38c38deaf411ea73f37bc39ff56c6e5c761a968b64ac1b25c92b5cd8","d7dbe0ad36bdca8a6ecf143422a48e72cc8927bab7b23a1a2485c2f78a7022c6","8718fa41d7cf4aa91de4e8f164c90f88e0bf343aa92a1b9b725a9c675c64e16b","f992cd6cc0bcbaa4e6c810468c90f2d8595f8c6c3cf050c806397d3de8585562","104c67f0da1bdf0d94865419247e20eded83ce7f9911a1aa75fc675c077ca66e","0dc6940ff35d845686a118ee7384713a84024d60ef26f25a2f87992ec7ddbd64","5385a7d591ae122fa744b647909ed60c065fc74715f2d350325aefb20af7381f","68cc8d6fcc2f270d7108f02f3ebc59480a54615be3e09a47e14527f349e9d53e","3eb11dbf3489064a47a2e1cf9d261b1f100ef0b3b50ffca6c44dd99d6dd81ac1","c0017998521cb9c4844bbc2b522ed2c257aa04e4582967fd6168fcd86cc13ab4","bc9d7f2a012412c294f4eb0fc856e063112a3666957a190542b62662391810b2",{"version":"64d4b35c5456adf258d2cf56c341e203a073253f229ef3208fc0d5020253b241","affectsGlobalScope":true},"ee7d8894904b465b072be0d2e4b45cf6b887cdba16a467645c4e200982ece7ea","f3d8c757e148ad968f0d98697987db363070abada5f503da3c06aefd9d4248c1","7852500a7dc3f9cb6b73d619f6e0249119211ea662fd5e16c59ee5aba3deeb80","1f68ab0e055994eb337b67aa87d2a15e0200951e9664959b3866ee6f6b11a0fe","085d4c9f010e6f363961dd1939a851d029b97994f705d79f2a72a0c88a5c4bc5",{"version":"0b812af1c8e8062774c99f008bea098f290db21fd3b4efb0c539356e722e9f6a","affectsGlobalScope":true},"c6bb7e4c7e80685ad60e2b286ee7eea9fffb05d48e24e52dbbb67d7214596e33","975f84de013567851d216d78a3a86736bb330cae11fdc907b222dffa148b31d2","ed19da84b7dbf00952ad0b98ce5c194f1903bcf7c94d8103e8e0d63b271543ae","ee65fe452abe1309389c5f50710f24114e08a302d40708101c4aa950a2a7d044",{"version":"0fc30665ed9340743e9a9fee26b4bf59f71280315a7b13a0c37f59c07ddab2d9","affectsGlobalScope":true},"96d14f21b7652903852eef49379d04dbda28c16ed36468f8c9fa08f7c14c9538","fec943fdb3275eb6e006b35e04a8e2e99e9adf3f4b969ddf15315ac7575a93e4","742f21debb3937c3839a63245648238555bdab1ea095d43fd10c88a64029bf76","7cfdf3b9a5ba934a058bfc9390c074104dc7223b7e3c16fd5335206d789bc3d3","ff81bffa4ecfceae2e86b5920c3fcb250b66b1d6ed72944dffdf58123be2481b","458111fc89d11d2151277c822dfdc1a28fa5b6b2493cf942e37d4cd0a6ee5f22","da2b6356b84a40111aaecb18304ea4e4fcb43d70efb1c13ca7d7a906445ee0d3","187119ff4f9553676a884e296089e131e8cc01691c546273b1d0089c3533ce42","aa2c18a1b5a086bbcaae10a4efba409cc95ba7287d8cf8f2591b53704fea3dea","6f294731b495c65ecf46a5694f0082954b961cf05463bea823f8014098eaffa0","0aaef8cded245bf5036a7a40b65622dd6c4da71f7a35343112edbe112b348a1e","00baffbe8a2f2e4875367479489b5d43b5fc1429ecb4a4cc98cfc3009095f52a","6c65d33115c7410ecbb59db5fcbb042fc6b831a258d028dbb06b42b75d8459c1","3c92b6dfd43cc1c2485d9eba5ff0b74a19bb8725b692773ef1d66dac48cda4bd","b03afe4bec768ae333582915146f48b161e567a81b5ebc31c4d78af089770ac9","df996e25faa505f85aeb294d15ebe61b399cf1d1e49959cdfaf2cc0815c203f9","4f6a12044ee6f458db11964153830abbc499e73d065c51c329ec97407f4b13dd","0e60e0cbf2283adfd5a15430ae548cd2f662d581b5da6ecd98220203e7067c70","0944f27ebff4b20646b71e7e3faaaae50a6debd40bc63e225de1320dd15c5795","5d30565583300c9256072a013ac0318cc603ff769b4c5cafc222394ea93963e1","6dfd0aeb128f03ebaa66306bf1fc753bf434f47373900fc2205660fae499ac2e","a109c4289d59d9019cfe1eeab506fe57817ee549499b02a83a7e9d3bdf662d63","169cc96316cacf8b489aaab4ac6bcef7b33e8779a8902bce57c737b4aa372d16","8841e2aa774b89bd23302dede20663306dc1b9902431ac64b24be8b8d0e3f649","fbca5ffaebf282ec3cdac47b0d1d4a138a8b0bb32105251a38acb235087d3318",{"version":"3f6d6465811321abc30a1e5f667feed63e5b3917b3d6c8d6645daf96c75f97ba","affectsGlobalScope":true},"22293bd6fa12747929f8dfca3ec1684a3fe08638aa18023dd286ab337e88a592","916be7d770b0ae0406be9486ac12eb9825f21514961dd050594c4b250617d5a8","254d9fb8c872d73d34594be8a200fd7311dbfa10a4116bfc465fba408052f2b3","e7500c5c071db4d1e20e87166be266f489dd632b738e885b221e6efa6c8efe89","4cf58cd73f135e59d2268b4b792623bd8cc7ea887d96498f2a64d550beb930bb","cc6bdeb756593c9c914204f158057b328ed53c898f176a0706a8dafcc108b49e","d8f7109e14f20eb735225a62fd3f8366da1a8349e90331cdad57f4b04caf6c5a","cf3d384d082b933d987c4e2fe7bfb8710adfd9dc8155190056ed6695a25a559e","9871b7ee672bc16c78833bdab3052615834b08375cb144e4d2cba74473f4a589","c863198dae89420f3c552b5a03da6ed6d0acfa3807a64772b895db624b0de707","8b03a5e327d7db67112ebbc93b4f744133eda2c1743dbb0a990c61a8007823ef","86c73f2ee1752bac8eeeece234fd05dfcf0637a4fbd8032e4f5f43102faa8eec","42fad1f540271e35ca37cecda12c4ce2eef27f0f5cf0f8dd761d723c744d3159","ff3743a5de32bee10906aff63d1de726f6a7fd6ee2da4b8229054dfa69de2c34","83acd370f7f84f203e71ebba33ba61b7f1291ca027d7f9a662c6307d74e4ac22","1445cec898f90bdd18b2949b9590b3c012f5b7e1804e6e329fb0fe053946d5ec","0e5318ec2275d8da858b541920d9306650ae6ac8012f0e872fe66eb50321a669","cf530297c3fb3a92ec9591dd4fa229d58b5981e45fe6702a0bd2bea53a5e59be","c1f6f7d08d42148ddfe164d36d7aba91f467dbcb3caa715966ff95f55048b3a4","f4e9bf9103191ef3b3612d3ec0044ca4044ca5be27711fe648ada06fad4bcc85","0c1ee27b8f6a00097c2d6d91a21ee4d096ab52c1e28350f6362542b55380059a","7677d5b0db9e020d3017720f853ba18f415219fb3a9597343b1b1012cfd699f7","bc1c6bc119c1784b1a2be6d9c47addec0d83ef0d52c8fbe1f14a51b4dfffc675","52cf2ce99c2a23de70225e252e9822a22b4e0adb82643ab0b710858810e00bf1","770625067bb27a20b9826255a8d47b6b5b0a2d3dfcbd21f89904c731f671ba77","d1ed6765f4d7906a05968fb5cd6d1db8afa14dbe512a4884e8ea5c0f5e142c80","799c0f1b07c092626cf1efd71d459997635911bb5f7fc1196efe449bba87e965","2a184e4462b9914a30b1b5c41cf80c6d3428f17b20d3afb711fff3f0644001fd","9eabde32a3aa5d80de34af2c2206cdc3ee094c6504a8d0c2d6d20c7c179503cc","397c8051b6cfcb48aa22656f0faca2553c5f56187262135162ee79d2b2f6c966","a8ead142e0c87dcd5dc130eba1f8eeed506b08952d905c47621dc2f583b1bff9","a02f10ea5f73130efca046429254a4e3c06b5475baecc8f7b99a0014731be8b3","c2576a4083232b0e2d9bd06875dd43d371dee2e090325a9eac0133fd5650c1cb","4c9a0564bb317349de6a24eb4efea8bb79898fa72ad63a1809165f5bd42970dd","f40ac11d8859092d20f953aae14ba967282c3bb056431a37fced1866ec7a2681","cc11e9e79d4746cc59e0e17473a59d6f104692fd0eeea1bdb2e206eabed83b03","b444a410d34fb5e98aa5ee2b381362044f4884652e8bc8a11c8fe14bbd85518e","c35808c1f5e16d2c571aa65067e3cb95afeff843b259ecfa2fc107a9519b5392","14d5dc055143e941c8743c6a21fa459f961cbc3deedf1bfe47b11587ca4b3ef5","a3ad4e1fc542751005267d50a6298e6765928c0c3a8dce1572f2ba6ca518661c","f237e7c97a3a89f4591afd49ecb3bd8d14f51a1c4adc8fcae3430febedff5eb6","3ffdfbec93b7aed71082af62b8c3e0cc71261cc68d796665faa1e91604fbae8f","662201f943ed45b1ad600d03a90dffe20841e725203ced8b708c91fcd7f9379a","c9ef74c64ed051ea5b958621e7fb853fe3b56e8787c1587aefc6ea988b3c7e79","2462ccfac5f3375794b861abaa81da380f1bbd9401de59ffa43119a0b644253d","34baf65cfee92f110d6653322e2120c2d368ee64b3c7981dff08ed105c4f19b0","7d8ddf0f021c53099e34ee831a06c394d50371816caa98684812f089b4c6b3d4","2bc8dc34e17c2289dec4615104ee29c874bf5e5224e199e376fdd502bb83ef9a","168435ab3390620aebf1aa0001b380983582d0849755eeb17f2c501d1fc57587","bf405bf5f16c35b3b2f0956602e4305d2b799a80ccbe384ff7cbfdd742cfc688","31c502014e5ba046d5cb060136929b73fd53f0f989aa37b2b0424644cb0d93ef",{"version":"c3924759a92cd75c7b9d36bc3aa7614e31c81df4a1dd8fc4289a9eeb56c596e0","affectsGlobalScope":true},{"version":"88c95849c807dcd491e15d624f27bc5e5680590bfb87d0278612aaee2d6214f7","affectsGlobalScope":true},"a6a80d576cb7beda26af64d1e0a23e382c9986fae214de994870f4cd7b4e0ea1","829c6dfd3224be3b599c64ce7fa9136a3422ac7ab4569cc52469c65574facb23","bae8d023ef6b23df7da26f51cea44321f95817c190342a36882e93b80d07a960","b7b0003c5404c9cae2d7caf5d6b469b190cea06cce7815ba0e479a4457875290","e9b48596baefe465d46567a4beccd564035024a154d99f54c7fed02380707333","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":[[141],[142],[129],[129,148],[91,94,121,129,150,151,152],[94,129],[84,129],[157],[147],[162,164],[161,162,163],[129,147],[167],[92,129],[91,129],[175],[177,179,180,181,182,183,184,185,186,187,188,189],[177,178,180,181,182,183,184,185,186,187,188,189],[178,179,180,181,182,183,184,185,186,187,188,189],[177,178,179,181,182,183,184,185,186,187,188,189],[177,178,179,180,182,183,184,185,186,187,188,189],[177,178,179,180,181,183,184,185,186,187,188,189],[177,178,179,180,181,182,184,185,186,187,188,189],[177,178,179,180,181,182,183,185,186,187,188,189],[177,178,179,180,181,182,183,184,186,187,188,189],[177,178,179,180,181,182,183,184,185,187,188,189],[177,178,179,180,181,182,183,184,185,186,188,189],[177,178,179,180,181,182,183,184,185,186,187,189],[177,178,179,180,181,182,183,184,185,186,187,188],[176,192],[193],[191],[42],[78],[79,84,113],[80,85,91,92,99,110,121],[80,81,91,99],[82,122],[83,84,92,100],[84,110,118],[85,87,91,99],[78,86],[87,88],[91],[89,91],[78,91],[91,92,93,110,121],[91,92,93,106,110,113],[76,79,126],[87,91,94,99,110,121],[91,92,94,95,99,110,118,121],[94,96,110,118,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,128],[91,97],[98,121,126],[87,91,99,110],[100],[101],[78,102],[99,100,103,120,126],[104],[105],[91,106,107],[106,108,122,124],[79,91,110,111,112,113],[79,110,112],[110,111],[113],[114],[78,110],[91,116,117],[116,117],[84,99,110,118],[119],[99,120],[79,94,105,121],[84,122],[110,123],[98,124],[125],[79,84,91,93,102,110,121,124,126],[110,127],[110,129],[94,110,129],[206,245],[206,230,245],[245],[206],[206,231,245],[206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244],[231,245],[79,92,94,110,129,155],[250],[91,94,96,99,121,127,129],[254],[132,133,134,135,136,137,138,140],[79,110,129,130,133],[79,110,129,130,131,132],[110,133],[79,110,129,130],[136,139],[110,130],[79,110,129],[53,57,121],[53,110,121],[48],[50,53,118,121],[99,118],[48,129],[50,53,99,121],[45,46,49,52,79,91,110,121],[45,51],[49,53,79,113,121,129],[79,129],[69,79,129],[47,48,129],[53],[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],[53,60,61],[51,53,61,62],[52],[45,48,53],[53,57,61,62],[57],[51,53,56,121],[45,50,51,53,57,60],[79,110],[48,53,69,79,126,129],[256,257],[260]],"referencedMap":[[142,1],[143,2],[147,3],[149,4],[153,5],[154,6],[156,7],[158,8],[159,3],[160,9],[165,10],[164,11],[166,12],[168,13],[170,14],[174,15],[176,16],[178,17],[179,18],[177,19],[180,20],[181,21],[182,22],[183,23],[184,24],[185,25],[186,26],[187,27],[188,28],[189,29],[193,30],[194,31],[192,32],[42,33],[43,33],[78,34],[79,35],[80,36],[81,37],[82,38],[83,39],[84,40],[85,41],[86,42],[87,43],[88,43],[90,44],[89,45],[91,46],[92,47],[93,48],[77,49],[94,50],[95,51],[96,52],[129,53],[97,54],[98,55],[99,56],[100,57],[101,58],[102,59],[103,60],[104,61],[105,62],[106,63],[107,63],[108,64],[110,65],[112,66],[111,67],[113,68],[114,69],[115,70],[116,71],[117,72],[118,73],[119,74],[120,75],[121,76],[122,77],[123,78],[124,79],[125,80],[126,81],[127,82],[201,3],[202,83],[204,7],[152,84],[205,3],[230,85],[231,86],[206,87],[209,87],[228,85],[229,85],[219,85],[218,88],[216,85],[211,85],[224,85],[222,85],[226,85],[210,85],[223,85],[227,85],[212,85],[213,85],[225,85],[207,85],[214,85],[215,85],[217,85],[221,85],[232,89],[220,85],[208,85],[245,90],[239,89],[241,91],[240,89],[233,89],[234,89],[236,89],[238,89],[242,91],[243,91],[235,91],[237,91],[246,7],[249,92],[251,93],[253,94],[255,95],[148,3],[141,96],[134,97],[133,98],[135,99],[136,100],[140,101],[131,102],[150,44],[130,103],[60,104],[67,105],[59,104],[74,106],[51,107],[50,108],[73,3],[68,109],[71,110],[53,111],[52,112],[48,113],[47,114],[70,115],[49,116],[54,117],[58,117],[76,118],[75,117],[62,119],[63,120],[65,121],[61,122],[64,123],[69,3],[56,124],[57,125],[66,126],[46,127],[72,128],[257,129],[261,130]],"exportedModulesMap":[[143,2],[147,3],[149,4],[153,5],[154,6],[156,7],[158,8],[159,3],[160,9],[165,10],[164,11],[166,12],[168,13],[170,14],[174,15],[176,16],[178,17],[179,18],[177,19],[180,20],[181,21],[182,22],[183,23],[184,24],[185,25],[186,26],[187,27],[188,28],[189,29],[193,30],[194,31],[192,32],[42,33],[43,33],[78,34],[79,35],[80,36],[81,37],[82,38],[83,39],[84,40],[85,41],[86,42],[87,43],[88,43],[90,44],[89,45],[91,46],[92,47],[93,48],[77,49],[94,50],[95,51],[96,52],[129,53],[97,54],[98,55],[99,56],[100,57],[101,58],[102,59],[103,60],[104,61],[105,62],[106,63],[107,63],[108,64],[110,65],[112,66],[111,67],[113,68],[114,69],[115,70],[116,71],[117,72],[118,73],[119,74],[120,75],[121,76],[122,77],[123,78],[124,79],[125,80],[126,81],[127,82],[201,3],[202,83],[204,7],[152,84],[205,3],[230,85],[231,86],[206,87],[209,87],[228,85],[229,85],[219,85],[218,88],[216,85],[211,85],[224,85],[222,85],[226,85],[210,85],[223,85],[227,85],[212,85],[213,85],[225,85],[207,85],[214,85],[215,85],[217,85],[221,85],[232,89],[220,85],[208,85],[245,90],[239,89],[241,91],[240,89],[233,89],[234,89],[236,89],[238,89],[242,91],[243,91],[235,91],[237,91],[246,7],[249,92],[251,93],[253,94],[255,95],[148,3],[141,96],[134,97],[133,98],[135,99],[136,100],[140,101],[131,102],[150,44],[130,103],[60,104],[67,105],[59,104],[74,106],[51,107],[50,108],[73,3],[68,109],[71,110],[53,111],[52,112],[48,113],[47,114],[70,115],[49,116],[54,117],[58,117],[76,118],[75,117],[62,119],[63,120],[65,121],[61,122],[64,123],[69,3],[56,124],[57,125],[66,126],[46,127],[72,128],[257,129],[261,130]],"semanticDiagnosticsPerFile":[144,142,143,145,146,147,149,153,154,155,156,158,159,160,165,161,164,162,166,167,168,169,170,171,151,172,163,173,174,175,176,178,179,177,180,181,182,183,184,185,186,187,188,189,190,193,194,191,192,195,196,197,198,157,42,43,78,79,80,81,82,83,84,85,86,87,88,90,89,91,92,93,77,128,94,95,96,129,97,98,99,100,101,102,103,104,105,106,107,108,109,110,112,111,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,199,200,201,202,203,204,152,205,230,231,206,209,228,229,219,218,216,211,224,222,226,210,223,227,212,213,225,207,214,215,217,221,232,220,208,245,244,239,241,240,233,234,236,238,242,243,235,237,246,247,248,249,250,251,252,253,254,255,148,256,44,141,134,133,135,136,138,139,140,137,132,131,150,130,260,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,257,258,259,261]},"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.200",
|
|
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": "df88ff597fa1b24262dccb232c6ef24e30e1fac0"
|
|
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
|
-
});
|