node-opcua-crypto 4.16.0 → 4.16.1
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/LICENSE +23 -23
- package/dist/{chunk-XPM4YIBT.mjs → chunk-JDT2M2NN.mjs} +7 -7
- package/dist/{chunk-F5EAPW2U.mjs → chunk-MGQCHN54.mjs} +339 -202
- package/dist/chunk-MGQCHN54.mjs.map +1 -0
- package/dist/index.js +337 -200
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/source/index.js +337 -200
- package/dist/source/index.js.map +1 -1
- package/dist/source/index.mjs +1 -1
- package/dist/source/index_web.js +337 -200
- package/dist/source/index_web.js.map +1 -1
- package/dist/source/index_web.mjs +1 -1
- package/dist/source_nodejs/index.js +99 -116
- package/dist/source_nodejs/index.js.map +1 -1
- package/dist/source_nodejs/index.mjs +2 -2
- package/package.json +5 -5
- package/dist/chunk-F5EAPW2U.mjs.map +0 -1
- /package/dist/{chunk-XPM4YIBT.mjs.map → chunk-JDT2M2NN.mjs.map} +0 -0
|
@@ -494,7 +494,7 @@ var BufferSourceConverter = class _BufferSourceConverter {
|
|
|
494
494
|
}
|
|
495
495
|
};
|
|
496
496
|
var STRING_TYPE = "string";
|
|
497
|
-
var HEX_REGEX = /^[0-9a-f]+$/i;
|
|
497
|
+
var HEX_REGEX = /^[0-9a-f\s]+$/i;
|
|
498
498
|
var BASE64_REGEX = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/;
|
|
499
499
|
var BASE64URL_REGEX = /^[a-zA-Z0-9-_]+$/;
|
|
500
500
|
var Utf8Converter = class {
|
|
@@ -942,19 +942,19 @@ var BIT_STRING_NAME = "BIT STRING";
|
|
|
942
942
|
function HexBlock(BaseClass) {
|
|
943
943
|
var _a2;
|
|
944
944
|
return _a2 = class Some extends BaseClass {
|
|
945
|
-
constructor(...args) {
|
|
946
|
-
var _a3;
|
|
947
|
-
super(...args);
|
|
948
|
-
const params = args[0] || {};
|
|
949
|
-
this.isHexOnly = (_a3 = params.isHexOnly) !== null && _a3 !== void 0 ? _a3 : false;
|
|
950
|
-
this.valueHexView = params.valueHex ? BufferSourceConverter.toUint8Array(params.valueHex) : EMPTY_VIEW;
|
|
951
|
-
}
|
|
952
945
|
get valueHex() {
|
|
953
946
|
return this.valueHexView.slice().buffer;
|
|
954
947
|
}
|
|
955
948
|
set valueHex(value) {
|
|
956
949
|
this.valueHexView = new Uint8Array(value);
|
|
957
950
|
}
|
|
951
|
+
constructor(...args) {
|
|
952
|
+
var _b;
|
|
953
|
+
super(...args);
|
|
954
|
+
const params = args[0] || {};
|
|
955
|
+
this.isHexOnly = (_b = params.isHexOnly) !== null && _b !== void 0 ? _b : false;
|
|
956
|
+
this.valueHexView = params.valueHex ? BufferSourceConverter.toUint8Array(params.valueHex) : EMPTY_VIEW;
|
|
957
|
+
}
|
|
958
958
|
fromBER(inputBuffer, inputOffset, inputLength) {
|
|
959
959
|
const view = inputBuffer instanceof ArrayBuffer ? new Uint8Array(inputBuffer) : inputBuffer;
|
|
960
960
|
if (!checkBufferParams(this, view, inputOffset, inputLength)) {
|
|
@@ -989,12 +989,6 @@ function HexBlock(BaseClass) {
|
|
|
989
989
|
}, _a2.NAME = "hexBlock", _a2;
|
|
990
990
|
}
|
|
991
991
|
var LocalBaseBlock = class {
|
|
992
|
-
constructor({ blockLength = 0, error = EMPTY_STRING, warnings = [], valueBeforeDecode = EMPTY_VIEW } = {}) {
|
|
993
|
-
this.blockLength = blockLength;
|
|
994
|
-
this.error = error;
|
|
995
|
-
this.warnings = warnings;
|
|
996
|
-
this.valueBeforeDecodeView = BufferSourceConverter.toUint8Array(valueBeforeDecode);
|
|
997
|
-
}
|
|
998
992
|
static blockName() {
|
|
999
993
|
return this.NAME;
|
|
1000
994
|
}
|
|
@@ -1004,6 +998,12 @@ var LocalBaseBlock = class {
|
|
|
1004
998
|
set valueBeforeDecode(value) {
|
|
1005
999
|
this.valueBeforeDecodeView = new Uint8Array(value);
|
|
1006
1000
|
}
|
|
1001
|
+
constructor({ blockLength = 0, error = EMPTY_STRING, warnings = [], valueBeforeDecode = EMPTY_VIEW } = {}) {
|
|
1002
|
+
this.blockLength = blockLength;
|
|
1003
|
+
this.error = error;
|
|
1004
|
+
this.warnings = warnings;
|
|
1005
|
+
this.valueBeforeDecodeView = BufferSourceConverter.toUint8Array(valueBeforeDecode);
|
|
1006
|
+
}
|
|
1007
1007
|
toJSON() {
|
|
1008
1008
|
return {
|
|
1009
1009
|
blockName: this.constructor.NAME,
|
|
@@ -1016,10 +1016,10 @@ var LocalBaseBlock = class {
|
|
|
1016
1016
|
};
|
|
1017
1017
|
LocalBaseBlock.NAME = "baseBlock";
|
|
1018
1018
|
var ValueBlock = class extends LocalBaseBlock {
|
|
1019
|
-
fromBER(
|
|
1019
|
+
fromBER(_inputBuffer, _inputOffset, _inputLength) {
|
|
1020
1020
|
throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'");
|
|
1021
1021
|
}
|
|
1022
|
-
toBER(
|
|
1022
|
+
toBER(_sizeOnly, _writer) {
|
|
1023
1023
|
throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'");
|
|
1024
1024
|
}
|
|
1025
1025
|
};
|
|
@@ -1360,7 +1360,9 @@ var BaseBlock = class extends LocalBaseBlock {
|
|
|
1360
1360
|
return Convert.ToHex(this.toBER());
|
|
1361
1361
|
}
|
|
1362
1362
|
onAsciiEncoding() {
|
|
1363
|
-
|
|
1363
|
+
const name = this.constructor.NAME;
|
|
1364
|
+
const value = Convert.ToHex(this.valueBlock.valueBeforeDecodeView);
|
|
1365
|
+
return `${name} : ${value}`;
|
|
1364
1366
|
}
|
|
1365
1367
|
isEqual(other) {
|
|
1366
1368
|
if (this === other) {
|
|
@@ -1376,6 +1378,7 @@ var BaseBlock = class extends LocalBaseBlock {
|
|
|
1376
1378
|
};
|
|
1377
1379
|
BaseBlock.NAME = "BaseBlock";
|
|
1378
1380
|
function prepareIndefiniteForm(baseBlock) {
|
|
1381
|
+
var _a2;
|
|
1379
1382
|
if (baseBlock instanceof typeStore.Constructed) {
|
|
1380
1383
|
for (const value of baseBlock.valueBlock.value) {
|
|
1381
1384
|
if (prepareIndefiniteForm(value)) {
|
|
@@ -1383,21 +1386,21 @@ function prepareIndefiniteForm(baseBlock) {
|
|
|
1383
1386
|
}
|
|
1384
1387
|
}
|
|
1385
1388
|
}
|
|
1386
|
-
return !!baseBlock.lenBlock.isIndefiniteForm;
|
|
1389
|
+
return !!((_a2 = baseBlock.lenBlock) === null || _a2 === void 0 ? void 0 : _a2.isIndefiniteForm);
|
|
1387
1390
|
}
|
|
1388
1391
|
var BaseStringBlock = class extends BaseBlock {
|
|
1389
|
-
constructor({ value = EMPTY_STRING, ...parameters } = {}, stringValueBlockType) {
|
|
1390
|
-
super(parameters, stringValueBlockType);
|
|
1391
|
-
if (value) {
|
|
1392
|
-
this.fromString(value);
|
|
1393
|
-
}
|
|
1394
|
-
}
|
|
1395
1392
|
getValue() {
|
|
1396
1393
|
return this.valueBlock.value;
|
|
1397
1394
|
}
|
|
1398
1395
|
setValue(value) {
|
|
1399
1396
|
this.valueBlock.value = value;
|
|
1400
1397
|
}
|
|
1398
|
+
constructor({ value = EMPTY_STRING, ...parameters } = {}, stringValueBlockType) {
|
|
1399
|
+
super(parameters, stringValueBlockType);
|
|
1400
|
+
if (value) {
|
|
1401
|
+
this.fromString(value);
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1401
1404
|
fromBER(inputBuffer, inputOffset, inputLength) {
|
|
1402
1405
|
const resultOffset = this.valueBlock.fromBER(inputBuffer, inputOffset, this.lenBlock.isIndefiniteForm ? inputLength : this.lenBlock.length);
|
|
1403
1406
|
if (resultOffset === -1) {
|
|
@@ -1756,10 +1759,10 @@ _a$v = Constructed;
|
|
|
1756
1759
|
})();
|
|
1757
1760
|
Constructed.NAME = "CONSTRUCTED";
|
|
1758
1761
|
var LocalEndOfContentValueBlock = class extends ValueBlock {
|
|
1759
|
-
fromBER(inputBuffer, inputOffset,
|
|
1762
|
+
fromBER(inputBuffer, inputOffset, _inputLength) {
|
|
1760
1763
|
return inputOffset;
|
|
1761
1764
|
}
|
|
1762
|
-
toBER(
|
|
1765
|
+
toBER(_sizeOnly) {
|
|
1763
1766
|
return EMPTY_BUFFER;
|
|
1764
1767
|
}
|
|
1765
1768
|
};
|
|
@@ -1820,17 +1823,6 @@ _a$t = Null;
|
|
|
1820
1823
|
})();
|
|
1821
1824
|
Null.NAME = "NULL";
|
|
1822
1825
|
var LocalBooleanValueBlock = class extends HexBlock(ValueBlock) {
|
|
1823
|
-
constructor({ value, ...parameters } = {}) {
|
|
1824
|
-
super(parameters);
|
|
1825
|
-
if (parameters.valueHex) {
|
|
1826
|
-
this.valueHexView = BufferSourceConverter.toUint8Array(parameters.valueHex);
|
|
1827
|
-
} else {
|
|
1828
|
-
this.valueHexView = new Uint8Array(1);
|
|
1829
|
-
}
|
|
1830
|
-
if (value) {
|
|
1831
|
-
this.value = value;
|
|
1832
|
-
}
|
|
1833
|
-
}
|
|
1834
1826
|
get value() {
|
|
1835
1827
|
for (const octet of this.valueHexView) {
|
|
1836
1828
|
if (octet > 0) {
|
|
@@ -1842,6 +1834,17 @@ var LocalBooleanValueBlock = class extends HexBlock(ValueBlock) {
|
|
|
1842
1834
|
set value(value) {
|
|
1843
1835
|
this.valueHexView[0] = value ? 255 : 0;
|
|
1844
1836
|
}
|
|
1837
|
+
constructor({ value, ...parameters } = {}) {
|
|
1838
|
+
super(parameters);
|
|
1839
|
+
if (parameters.valueHex) {
|
|
1840
|
+
this.valueHexView = BufferSourceConverter.toUint8Array(parameters.valueHex);
|
|
1841
|
+
} else {
|
|
1842
|
+
this.valueHexView = new Uint8Array(1);
|
|
1843
|
+
}
|
|
1844
|
+
if (value) {
|
|
1845
|
+
this.value = value;
|
|
1846
|
+
}
|
|
1847
|
+
}
|
|
1845
1848
|
fromBER(inputBuffer, inputOffset, inputLength) {
|
|
1846
1849
|
const inputView = BufferSourceConverter.toUint8Array(inputBuffer);
|
|
1847
1850
|
if (!checkBufferParams(this, inputView, inputOffset, inputLength)) {
|
|
@@ -1868,17 +1871,17 @@ var LocalBooleanValueBlock = class extends HexBlock(ValueBlock) {
|
|
|
1868
1871
|
LocalBooleanValueBlock.NAME = "BooleanValueBlock";
|
|
1869
1872
|
var _a$s;
|
|
1870
1873
|
var Boolean = class extends BaseBlock {
|
|
1871
|
-
constructor(parameters = {}) {
|
|
1872
|
-
super(parameters, LocalBooleanValueBlock);
|
|
1873
|
-
this.idBlock.tagClass = 1;
|
|
1874
|
-
this.idBlock.tagNumber = 1;
|
|
1875
|
-
}
|
|
1876
1874
|
getValue() {
|
|
1877
1875
|
return this.valueBlock.value;
|
|
1878
1876
|
}
|
|
1879
1877
|
setValue(value) {
|
|
1880
1878
|
this.valueBlock.value = value;
|
|
1881
1879
|
}
|
|
1880
|
+
constructor(parameters = {}) {
|
|
1881
|
+
super(parameters, LocalBooleanValueBlock);
|
|
1882
|
+
this.idBlock.tagClass = 1;
|
|
1883
|
+
this.idBlock.tagNumber = 1;
|
|
1884
|
+
}
|
|
1882
1885
|
onAsciiEncoding() {
|
|
1883
1886
|
return `${this.constructor.NAME} : ${this.getValue}`;
|
|
1884
1887
|
}
|
|
@@ -1936,7 +1939,7 @@ var LocalOctetStringValueBlock = class extends HexBlock(LocalConstructedValueBlo
|
|
|
1936
1939
|
};
|
|
1937
1940
|
LocalOctetStringValueBlock.NAME = "OctetStringValueBlock";
|
|
1938
1941
|
var _a$r;
|
|
1939
|
-
var OctetString = class
|
|
1942
|
+
var OctetString = class extends BaseBlock {
|
|
1940
1943
|
constructor({ idBlock = {}, lenBlock = {}, ...parameters } = {}) {
|
|
1941
1944
|
var _b, _c;
|
|
1942
1945
|
(_b = parameters.isConstructed) !== null && _b !== void 0 ? _b : parameters.isConstructed = !!((_c = parameters.value) === null || _c === void 0 ? void 0 : _c.length);
|
|
@@ -1974,7 +1977,7 @@ var OctetString = class _OctetString extends BaseBlock {
|
|
|
1974
1977
|
this.valueBlock.value = [asn.result];
|
|
1975
1978
|
}
|
|
1976
1979
|
}
|
|
1977
|
-
} catch
|
|
1980
|
+
} catch {
|
|
1978
1981
|
}
|
|
1979
1982
|
}
|
|
1980
1983
|
return super.fromBER(inputBuffer, inputOffset, inputLength);
|
|
@@ -1983,7 +1986,9 @@ var OctetString = class _OctetString extends BaseBlock {
|
|
|
1983
1986
|
if (this.valueBlock.isConstructed || this.valueBlock.value && this.valueBlock.value.length) {
|
|
1984
1987
|
return Constructed.prototype.onAsciiEncoding.call(this);
|
|
1985
1988
|
}
|
|
1986
|
-
|
|
1989
|
+
const name = this.constructor.NAME;
|
|
1990
|
+
const value = Convert.ToHex(this.valueBlock.valueHexView);
|
|
1991
|
+
return `${name} : ${value}`;
|
|
1987
1992
|
}
|
|
1988
1993
|
getValue() {
|
|
1989
1994
|
if (!this.idBlock.isConstructed) {
|
|
@@ -1991,7 +1996,7 @@ var OctetString = class _OctetString extends BaseBlock {
|
|
|
1991
1996
|
}
|
|
1992
1997
|
const array = [];
|
|
1993
1998
|
for (const content of this.valueBlock.value) {
|
|
1994
|
-
if (content instanceof
|
|
1999
|
+
if (content instanceof _a$r) {
|
|
1995
2000
|
array.push(content.valueBlock.valueHexView);
|
|
1996
2001
|
}
|
|
1997
2002
|
}
|
|
@@ -2061,7 +2066,7 @@ var LocalBitStringValueBlock = class extends HexBlock(LocalConstructedValueBlock
|
|
|
2061
2066
|
this.value = [asn.result];
|
|
2062
2067
|
}
|
|
2063
2068
|
}
|
|
2064
|
-
} catch
|
|
2069
|
+
} catch {
|
|
2065
2070
|
}
|
|
2066
2071
|
}
|
|
2067
2072
|
this.valueHexView = intBuffer.subarray(1);
|
|
@@ -2076,7 +2081,9 @@ var LocalBitStringValueBlock = class extends HexBlock(LocalConstructedValueBlock
|
|
|
2076
2081
|
return new ArrayBuffer(this.valueHexView.byteLength + 1);
|
|
2077
2082
|
}
|
|
2078
2083
|
if (!this.valueHexView.byteLength) {
|
|
2079
|
-
|
|
2084
|
+
const empty = new Uint8Array(1);
|
|
2085
|
+
empty[0] = 0;
|
|
2086
|
+
return empty.buffer;
|
|
2080
2087
|
}
|
|
2081
2088
|
const retView = new Uint8Array(this.valueHexView.length + 1);
|
|
2082
2089
|
retView[0] = this.unusedBits;
|
|
@@ -2126,7 +2133,9 @@ var BitString = class extends BaseBlock {
|
|
|
2126
2133
|
bits.push(byte.toString(2).padStart(8, "0"));
|
|
2127
2134
|
}
|
|
2128
2135
|
const bitsStr = bits.join("");
|
|
2129
|
-
|
|
2136
|
+
const name = this.constructor.NAME;
|
|
2137
|
+
const value = bitsStr.substring(0, bitsStr.length - this.valueBlock.unusedBits);
|
|
2138
|
+
return `${name} : ${value}`;
|
|
2130
2139
|
}
|
|
2131
2140
|
}
|
|
2132
2141
|
};
|
|
@@ -2223,16 +2232,6 @@ function viewSub(first, second) {
|
|
|
2223
2232
|
return firstViewCopy.slice();
|
|
2224
2233
|
}
|
|
2225
2234
|
var LocalIntegerValueBlock = class extends HexBlock(ValueBlock) {
|
|
2226
|
-
constructor({ value, ...parameters } = {}) {
|
|
2227
|
-
super(parameters);
|
|
2228
|
-
this._valueDec = 0;
|
|
2229
|
-
if (parameters.valueHex) {
|
|
2230
|
-
this.setValueHex();
|
|
2231
|
-
}
|
|
2232
|
-
if (value !== void 0) {
|
|
2233
|
-
this.valueDec = value;
|
|
2234
|
-
}
|
|
2235
|
-
}
|
|
2236
2235
|
setValueHex() {
|
|
2237
2236
|
if (this.valueHexView.length >= 4) {
|
|
2238
2237
|
this.warnings.push("Too big Integer for decoding, hex only");
|
|
@@ -2245,6 +2244,16 @@ var LocalIntegerValueBlock = class extends HexBlock(ValueBlock) {
|
|
|
2245
2244
|
}
|
|
2246
2245
|
}
|
|
2247
2246
|
}
|
|
2247
|
+
constructor({ value, ...parameters } = {}) {
|
|
2248
|
+
super(parameters);
|
|
2249
|
+
this._valueDec = 0;
|
|
2250
|
+
if (parameters.valueHex) {
|
|
2251
|
+
this.setValueHex();
|
|
2252
|
+
}
|
|
2253
|
+
if (value !== void 0) {
|
|
2254
|
+
this.valueDec = value;
|
|
2255
|
+
}
|
|
2256
|
+
}
|
|
2248
2257
|
set valueDec(v) {
|
|
2249
2258
|
this._valueDec = v;
|
|
2250
2259
|
this.isHexOnly = false;
|
|
@@ -2357,7 +2366,7 @@ LocalIntegerValueBlock.NAME = "IntegerValueBlock";
|
|
|
2357
2366
|
});
|
|
2358
2367
|
})();
|
|
2359
2368
|
var _a$o;
|
|
2360
|
-
var Integer = class
|
|
2369
|
+
var Integer = class extends BaseBlock {
|
|
2361
2370
|
constructor(parameters = {}) {
|
|
2362
2371
|
super(parameters, LocalIntegerValueBlock);
|
|
2363
2372
|
this.idBlock.tagClass = 1;
|
|
@@ -2387,18 +2396,16 @@ var Integer = class _Integer extends BaseBlock {
|
|
|
2387
2396
|
}
|
|
2388
2397
|
writer.write(view);
|
|
2389
2398
|
}
|
|
2390
|
-
const res = new
|
|
2391
|
-
valueHex: writer.final()
|
|
2392
|
-
});
|
|
2399
|
+
const res = new _a$o({ valueHex: writer.final() });
|
|
2393
2400
|
return res;
|
|
2394
2401
|
}
|
|
2395
2402
|
convertToDER() {
|
|
2396
|
-
const integer = new
|
|
2403
|
+
const integer = new _a$o({ valueHex: this.valueBlock.valueHexView });
|
|
2397
2404
|
integer.valueBlock.toDER();
|
|
2398
2405
|
return integer;
|
|
2399
2406
|
}
|
|
2400
2407
|
convertFromDER() {
|
|
2401
|
-
return new
|
|
2408
|
+
return new _a$o({
|
|
2402
2409
|
valueHex: this.valueBlock.valueHexView[0] === 0 ? this.valueBlock.valueHexView.subarray(1) : this.valueBlock.valueHexView
|
|
2403
2410
|
});
|
|
2404
2411
|
}
|
|
@@ -2661,17 +2668,17 @@ var LocalObjectIdentifierValueBlock = class extends ValueBlock {
|
|
|
2661
2668
|
LocalObjectIdentifierValueBlock.NAME = "ObjectIdentifierValueBlock";
|
|
2662
2669
|
var _a$m;
|
|
2663
2670
|
var ObjectIdentifier = class extends BaseBlock {
|
|
2664
|
-
constructor(parameters = {}) {
|
|
2665
|
-
super(parameters, LocalObjectIdentifierValueBlock);
|
|
2666
|
-
this.idBlock.tagClass = 1;
|
|
2667
|
-
this.idBlock.tagNumber = 6;
|
|
2668
|
-
}
|
|
2669
2671
|
getValue() {
|
|
2670
2672
|
return this.valueBlock.toString();
|
|
2671
2673
|
}
|
|
2672
2674
|
setValue(value) {
|
|
2673
2675
|
this.valueBlock.fromString(value);
|
|
2674
2676
|
}
|
|
2677
|
+
constructor(parameters = {}) {
|
|
2678
|
+
super(parameters, LocalObjectIdentifierValueBlock);
|
|
2679
|
+
this.idBlock.tagClass = 1;
|
|
2680
|
+
this.idBlock.tagNumber = 6;
|
|
2681
|
+
}
|
|
2675
2682
|
onAsciiEncoding() {
|
|
2676
2683
|
return `${this.constructor.NAME} : ${this.valueBlock.toString() || "empty"}`;
|
|
2677
2684
|
}
|
|
@@ -2791,7 +2798,7 @@ var LocalRelativeObjectIdentifierValueBlock = class extends ValueBlock {
|
|
|
2791
2798
|
}
|
|
2792
2799
|
return resultOffset;
|
|
2793
2800
|
}
|
|
2794
|
-
toBER(sizeOnly,
|
|
2801
|
+
toBER(sizeOnly, _writer) {
|
|
2795
2802
|
const retBuffers = [];
|
|
2796
2803
|
for (let i = 0; i < this.value.length; i++) {
|
|
2797
2804
|
const valueBuf = this.value[i].toBER(sizeOnly);
|
|
@@ -2853,17 +2860,17 @@ var LocalRelativeObjectIdentifierValueBlock = class extends ValueBlock {
|
|
|
2853
2860
|
LocalRelativeObjectIdentifierValueBlock.NAME = "RelativeObjectIdentifierValueBlock";
|
|
2854
2861
|
var _a$l;
|
|
2855
2862
|
var RelativeObjectIdentifier = class extends BaseBlock {
|
|
2856
|
-
constructor(parameters = {}) {
|
|
2857
|
-
super(parameters, LocalRelativeObjectIdentifierValueBlock);
|
|
2858
|
-
this.idBlock.tagClass = 1;
|
|
2859
|
-
this.idBlock.tagNumber = 13;
|
|
2860
|
-
}
|
|
2861
2863
|
getValue() {
|
|
2862
2864
|
return this.valueBlock.toString();
|
|
2863
2865
|
}
|
|
2864
2866
|
setValue(value) {
|
|
2865
2867
|
this.valueBlock.fromString(value);
|
|
2866
2868
|
}
|
|
2869
|
+
constructor(parameters = {}) {
|
|
2870
|
+
super(parameters, LocalRelativeObjectIdentifierValueBlock);
|
|
2871
|
+
this.idBlock.tagClass = 1;
|
|
2872
|
+
this.idBlock.tagNumber = 13;
|
|
2873
|
+
}
|
|
2867
2874
|
onAsciiEncoding() {
|
|
2868
2875
|
return `${this.constructor.NAME} : ${this.valueBlock.toString() || "empty"}`;
|
|
2869
2876
|
}
|
|
@@ -3260,7 +3267,8 @@ var GeneralizedTime = class extends UTCTime {
|
|
|
3260
3267
|
this.millisecond = inputDate.getUTCMilliseconds();
|
|
3261
3268
|
}
|
|
3262
3269
|
toDate() {
|
|
3263
|
-
|
|
3270
|
+
const utcDate = Date.UTC(this.year, this.month - 1, this.day, this.hour, this.minute, this.second, this.millisecond);
|
|
3271
|
+
return new Date(utcDate);
|
|
3264
3272
|
}
|
|
3265
3273
|
fromString(inputString) {
|
|
3266
3274
|
let isUTC = false;
|
|
@@ -3509,28 +3517,28 @@ var Repeated = class extends Any {
|
|
|
3509
3517
|
}
|
|
3510
3518
|
};
|
|
3511
3519
|
var RawData = class {
|
|
3512
|
-
constructor({ data = EMPTY_VIEW } = {}) {
|
|
3513
|
-
this.dataView = BufferSourceConverter.toUint8Array(data);
|
|
3514
|
-
}
|
|
3515
3520
|
get data() {
|
|
3516
3521
|
return this.dataView.slice().buffer;
|
|
3517
3522
|
}
|
|
3518
3523
|
set data(value) {
|
|
3519
3524
|
this.dataView = BufferSourceConverter.toUint8Array(value);
|
|
3520
3525
|
}
|
|
3526
|
+
constructor({ data = EMPTY_VIEW } = {}) {
|
|
3527
|
+
this.dataView = BufferSourceConverter.toUint8Array(data);
|
|
3528
|
+
}
|
|
3521
3529
|
fromBER(inputBuffer, inputOffset, inputLength) {
|
|
3522
3530
|
const endLength = inputOffset + inputLength;
|
|
3523
3531
|
this.dataView = BufferSourceConverter.toUint8Array(inputBuffer).subarray(inputOffset, endLength);
|
|
3524
3532
|
return endLength;
|
|
3525
3533
|
}
|
|
3526
|
-
toBER(
|
|
3534
|
+
toBER(_sizeOnly) {
|
|
3527
3535
|
return this.dataView.slice().buffer;
|
|
3528
3536
|
}
|
|
3529
3537
|
};
|
|
3530
3538
|
function compareSchema(root, inputData, inputSchema) {
|
|
3531
3539
|
if (inputSchema instanceof Choice) {
|
|
3532
|
-
for (
|
|
3533
|
-
const result = compareSchema(root, inputData,
|
|
3540
|
+
for (const element of inputSchema.value) {
|
|
3541
|
+
const result = compareSchema(root, inputData, element);
|
|
3534
3542
|
if (result.verified) {
|
|
3535
3543
|
return {
|
|
3536
3544
|
verified: true,
|
|
@@ -3541,9 +3549,7 @@ function compareSchema(root, inputData, inputSchema) {
|
|
|
3541
3549
|
{
|
|
3542
3550
|
const _result = {
|
|
3543
3551
|
verified: false,
|
|
3544
|
-
result: {
|
|
3545
|
-
error: "Wrong values for Choice type"
|
|
3546
|
-
}
|
|
3552
|
+
result: { error: "Wrong values for Choice type" }
|
|
3547
3553
|
};
|
|
3548
3554
|
if (inputSchema.hasOwnProperty(NAME))
|
|
3549
3555
|
_result.name = inputSchema.name;
|
|
@@ -3689,9 +3695,7 @@ function compareSchema(root, inputData, inputSchema) {
|
|
|
3689
3695
|
let admission = 0;
|
|
3690
3696
|
let result = {
|
|
3691
3697
|
verified: false,
|
|
3692
|
-
result: {
|
|
3693
|
-
error: "Unknown error"
|
|
3694
|
-
}
|
|
3698
|
+
result: { error: "Unknown error" }
|
|
3695
3699
|
};
|
|
3696
3700
|
let maxLength = inputSchema.valueBlock.value.length;
|
|
3697
3701
|
if (maxLength > 0) {
|
|
@@ -3940,10 +3944,7 @@ var AsnSchemaStorage = class {
|
|
|
3940
3944
|
}
|
|
3941
3945
|
}
|
|
3942
3946
|
createDefault(target) {
|
|
3943
|
-
const schema = {
|
|
3944
|
-
type: AsnTypeTypes.Sequence,
|
|
3945
|
-
items: {}
|
|
3946
|
-
};
|
|
3947
|
+
const schema = { type: AsnTypeTypes.Sequence, items: {} };
|
|
3947
3948
|
const parentSchema = this.findParentSchema(target);
|
|
3948
3949
|
if (parentSchema) {
|
|
3949
3950
|
Object.assign(schema, parentSchema);
|
|
@@ -3985,26 +3986,14 @@ var AsnSchemaStorage = class {
|
|
|
3985
3986
|
const Container = item.repeated === "set" ? Set : Sequence;
|
|
3986
3987
|
asn1Item = new Container({
|
|
3987
3988
|
name: "",
|
|
3988
|
-
value: [
|
|
3989
|
-
new Repeated({
|
|
3990
|
-
name,
|
|
3991
|
-
value: asn1Item
|
|
3992
|
-
})
|
|
3993
|
-
]
|
|
3989
|
+
value: [new Repeated({ name, value: asn1Item })]
|
|
3994
3990
|
});
|
|
3995
3991
|
}
|
|
3996
3992
|
if (item.context !== null && item.context !== void 0) {
|
|
3997
3993
|
if (item.implicit) {
|
|
3998
3994
|
if (typeof item.type === "number" || isConvertible(item.type)) {
|
|
3999
3995
|
const Container = item.repeated ? Constructed : Primitive;
|
|
4000
|
-
asn1Value.push(new Container({
|
|
4001
|
-
name,
|
|
4002
|
-
optional,
|
|
4003
|
-
idBlock: {
|
|
4004
|
-
tagClass: 3,
|
|
4005
|
-
tagNumber: item.context
|
|
4006
|
-
}
|
|
4007
|
-
}));
|
|
3996
|
+
asn1Value.push(new Container({ name, optional, idBlock: { tagClass: 3, tagNumber: item.context } }));
|
|
4008
3997
|
} else {
|
|
4009
3998
|
this.cache(item.type);
|
|
4010
3999
|
const isRepeated = !!item.repeated;
|
|
@@ -4013,20 +4002,14 @@ var AsnSchemaStorage = class {
|
|
|
4013
4002
|
asn1Value.push(new Constructed({
|
|
4014
4003
|
name: !isRepeated ? name : "",
|
|
4015
4004
|
optional,
|
|
4016
|
-
idBlock: {
|
|
4017
|
-
tagClass: 3,
|
|
4018
|
-
tagNumber: item.context
|
|
4019
|
-
},
|
|
4005
|
+
idBlock: { tagClass: 3, tagNumber: item.context },
|
|
4020
4006
|
value
|
|
4021
4007
|
}));
|
|
4022
4008
|
}
|
|
4023
4009
|
} else {
|
|
4024
4010
|
asn1Value.push(new Constructed({
|
|
4025
4011
|
optional,
|
|
4026
|
-
idBlock: {
|
|
4027
|
-
tagClass: 3,
|
|
4028
|
-
tagNumber: item.context
|
|
4029
|
-
},
|
|
4012
|
+
idBlock: { tagClass: 3, tagNumber: item.context },
|
|
4030
4013
|
value: [asn1Item]
|
|
4031
4014
|
}));
|
|
4032
4015
|
}
|
|
@@ -4102,7 +4085,7 @@ pvtsutils/build/index.es.js:
|
|
|
4102
4085
|
(*!
|
|
4103
4086
|
* MIT License
|
|
4104
4087
|
*
|
|
4105
|
-
* Copyright (c) 2017-
|
|
4088
|
+
* Copyright (c) 2017-2024 Peculiar Ventures, LLC
|
|
4106
4089
|
*
|
|
4107
4090
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4108
4091
|
* of this software and associated documentation files (the "Software"), to deal
|