@blamejs/core 0.18.39 → 0.18.40
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 +100 -0
- package/NOTICE +2 -2
- package/README.md +1 -1
- package/lib/app.js +14 -5
- package/lib/file-upload.js +17 -3
- package/lib/gate-contract.js +159 -5
- package/lib/guard-filename.js +93 -18
- package/lib/guard-yaml.js +64 -0
- package/lib/mail-auth.js +473 -73
- package/lib/network-dns-resolver.js +23 -23
- package/lib/network-dns.js +205 -43
- package/lib/public-suffix.js +110 -24
- package/lib/vendor/MANIFEST.json +14 -14
- package/lib/vendor/blamejs-pki.cjs +1385 -402
- package/lib/vendor/public-suffix-list.dat +4 -3
- package/lib/vendor/public-suffix-list.data.js +2201 -2201
- package/package.json +1 -1
- package/sbom.cdx.json +6 -6
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @blamejs/pki v0.5.
|
|
1
|
+
// @blamejs/pki v0.5.16 — vendored (Apache-2.0). Zero-dep pure CJS.
|
|
2
2
|
// https://github.com/blamejs/pki Exports: x509, crl, pkcs12, key, webcrypto, schema, csr, cms, ...
|
|
3
3
|
// Backs lib/mtls-engine-default.js (PQC-capable CA + PKCS#12 engine).
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -141,7 +141,7 @@ var require_package = __commonJS({
|
|
|
141
141
|
"node_modules/@blamejs/pki/package.json"(exports2, module2) {
|
|
142
142
|
module2.exports = {
|
|
143
143
|
name: "@blamejs/pki",
|
|
144
|
-
version: "0.5.
|
|
144
|
+
version: "0.5.16",
|
|
145
145
|
description: "Pure-JavaScript PKI toolkit that owns its stack \u2014 X.509, ASN.1/DER, CMS, PQC-first.",
|
|
146
146
|
license: "Apache-2.0",
|
|
147
147
|
author: "blamejs contributors",
|
|
@@ -698,15 +698,201 @@ var require_constants = __commonJS({
|
|
|
698
698
|
}
|
|
699
699
|
});
|
|
700
700
|
|
|
701
|
+
// node_modules/@blamejs/pki/lib/guard-intrinsic.js
|
|
702
|
+
var require_guard_intrinsic = __commonJS({
|
|
703
|
+
"node_modules/@blamejs/pki/lib/guard-intrinsic.js"(exports2, module2) {
|
|
704
|
+
"use strict";
|
|
705
|
+
var _utilTypes = require("util").types;
|
|
706
|
+
var _call = Function.prototype.call;
|
|
707
|
+
var _bind = Function.prototype.bind;
|
|
708
|
+
var _reflectApply = Reflect.apply;
|
|
709
|
+
var _isArray = Array.isArray;
|
|
710
|
+
var _bufferFrom = Buffer.from;
|
|
711
|
+
var _bufferAlloc = Buffer.alloc;
|
|
712
|
+
var _bufferConcat = Buffer.concat;
|
|
713
|
+
var _bufferIsBuffer = Buffer.isBuffer;
|
|
714
|
+
var _bufferByteLength = Buffer.byteLength;
|
|
715
|
+
var _bufferCompare = Buffer.compare;
|
|
716
|
+
var _isView = ArrayBuffer.isView;
|
|
717
|
+
var _isInteger = Number.isInteger;
|
|
718
|
+
var _isSafeInteger = Number.isSafeInteger;
|
|
719
|
+
var _fromCharCode = String.fromCharCode;
|
|
720
|
+
var _objectCreate = Object.create;
|
|
721
|
+
var _getPrototypeOf = Object.getPrototypeOf;
|
|
722
|
+
var _setPrototypeOf = Object.setPrototypeOf;
|
|
723
|
+
var _getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
724
|
+
var _getOwnPropertyNames = Object.getOwnPropertyNames;
|
|
725
|
+
var _defineProperty = Object.defineProperty;
|
|
726
|
+
var _objectKeys = Object.keys;
|
|
727
|
+
var _objectAssign = Object.assign;
|
|
728
|
+
var _objectFreeze = Object.freeze;
|
|
729
|
+
var _isExtensible = Object.isExtensible;
|
|
730
|
+
var _ownKeys = Reflect.ownKeys;
|
|
731
|
+
var _jsonStringify = JSON.stringify;
|
|
732
|
+
var _mathFloor = Math.floor;
|
|
733
|
+
var _mathCeil = Math.ceil;
|
|
734
|
+
var _mathMin = Math.min;
|
|
735
|
+
var _promiseResolve = Promise.resolve;
|
|
736
|
+
var _promiseReject = Promise.reject;
|
|
737
|
+
var _arrForEach = uncurry(Array.prototype.forEach);
|
|
738
|
+
var _arrMap = uncurry(Array.prototype.map);
|
|
739
|
+
var _arrFilter = uncurry(Array.prototype.filter);
|
|
740
|
+
var _arrEvery = uncurry(Array.prototype.every);
|
|
741
|
+
var _arrSome = uncurry(Array.prototype.some);
|
|
742
|
+
var _arrIndexOf = uncurry(Array.prototype.indexOf);
|
|
743
|
+
var _arrSort = uncurry(Array.prototype.sort);
|
|
744
|
+
var _arrConcat = uncurry(Array.prototype.concat);
|
|
745
|
+
var _arrSlice = uncurry(Array.prototype.slice);
|
|
746
|
+
var _arrJoin = uncurry(Array.prototype.join);
|
|
747
|
+
var _setAdd = uncurry(Set.prototype.add);
|
|
748
|
+
var _setHas = uncurry(Set.prototype.has);
|
|
749
|
+
var _mapGet = uncurry(Map.prototype.get);
|
|
750
|
+
var _mapSet = uncurry(Map.prototype.set);
|
|
751
|
+
var _mapHas = uncurry(Map.prototype.has);
|
|
752
|
+
var _weakGet = uncurry(WeakMap.prototype.get);
|
|
753
|
+
var _weakSet = uncurry(WeakMap.prototype.set);
|
|
754
|
+
var _weakHas = uncurry(WeakMap.prototype.has);
|
|
755
|
+
var _taSet = uncurry(Uint8Array.prototype.set);
|
|
756
|
+
var _hasOwn = uncurry(Object.prototype.hasOwnProperty);
|
|
757
|
+
var _String = String;
|
|
758
|
+
var _Number = Number;
|
|
759
|
+
var _Boolean = Boolean;
|
|
760
|
+
var _BigInt = BigInt;
|
|
761
|
+
var _Date = Date;
|
|
762
|
+
var _isFinite = globalThis.isFinite;
|
|
763
|
+
var _ArrayBuffer = ArrayBuffer;
|
|
764
|
+
var _Uint8Array = Uint8Array;
|
|
765
|
+
var _DataView = DataView;
|
|
766
|
+
var _ObjectFn = Object;
|
|
767
|
+
var _ObjectProto = Object.prototype;
|
|
768
|
+
var _BufferProto = Buffer.prototype;
|
|
769
|
+
var _ArrayProto = Array.prototype;
|
|
770
|
+
var _Set = Set;
|
|
771
|
+
var _Map = Map;
|
|
772
|
+
var _WeakMap = WeakMap;
|
|
773
|
+
var _types = /* @__PURE__ */ Object.create(null);
|
|
774
|
+
var _typeNames = Object.getOwnPropertyNames(_utilTypes);
|
|
775
|
+
for (_i = 0; _i < _typeNames.length; _i++) {
|
|
776
|
+
if (typeof _utilTypes[_typeNames[_i]] === "function") {
|
|
777
|
+
_types[_typeNames[_i]] = _utilTypes[_typeNames[_i]];
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
var _i;
|
|
781
|
+
Object.freeze(_types);
|
|
782
|
+
function uncurry(fn) {
|
|
783
|
+
if (typeof fn !== "function") {
|
|
784
|
+
throw new TypeError("guard.intrinsic.uncurry: expects the captured function, got " + typeof fn);
|
|
785
|
+
}
|
|
786
|
+
return _reflectApply(_bind, _call, [fn]);
|
|
787
|
+
}
|
|
788
|
+
function getter(proto, name, who) {
|
|
789
|
+
var d = _getOwnPropertyDescriptor(proto, name);
|
|
790
|
+
if (!d || typeof d.get !== "function") {
|
|
791
|
+
throw new TypeError("guard.intrinsic.getter: this runtime has no intrinsic " + who + "." + name + " accessor, so the value's own would have to be invoked instead");
|
|
792
|
+
}
|
|
793
|
+
return uncurry(d.get);
|
|
794
|
+
}
|
|
795
|
+
var _taByteLength = getter(_getPrototypeOf(Uint8Array.prototype), "byteLength", "%TypedArray%.prototype");
|
|
796
|
+
var _dvByteLength = getter(DataView.prototype, "byteLength", "DataView.prototype");
|
|
797
|
+
function sizeOf(value) {
|
|
798
|
+
if (typeof value === "string") return value.length;
|
|
799
|
+
if (_types.isDataView(value)) return _dvByteLength(value);
|
|
800
|
+
if (_types.isTypedArray(value)) return _taByteLength(value);
|
|
801
|
+
throw new TypeError("guard.intrinsic.sizeOf: expects a string or a byte view, got " + (value === null ? "null" : typeof value));
|
|
802
|
+
}
|
|
803
|
+
module2.exports = {
|
|
804
|
+
uncurry,
|
|
805
|
+
getter,
|
|
806
|
+
sizeOf,
|
|
807
|
+
types: _types,
|
|
808
|
+
isArray: _isArray,
|
|
809
|
+
bufferFrom: _bufferFrom,
|
|
810
|
+
bufferAlloc: _bufferAlloc,
|
|
811
|
+
bufferConcat: _bufferConcat,
|
|
812
|
+
isBuffer: _bufferIsBuffer,
|
|
813
|
+
byteLength: _bufferByteLength,
|
|
814
|
+
compare: _bufferCompare,
|
|
815
|
+
isView: _isView,
|
|
816
|
+
isInteger: _isInteger,
|
|
817
|
+
isSafeInteger: _isSafeInteger,
|
|
818
|
+
fromCharCode: _fromCharCode,
|
|
819
|
+
create: _objectCreate,
|
|
820
|
+
getPrototypeOf: _getPrototypeOf,
|
|
821
|
+
setPrototypeOf: _setPrototypeOf,
|
|
822
|
+
getOwnPropertyDescriptor: _getOwnPropertyDescriptor,
|
|
823
|
+
getOwnPropertyNames: _getOwnPropertyNames,
|
|
824
|
+
defineProperty: _defineProperty,
|
|
825
|
+
keys: _objectKeys,
|
|
826
|
+
assign: _objectAssign,
|
|
827
|
+
freeze: _objectFreeze,
|
|
828
|
+
isExtensible: _isExtensible,
|
|
829
|
+
ownKeys: _ownKeys,
|
|
830
|
+
stringify: _jsonStringify,
|
|
831
|
+
floor: _mathFloor,
|
|
832
|
+
ceil: _mathCeil,
|
|
833
|
+
min: _mathMin,
|
|
834
|
+
promiseResolve: _promiseResolve,
|
|
835
|
+
promiseReject: _promiseReject,
|
|
836
|
+
forEach: _arrForEach,
|
|
837
|
+
map: _arrMap,
|
|
838
|
+
filter: _arrFilter,
|
|
839
|
+
every: _arrEvery,
|
|
840
|
+
some: _arrSome,
|
|
841
|
+
indexOf: _arrIndexOf,
|
|
842
|
+
sort: _arrSort,
|
|
843
|
+
concat: _arrConcat,
|
|
844
|
+
arraySlice: _arrSlice,
|
|
845
|
+
join: _arrJoin,
|
|
846
|
+
hasOwn: _hasOwn,
|
|
847
|
+
// Invocation itself. `fn.apply(...)` reads `apply` off Function.prototype, so a replacement
|
|
848
|
+
// decides whether a verb's body runs at all and what it appears to return; `Reflect.apply` is
|
|
849
|
+
// invoked directly and consults no property of the function.
|
|
850
|
+
apply: _reflectApply,
|
|
851
|
+
// And the cleanup half of a promise chain: `.finally` is where a copied secret is released, so a
|
|
852
|
+
// replacement that drops its callback leaves the plaintext copy alive for the process's lifetime.
|
|
853
|
+
promiseFinally: uncurry(Promise.prototype["finally"]),
|
|
854
|
+
String: _String,
|
|
855
|
+
Number: _Number,
|
|
856
|
+
Boolean: _Boolean,
|
|
857
|
+
BigInt: _BigInt,
|
|
858
|
+
Date: _Date,
|
|
859
|
+
isFinite: _isFinite,
|
|
860
|
+
ArrayBuffer: _ArrayBuffer,
|
|
861
|
+
Uint8Array: _Uint8Array,
|
|
862
|
+
DataView: _DataView,
|
|
863
|
+
Object: _ObjectFn,
|
|
864
|
+
ObjectProto: _ObjectProto,
|
|
865
|
+
BufferProto: _BufferProto,
|
|
866
|
+
ArrayProto: _ArrayProto,
|
|
867
|
+
setAdd: _setAdd,
|
|
868
|
+
setHas: _setHas,
|
|
869
|
+
mapGet: _mapGet,
|
|
870
|
+
mapSet: _mapSet,
|
|
871
|
+
mapHas: _mapHas,
|
|
872
|
+
weakGet: _weakGet,
|
|
873
|
+
weakSet: _weakSet,
|
|
874
|
+
weakHas: _weakHas,
|
|
875
|
+
typedArraySet: _taSet,
|
|
876
|
+
Set: _Set,
|
|
877
|
+
Map: _Map,
|
|
878
|
+
WeakMap: _WeakMap
|
|
879
|
+
};
|
|
880
|
+
}
|
|
881
|
+
});
|
|
882
|
+
|
|
701
883
|
// node_modules/@blamejs/pki/lib/guard-async.js
|
|
702
884
|
var require_guard_async = __commonJS({
|
|
703
885
|
"node_modules/@blamejs/pki/lib/guard-async.js"(exports2, module2) {
|
|
704
886
|
"use strict";
|
|
887
|
+
var _intrinsic = require_guard_intrinsic();
|
|
888
|
+
var _resolve = _intrinsic.uncurry(_intrinsic.promiseResolve);
|
|
889
|
+
var _reject = _intrinsic.uncurry(_intrinsic.promiseReject);
|
|
890
|
+
var _Promise = Promise;
|
|
705
891
|
function deferred(body) {
|
|
706
892
|
try {
|
|
707
|
-
return
|
|
893
|
+
return _resolve(_Promise, body());
|
|
708
894
|
} catch (e) {
|
|
709
|
-
return
|
|
895
|
+
return _reject(_Promise, e);
|
|
710
896
|
}
|
|
711
897
|
}
|
|
712
898
|
module2.exports = { deferred };
|
|
@@ -717,12 +903,49 @@ var require_guard_async = __commonJS({
|
|
|
717
903
|
var require_guard_identifier = __commonJS({
|
|
718
904
|
"node_modules/@blamejs/pki/lib/guard-identifier.js"(exports2, module2) {
|
|
719
905
|
"use strict";
|
|
720
|
-
var
|
|
906
|
+
var intrinsic = require_guard_intrinsic();
|
|
907
|
+
var util = { types: intrinsic.types };
|
|
908
|
+
var _isArray = intrinsic.isArray;
|
|
909
|
+
var _create = intrinsic.create;
|
|
910
|
+
var _getPrototypeOf = intrinsic.getPrototypeOf;
|
|
911
|
+
var _setPrototypeOf = intrinsic.setPrototypeOf;
|
|
912
|
+
var _getOwnPropertyDescriptor = intrinsic.getOwnPropertyDescriptor;
|
|
913
|
+
var _getOwnPropertyNames = intrinsic.getOwnPropertyNames;
|
|
914
|
+
var _defineProperty = intrinsic.defineProperty;
|
|
915
|
+
var _ownKeys = intrinsic.ownKeys;
|
|
916
|
+
var _isView = intrinsic.isView;
|
|
917
|
+
var _isInteger = intrinsic.isInteger;
|
|
918
|
+
var _stringify = intrinsic.stringify;
|
|
919
|
+
var _forEach = intrinsic.forEach;
|
|
920
|
+
var _map = intrinsic.map;
|
|
921
|
+
var _filter = intrinsic.filter;
|
|
922
|
+
var _every = intrinsic.every;
|
|
923
|
+
var _some = intrinsic.some;
|
|
924
|
+
var _indexOf = intrinsic.indexOf;
|
|
925
|
+
var _sort = intrinsic.sort;
|
|
926
|
+
var _setAdd = intrinsic.setAdd;
|
|
927
|
+
var _setHas = intrinsic.setHas;
|
|
928
|
+
var _mapGet = intrinsic.mapGet;
|
|
929
|
+
var _mapSet = intrinsic.mapSet;
|
|
930
|
+
var _mapHas = intrinsic.mapHas;
|
|
931
|
+
var _Set = intrinsic.Set;
|
|
932
|
+
var _Map = intrinsic.Map;
|
|
933
|
+
var _charCodeAt = intrinsic.uncurry(String.prototype.charCodeAt);
|
|
934
|
+
var _strSplit = intrinsic.uncurry(String.prototype.split);
|
|
935
|
+
var _hasOwn = intrinsic.hasOwn;
|
|
936
|
+
var _String = intrinsic.String;
|
|
937
|
+
var _Number = intrinsic.Number;
|
|
938
|
+
var _BigInt = intrinsic.BigInt;
|
|
939
|
+
var _Object = intrinsic.Object;
|
|
940
|
+
var _BufferProto = intrinsic.BufferProto;
|
|
941
|
+
function _append(arr, v) {
|
|
942
|
+
_defineProperty(arr, arr.length, { value: v, writable: true, enumerable: true, configurable: true });
|
|
943
|
+
}
|
|
721
944
|
function _isDottedDecimal(str) {
|
|
722
945
|
if (str.length === 0) return false;
|
|
723
946
|
var arcs = 0, digits = 0, leadingZero = false;
|
|
724
947
|
for (var i = 0; i < str.length; i++) {
|
|
725
|
-
var c = str
|
|
948
|
+
var c = _charCodeAt(str, i);
|
|
726
949
|
if (c === 46) {
|
|
727
950
|
if (digits === 0 || leadingZero) return false;
|
|
728
951
|
arcs++;
|
|
@@ -731,7 +954,7 @@ var require_guard_identifier = __commonJS({
|
|
|
731
954
|
continue;
|
|
732
955
|
}
|
|
733
956
|
if (c < 48 || c > 57) return false;
|
|
734
|
-
if (digits === 1 && str
|
|
957
|
+
if (digits === 1 && _charCodeAt(str, i - 1) === 48) leadingZero = true;
|
|
735
958
|
digits++;
|
|
736
959
|
}
|
|
737
960
|
if (digits === 0 || leadingZero) return false;
|
|
@@ -744,9 +967,9 @@ var require_guard_identifier = __commonJS({
|
|
|
744
967
|
}
|
|
745
968
|
if (boundsCode === null) return str;
|
|
746
969
|
var bcode = boundsCode === void 0 ? code : boundsCode;
|
|
747
|
-
var parts = str
|
|
748
|
-
var root =
|
|
749
|
-
var second =
|
|
970
|
+
var parts = _strSplit(str, ".");
|
|
971
|
+
var root = _BigInt(parts[0]);
|
|
972
|
+
var second = _BigInt(parts[1]);
|
|
750
973
|
if (root > 2n) throw E(bcode, who + " root arc must be 0, 1, or 2 (X.660)");
|
|
751
974
|
if (root < 2n && second > 39n) throw E(bcode, who + " second arc must be 0..39 under roots 0 and 1 (X.660)");
|
|
752
975
|
return str;
|
|
@@ -754,16 +977,16 @@ var require_guard_identifier = __commonJS({
|
|
|
754
977
|
function assertKnownKeys(obj, known, E, code, message) {
|
|
755
978
|
_refuseUnenumerable(obj, E, code, "the options");
|
|
756
979
|
var describe = typeof message === "function" ? message : function(k) {
|
|
757
|
-
return message +
|
|
980
|
+
return message + _stringify(k);
|
|
758
981
|
};
|
|
759
|
-
_readableNames(obj)
|
|
760
|
-
if (
|
|
761
|
-
throw E(code, describe(typeof k === "symbol" ?
|
|
982
|
+
_forEach(_readableNames(obj), function(k) {
|
|
983
|
+
if (_hasOwn(known, k)) return;
|
|
984
|
+
throw E(code, describe(typeof k === "symbol" ? _String(k) : k));
|
|
762
985
|
});
|
|
763
986
|
}
|
|
764
987
|
var _PRISTINE_OBJECT_PROTO = (function() {
|
|
765
|
-
var s =
|
|
766
|
-
[
|
|
988
|
+
var s = _create(null);
|
|
989
|
+
_forEach([
|
|
767
990
|
"constructor",
|
|
768
991
|
"hasOwnProperty",
|
|
769
992
|
"isPrototypeOf",
|
|
@@ -776,7 +999,7 @@ var require_guard_identifier = __commonJS({
|
|
|
776
999
|
"__lookupGetter__",
|
|
777
1000
|
"__lookupSetter__",
|
|
778
1001
|
"__proto__"
|
|
779
|
-
]
|
|
1002
|
+
], function(k) {
|
|
780
1003
|
s[k] = 1;
|
|
781
1004
|
});
|
|
782
1005
|
return s;
|
|
@@ -792,29 +1015,29 @@ var require_guard_identifier = __commonJS({
|
|
|
792
1015
|
function _refuseUnenumerable(v, E, code, label) {
|
|
793
1016
|
_requireFactory(E);
|
|
794
1017
|
if (v === null || typeof v !== "object") return;
|
|
795
|
-
var visited =
|
|
796
|
-
for (var o = v; o && !visited
|
|
797
|
-
visited
|
|
1018
|
+
var visited = new _Set();
|
|
1019
|
+
for (var o = v; o && !_setHas(visited, o); o = _getPrototypeOf(o)) {
|
|
1020
|
+
_setAdd(visited, o);
|
|
798
1021
|
if (!util.types.isProxy(o)) continue;
|
|
799
1022
|
throw E(code, label + (o === v ? " is" : " inherits from") + " a Proxy, whose reported keys need not match what it answers, so an option it holds cannot be found; pass a plain object");
|
|
800
1023
|
}
|
|
801
1024
|
}
|
|
802
1025
|
function _isMethodOf(from, k, fn) {
|
|
803
|
-
var visited =
|
|
804
|
-
for (var o = from; o && !visited
|
|
805
|
-
visited
|
|
806
|
-
var d =
|
|
1026
|
+
var visited = new _Set();
|
|
1027
|
+
for (var o = from; o && !_setHas(visited, o); o = _getPrototypeOf(o)) {
|
|
1028
|
+
_setAdd(visited, o);
|
|
1029
|
+
var d = _getOwnPropertyDescriptor(o, k);
|
|
807
1030
|
if (!d) continue;
|
|
808
1031
|
return !d.get && !d.set && d.value === fn;
|
|
809
1032
|
}
|
|
810
1033
|
return false;
|
|
811
1034
|
}
|
|
812
1035
|
function _isArrayIndex(k) {
|
|
813
|
-
var n =
|
|
814
|
-
return
|
|
1036
|
+
var n = _Number(k);
|
|
1037
|
+
return _isInteger(n) && n >= 0 && n < 4294967295 && _String(n) === k;
|
|
815
1038
|
}
|
|
816
1039
|
function _isIndexedKind(v) {
|
|
817
|
-
return
|
|
1040
|
+
return _isArray(v) || _isView(v) && !util.types.isDataView(v);
|
|
818
1041
|
}
|
|
819
1042
|
var _ARRAY_PROTO_MEMBERS = ["length", Symbol.unscopables];
|
|
820
1043
|
var _REGEXP_PROTO_MEMBERS = [
|
|
@@ -850,25 +1073,25 @@ var require_guard_identifier = __commonJS({
|
|
|
850
1073
|
var _DATAVIEW_MEMBERS = _DATAVIEW_PROTO_MEMBERS;
|
|
851
1074
|
var _ARRAYBUFFER_MEMBERS = _ARRAYBUFFER_PROTO_MEMBERS;
|
|
852
1075
|
var _SHARED_MEMBERS = _SHARED_PROTO_MEMBERS;
|
|
853
|
-
var _TYPED_ARRAY_PROTO =
|
|
1076
|
+
var _TYPED_ARRAY_PROTO = _getPrototypeOf(Uint8Array.prototype);
|
|
854
1077
|
var _INTRINSIC_HOLDERS = (function() {
|
|
855
|
-
var m =
|
|
1078
|
+
var m = new _Map([[_TYPED_ARRAY_PROTO, _TYPED_PROTO_MEMBERS]]);
|
|
856
1079
|
function pair(ctor, members) {
|
|
857
|
-
if (ctor && ctor.prototype) m
|
|
1080
|
+
if (ctor && ctor.prototype) _mapSet(m, ctor.prototype, members);
|
|
858
1081
|
}
|
|
859
1082
|
pair(Array, _ARRAY_PROTO_MEMBERS);
|
|
860
1083
|
pair(RegExp, _REGEXP_PROTO_MEMBERS);
|
|
861
|
-
[Map, Set]
|
|
1084
|
+
_forEach([Map, Set], function(c) {
|
|
862
1085
|
pair(c, _SIZED_PROTO_MEMBERS);
|
|
863
1086
|
});
|
|
864
|
-
[WeakMap, WeakSet]
|
|
1087
|
+
_forEach([WeakMap, WeakSet], function(c) {
|
|
865
1088
|
pair(c, _WEAK_PROTO_MEMBERS);
|
|
866
1089
|
});
|
|
867
1090
|
pair(ArrayBuffer, _ARRAYBUFFER_PROTO_MEMBERS);
|
|
868
1091
|
pair(typeof SharedArrayBuffer === "function" ? SharedArrayBuffer : null, _SHARED_PROTO_MEMBERS);
|
|
869
1092
|
pair(DataView, _DATAVIEW_PROTO_MEMBERS);
|
|
870
1093
|
pair(Buffer, _BUFFER_PROTO_MEMBERS);
|
|
871
|
-
|
|
1094
|
+
_forEach(_getOwnPropertyNames(globalThis), function(n) {
|
|
872
1095
|
var C;
|
|
873
1096
|
try {
|
|
874
1097
|
C = globalThis[n];
|
|
@@ -876,29 +1099,29 @@ var require_guard_identifier = __commonJS({
|
|
|
876
1099
|
return;
|
|
877
1100
|
}
|
|
878
1101
|
if (typeof C !== "function" || typeof C.BYTES_PER_ELEMENT !== "number") return;
|
|
879
|
-
if (!C.prototype ||
|
|
880
|
-
m
|
|
1102
|
+
if (!C.prototype || _getPrototypeOf(C.prototype) !== _TYPED_ARRAY_PROTO) return;
|
|
1103
|
+
_mapSet(m, C.prototype, _CONCRETE_TYPED_MEMBERS);
|
|
881
1104
|
});
|
|
882
1105
|
return m;
|
|
883
1106
|
})();
|
|
884
1107
|
function _holderMembers(o) {
|
|
885
|
-
return _INTRINSIC_HOLDERS
|
|
1108
|
+
return _mapHas(_INTRINSIC_HOLDERS, o) ? _mapGet(_INTRINSIC_HOLDERS, o) : null;
|
|
886
1109
|
}
|
|
887
1110
|
function _isNodeBuffer(v) {
|
|
888
1111
|
if (!util.types.isUint8Array(v)) return false;
|
|
889
|
-
var visited =
|
|
890
|
-
for (var o = v; o && !visited
|
|
891
|
-
visited
|
|
892
|
-
if (o ===
|
|
1112
|
+
var visited = new _Set();
|
|
1113
|
+
for (var o = v; o && !_setHas(visited, o); o = _getPrototypeOf(o)) {
|
|
1114
|
+
_setAdd(visited, o);
|
|
1115
|
+
if (o === _BufferProto) return true;
|
|
893
1116
|
}
|
|
894
1117
|
return false;
|
|
895
1118
|
}
|
|
896
1119
|
function _kindMembers(v) {
|
|
897
1120
|
if (v === null || v === void 0) return [];
|
|
898
|
-
if (
|
|
1121
|
+
if (_isArray(v)) return _ARRAY_MEMBERS;
|
|
899
1122
|
if (_isNodeBuffer(v)) return _BUFFER_KIND_MEMBERS;
|
|
900
1123
|
if (util.types.isDataView(v)) return _DATAVIEW_MEMBERS;
|
|
901
|
-
if (
|
|
1124
|
+
if (_isView(v)) return _VIEW_MEMBERS;
|
|
902
1125
|
if (util.types.isArrayBuffer(v)) return _ARRAYBUFFER_MEMBERS;
|
|
903
1126
|
if (util.types.isSharedArrayBuffer(v)) return _SHARED_MEMBERS;
|
|
904
1127
|
if (util.types.isRegExp(v)) return _REGEXP_MEMBERS;
|
|
@@ -913,47 +1136,47 @@ var require_guard_identifier = __commonJS({
|
|
|
913
1136
|
return !!d && (!!d.get || !!d.set || typeof d.value === "function" || d.writable === false || d.configurable === false);
|
|
914
1137
|
}
|
|
915
1138
|
function _shadowsAnother(v, k, holder) {
|
|
916
|
-
var visited =
|
|
1139
|
+
var visited = new _Set();
|
|
917
1140
|
var past = false;
|
|
918
|
-
for (var o = v; o !== null && o !== void 0 && !visited
|
|
919
|
-
visited
|
|
1141
|
+
for (var o = v; o !== null && o !== void 0 && !_setHas(visited, o); o = _getPrototypeOf(o)) {
|
|
1142
|
+
_setAdd(visited, o);
|
|
920
1143
|
if (o === holder) {
|
|
921
1144
|
past = true;
|
|
922
1145
|
continue;
|
|
923
1146
|
}
|
|
924
|
-
if (past &&
|
|
1147
|
+
if (past && _getOwnPropertyDescriptor(o, k)) return true;
|
|
925
1148
|
}
|
|
926
1149
|
return false;
|
|
927
1150
|
}
|
|
928
1151
|
function _readableNames(obj) {
|
|
929
|
-
var seen =
|
|
1152
|
+
var seen = _create(null);
|
|
930
1153
|
var out = [];
|
|
931
|
-
var o = obj === null || obj === void 0 ? null :
|
|
1154
|
+
var o = obj === null || obj === void 0 ? null : _Object(obj);
|
|
932
1155
|
var indexedSelf = _isIndexedKind(o);
|
|
933
1156
|
var members = _kindMembers(o);
|
|
934
|
-
var visited =
|
|
935
|
-
while (o && !visited
|
|
936
|
-
visited
|
|
1157
|
+
var visited = new _Set();
|
|
1158
|
+
while (o && !_setHas(visited, o)) {
|
|
1159
|
+
_setAdd(visited, o);
|
|
937
1160
|
var inherited = o !== obj;
|
|
938
|
-
var above =
|
|
1161
|
+
var above = _getPrototypeOf(o);
|
|
939
1162
|
var atObjectProto = inherited && above === null;
|
|
940
|
-
|
|
1163
|
+
_forEach(_ownKeys(o), function(k) {
|
|
941
1164
|
if (seen[k]) return;
|
|
942
1165
|
if (indexedSelf && typeof k === "string" && _isArrayIndex(k)) return;
|
|
943
1166
|
if (indexedSelf && k === "length" && !inherited) return;
|
|
944
1167
|
if (_isOwnStructuralName(obj, k)) return;
|
|
945
|
-
var d =
|
|
1168
|
+
var d = _getOwnPropertyDescriptor(o, k);
|
|
946
1169
|
var here = _holderMembers(o);
|
|
947
|
-
if (inherited && _looksIntrinsic(d) && !_shadowsAnother(obj, k, o) && (here === null ? members
|
|
1170
|
+
if (inherited && _looksIntrinsic(d) && !_shadowsAnother(obj, k, o) && (here === null ? _indexOf(members, k) !== -1 : _indexOf(here, k) !== -1)) return;
|
|
948
1171
|
if (atObjectProto) {
|
|
949
1172
|
if (_PRISTINE_OBJECT_PROTO[k] && _looksBuiltIn(d)) return;
|
|
950
1173
|
seen[k] = 1;
|
|
951
|
-
out
|
|
1174
|
+
_append(out, k);
|
|
952
1175
|
return;
|
|
953
1176
|
}
|
|
954
1177
|
if (d && !d.get && !d.set && typeof d.value === "function" && (inherited || _isMethodOf(above, k, d.value))) return;
|
|
955
1178
|
seen[k] = 1;
|
|
956
|
-
out
|
|
1179
|
+
_append(out, k);
|
|
957
1180
|
});
|
|
958
1181
|
o = above;
|
|
959
1182
|
}
|
|
@@ -965,23 +1188,23 @@ var require_guard_identifier = __commonJS({
|
|
|
965
1188
|
}
|
|
966
1189
|
function readableIndices(obj, E, code, label) {
|
|
967
1190
|
_refuseUnenumerable(obj, E, code, label);
|
|
968
|
-
if (!
|
|
969
|
-
var own =
|
|
1191
|
+
if (!_isArray(obj)) return [];
|
|
1192
|
+
var own = _getOwnPropertyDescriptor(obj, "length");
|
|
970
1193
|
var limit = own ? own.value : 0;
|
|
971
|
-
var seen =
|
|
1194
|
+
var seen = _create(null);
|
|
972
1195
|
var out = [];
|
|
973
|
-
var visited =
|
|
974
|
-
for (var o = obj; o && !visited
|
|
975
|
-
visited
|
|
976
|
-
|
|
1196
|
+
var visited = new _Set();
|
|
1197
|
+
for (var o = obj; o && !_setHas(visited, o); o = _getPrototypeOf(o)) {
|
|
1198
|
+
_setAdd(visited, o);
|
|
1199
|
+
_forEach(_ownKeys(o), function(k) {
|
|
977
1200
|
if (typeof k !== "string" || !_isArrayIndex(k) || seen[k]) return;
|
|
978
|
-
if (
|
|
1201
|
+
if (_Number(k) >= limit) return;
|
|
979
1202
|
seen[k] = 1;
|
|
980
|
-
out
|
|
1203
|
+
_append(out, k);
|
|
981
1204
|
});
|
|
982
1205
|
}
|
|
983
|
-
return out
|
|
984
|
-
return
|
|
1206
|
+
return _sort(out, function(a, b) {
|
|
1207
|
+
return _Number(a) - _Number(b);
|
|
985
1208
|
});
|
|
986
1209
|
}
|
|
987
1210
|
function _notAnOptionsBag(v) {
|
|
@@ -992,7 +1215,7 @@ var require_guard_identifier = __commonJS({
|
|
|
992
1215
|
return null;
|
|
993
1216
|
}
|
|
994
1217
|
function optionsObject(opts, E, code, label) {
|
|
995
|
-
if (opts === null || opts === void 0) return
|
|
1218
|
+
if (opts === null || opts === void 0) return _create(null);
|
|
996
1219
|
if (typeof opts !== "object") throw E(code, label + " must be an object");
|
|
997
1220
|
_refuseUnenumerable(opts, E, code, label);
|
|
998
1221
|
if (_isNodeBuffer(opts)) throw E(code, label + " must be an object");
|
|
@@ -1001,10 +1224,10 @@ var require_guard_identifier = __commonJS({
|
|
|
1001
1224
|
return _settle(opts, E, code, label);
|
|
1002
1225
|
}
|
|
1003
1226
|
function _descriptorHolder(v, k) {
|
|
1004
|
-
var visited =
|
|
1005
|
-
for (var o = v; o !== null && o !== void 0 && !visited
|
|
1006
|
-
visited
|
|
1007
|
-
var d =
|
|
1227
|
+
var visited = new _Set();
|
|
1228
|
+
for (var o = v; o !== null && o !== void 0 && !_setHas(visited, o); o = _getPrototypeOf(o)) {
|
|
1229
|
+
_setAdd(visited, o);
|
|
1230
|
+
var d = _getOwnPropertyDescriptor(o, k);
|
|
1008
1231
|
if (d) return d;
|
|
1009
1232
|
}
|
|
1010
1233
|
return null;
|
|
@@ -1013,7 +1236,7 @@ var require_guard_identifier = __commonJS({
|
|
|
1013
1236
|
for (var i = 0; i < names.length; i++) {
|
|
1014
1237
|
var holder = _descriptorHolder(obj, names[i]);
|
|
1015
1238
|
if (holder && (holder.get || holder.set)) {
|
|
1016
|
-
throw E(code, label + " supplies " +
|
|
1239
|
+
throw E(code, label + " supplies " + _stringify(typeof names[i] === "symbol" ? _String(names[i]) : names[i]) + " through an accessor, whose value can differ between the check and the read; pass an object whose fields are plain values");
|
|
1017
1240
|
}
|
|
1018
1241
|
}
|
|
1019
1242
|
}
|
|
@@ -1023,7 +1246,7 @@ var require_guard_identifier = __commonJS({
|
|
|
1023
1246
|
try {
|
|
1024
1247
|
void opts[names[i]];
|
|
1025
1248
|
} catch (_e) {
|
|
1026
|
-
throw E(code, label + ": reading " +
|
|
1249
|
+
throw E(code, label + ": reading " + _stringify(typeof names[i] === "symbol" ? _String(names[i]) : names[i]) + " threw");
|
|
1027
1250
|
}
|
|
1028
1251
|
}
|
|
1029
1252
|
}
|
|
@@ -1032,7 +1255,7 @@ var require_guard_identifier = __commonJS({
|
|
|
1032
1255
|
readAll(before);
|
|
1033
1256
|
var after = _readableNames(opts);
|
|
1034
1257
|
var same = after.length === before.length;
|
|
1035
|
-
for (var j = 0; same && j < after.length; j++) same = before
|
|
1258
|
+
for (var j = 0; same && j < after.length; j++) same = _indexOf(before, after[j]) !== -1;
|
|
1036
1259
|
if (!same) {
|
|
1037
1260
|
throw E(code, label + " changes which options it carries while they are read, so no set of them can be checked; pass an object whose properties are plain values");
|
|
1038
1261
|
}
|
|
@@ -1059,13 +1282,14 @@ var require_guard_identifier = __commonJS({
|
|
|
1059
1282
|
var require_guard_time = __commonJS({
|
|
1060
1283
|
"node_modules/@blamejs/pki/lib/guard-time.js"(exports2, module2) {
|
|
1061
1284
|
"use strict";
|
|
1062
|
-
var util =
|
|
1063
|
-
var
|
|
1285
|
+
var util = { types: require_guard_intrinsic().types };
|
|
1286
|
+
var _isNaN = Number.isNaN;
|
|
1287
|
+
var _dateGetTime = require_guard_intrinsic().uncurry(Date.prototype.getTime);
|
|
1064
1288
|
function instantOf(value) {
|
|
1065
|
-
return _dateGetTime
|
|
1289
|
+
return _dateGetTime(value);
|
|
1066
1290
|
}
|
|
1067
1291
|
function assertValid(value, E, code, label) {
|
|
1068
|
-
if (!util.types.isDate(value) ||
|
|
1292
|
+
if (!util.types.isDate(value) || _isNaN(instantOf(value))) {
|
|
1069
1293
|
throw E(code, (label || "value") + " must be a valid Date");
|
|
1070
1294
|
}
|
|
1071
1295
|
return value;
|
|
@@ -2949,6 +3173,23 @@ var require_guard_parsed = __commonJS({
|
|
|
2949
3173
|
"use strict";
|
|
2950
3174
|
var bytes = require_guard_bytes();
|
|
2951
3175
|
var time = require_guard_time();
|
|
3176
|
+
var _isArray = require_guard_intrinsic().isArray;
|
|
3177
|
+
var _bufferFrom = require_guard_intrinsic().bufferFrom;
|
|
3178
|
+
var _ObjectProto = require_guard_intrinsic().ObjectProto;
|
|
3179
|
+
var _isBuffer = require_guard_intrinsic().isBuffer;
|
|
3180
|
+
var _create = require_guard_intrinsic().create;
|
|
3181
|
+
var _assign = require_guard_intrinsic().assign;
|
|
3182
|
+
var _getPrototypeOf = require_guard_intrinsic().getPrototypeOf;
|
|
3183
|
+
var _getOwnPropertyNames = require_guard_intrinsic().getOwnPropertyNames;
|
|
3184
|
+
var _every = require_guard_intrinsic().every;
|
|
3185
|
+
var _weakGet = require_guard_intrinsic().weakGet;
|
|
3186
|
+
var _weakSet = require_guard_intrinsic().weakSet;
|
|
3187
|
+
var _weakHas = require_guard_intrinsic().weakHas;
|
|
3188
|
+
var _WeakMap = require_guard_intrinsic().WeakMap;
|
|
3189
|
+
var _defineProperty = require_guard_intrinsic().defineProperty;
|
|
3190
|
+
function _append(arr, v) {
|
|
3191
|
+
_defineProperty(arr, arr.length, { value: v, writable: true, enumerable: true, configurable: true });
|
|
3192
|
+
}
|
|
2952
3193
|
function _isBytes(x) {
|
|
2953
3194
|
return bytes.isByteSource(x);
|
|
2954
3195
|
}
|
|
@@ -2956,37 +3197,37 @@ var require_guard_parsed = __commonJS({
|
|
|
2956
3197
|
return !!a && typeof a.type === "string" && _isOptName(a.name) && typeof a.value === "string";
|
|
2957
3198
|
}
|
|
2958
3199
|
function _isRdnSequence(rdns) {
|
|
2959
|
-
if (!
|
|
3200
|
+
if (!_isArray(rdns)) return false;
|
|
2960
3201
|
for (var i = 0; i < rdns.length; i++) {
|
|
2961
|
-
if (!
|
|
2962
|
-
if (!rdns[i]
|
|
3202
|
+
if (!_isArray(rdns[i]) || rdns[i].length === 0) return false;
|
|
3203
|
+
if (!_every(rdns[i], _isAttributeTypeAndValue)) return false;
|
|
2963
3204
|
}
|
|
2964
3205
|
return true;
|
|
2965
3206
|
}
|
|
2966
3207
|
function _isName(n) {
|
|
2967
|
-
return !!n && _isRdnSequence(n.rdns) &&
|
|
3208
|
+
return !!n && _isRdnSequence(n.rdns) && _isBuffer(n.bytes) && typeof n.dn === "string";
|
|
2968
3209
|
}
|
|
2969
3210
|
function _isOptName(v) {
|
|
2970
3211
|
return typeof v === "string" || v === null;
|
|
2971
3212
|
}
|
|
2972
3213
|
function _isAlgorithmIdentifier(a) {
|
|
2973
|
-
return !!a && typeof a.oid === "string" && _isOptName(a.name) && (
|
|
3214
|
+
return !!a && typeof a.oid === "string" && _isOptName(a.name) && (_isBuffer(a.parameters) || a.parameters === null);
|
|
2974
3215
|
}
|
|
2975
3216
|
function _isBitString(b) {
|
|
2976
|
-
return !!b &&
|
|
3217
|
+
return !!b && _isBuffer(b.bytes) && typeof b.unusedBits === "number";
|
|
2977
3218
|
}
|
|
2978
3219
|
function _isExtensionEntry(e) {
|
|
2979
|
-
return !!e && typeof e.oid === "string" && _isOptName(e.name) && typeof e.critical === "boolean" &&
|
|
3220
|
+
return !!e && typeof e.oid === "string" && _isOptName(e.name) && typeof e.critical === "boolean" && _isBuffer(e.value);
|
|
2980
3221
|
}
|
|
2981
3222
|
function _isCrlExtensionEntry(e) {
|
|
2982
3223
|
return !!e && typeof e.oid === "string" && _isOptName(e.name) && typeof e.critical === "boolean" && e.value !== void 0;
|
|
2983
3224
|
}
|
|
2984
3225
|
function isCert(o) {
|
|
2985
|
-
return !!o && typeof o === "object" &&
|
|
3226
|
+
return !!o && typeof o === "object" && _isBuffer(o.tbsBytes) && typeof o.version === "number" && typeof o.serialNumber === "bigint" && typeof o.serialNumberHex === "string" && _isAlgorithmIdentifier(o.signatureAlgorithm) && _isAlgorithmIdentifier(o.tbsSignatureAlgorithm) && _isBitString(o.signatureValue) && !!o.validity && time.isDate(o.validity.notBefore) && time.isDate(o.validity.notAfter) && _isName(o.issuer) && _isName(o.subject) && !!o.subjectPublicKeyInfo && _isBuffer(o.subjectPublicKeyInfo.bytes) && _isAlgorithmIdentifier(o.subjectPublicKeyInfo.algorithm) && _isBitString(o.subjectPublicKeyInfo.publicKey) && _isArray(o.extensions) && _every(o.extensions, _isExtensionEntry);
|
|
2986
3227
|
}
|
|
2987
3228
|
function isCrl(o) {
|
|
2988
|
-
return !!o && typeof o === "object" &&
|
|
2989
|
-
return !!e && typeof e.serialNumber === "bigint" && typeof e.serialNumberHex === "string" && time.isDate(e.revocationDate) &&
|
|
3229
|
+
return !!o && typeof o === "object" && _isBuffer(o.tbsBytes) && typeof o.version === "number" && _isAlgorithmIdentifier(o.signatureAlgorithm) && _isBitString(o.signatureValue) && _isName(o.issuer) && time.isDate(o.thisUpdate) && (o.nextUpdate === null || time.isDate(o.nextUpdate)) && _isArray(o.crlExtensions) && _every(o.crlExtensions, _isCrlExtensionEntry) && _isArray(o.revokedCertificates) && _every(o.revokedCertificates, function(e) {
|
|
3230
|
+
return !!e && typeof e.serialNumber === "bigint" && typeof e.serialNumberHex === "string" && time.isDate(e.revocationDate) && _isArray(e.crlEntryExtensions) && _every(e.crlEntryExtensions, _isCrlExtensionEntry);
|
|
2990
3231
|
});
|
|
2991
3232
|
}
|
|
2992
3233
|
function _safe(shape) {
|
|
@@ -3000,7 +3241,7 @@ var require_guard_parsed = __commonJS({
|
|
|
3000
3241
|
}
|
|
3001
3242
|
var certShape = _safe(isCert);
|
|
3002
3243
|
var crlShape = _safe(isCrl);
|
|
3003
|
-
var _SHAPES = { certificate: certShape, crl: crlShape };
|
|
3244
|
+
var _SHAPES = _assign(_create(null), { certificate: certShape, crl: crlShape });
|
|
3004
3245
|
function accept(input, kind, parse, E, code, label) {
|
|
3005
3246
|
var who = label || "the argument";
|
|
3006
3247
|
var shape = _SHAPES[kind];
|
|
@@ -3022,16 +3263,16 @@ var require_guard_parsed = __commonJS({
|
|
|
3022
3263
|
}
|
|
3023
3264
|
throw E(code, who + " must be a " + kind + " DER Buffer, a PEM string, or a parsed " + kind);
|
|
3024
3265
|
}
|
|
3025
|
-
var PROVENANCE =
|
|
3266
|
+
var PROVENANCE = new _WeakMap();
|
|
3026
3267
|
function recordingParser(kind, parse, ErrorClass, code, label) {
|
|
3027
3268
|
return function(input) {
|
|
3028
3269
|
var isText = typeof input === "string";
|
|
3029
3270
|
var snap = isText ? input : bytes.snapshotSource(input, ErrorClass, code, label);
|
|
3030
3271
|
var out = parse(snap);
|
|
3031
3272
|
if (out && typeof out === "object") {
|
|
3032
|
-
PROVENANCE
|
|
3273
|
+
_weakSet(PROVENANCE, out, {
|
|
3033
3274
|
kind,
|
|
3034
|
-
source: isText ? snap :
|
|
3275
|
+
source: isText ? snap : _bufferFrom(snap),
|
|
3035
3276
|
shape: _shapeOf(out)
|
|
3036
3277
|
});
|
|
3037
3278
|
}
|
|
@@ -3042,9 +3283,9 @@ var require_guard_parsed = __commonJS({
|
|
|
3042
3283
|
return function(node) {
|
|
3043
3284
|
var out = walkNode(node);
|
|
3044
3285
|
if (out && typeof out === "object" && node && _isBytes(node.bytes)) {
|
|
3045
|
-
PROVENANCE
|
|
3286
|
+
_weakSet(PROVENANCE, out, {
|
|
3046
3287
|
kind,
|
|
3047
|
-
source:
|
|
3288
|
+
source: _bufferFrom(node.bytes),
|
|
3048
3289
|
shape: _shapeOf(out),
|
|
3049
3290
|
derive: function(src) {
|
|
3050
3291
|
return walkNode(decodeBytes(src));
|
|
@@ -3056,15 +3297,15 @@ var require_guard_parsed = __commonJS({
|
|
|
3056
3297
|
}
|
|
3057
3298
|
function _recordOf(obj, kind) {
|
|
3058
3299
|
if (!obj || typeof obj !== "object") return void 0;
|
|
3059
|
-
var rec = PROVENANCE
|
|
3300
|
+
var rec = _weakGet(PROVENANCE, obj);
|
|
3060
3301
|
return rec && rec.kind === kind ? rec : void 0;
|
|
3061
3302
|
}
|
|
3062
3303
|
function isRecorded(obj) {
|
|
3063
|
-
return !!obj && typeof obj === "object" && PROVENANCE
|
|
3304
|
+
return !!obj && typeof obj === "object" && _weakHas(PROVENANCE, obj);
|
|
3064
3305
|
}
|
|
3065
3306
|
function isRecordedAsProduced(obj) {
|
|
3066
3307
|
if (!isRecorded(obj)) return false;
|
|
3067
|
-
var shape = PROVENANCE
|
|
3308
|
+
var shape = _weakGet(PROVENANCE, obj).shape;
|
|
3068
3309
|
var keys = _allNames(obj);
|
|
3069
3310
|
for (var i = 0; i < keys.length; i++) {
|
|
3070
3311
|
if (!shape[keys[i]]) return false;
|
|
@@ -3072,20 +3313,20 @@ var require_guard_parsed = __commonJS({
|
|
|
3072
3313
|
return true;
|
|
3073
3314
|
}
|
|
3074
3315
|
function _shapeOf(obj) {
|
|
3075
|
-
var shape =
|
|
3316
|
+
var shape = _create(null);
|
|
3076
3317
|
var keys = _allNames(obj);
|
|
3077
3318
|
for (var i = 0; i < keys.length; i++) shape[keys[i]] = true;
|
|
3078
3319
|
return shape;
|
|
3079
3320
|
}
|
|
3080
3321
|
function _allNames(obj) {
|
|
3081
3322
|
var names = [];
|
|
3082
|
-
var seen =
|
|
3083
|
-
for (var o = obj; o && o !==
|
|
3084
|
-
var own =
|
|
3323
|
+
var seen = _create(null);
|
|
3324
|
+
for (var o = obj; o && o !== _ObjectProto; o = _getPrototypeOf(o)) {
|
|
3325
|
+
var own = _getOwnPropertyNames(o);
|
|
3085
3326
|
for (var i = 0; i < own.length; i++) {
|
|
3086
3327
|
if (seen[own[i]]) continue;
|
|
3087
3328
|
seen[own[i]] = true;
|
|
3088
|
-
names
|
|
3329
|
+
_append(names, own[i]);
|
|
3089
3330
|
}
|
|
3090
3331
|
}
|
|
3091
3332
|
return names;
|
|
@@ -3106,16 +3347,22 @@ var require_guard_parsed = __commonJS({
|
|
|
3106
3347
|
}
|
|
3107
3348
|
return parse(input);
|
|
3108
3349
|
}
|
|
3109
|
-
var _CLAIMS = {
|
|
3350
|
+
var _CLAIMS = _assign(_create(null), {
|
|
3110
3351
|
certificate: ["tbsBytes", "subjectPublicKeyInfo", "serialNumberHex"],
|
|
3111
3352
|
crl: ["tbsBytes", "revokedCertificates", "crlExtensions"],
|
|
3112
|
-
cms: ["signerInfos", "encapContentInfo"]
|
|
3113
|
-
|
|
3114
|
-
|
|
3353
|
+
cms: ["signerInfos", "encapContentInfo"],
|
|
3354
|
+
csr: ["certificationRequestInfoBytes", "subjectPublicKeyInfo", "attributes"],
|
|
3355
|
+
crmf: ["messages"],
|
|
3356
|
+
attributeCertificate: ["tbsBytes", "holder", "attributes"]
|
|
3357
|
+
});
|
|
3358
|
+
var _WHY = _assign(_create(null), {
|
|
3115
3359
|
certificate: "the signed byte range, the signature and the fields that range encodes are separate properties of a parsed object, so a rebuilt certificate (Object.assign, spread, a JSON round-trip) could have them describe different certificates: keep a real CA certificate's signed bytes and signature, replace only its public key, and every field is still well-formed",
|
|
3116
3360
|
crl: "the signed byte range, the revocation list and the scope extensions are separate properties of a parsed object, so a rebuilt CRL could have them describe different CRLs: empty the revocation list and a correctly signed CRL reports a revoked certificate as good",
|
|
3117
|
-
cms: "the signed attribute bytes, the signature, the encapsulated content and the certificates that verify it are separate properties of a parsed object, so a rebuilt SignedData could have them describe different messages: keep a genuine signer's signature and signed attributes, put other content beside them, and every part of the check passes for content that signer never signed"
|
|
3118
|
-
|
|
3361
|
+
cms: "the signed attribute bytes, the signature, the encapsulated content and the certificates that verify it are separate properties of a parsed object, so a rebuilt SignedData could have them describe different messages: keep a genuine signer's signature and signed attributes, put other content beside them, and every part of the check passes for content that signer never signed",
|
|
3362
|
+
csr: "the signed byte range, the key it proves possession of and the subject and requested extensions that range encodes are separate properties of a parsed object, so a rebuilt request could have them describe different requests: keep a genuine requester's signed bytes and signature, replace only the subject or the extensionRequest, and the proof of possession still verifies while the certificate a CA issues from those fields is for a name and a set of extensions nobody signed",
|
|
3363
|
+
crmf: "the byte range a proof of possession covers, the key that possession is proven for and the subject a CA will issue to are separate properties of a parsed object, so a rebuilt message set could have them describe different requests: keep a genuine requester's signed range and signature, replace only the certTemplate subject or public key, and the proof still verifies while the certificate is issued for a name and a key nobody proved anything about",
|
|
3364
|
+
attributeCertificate: "the signed byte range, the holder the privileges attach to and the attributes granting them are separate properties of a parsed object, so a rebuilt attribute certificate could have them describe different grants: keep a genuine issuer's signed bytes and signature, replace only the holder or an attribute, and the signature still verifies while the privileges are read for someone the issuer never granted them to"
|
|
3365
|
+
});
|
|
3119
3366
|
function acceptDerived(input, kind, parse, E, code, label) {
|
|
3120
3367
|
var claims = _CLAIMS[kind];
|
|
3121
3368
|
if (!claims) throw new TypeError("guard.parsed.acceptDerived: unknown kind " + kind);
|
|
@@ -3133,7 +3380,14 @@ var require_guard_parsed = __commonJS({
|
|
|
3133
3380
|
throw E(code, who + " must be a " + kind + " DER Buffer, a PEM string, or a parsed " + kind);
|
|
3134
3381
|
}
|
|
3135
3382
|
}
|
|
3136
|
-
var ns = {
|
|
3383
|
+
var ns = {
|
|
3384
|
+
certificate: "x509",
|
|
3385
|
+
crl: "crl",
|
|
3386
|
+
cms: "cms",
|
|
3387
|
+
csr: "csr",
|
|
3388
|
+
crmf: "crmf",
|
|
3389
|
+
attributeCertificate: "attrcert"
|
|
3390
|
+
}[kind];
|
|
3137
3391
|
return fromTrustedSource(
|
|
3138
3392
|
input,
|
|
3139
3393
|
kind,
|
|
@@ -3163,10 +3417,12 @@ var require_guard_secret = __commonJS({
|
|
|
3163
3417
|
"node_modules/@blamejs/pki/lib/guard-secret.js"(exports2, module2) {
|
|
3164
3418
|
"use strict";
|
|
3165
3419
|
var bytes = require_guard_bytes();
|
|
3420
|
+
var intrinsic = require_guard_intrinsic();
|
|
3421
|
+
var _fill = intrinsic.uncurry(Uint8Array.prototype.fill);
|
|
3166
3422
|
function zeroize(value, ErrorClass, code, label) {
|
|
3167
3423
|
if (value === null || value === void 0) return value;
|
|
3168
3424
|
var view = bytes.view(value, ErrorClass, code, label);
|
|
3169
|
-
view
|
|
3425
|
+
_fill(view, 0);
|
|
3170
3426
|
return value;
|
|
3171
3427
|
}
|
|
3172
3428
|
function zeroizeAll(list, ErrorClass, code, label) {
|
|
@@ -3185,53 +3441,89 @@ var require_guard_bytes = __commonJS({
|
|
|
3185
3441
|
var async = require_guard_async();
|
|
3186
3442
|
var identifier = require_guard_identifier();
|
|
3187
3443
|
var time = require_guard_time();
|
|
3188
|
-
var
|
|
3444
|
+
var intrinsic = require_guard_intrinsic();
|
|
3445
|
+
var util = { types: intrinsic.types };
|
|
3446
|
+
var _isArray = intrinsic.isArray;
|
|
3447
|
+
var _bufferFrom = intrinsic.bufferFrom;
|
|
3448
|
+
var _isView = intrinsic.isView;
|
|
3449
|
+
var _isBuffer = intrinsic.isBuffer;
|
|
3450
|
+
var _create = intrinsic.create;
|
|
3451
|
+
var _getPrototypeOf = intrinsic.getPrototypeOf;
|
|
3452
|
+
var _getOwnPropertyDescriptor = intrinsic.getOwnPropertyDescriptor;
|
|
3453
|
+
var _defineProperty = intrinsic.defineProperty;
|
|
3454
|
+
var _objectKeys = intrinsic.keys;
|
|
3455
|
+
var _isExtensible = intrinsic.isExtensible;
|
|
3456
|
+
var _ownKeys = intrinsic.ownKeys;
|
|
3457
|
+
var _stringify = intrinsic.stringify;
|
|
3458
|
+
var _forEach = intrinsic.forEach;
|
|
3459
|
+
var _map = intrinsic.map;
|
|
3460
|
+
var _filter = intrinsic.filter;
|
|
3461
|
+
var _reTest = intrinsic.uncurry(RegExp.prototype.test);
|
|
3462
|
+
var _setForEach = intrinsic.uncurry(Set.prototype.forEach);
|
|
3463
|
+
var _mapForEach = intrinsic.uncurry(Map.prototype.forEach);
|
|
3464
|
+
var _String = intrinsic.String;
|
|
3465
|
+
var _Date = intrinsic.Date;
|
|
3466
|
+
var _apply = intrinsic.apply;
|
|
3467
|
+
var _promiseFinally = intrinsic.promiseFinally;
|
|
3468
|
+
var _ArrayBuffer = intrinsic.ArrayBuffer;
|
|
3469
|
+
var _Uint8Array = intrinsic.Uint8Array;
|
|
3470
|
+
var _DataView = intrinsic.DataView;
|
|
3471
|
+
var _ObjectProto = intrinsic.ObjectProto;
|
|
3472
|
+
var _setAdd = intrinsic.setAdd;
|
|
3473
|
+
var _setHas = intrinsic.setHas;
|
|
3474
|
+
var _mapSet = intrinsic.mapSet;
|
|
3475
|
+
var _taSet = intrinsic.typedArraySet;
|
|
3476
|
+
var _Set = intrinsic.Set;
|
|
3477
|
+
var _Map = intrinsic.Map;
|
|
3478
|
+
function _append(arr, v) {
|
|
3479
|
+
_defineProperty(arr, arr.length, { value: v, writable: true, enumerable: true, configurable: true });
|
|
3480
|
+
}
|
|
3189
3481
|
function isByteSource(x) {
|
|
3190
|
-
return
|
|
3482
|
+
return _isBuffer(x) || _isView(x) || _isArrayBuffer(x);
|
|
3191
3483
|
}
|
|
3192
3484
|
function _isArrayBuffer(v) {
|
|
3193
3485
|
return util.types.isArrayBuffer(v);
|
|
3194
3486
|
}
|
|
3195
|
-
var _TYPED_ARRAY_PROTO =
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
return d.get;
|
|
3202
|
-
}
|
|
3203
|
-
var _taBuffer = _intrinsicGetter(_TYPED_ARRAY_PROTO, "buffer", "%TypedArray%.prototype");
|
|
3204
|
-
var _taByteOffset = _intrinsicGetter(_TYPED_ARRAY_PROTO, "byteOffset", "%TypedArray%.prototype");
|
|
3205
|
-
var _taByteLength = _intrinsicGetter(_TYPED_ARRAY_PROTO, "byteLength", "%TypedArray%.prototype");
|
|
3206
|
-
var _dvBuffer = _intrinsicGetter(DataView.prototype, "buffer", "DataView.prototype");
|
|
3207
|
-
var _dvByteOffset = _intrinsicGetter(DataView.prototype, "byteOffset", "DataView.prototype");
|
|
3208
|
-
var _dvByteLength = _intrinsicGetter(DataView.prototype, "byteLength", "DataView.prototype");
|
|
3487
|
+
var _TYPED_ARRAY_PROTO = _getPrototypeOf(Uint8Array.prototype);
|
|
3488
|
+
var _uncurriedGetter = intrinsic.getter;
|
|
3489
|
+
var _taBuffer = _uncurriedGetter(_TYPED_ARRAY_PROTO, "buffer", "%TypedArray%.prototype");
|
|
3490
|
+
var _taByteOffset = _uncurriedGetter(_TYPED_ARRAY_PROTO, "byteOffset", "%TypedArray%.prototype");
|
|
3491
|
+
var _dvBuffer = _uncurriedGetter(DataView.prototype, "buffer", "DataView.prototype");
|
|
3492
|
+
var _dvByteOffset = _uncurriedGetter(DataView.prototype, "byteOffset", "DataView.prototype");
|
|
3209
3493
|
function _storeOf(v) {
|
|
3210
|
-
return util.types.isDataView(v) ? _dvBuffer
|
|
3494
|
+
return util.types.isDataView(v) ? _dvBuffer(v) : _taBuffer(v);
|
|
3211
3495
|
}
|
|
3212
3496
|
function _offsetOf(v) {
|
|
3213
|
-
return util.types.isDataView(v) ? _dvByteOffset
|
|
3497
|
+
return util.types.isDataView(v) ? _dvByteOffset(v) : _taByteOffset(v);
|
|
3214
3498
|
}
|
|
3215
3499
|
function _lengthOf(v) {
|
|
3216
|
-
return
|
|
3500
|
+
return intrinsic.sizeOf(v);
|
|
3217
3501
|
}
|
|
3218
3502
|
function _reView(v) {
|
|
3219
|
-
return
|
|
3220
|
-
}
|
|
3221
|
-
var _CONCRETE_KINDS =
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3503
|
+
return _bufferFrom(_storeOf(v), _offsetOf(v), _lengthOf(v));
|
|
3504
|
+
}
|
|
3505
|
+
var _CONCRETE_KINDS = _filter(
|
|
3506
|
+
_map(
|
|
3507
|
+
// allow:guard-reads-runtime-live -- module-init, see above
|
|
3508
|
+
_filter(_objectKeys(util.types), function(name) {
|
|
3509
|
+
return _reTest(/^is[A-Za-z0-9]+Array$/, name);
|
|
3510
|
+
}),
|
|
3511
|
+
// allow:guard-reads-runtime-live -- module-init, see above
|
|
3512
|
+
function(name) {
|
|
3513
|
+
return [util.types[name], globalThis[name.slice(2)]];
|
|
3514
|
+
}
|
|
3515
|
+
),
|
|
3516
|
+
function(row) {
|
|
3517
|
+
return typeof row[0] === "function" && typeof row[1] === "function" && typeof row[1].BYTES_PER_ELEMENT === "number" && row[1].BYTES_PER_ELEMENT > 0;
|
|
3518
|
+
}
|
|
3519
|
+
);
|
|
3228
3520
|
function _concreteKindOf(v) {
|
|
3229
3521
|
for (var i = 0; i < _CONCRETE_KINDS.length; i++) {
|
|
3230
3522
|
if (_CONCRETE_KINDS[i][0](v)) return _CONCRETE_KINDS[i][1];
|
|
3231
3523
|
}
|
|
3232
3524
|
return null;
|
|
3233
3525
|
}
|
|
3234
|
-
var _NAMED_KINDS = [
|
|
3526
|
+
var _NAMED_KINDS = _filter([
|
|
3235
3527
|
["isNativeError", "Error"],
|
|
3236
3528
|
["isRegExp", "RegExp"],
|
|
3237
3529
|
["isPromise", "Promise"],
|
|
@@ -3241,7 +3533,7 @@ var require_guard_bytes = __commonJS({
|
|
|
3241
3533
|
["isSet", "Set"],
|
|
3242
3534
|
["isDate", "Date"],
|
|
3243
3535
|
["isProxy", "Proxy"]
|
|
3244
|
-
]
|
|
3536
|
+
], function(row) {
|
|
3245
3537
|
return typeof util.types[row[0]] === "function";
|
|
3246
3538
|
});
|
|
3247
3539
|
function _kindName(v) {
|
|
@@ -3251,10 +3543,10 @@ var require_guard_bytes = __commonJS({
|
|
|
3251
3543
|
return typeof v === "function" ? "function" : "value";
|
|
3252
3544
|
}
|
|
3253
3545
|
function _article(name) {
|
|
3254
|
-
return /^[AEIOU]/i
|
|
3546
|
+
return _reTest(/^[AEIOU]/i, name) ? "an" : "a";
|
|
3255
3547
|
}
|
|
3256
3548
|
function outputView(input, ErrorClass, code, label) {
|
|
3257
|
-
if (!util.types.isUint8Array(input) && !
|
|
3549
|
+
if (!util.types.isUint8Array(input) && !_isView(input)) {
|
|
3258
3550
|
throw _raise(ErrorClass, code, label + ": expected a Buffer / TypedArray to write into");
|
|
3259
3551
|
}
|
|
3260
3552
|
try {
|
|
@@ -3267,12 +3559,23 @@ var require_guard_bytes = __commonJS({
|
|
|
3267
3559
|
return _lengthOf(view2);
|
|
3268
3560
|
}
|
|
3269
3561
|
function _refuseShared(v, ErrorClass, code, label) {
|
|
3270
|
-
if (util.types.isSharedArrayBuffer(v) ||
|
|
3562
|
+
if (util.types.isSharedArrayBuffer(v) || _isView(v) && util.types.isSharedArrayBuffer(_storeOf(v))) {
|
|
3271
3563
|
throw _raise(ErrorClass, code, label + ": shared memory cannot be used here, because another thread can rewrite it after it has been checked; pass a Buffer or a Uint8Array over memory this process owns");
|
|
3272
3564
|
}
|
|
3273
3565
|
}
|
|
3566
|
+
var _ErrorProto = Error.prototype;
|
|
3567
|
+
function _isErrorClass(E) {
|
|
3568
|
+
if (typeof E !== "function") return false;
|
|
3569
|
+
var seen = new _Set();
|
|
3570
|
+
for (var p = E.prototype; p !== null && typeof p === "object"; p = _getPrototypeOf(p)) {
|
|
3571
|
+
if (p === _ErrorProto) return true;
|
|
3572
|
+
if (_setHas(seen, p)) return false;
|
|
3573
|
+
_setAdd(seen, p);
|
|
3574
|
+
}
|
|
3575
|
+
return false;
|
|
3576
|
+
}
|
|
3274
3577
|
function _raise(E, code, message, cause) {
|
|
3275
|
-
return E
|
|
3578
|
+
return _isErrorClass(E) ? new E(code, message, cause) : E(code, message, cause);
|
|
3276
3579
|
}
|
|
3277
3580
|
function view(input, ErrorClass, code, label) {
|
|
3278
3581
|
_refuseShared(input, ErrorClass, code, label);
|
|
@@ -3288,9 +3591,9 @@ var require_guard_bytes = __commonJS({
|
|
|
3288
3591
|
function source(input, ErrorClass, code, label) {
|
|
3289
3592
|
_refuseShared(input, ErrorClass, code, label);
|
|
3290
3593
|
var isAb = _isArrayBuffer(input);
|
|
3291
|
-
if (isAb ||
|
|
3594
|
+
if (isAb || _isView(input)) {
|
|
3292
3595
|
try {
|
|
3293
|
-
return isAb ?
|
|
3596
|
+
return isAb ? _bufferFrom(input) : _reView(input);
|
|
3294
3597
|
} catch (e) {
|
|
3295
3598
|
throw _raise(ErrorClass, code, label + ": input is not a usable byte source (detached backing buffer?)", e);
|
|
3296
3599
|
}
|
|
@@ -3298,10 +3601,10 @@ var require_guard_bytes = __commonJS({
|
|
|
3298
3601
|
throw _raise(ErrorClass, code, label + ": expected a BufferSource (ArrayBuffer / TypedArray / Buffer)");
|
|
3299
3602
|
}
|
|
3300
3603
|
function snapshot(input, ErrorClass, code, label) {
|
|
3301
|
-
return
|
|
3604
|
+
return _bufferFrom(view(input, ErrorClass, code, label));
|
|
3302
3605
|
}
|
|
3303
3606
|
function snapshotSource(input, ErrorClass, code, label) {
|
|
3304
|
-
return
|
|
3607
|
+
return _bufferFrom(source(input, ErrorClass, code, label));
|
|
3305
3608
|
}
|
|
3306
3609
|
function snapshotDeep(value, ErrorClass, code, label, opts) {
|
|
3307
3610
|
var o = opts || {};
|
|
@@ -3309,8 +3612,8 @@ var require_guard_bytes = __commonJS({
|
|
|
3309
3612
|
return _deep(value, ErrorClass, code, label, cap, 0, o.collect || null);
|
|
3310
3613
|
}
|
|
3311
3614
|
function _surface(names) {
|
|
3312
|
-
var t =
|
|
3313
|
-
names
|
|
3615
|
+
var t = _create(null);
|
|
3616
|
+
_forEach(names, function(n) {
|
|
3314
3617
|
t[n] = 1;
|
|
3315
3618
|
});
|
|
3316
3619
|
t[Symbol.toStringTag] = 1;
|
|
@@ -3341,10 +3644,10 @@ var require_guard_bytes = __commonJS({
|
|
|
3341
3644
|
]);
|
|
3342
3645
|
var _THENABLE_SURFACE = _surface(["then", "catch", "finally"]);
|
|
3343
3646
|
function _opaqueSurface(v, ErrorClass, code, label) {
|
|
3344
|
-
var proto =
|
|
3345
|
-
if (proto ===
|
|
3346
|
-
if (util.types.isWeakMap(v) || util.types.isWeakSet(v)) return
|
|
3347
|
-
if (v
|
|
3647
|
+
var proto = _getPrototypeOf(v);
|
|
3648
|
+
if (proto === _ObjectProto || proto === null) return null;
|
|
3649
|
+
if (util.types.isWeakMap(v) || util.types.isWeakSet(v)) return _create(null);
|
|
3650
|
+
if (util.types.isNativeError(v)) return _ERROR_SURFACE;
|
|
3348
3651
|
if (util.types.isRegExp(v)) return _REGEXP_SURFACE;
|
|
3349
3652
|
if (util.types.isKeyObject(v)) return _CRYPTO_KEY_SURFACE;
|
|
3350
3653
|
var keyLike;
|
|
@@ -3364,13 +3667,13 @@ var require_guard_bytes = __commonJS({
|
|
|
3364
3667
|
return null;
|
|
3365
3668
|
}
|
|
3366
3669
|
function _canChangeAfterTheCheck(v, name) {
|
|
3367
|
-
var visited =
|
|
3368
|
-
for (var o = v; o && !visited
|
|
3369
|
-
visited
|
|
3370
|
-
var d =
|
|
3670
|
+
var visited = new _Set();
|
|
3671
|
+
for (var o = v; o && !_setHas(visited, o); o = _getPrototypeOf(o)) {
|
|
3672
|
+
_setAdd(visited, o);
|
|
3673
|
+
var d = _getOwnPropertyDescriptor(o, name);
|
|
3371
3674
|
if (!d) continue;
|
|
3372
3675
|
if (d.get || d.set || d.writable || d.configurable) return true;
|
|
3373
|
-
return o !== v &&
|
|
3676
|
+
return o !== v && _isExtensible(v);
|
|
3374
3677
|
}
|
|
3375
3678
|
return false;
|
|
3376
3679
|
}
|
|
@@ -3395,30 +3698,31 @@ var require_guard_bytes = __commonJS({
|
|
|
3395
3698
|
}
|
|
3396
3699
|
function _copyBytesSameKind(v, ErrorClass, code, label, collect) {
|
|
3397
3700
|
var src = source(v, ErrorClass, code, label);
|
|
3398
|
-
var
|
|
3399
|
-
new
|
|
3400
|
-
|
|
3401
|
-
if (
|
|
3701
|
+
var srcLen = _lengthOf(src);
|
|
3702
|
+
var owned = new _ArrayBuffer(srcLen);
|
|
3703
|
+
_taSet(new _Uint8Array(owned), src);
|
|
3704
|
+
if (collect) _append(collect, _bufferFrom(owned, 0, srcLen));
|
|
3705
|
+
if (_isBuffer(v)) return _bufferFrom(owned, 0, srcLen);
|
|
3402
3706
|
if (_isArrayBuffer(v)) return owned;
|
|
3403
|
-
if (util.types.isDataView(v)) return new
|
|
3707
|
+
if (util.types.isDataView(v)) return new _DataView(owned);
|
|
3404
3708
|
var Ctor = _concreteKindOf(v);
|
|
3405
3709
|
if (!Ctor) {
|
|
3406
3710
|
throw _raise(ErrorClass, code, label + ": a " + (util.types.isTypedArray(v) ? "typed array of a kind this runtime added" : "byte view") + " cannot be copied while keeping its kind; pass a Buffer or a Uint8Array");
|
|
3407
3711
|
}
|
|
3408
|
-
return new Ctor(owned, 0,
|
|
3712
|
+
return new Ctor(owned, 0, srcLen / Ctor.BYTES_PER_ELEMENT);
|
|
3409
3713
|
}
|
|
3410
3714
|
function _protoChainIsCyclic(v) {
|
|
3411
|
-
var visited =
|
|
3412
|
-
for (var o = v; o; o =
|
|
3413
|
-
if (visited
|
|
3414
|
-
visited
|
|
3715
|
+
var visited = new _Set();
|
|
3716
|
+
for (var o = v; o; o = _getPrototypeOf(o)) {
|
|
3717
|
+
if (_setHas(visited, o)) return true;
|
|
3718
|
+
_setAdd(visited, o);
|
|
3415
3719
|
}
|
|
3416
3720
|
return false;
|
|
3417
3721
|
}
|
|
3418
3722
|
function _protoChainHasProxy(v) {
|
|
3419
|
-
var visited =
|
|
3420
|
-
for (var o = v; o && !visited
|
|
3421
|
-
visited
|
|
3723
|
+
var visited = new _Set();
|
|
3724
|
+
for (var o = v; o && !_setHas(visited, o); o = _getPrototypeOf(o)) {
|
|
3725
|
+
_setAdd(visited, o);
|
|
3422
3726
|
if (util.types.isProxy(o)) return true;
|
|
3423
3727
|
}
|
|
3424
3728
|
return false;
|
|
@@ -3436,25 +3740,25 @@ var require_guard_bytes = __commonJS({
|
|
|
3436
3740
|
if (_protoChainIsCyclic(v)) {
|
|
3437
3741
|
throw _raise(ErrorClass, code, label + ": its prototype chain is a cycle, so it cannot be read or copied; pass a plain object");
|
|
3438
3742
|
}
|
|
3439
|
-
if (
|
|
3743
|
+
if (_isBuffer(v) || _isView(v) || _isArrayBuffer(v)) {
|
|
3440
3744
|
var bytesCopy = _copyBytesSameKind(v, ErrorClass, code, label, collect);
|
|
3441
3745
|
_copyNamed(v, bytesCopy, ErrorClass, code, label, cap, depth, collect);
|
|
3442
3746
|
return bytesCopy;
|
|
3443
3747
|
}
|
|
3444
3748
|
if (require_guard_parsed().isRecordedAsProduced(v)) return v;
|
|
3445
3749
|
if (util.types.isDate(v)) {
|
|
3446
|
-
var dateCopy = new
|
|
3750
|
+
var dateCopy = new _Date(time.instantOf(v));
|
|
3447
3751
|
_copyNamed(v, dateCopy, ErrorClass, code, label, cap, depth, collect, _DATE_BEHAVIOR);
|
|
3448
3752
|
return _plainCopy(dateCopy);
|
|
3449
3753
|
}
|
|
3450
|
-
if (
|
|
3754
|
+
if (_isArray(v)) {
|
|
3451
3755
|
var arr = [];
|
|
3452
3756
|
var indexE = function(c, m) {
|
|
3453
3757
|
return _raise(ErrorClass, c, m);
|
|
3454
3758
|
};
|
|
3455
3759
|
var indices = identifier.readableIndices(v, indexE, code, label);
|
|
3456
3760
|
if (depth === 0) identifier.refuseAccessorFields(v, indices, indexE, code, label);
|
|
3457
|
-
indices
|
|
3761
|
+
_forEach(indices, function(k) {
|
|
3458
3762
|
var element;
|
|
3459
3763
|
try {
|
|
3460
3764
|
element = v[k];
|
|
@@ -3471,15 +3775,15 @@ var require_guard_bytes = __commonJS({
|
|
|
3471
3775
|
if (surface) {
|
|
3472
3776
|
var carried = _opaqueFieldOutsideSurface(v, surface, ErrorClass, code, label);
|
|
3473
3777
|
if (carried === null) return v;
|
|
3474
|
-
throw _raise(ErrorClass, code, label + ": " + _article(_kindName(v)) + " " + _kindName(v) + " carrying its own field " +
|
|
3778
|
+
throw _raise(ErrorClass, code, label + ": " + _article(_kindName(v)) + " " + _kindName(v) + " carrying its own field " + _stringify(_String(carried)) + " cannot be used here -- its state cannot be copied, so that field would stay changeable after it was checked; pass the fields as a plain object");
|
|
3475
3779
|
}
|
|
3476
3780
|
if (util.types.isMap(v)) {
|
|
3477
|
-
return _plainCopy(_copyEntries(v,
|
|
3781
|
+
return _plainCopy(_copyEntries(v, new _Map(), ErrorClass, code, label, cap, depth, collect));
|
|
3478
3782
|
}
|
|
3479
3783
|
if (util.types.isSet(v)) {
|
|
3480
|
-
return _plainCopy(_copyEntries(v,
|
|
3784
|
+
return _plainCopy(_copyEntries(v, new _Set(), ErrorClass, code, label, cap, depth, collect));
|
|
3481
3785
|
}
|
|
3482
|
-
var out =
|
|
3786
|
+
var out = _create(_getPrototypeOf(v) === null ? null : _ObjectProto);
|
|
3483
3787
|
_copyNamed(v, out, ErrorClass, code, label, cap, depth, collect);
|
|
3484
3788
|
return out;
|
|
3485
3789
|
}
|
|
@@ -3492,18 +3796,18 @@ var require_guard_bytes = __commonJS({
|
|
|
3492
3796
|
return names;
|
|
3493
3797
|
}
|
|
3494
3798
|
function _copyEntries(src, dst, ErrorClass, code, label, cap, depth, collect) {
|
|
3495
|
-
var walk = util.types.isSet(src) ?
|
|
3496
|
-
walk
|
|
3799
|
+
var walk = util.types.isSet(src) ? _setForEach : _mapForEach;
|
|
3800
|
+
walk(src, function(value, key) {
|
|
3497
3801
|
var copiedValue = _deep(value, ErrorClass, code, label, cap, depth + 1, collect);
|
|
3498
|
-
if (util.types.isSet(dst)) dst
|
|
3499
|
-
else dst
|
|
3802
|
+
if (util.types.isSet(dst)) _setAdd(dst, copiedValue);
|
|
3803
|
+
else _mapSet(dst, _deep(key, ErrorClass, code, label, cap, depth + 1, collect), copiedValue);
|
|
3500
3804
|
});
|
|
3501
3805
|
_copyNamed(src, dst, ErrorClass, code, label, cap, depth, collect);
|
|
3502
3806
|
return dst;
|
|
3503
3807
|
}
|
|
3504
3808
|
var _DATE_BEHAVIOR = (function() {
|
|
3505
|
-
var t =
|
|
3506
|
-
|
|
3809
|
+
var t = _create(null);
|
|
3810
|
+
_forEach(_ownKeys(Date.prototype), function(n) {
|
|
3507
3811
|
t[n] = 1;
|
|
3508
3812
|
});
|
|
3509
3813
|
return t;
|
|
@@ -3515,10 +3819,10 @@ var require_guard_bytes = __commonJS({
|
|
|
3515
3819
|
try {
|
|
3516
3820
|
value = src[keys[k]];
|
|
3517
3821
|
} catch (e) {
|
|
3518
|
-
throw _raise(ErrorClass, code, label + ": reading " +
|
|
3822
|
+
throw _raise(ErrorClass, code, label + ": reading " + _stringify(keys[k]) + " threw", e);
|
|
3519
3823
|
}
|
|
3520
3824
|
if (behavior && behavior[keys[k]] && typeof value === "function") continue;
|
|
3521
|
-
|
|
3825
|
+
_defineProperty(dst, keys[k], {
|
|
3522
3826
|
value: typeof value === "function" ? value : _deep(value, ErrorClass, code, label, cap, depth + 1, collect),
|
|
3523
3827
|
writable: true,
|
|
3524
3828
|
enumerable: _wasEnumerable(src, keys[k]),
|
|
@@ -3527,8 +3831,8 @@ var require_guard_bytes = __commonJS({
|
|
|
3527
3831
|
}
|
|
3528
3832
|
}
|
|
3529
3833
|
function _wasEnumerable(v, name) {
|
|
3530
|
-
for (var o = v; o && o !==
|
|
3531
|
-
var d =
|
|
3834
|
+
for (var o = v; o && o !== _ObjectProto; o = _getPrototypeOf(o)) {
|
|
3835
|
+
var d = _getOwnPropertyDescriptor(o, name);
|
|
3532
3836
|
if (d) return !!d.enumerable;
|
|
3533
3837
|
}
|
|
3534
3838
|
return false;
|
|
@@ -3547,7 +3851,7 @@ var require_guard_bytes = __commonJS({
|
|
|
3547
3851
|
}
|
|
3548
3852
|
try {
|
|
3549
3853
|
for (var i = 0; i < args.length; i++) {
|
|
3550
|
-
values
|
|
3854
|
+
_append(values, snapshotDeep(args[i][0], ErrorClass, code, args[i][1], { collect: copies }));
|
|
3551
3855
|
}
|
|
3552
3856
|
} catch (e) {
|
|
3553
3857
|
release();
|
|
@@ -3557,10 +3861,10 @@ var require_guard_bytes = __commonJS({
|
|
|
3557
3861
|
}
|
|
3558
3862
|
function fixedCall(ErrorClass, code, args, body) {
|
|
3559
3863
|
var handle = null;
|
|
3560
|
-
return async.deferred(function() {
|
|
3864
|
+
return _promiseFinally(async.deferred(function() {
|
|
3561
3865
|
handle = fixArguments(ErrorClass, code, args);
|
|
3562
|
-
return body
|
|
3563
|
-
})
|
|
3866
|
+
return _apply(body, null, handle.values);
|
|
3867
|
+
}), function() {
|
|
3564
3868
|
if (handle) handle.release();
|
|
3565
3869
|
});
|
|
3566
3870
|
}
|
|
@@ -3584,26 +3888,33 @@ var require_guard_text = __commonJS({
|
|
|
3584
3888
|
"node_modules/@blamejs/pki/lib/guard-text.js"(exports2, module2) {
|
|
3585
3889
|
"use strict";
|
|
3586
3890
|
var bytes = require_guard_bytes();
|
|
3891
|
+
var intrinsic = require_guard_intrinsic();
|
|
3892
|
+
var _toString = intrinsic.uncurry(Buffer.prototype.toString);
|
|
3893
|
+
var _decode = intrinsic.uncurry(TextDecoder.prototype.decode);
|
|
3894
|
+
var _byteLength = Buffer.byteLength;
|
|
3895
|
+
var _isBuffer = Buffer.isBuffer;
|
|
3896
|
+
var _isInteger = Number.isInteger;
|
|
3897
|
+
var _TextDecoder = TextDecoder;
|
|
3587
3898
|
var LATIN1 = "latin1";
|
|
3588
3899
|
function decode(input, maxBytes, ErrorClass, spec) {
|
|
3589
|
-
if (!
|
|
3900
|
+
if (!_isInteger(maxBytes) || maxBytes < 0) {
|
|
3590
3901
|
throw new TypeError("guard.text.decode: maxBytes must be a non-negative integer");
|
|
3591
3902
|
}
|
|
3592
3903
|
var charset = spec.charset || LATIN1;
|
|
3593
|
-
if (
|
|
3904
|
+
if (_isBuffer(input)) {
|
|
3594
3905
|
input = bytes.view(input, ErrorClass, spec.badInput, spec.label);
|
|
3595
|
-
if (input
|
|
3906
|
+
if (bytes.lengthOf(input) > maxBytes) throw new ErrorClass(spec.tooLarge, spec.label + " exceeds the size cap");
|
|
3596
3907
|
if (spec.fatal) {
|
|
3597
3908
|
try {
|
|
3598
|
-
return new
|
|
3909
|
+
return _decode(new _TextDecoder(charset, { fatal: true }), input);
|
|
3599
3910
|
} catch (e) {
|
|
3600
3911
|
throw new ErrorClass(spec.badDecode, spec.label + " is not valid " + charset, e);
|
|
3601
3912
|
}
|
|
3602
3913
|
}
|
|
3603
|
-
return input
|
|
3914
|
+
return _toString(input, charset);
|
|
3604
3915
|
}
|
|
3605
3916
|
if (typeof input === "string") {
|
|
3606
|
-
var byteLen = charset === LATIN1 ? input.length :
|
|
3917
|
+
var byteLen = charset === LATIN1 ? input.length : _byteLength(input, "utf8");
|
|
3607
3918
|
if (byteLen > maxBytes) throw new ErrorClass(spec.tooLarge, spec.label + " exceeds the size cap");
|
|
3608
3919
|
return input;
|
|
3609
3920
|
}
|
|
@@ -3618,14 +3929,16 @@ var require_guard_limits = __commonJS({
|
|
|
3618
3929
|
"node_modules/@blamejs/pki/lib/guard-limits.js"(exports2, module2) {
|
|
3619
3930
|
"use strict";
|
|
3620
3931
|
var constants = require_constants();
|
|
3932
|
+
var _isInteger = require_guard_intrinsic().isInteger;
|
|
3933
|
+
var _sizeOf = require_guard_intrinsic().sizeOf;
|
|
3621
3934
|
function cap(value, key, dflt, opts) {
|
|
3622
3935
|
if (value === void 0) return dflt;
|
|
3623
3936
|
opts = opts || {};
|
|
3624
3937
|
var min = opts.min === void 0 ? 0 : opts.min;
|
|
3625
|
-
if (!
|
|
3938
|
+
if (!_isInteger(min) || opts.max !== void 0 && !_isInteger(opts.max)) {
|
|
3626
3939
|
throw new TypeError("guard.limits.cap: the min/max bounds for " + key + " must be integers");
|
|
3627
3940
|
}
|
|
3628
|
-
if (!
|
|
3941
|
+
if (!_isInteger(value) || value < min || opts.max !== void 0 && value > opts.max) {
|
|
3629
3942
|
var want = "an integer >= " + min + (opts.max !== void 0 ? " and <= " + opts.max : "");
|
|
3630
3943
|
if (min === 0 && opts.max === void 0) want = "a non-negative integer";
|
|
3631
3944
|
if (opts.E) throw opts.E(opts.code, (opts.label || key) + " must be " + want);
|
|
@@ -3641,7 +3954,7 @@ var require_guard_limits = __commonJS({
|
|
|
3641
3954
|
return n;
|
|
3642
3955
|
}
|
|
3643
3956
|
function counter(max, E, code, label) {
|
|
3644
|
-
if (!
|
|
3957
|
+
if (!_isInteger(max) || max < 0) {
|
|
3645
3958
|
throw new TypeError("guard.limits.counter: max must be a non-negative integer");
|
|
3646
3959
|
}
|
|
3647
3960
|
var n = 0;
|
|
@@ -3653,11 +3966,12 @@ var require_guard_limits = __commonJS({
|
|
|
3653
3966
|
};
|
|
3654
3967
|
}
|
|
3655
3968
|
function byteCap(buf, max, E, code, label) {
|
|
3656
|
-
if (!
|
|
3969
|
+
if (!_isInteger(max) || max < 0) {
|
|
3657
3970
|
throw new TypeError("guard.limits.byteCap: max must be a non-negative integer");
|
|
3658
3971
|
}
|
|
3659
|
-
|
|
3660
|
-
|
|
3972
|
+
var size = _sizeOf(buf);
|
|
3973
|
+
if (size > max) {
|
|
3974
|
+
throw E(code, (label || "input") + " is " + size + " bytes, over the " + max + "-byte cap");
|
|
3661
3975
|
}
|
|
3662
3976
|
return buf;
|
|
3663
3977
|
}
|
|
@@ -3690,6 +4004,9 @@ var require_guard_crypto = __commonJS({
|
|
|
3690
4004
|
var require_guard_range = __commonJS({
|
|
3691
4005
|
"node_modules/@blamejs/pki/lib/guard-range.js"(exports2, module2) {
|
|
3692
4006
|
"use strict";
|
|
4007
|
+
var _isSafeInteger = require_guard_intrinsic().isSafeInteger;
|
|
4008
|
+
var _Number = require_guard_intrinsic().Number;
|
|
4009
|
+
var _BigInt = require_guard_intrinsic().BigInt;
|
|
3693
4010
|
var UINT31_MAX = 2147483647n;
|
|
3694
4011
|
var SAFE_MAX = 9007199254740991n;
|
|
3695
4012
|
var SAFE_MIN = -9007199254740991n;
|
|
@@ -3707,7 +4024,7 @@ var require_guard_range = __commonJS({
|
|
|
3707
4024
|
if (typeof value !== "bigint" || value < min || value > max) {
|
|
3708
4025
|
throw E(code, label + " must be an integer within " + min + ".." + max);
|
|
3709
4026
|
}
|
|
3710
|
-
return
|
|
4027
|
+
return _Number(value);
|
|
3711
4028
|
}
|
|
3712
4029
|
function uint31(value, E, code, label) {
|
|
3713
4030
|
return int(value, 0n, UINT31_MAX, E, code, label);
|
|
@@ -3719,8 +4036,8 @@ var require_guard_range = __commonJS({
|
|
|
3719
4036
|
var v;
|
|
3720
4037
|
if (typeof value === "bigint") {
|
|
3721
4038
|
v = value;
|
|
3722
|
-
} else if (typeof value === "number" &&
|
|
3723
|
-
v =
|
|
4039
|
+
} else if (typeof value === "number" && _isSafeInteger(value) && value >= 0) {
|
|
4040
|
+
v = _BigInt(value);
|
|
3724
4041
|
} else {
|
|
3725
4042
|
throw E(code, label + " must be a non-negative safe-integer Number or a BigInt (a uint64)");
|
|
3726
4043
|
}
|
|
@@ -3731,7 +4048,7 @@ var require_guard_range = __commonJS({
|
|
|
3731
4048
|
}
|
|
3732
4049
|
function authoredInteger(value, E, code, label) {
|
|
3733
4050
|
if (typeof value === "bigint") return value;
|
|
3734
|
-
if (typeof value === "number" &&
|
|
4051
|
+
if (typeof value === "number" && _isSafeInteger(value)) return _BigInt(value);
|
|
3735
4052
|
throw E(code, label + " must be an integer (a safe-integer number, or a bigint for a large value)");
|
|
3736
4053
|
}
|
|
3737
4054
|
module2.exports = {
|
|
@@ -3748,9 +4065,22 @@ var require_guard_range = __commonJS({
|
|
|
3748
4065
|
var require_guard_name = __commonJS({
|
|
3749
4066
|
"node_modules/@blamejs/pki/lib/guard-name.js"(exports2, module2) {
|
|
3750
4067
|
"use strict";
|
|
4068
|
+
var intrinsic = require_guard_intrinsic();
|
|
4069
|
+
var _charCodeAt = intrinsic.uncurry(String.prototype.charCodeAt);
|
|
4070
|
+
var _charAt = intrinsic.uncurry(String.prototype.charAt);
|
|
4071
|
+
var _toLowerCase = intrinsic.uncurry(String.prototype.toLowerCase);
|
|
4072
|
+
var _toUpperCase = intrinsic.uncurry(String.prototype.toUpperCase);
|
|
4073
|
+
var _strSlice = intrinsic.uncurry(String.prototype.slice);
|
|
4074
|
+
var _lastIndexOf = intrinsic.uncurry(String.prototype.lastIndexOf);
|
|
4075
|
+
var _numToString = intrinsic.uncurry(Number.prototype.toString);
|
|
4076
|
+
var _create = intrinsic.create;
|
|
4077
|
+
var _hasOwn = intrinsic.hasOwn;
|
|
4078
|
+
var _fromCharCode = String.fromCharCode;
|
|
4079
|
+
var _String = String;
|
|
4080
|
+
var _isArray = Array.isArray;
|
|
3751
4081
|
function assertNoControlBytes(str, E, code, label) {
|
|
3752
4082
|
for (var i = 0; i < str.length; i++) {
|
|
3753
|
-
var c = str
|
|
4083
|
+
var c = _charCodeAt(str, i);
|
|
3754
4084
|
if (c === 0 || c < 32 && c !== 9) {
|
|
3755
4085
|
throw E(code, label + " contains an embedded control byte (CVE-2009-2408)");
|
|
3756
4086
|
}
|
|
@@ -3758,7 +4088,8 @@ var require_guard_name = __commonJS({
|
|
|
3758
4088
|
return str;
|
|
3759
4089
|
}
|
|
3760
4090
|
function assertPrintableIa5(buf, E, code, label) {
|
|
3761
|
-
|
|
4091
|
+
var n = intrinsic.sizeOf(buf);
|
|
4092
|
+
for (var i = 0; i < n; i++) {
|
|
3762
4093
|
if (buf[i] < 32 || buf[i] > 126) {
|
|
3763
4094
|
throw E(code, label + " must be a printable IA5String (no control bytes)");
|
|
3764
4095
|
}
|
|
@@ -3773,25 +4104,34 @@ var require_guard_name = __commonJS({
|
|
|
3773
4104
|
assertNoControlBytes(v, E, code, label);
|
|
3774
4105
|
var out = "", lastWasSpace = true;
|
|
3775
4106
|
for (var i = 0; i < v.length; i++) {
|
|
3776
|
-
if (_isSpace(v
|
|
4107
|
+
if (_isSpace(_charCodeAt(v, i))) {
|
|
3777
4108
|
lastWasSpace = true;
|
|
3778
4109
|
continue;
|
|
3779
4110
|
}
|
|
3780
4111
|
if (lastWasSpace && out.length) out += " ";
|
|
3781
4112
|
lastWasSpace = false;
|
|
3782
|
-
out += v
|
|
4113
|
+
out += _charAt(v, i);
|
|
3783
4114
|
}
|
|
3784
|
-
return out
|
|
4115
|
+
return _toLowerCase(out);
|
|
3785
4116
|
}
|
|
3786
4117
|
function _assertSequence(a, b, E, code, label, what) {
|
|
3787
|
-
if (!
|
|
4118
|
+
if (!_isArray(a) || !_isArray(b)) {
|
|
3788
4119
|
throw E(code, "cannot compare " + label + ": " + what + " comparison requires the RDN sequence on both sides (pass name.rdns, not the parsed Name)");
|
|
3789
4120
|
}
|
|
4121
|
+
if (_hasHole(a) || _hasHole(b)) {
|
|
4122
|
+
throw E(code, "cannot compare " + label + ": " + what + " comparison requires a dense sequence on both sides");
|
|
4123
|
+
}
|
|
4124
|
+
}
|
|
4125
|
+
function _hasHole(arr) {
|
|
4126
|
+
for (var i = 0; i < arr.length; i++) {
|
|
4127
|
+
if (!_hasOwn(arr, i)) return true;
|
|
4128
|
+
}
|
|
4129
|
+
return false;
|
|
3790
4130
|
}
|
|
3791
4131
|
function rdnEqual(a, b, E, code, label) {
|
|
3792
4132
|
_assertSequence(a, b, E, code, label, "an RDN");
|
|
3793
4133
|
if (a.length !== b.length) return false;
|
|
3794
|
-
var used =
|
|
4134
|
+
var used = _create(null);
|
|
3795
4135
|
for (var i = 0; i < a.length; i++) {
|
|
3796
4136
|
var found = false;
|
|
3797
4137
|
for (var j = 0; j < b.length; j++) {
|
|
@@ -3815,46 +4155,46 @@ var require_guard_name = __commonJS({
|
|
|
3815
4155
|
return true;
|
|
3816
4156
|
}
|
|
3817
4157
|
function escapeControlBytes(str) {
|
|
3818
|
-
var s =
|
|
4158
|
+
var s = _String(str), out = "";
|
|
3819
4159
|
for (var i = 0; i < s.length; i++) {
|
|
3820
|
-
var c = s
|
|
3821
|
-
out += c < 32 || c === 127 ? "\\x" + (c < 16 ? "0" : "") + c
|
|
4160
|
+
var c = _charCodeAt(s, i);
|
|
4161
|
+
out += c < 32 || c === 127 ? "\\x" + (c < 16 ? "0" : "") + _toUpperCase(_numToString(c, 16)) : _charAt(s, i);
|
|
3822
4162
|
}
|
|
3823
4163
|
return out;
|
|
3824
4164
|
}
|
|
3825
4165
|
var DN_SPECIAL = { 44: 1, 43: 1, 34: 1, 92: 1, 60: 1, 62: 1, 59: 1 };
|
|
3826
4166
|
function escapeDnValue(v) {
|
|
3827
|
-
var s =
|
|
4167
|
+
var s = _String(v), out = "";
|
|
3828
4168
|
for (var i = 0; i < s.length; i++) {
|
|
3829
|
-
var c = s
|
|
3830
|
-
if (c < 32 || c === 127) out += "\\" + (c < 16 ? "0" : "") + c
|
|
3831
|
-
else if (DN_SPECIAL[c] === 1) out += "\\" + s
|
|
3832
|
-
else out += s
|
|
4169
|
+
var c = _charCodeAt(s, i);
|
|
4170
|
+
if (c < 32 || c === 127) out += "\\" + (c < 16 ? "0" : "") + _toUpperCase(_numToString(c, 16));
|
|
4171
|
+
else if (DN_SPECIAL[c] === 1) out += "\\" + _charAt(s, i);
|
|
4172
|
+
else out += _charAt(s, i);
|
|
3833
4173
|
}
|
|
3834
|
-
if (out.length &&
|
|
3835
|
-
if (out
|
|
4174
|
+
if (out.length && _charAt(out, out.length - 1) === " ") out = _strSlice(out, 0, -1) + "\\ ";
|
|
4175
|
+
if (_charAt(out, 0) === "#" || _charAt(out, 0) === " ") out = "\\" + out;
|
|
3836
4176
|
return out;
|
|
3837
4177
|
}
|
|
3838
4178
|
function emailEqual(a, b) {
|
|
3839
4179
|
if (typeof a !== "string" || typeof b !== "string") return "not-comparable";
|
|
3840
|
-
var ai = a
|
|
4180
|
+
var ai = _lastIndexOf(a, "@"), bi = _lastIndexOf(b, "@");
|
|
3841
4181
|
if (ai <= 0 || bi <= 0 || ai === a.length - 1 || bi === b.length - 1) return "not-comparable";
|
|
3842
|
-
var aLocal = a
|
|
3843
|
-
var aHost = a
|
|
4182
|
+
var aLocal = _strSlice(a, 0, ai), bLocal = _strSlice(b, 0, bi);
|
|
4183
|
+
var aHost = _strSlice(a, ai + 1), bHost = _strSlice(b, bi + 1);
|
|
3844
4184
|
if (!_asciiHost(aHost) || !_asciiHost(bHost)) return "not-comparable";
|
|
3845
4185
|
if (aLocal !== bLocal) return "no-match";
|
|
3846
4186
|
return _lowerAscii(aHost) === _lowerAscii(bHost) ? "match" : "no-match";
|
|
3847
4187
|
}
|
|
3848
4188
|
function _asciiHost(h) {
|
|
3849
4189
|
if (h.length === 0) return false;
|
|
3850
|
-
for (var i = 0; i < h.length; i++) if (h
|
|
4190
|
+
for (var i = 0; i < h.length; i++) if (_charCodeAt(h, i) > 127) return false;
|
|
3851
4191
|
return true;
|
|
3852
4192
|
}
|
|
3853
4193
|
function _lowerAscii(s) {
|
|
3854
4194
|
var out = "";
|
|
3855
4195
|
for (var i = 0; i < s.length; i++) {
|
|
3856
|
-
var c = s
|
|
3857
|
-
out += c >= 65 && c <= 90 ?
|
|
4196
|
+
var c = _charCodeAt(s, i);
|
|
4197
|
+
out += c >= 65 && c <= 90 ? _fromCharCode(c + 32) : _charAt(s, i);
|
|
3858
4198
|
}
|
|
3859
4199
|
return out;
|
|
3860
4200
|
}
|
|
@@ -3876,9 +4216,17 @@ var require_guard_encoding = __commonJS({
|
|
|
3876
4216
|
"use strict";
|
|
3877
4217
|
function _alphabet(chars) {
|
|
3878
4218
|
var t = new Uint8Array(128);
|
|
3879
|
-
for (var i = 0; i < chars.length; i++) t[chars
|
|
4219
|
+
for (var i = 0; i < chars.length; i++) t[_charCodeAt(chars, i)] = 1;
|
|
3880
4220
|
return t;
|
|
3881
4221
|
}
|
|
4222
|
+
var _intrinsic = require_guard_intrinsic();
|
|
4223
|
+
var _bufferFrom = _intrinsic.bufferFrom;
|
|
4224
|
+
var _toString = _intrinsic.uncurry(Buffer.prototype.toString);
|
|
4225
|
+
var _charCodeAt = _intrinsic.uncurry(String.prototype.charCodeAt);
|
|
4226
|
+
var _strSlice = _intrinsic.uncurry(String.prototype.slice);
|
|
4227
|
+
var _toLowerCase = _intrinsic.uncurry(String.prototype.toLowerCase);
|
|
4228
|
+
var _isInteger = _intrinsic.isInteger;
|
|
4229
|
+
var _floor = _intrinsic.floor;
|
|
3882
4230
|
var UPPER = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
3883
4231
|
var LOWER = "abcdefghijklmnopqrstuvwxyz";
|
|
3884
4232
|
var DIGITS = "0123456789";
|
|
@@ -3887,17 +4235,17 @@ var require_guard_encoding = __commonJS({
|
|
|
3887
4235
|
var HEX_ALPHABET = _alphabet(DIGITS + "abcdefABCDEF");
|
|
3888
4236
|
function _inAlphabet(text, table) {
|
|
3889
4237
|
for (var i = 0; i < text.length; i++) {
|
|
3890
|
-
var c = text
|
|
4238
|
+
var c = _charCodeAt(text, i);
|
|
3891
4239
|
if (c > 127 || table[c] !== 1) return false;
|
|
3892
4240
|
}
|
|
3893
4241
|
return true;
|
|
3894
4242
|
}
|
|
3895
4243
|
function _capBefore(nChars, perByteChars, maxBytes, E, code, label) {
|
|
3896
4244
|
if (maxBytes == null) return;
|
|
3897
|
-
if (!
|
|
4245
|
+
if (!_isInteger(maxBytes) || maxBytes < 0) {
|
|
3898
4246
|
throw new TypeError("guard.encoding: maxBytes must be a non-negative integer or null");
|
|
3899
4247
|
}
|
|
3900
|
-
if (
|
|
4248
|
+
if (_floor(nChars / perByteChars) > maxBytes) {
|
|
3901
4249
|
throw E(code, label + " exceeds the maximum decoded size of " + maxBytes + " bytes");
|
|
3902
4250
|
}
|
|
3903
4251
|
}
|
|
@@ -3906,19 +4254,19 @@ var require_guard_encoding = __commonJS({
|
|
|
3906
4254
|
if (!_inAlphabet(text, B64URL_ALPHABET)) throw E(code, label + " is not base64url (padding or a non-alphabet character)");
|
|
3907
4255
|
if (text.length % 4 === 1) throw E(code, label + " has an impossible base64url length");
|
|
3908
4256
|
_capBefore(text.length * 3, 4, maxBytes, E, code, label);
|
|
3909
|
-
var buf =
|
|
3910
|
-
if (buf
|
|
4257
|
+
var buf = _bufferFrom(text, "base64url");
|
|
4258
|
+
if (_toString(buf, "base64url") !== text) throw E(code, label + " is not canonical base64url");
|
|
3911
4259
|
return buf;
|
|
3912
4260
|
}
|
|
3913
4261
|
function base64(text, maxBytes, E, code, label) {
|
|
3914
4262
|
if (typeof text !== "string") throw E(code, label + " must be a string");
|
|
3915
4263
|
var pad = 0;
|
|
3916
|
-
while (pad < 2 && text.length > pad &&
|
|
3917
|
-
if (!_inAlphabet(text
|
|
4264
|
+
while (pad < 2 && text.length > pad && _charCodeAt(text, text.length - 1 - pad) === 61) pad++;
|
|
4265
|
+
if (!_inAlphabet(_strSlice(text, 0, text.length - pad), B64_ALPHABET)) throw E(code, label + " is not base64 (a non-alphabet character)");
|
|
3918
4266
|
if (text.length % 4 !== 0) throw E(code, label + " must be whole 4-character base64 groups (RFC 4648 sec. 3.5)");
|
|
3919
4267
|
_capBefore(text.length * 3, 4, maxBytes, E, code, label);
|
|
3920
|
-
var buf =
|
|
3921
|
-
if (buf
|
|
4268
|
+
var buf = _bufferFrom(text, "base64");
|
|
4269
|
+
if (_toString(buf, "base64") !== text) throw E(code, label + " is not canonical base64 (RFC 4648 sec. 3.5)");
|
|
3922
4270
|
return buf;
|
|
3923
4271
|
}
|
|
3924
4272
|
function hex(text, maxBytes, E, code, label) {
|
|
@@ -3926,8 +4274,8 @@ var require_guard_encoding = __commonJS({
|
|
|
3926
4274
|
if (!_inAlphabet(text, HEX_ALPHABET)) throw E(code, label + " is not hexadecimal");
|
|
3927
4275
|
if (text.length % 2 !== 0) throw E(code, label + " must have an even number of hex digits");
|
|
3928
4276
|
_capBefore(text.length, 2, maxBytes, E, code, label);
|
|
3929
|
-
var buf =
|
|
3930
|
-
if (buf
|
|
4277
|
+
var buf = _bufferFrom(text, "hex");
|
|
4278
|
+
if (_toString(buf, "hex") !== _toLowerCase(text)) throw E(code, label + " is not canonical hexadecimal");
|
|
3931
4279
|
return buf;
|
|
3932
4280
|
}
|
|
3933
4281
|
module2.exports = { base64url, base64, hex };
|
|
@@ -3938,6 +4286,10 @@ var require_guard_encoding = __commonJS({
|
|
|
3938
4286
|
var require_guard_der = __commonJS({
|
|
3939
4287
|
"node_modules/@blamejs/pki/lib/guard-der.js"(exports2, module2) {
|
|
3940
4288
|
"use strict";
|
|
4289
|
+
var _compare = require_guard_intrinsic().compare;
|
|
4290
|
+
var _forEach = require_guard_intrinsic().forEach;
|
|
4291
|
+
var _sizeOf = require_guard_intrinsic().sizeOf;
|
|
4292
|
+
var _create = require_guard_intrinsic().create;
|
|
3941
4293
|
var asn1 = null;
|
|
3942
4294
|
function _asn1() {
|
|
3943
4295
|
if (asn1 === null) asn1 = require_asn1_der();
|
|
@@ -3947,7 +4299,7 @@ var require_guard_der = __commonJS({
|
|
|
3947
4299
|
function _readers() {
|
|
3948
4300
|
if (VALUE_READERS !== null) return VALUE_READERS;
|
|
3949
4301
|
var asn12 = _asn1();
|
|
3950
|
-
var m =
|
|
4302
|
+
var m = _create(null), R = asn12.read, T = asn12.TAGS;
|
|
3951
4303
|
m[T.BOOLEAN] = R.boolean;
|
|
3952
4304
|
m[T.INTEGER] = R.integer;
|
|
3953
4305
|
m[T.ENUMERATED] = R.enumerated;
|
|
@@ -3958,7 +4310,7 @@ var require_guard_der = __commonJS({
|
|
|
3958
4310
|
m[T.UTC_TIME] = R.time;
|
|
3959
4311
|
m[T.GENERALIZED_TIME] = R.time;
|
|
3960
4312
|
m[T.NUMERIC_STRING] = R.numericString;
|
|
3961
|
-
[
|
|
4313
|
+
_forEach([
|
|
3962
4314
|
T.UTF8_STRING,
|
|
3963
4315
|
T.PRINTABLE_STRING,
|
|
3964
4316
|
T.IA5_STRING,
|
|
@@ -3966,15 +4318,19 @@ var require_guard_der = __commonJS({
|
|
|
3966
4318
|
T.VISIBLE_STRING,
|
|
3967
4319
|
T.BMP_STRING,
|
|
3968
4320
|
T.UNIVERSAL_STRING
|
|
3969
|
-
]
|
|
4321
|
+
], function(t) {
|
|
3970
4322
|
m[t] = R.string;
|
|
3971
4323
|
});
|
|
3972
4324
|
VALUE_READERS = m;
|
|
3973
4325
|
return VALUE_READERS;
|
|
3974
4326
|
}
|
|
3975
|
-
var TAG_CLASS_RANK =
|
|
4327
|
+
var TAG_CLASS_RANK = _create(null);
|
|
4328
|
+
TAG_CLASS_RANK.universal = 0;
|
|
4329
|
+
TAG_CLASS_RANK.application = 1;
|
|
4330
|
+
TAG_CLASS_RANK.context = 2;
|
|
4331
|
+
TAG_CLASS_RANK["private"] = 3;
|
|
3976
4332
|
function setOrderOk(kids) {
|
|
3977
|
-
var i, dup = false, seen =
|
|
4333
|
+
var i, dup = false, seen = _create(null);
|
|
3978
4334
|
for (i = 0; i < kids.length; i++) {
|
|
3979
4335
|
var key = kids[i].tagClass + ":" + kids[i].tagNumber;
|
|
3980
4336
|
if (seen[key]) {
|
|
@@ -3985,7 +4341,7 @@ var require_guard_der = __commonJS({
|
|
|
3985
4341
|
}
|
|
3986
4342
|
var octetAsc = true, tagAsc = true;
|
|
3987
4343
|
for (i = 1; i < kids.length; i++) {
|
|
3988
|
-
if (
|
|
4344
|
+
if (_compare(kids[i - 1].bytes, kids[i].bytes) > 0) octetAsc = false;
|
|
3989
4345
|
var pc = TAG_CLASS_RANK[kids[i - 1].tagClass], cc = TAG_CLASS_RANK[kids[i].tagClass];
|
|
3990
4346
|
if (pc !== cc ? pc > cc : kids[i - 1].tagNumber > kids[i].tagNumber) tagAsc = false;
|
|
3991
4347
|
}
|
|
@@ -4018,7 +4374,7 @@ var require_guard_der = __commonJS({
|
|
|
4018
4374
|
}
|
|
4019
4375
|
}
|
|
4020
4376
|
function tlv(content, E, code, label) {
|
|
4021
|
-
if (!content || content
|
|
4377
|
+
if (!content || _sizeOf(content) === 0) throw E(code, label + " must be a non-empty DER element");
|
|
4022
4378
|
var node;
|
|
4023
4379
|
try {
|
|
4024
4380
|
node = _asn1().decode(content);
|
|
@@ -4037,6 +4393,17 @@ var require_guard_json = __commonJS({
|
|
|
4037
4393
|
"node_modules/@blamejs/pki/lib/guard-json.js"(exports2, module2) {
|
|
4038
4394
|
"use strict";
|
|
4039
4395
|
var text = require_guard_text();
|
|
4396
|
+
var _defineProperty = require_guard_intrinsic().defineProperty;
|
|
4397
|
+
var _fromCharCode = require_guard_intrinsic().fromCharCode;
|
|
4398
|
+
var _charCodeAt = require_guard_intrinsic().uncurry(String.prototype.charCodeAt);
|
|
4399
|
+
var _strSlice = require_guard_intrinsic().uncurry(String.prototype.slice);
|
|
4400
|
+
var _hasOwn = require_guard_intrinsic().hasOwn;
|
|
4401
|
+
var _Number = require_guard_intrinsic().Number;
|
|
4402
|
+
var _isFinite = require_guard_intrinsic().isFinite;
|
|
4403
|
+
var _stringify = require_guard_intrinsic().stringify;
|
|
4404
|
+
function _append(arr, v) {
|
|
4405
|
+
_defineProperty(arr, arr.length, { value: v, writable: true, enumerable: true, configurable: true });
|
|
4406
|
+
}
|
|
4040
4407
|
var limits = require_guard_limits();
|
|
4041
4408
|
function _hexVal(c) {
|
|
4042
4409
|
if (c >= 48 && c <= 57) return c - 48;
|
|
@@ -4064,7 +4431,7 @@ var require_guard_json = __commonJS({
|
|
|
4064
4431
|
var i = 0, n = str.length;
|
|
4065
4432
|
function ws() {
|
|
4066
4433
|
while (i < n) {
|
|
4067
|
-
var c = str
|
|
4434
|
+
var c = _charCodeAt(str, i);
|
|
4068
4435
|
if (c === 32 || c === 9 || c === 10 || c === 13) i++;
|
|
4069
4436
|
else break;
|
|
4070
4437
|
}
|
|
@@ -4081,15 +4448,15 @@ var require_guard_json = __commonJS({
|
|
|
4081
4448
|
if (c === "[") return array(depth);
|
|
4082
4449
|
if (c === '"') return string();
|
|
4083
4450
|
if (c === "-" || c >= "0" && c <= "9") return number();
|
|
4084
|
-
if (str
|
|
4451
|
+
if (_strSlice(str, i, i + 4) === "true") {
|
|
4085
4452
|
i += 4;
|
|
4086
4453
|
return true;
|
|
4087
4454
|
}
|
|
4088
|
-
if (str
|
|
4455
|
+
if (_strSlice(str, i, i + 5) === "false") {
|
|
4089
4456
|
i += 5;
|
|
4090
4457
|
return false;
|
|
4091
4458
|
}
|
|
4092
|
-
if (str
|
|
4459
|
+
if (_strSlice(str, i, i + 4) === "null") {
|
|
4093
4460
|
i += 4;
|
|
4094
4461
|
return null;
|
|
4095
4462
|
}
|
|
@@ -4108,11 +4475,11 @@ var require_guard_json = __commonJS({
|
|
|
4108
4475
|
ws();
|
|
4109
4476
|
if (str[i] !== '"') fail("expected a string key");
|
|
4110
4477
|
var key = string();
|
|
4111
|
-
if (
|
|
4478
|
+
if (_hasOwn(out, key)) throw E(spec.duplicateMember, "duplicate JSON member " + _stringify(key));
|
|
4112
4479
|
ws();
|
|
4113
4480
|
if (str[i] !== ":") fail("expected ':'");
|
|
4114
4481
|
i++;
|
|
4115
|
-
|
|
4482
|
+
_defineProperty(out, key, { value: value(depth + 1), writable: true, enumerable: true, configurable: true });
|
|
4116
4483
|
ws();
|
|
4117
4484
|
if (str[i] === ",") {
|
|
4118
4485
|
i++;
|
|
@@ -4134,7 +4501,7 @@ var require_guard_json = __commonJS({
|
|
|
4134
4501
|
return out;
|
|
4135
4502
|
}
|
|
4136
4503
|
for (; ; ) {
|
|
4137
|
-
out
|
|
4504
|
+
_append(out, value(depth + 1));
|
|
4138
4505
|
ws();
|
|
4139
4506
|
if (str[i] === ",") {
|
|
4140
4507
|
i++;
|
|
@@ -4169,14 +4536,14 @@ var require_guard_json = __commonJS({
|
|
|
4169
4536
|
var cp = 0;
|
|
4170
4537
|
if (i + 4 > n) fail("bad \\u escape");
|
|
4171
4538
|
for (var h = 0; h < 4; h++) {
|
|
4172
|
-
var d = _hexVal(str
|
|
4539
|
+
var d = _hexVal(_charCodeAt(str, i + h));
|
|
4173
4540
|
if (d < 0) fail("bad \\u escape");
|
|
4174
4541
|
cp = cp << 4 | d;
|
|
4175
4542
|
}
|
|
4176
|
-
s +=
|
|
4543
|
+
s += _fromCharCode(cp);
|
|
4177
4544
|
i += 4;
|
|
4178
4545
|
} else fail("bad escape");
|
|
4179
|
-
} else if (c
|
|
4546
|
+
} else if (_charCodeAt(c, 0) < 32) {
|
|
4180
4547
|
fail("control character in string");
|
|
4181
4548
|
} else s += c;
|
|
4182
4549
|
}
|
|
@@ -4202,8 +4569,8 @@ var require_guard_json = __commonJS({
|
|
|
4202
4569
|
while (i < n && str[i] >= "0" && str[i] <= "9") i++;
|
|
4203
4570
|
if (i === expStart) fail("malformed number");
|
|
4204
4571
|
}
|
|
4205
|
-
var v =
|
|
4206
|
-
if (!
|
|
4572
|
+
var v = _Number(_strSlice(str, start, i));
|
|
4573
|
+
if (!_isFinite(v)) fail("bad number");
|
|
4207
4574
|
return v;
|
|
4208
4575
|
}
|
|
4209
4576
|
var result = value(0);
|
|
@@ -4220,19 +4587,23 @@ var require_guard_header = __commonJS({
|
|
|
4220
4587
|
"node_modules/@blamejs/pki/lib/guard-header.js"(exports2, module2) {
|
|
4221
4588
|
"use strict";
|
|
4222
4589
|
var C = require_constants();
|
|
4590
|
+
var _byteLength = require_guard_intrinsic().byteLength;
|
|
4591
|
+
var _charCodeAt = require_guard_intrinsic().uncurry(String.prototype.charCodeAt);
|
|
4592
|
+
var _stringify = require_guard_intrinsic().stringify;
|
|
4593
|
+
var _String = require_guard_intrinsic().String;
|
|
4223
4594
|
function assertField(name, value, E, code) {
|
|
4224
4595
|
if (typeof name !== "string" || name.length === 0) throw new E(code, "a header field name must be a non-empty string");
|
|
4225
4596
|
for (var i = 0; i < name.length; i++) {
|
|
4226
|
-
var nc = name
|
|
4227
|
-
if (nc < 33 || nc > 126 || nc === 58) throw new E(code, "a header field name must be RFC 5322 ftext (printable ASCII, no space / ':' / control): " +
|
|
4597
|
+
var nc = _charCodeAt(name, i);
|
|
4598
|
+
if (nc < 33 || nc > 126 || nc === 58) throw new E(code, "a header field name must be RFC 5322 ftext (printable ASCII, no space / ':' / control): " + _stringify(name));
|
|
4228
4599
|
}
|
|
4229
|
-
var v = typeof value === "string" ? value :
|
|
4600
|
+
var v = typeof value === "string" ? value : _String(value);
|
|
4230
4601
|
for (var j = 0; j < v.length; j++) {
|
|
4231
|
-
var vc = v
|
|
4232
|
-
if (vc === 0 || vc === 13 || vc === 10) throw new E(code, "a header field value must not contain CR / LF / NUL (header injection) in " +
|
|
4602
|
+
var vc = _charCodeAt(v, j);
|
|
4603
|
+
if (vc === 0 || vc === 13 || vc === 10) throw new E(code, "a header field value must not contain CR / LF / NUL (header injection) in " + _stringify(name));
|
|
4233
4604
|
}
|
|
4234
|
-
if (
|
|
4235
|
-
throw new E(code, "a header field line exceeds RFC 5322's " + C.LIMITS.HEADER_LINE_MAX_OCTETS + "-octet limit: " +
|
|
4605
|
+
if (_byteLength(name, "utf8") + 2 + _byteLength(v, "utf8") > C.LIMITS.HEADER_LINE_MAX_OCTETS) {
|
|
4606
|
+
throw new E(code, "a header field line exceeds RFC 5322's " + C.LIMITS.HEADER_LINE_MAX_OCTETS + "-octet limit: " + _stringify(name));
|
|
4236
4607
|
}
|
|
4237
4608
|
return v;
|
|
4238
4609
|
}
|
|
@@ -4245,6 +4616,16 @@ var require_guard_compress = __commonJS({
|
|
|
4245
4616
|
"node_modules/@blamejs/pki/lib/guard-compress.js"(exports2, module2) {
|
|
4246
4617
|
"use strict";
|
|
4247
4618
|
var zlib = require("zlib");
|
|
4619
|
+
var _intrinsic = require_guard_intrinsic();
|
|
4620
|
+
var _bufferFrom = _intrinsic.bufferFrom;
|
|
4621
|
+
var _isBuffer = _intrinsic.isBuffer;
|
|
4622
|
+
var _isInteger = _intrinsic.isInteger;
|
|
4623
|
+
var _objectKeys = _intrinsic.keys;
|
|
4624
|
+
var _stringify = _intrinsic.stringify;
|
|
4625
|
+
var _compare = _intrinsic.compare;
|
|
4626
|
+
var _sizeOf = _intrinsic.sizeOf;
|
|
4627
|
+
var _subarray = _intrinsic.uncurry(Uint8Array.prototype.subarray);
|
|
4628
|
+
var _hasOwn = _intrinsic.hasOwn;
|
|
4248
4629
|
var DECOMPRESS = {
|
|
4249
4630
|
zlib: zlib.inflateSync,
|
|
4250
4631
|
// RFC 1950
|
|
@@ -4262,41 +4643,41 @@ var require_guard_compress = __commonJS({
|
|
|
4262
4643
|
var compress = _PROBE_COMPRESS[name];
|
|
4263
4644
|
var decompress = DECOMPRESS[name];
|
|
4264
4645
|
if (typeof compress !== "function" || typeof decompress !== "function") return false;
|
|
4265
|
-
var sample =
|
|
4646
|
+
var sample = _bufferFrom("0123456789abcdefghijklmnopqrstuvwxyz0123456789");
|
|
4266
4647
|
var frame, whole;
|
|
4267
4648
|
try {
|
|
4268
4649
|
frame = compress(sample);
|
|
4269
4650
|
} catch (_e) {
|
|
4270
4651
|
return false;
|
|
4271
4652
|
}
|
|
4272
|
-
if (!
|
|
4653
|
+
if (!_isBuffer(frame) || _sizeOf(frame) < 4) return false;
|
|
4273
4654
|
try {
|
|
4274
4655
|
whole = decompress(frame, { maxOutputLength: 4096 });
|
|
4275
4656
|
} catch (_e2) {
|
|
4276
4657
|
return false;
|
|
4277
4658
|
}
|
|
4278
|
-
if (!
|
|
4659
|
+
if (!_isBuffer(whole) || _compare(whole, sample) !== 0) return false;
|
|
4279
4660
|
var cutAccepted = false;
|
|
4280
4661
|
try {
|
|
4281
|
-
decompress(frame
|
|
4662
|
+
decompress(_subarray(frame, 0, _sizeOf(frame) - 2), { maxOutputLength: 4096 });
|
|
4282
4663
|
cutAccepted = true;
|
|
4283
4664
|
} catch (_e3) {
|
|
4284
4665
|
}
|
|
4285
4666
|
return !cutAccepted;
|
|
4286
4667
|
}
|
|
4287
4668
|
var SAFE = {};
|
|
4288
|
-
|
|
4669
|
+
_intrinsic.forEach(_objectKeys(DECOMPRESS), function(n) {
|
|
4289
4670
|
if (_reportsTruncation(n)) SAFE[n] = true;
|
|
4290
4671
|
});
|
|
4291
4672
|
function bounded(algorithm, stream, cap, E, codes, label) {
|
|
4292
4673
|
var decompress = DECOMPRESS[algorithm];
|
|
4293
|
-
if (!
|
|
4294
|
-
throw new TypeError("guard.compress.bounded: unknown or unsafe algorithm " +
|
|
4674
|
+
if (!_hasOwn(SAFE, algorithm) || !decompress) {
|
|
4675
|
+
throw new TypeError("guard.compress.bounded: unknown or unsafe algorithm " + _stringify(algorithm));
|
|
4295
4676
|
}
|
|
4296
|
-
if (!
|
|
4677
|
+
if (!_isBuffer(stream)) {
|
|
4297
4678
|
throw new TypeError("guard.compress.bounded: stream must be a Buffer (route the input through guard.bytes.view first)");
|
|
4298
4679
|
}
|
|
4299
|
-
if (!
|
|
4680
|
+
if (!_isInteger(cap) || cap < 1) {
|
|
4300
4681
|
throw new TypeError("guard.compress.bounded: cap must be a positive integer");
|
|
4301
4682
|
}
|
|
4302
4683
|
var what = label || "the compressed input";
|
|
@@ -4310,13 +4691,14 @@ var require_guard_compress = __commonJS({
|
|
|
4310
4691
|
throw E(codes.failed, what + " could not be decompressed", e);
|
|
4311
4692
|
}
|
|
4312
4693
|
var consumed = res.engine.bytesWritten;
|
|
4313
|
-
|
|
4314
|
-
|
|
4694
|
+
var streamLen = _sizeOf(stream);
|
|
4695
|
+
if (consumed !== streamLen) {
|
|
4696
|
+
throw E(codes.failed, what + " carries " + (streamLen - consumed) + " trailing byte(s) after the end of the compressed stream");
|
|
4315
4697
|
}
|
|
4316
4698
|
return res.buffer;
|
|
4317
4699
|
}
|
|
4318
4700
|
function algorithms() {
|
|
4319
|
-
return
|
|
4701
|
+
return _objectKeys(SAFE);
|
|
4320
4702
|
}
|
|
4321
4703
|
module2.exports = { bounded, algorithms };
|
|
4322
4704
|
}
|
|
@@ -4342,6 +4724,7 @@ var require_guard_all = __commonJS({
|
|
|
4342
4724
|
var secret = require_guard_secret();
|
|
4343
4725
|
var parsed = require_guard_parsed();
|
|
4344
4726
|
var async_ = require_guard_async();
|
|
4727
|
+
var intrinsic = require_guard_intrinsic();
|
|
4345
4728
|
module2.exports = {
|
|
4346
4729
|
bytes,
|
|
4347
4730
|
text,
|
|
@@ -4358,7 +4741,8 @@ var require_guard_all = __commonJS({
|
|
|
4358
4741
|
compress,
|
|
4359
4742
|
secret,
|
|
4360
4743
|
parsed,
|
|
4361
|
-
async: async_
|
|
4744
|
+
async: async_,
|
|
4745
|
+
intrinsic
|
|
4362
4746
|
};
|
|
4363
4747
|
}
|
|
4364
4748
|
});
|
|
@@ -11651,7 +12035,7 @@ var require_schema_csr = __commonJS({
|
|
|
11651
12035
|
};
|
|
11652
12036
|
}
|
|
11653
12037
|
});
|
|
11654
|
-
var parse = pkix.
|
|
12038
|
+
var parse = pkix.makeRecordingParser({ pemLabel: "CERTIFICATE REQUEST", PemError, ErrorClass: CsrError, prefix: "csr", what: "certification request", topSchema: CERTIFICATION_REQUEST, ns: NS }, "csr");
|
|
11655
12039
|
function pemDecode(text, label) {
|
|
11656
12040
|
return pkix.pemDecode(text, label || "CERTIFICATE REQUEST", PemError);
|
|
11657
12041
|
}
|
|
@@ -14237,7 +14621,7 @@ var require_schema_crmf = __commonJS({
|
|
|
14237
14621
|
}) };
|
|
14238
14622
|
}
|
|
14239
14623
|
});
|
|
14240
|
-
var parse = pkix.
|
|
14624
|
+
var parse = pkix.makeRecordingParser({
|
|
14241
14625
|
pemLabel: null,
|
|
14242
14626
|
PemError,
|
|
14243
14627
|
ErrorClass: CrmfError,
|
|
@@ -14245,7 +14629,7 @@ var require_schema_crmf = __commonJS({
|
|
|
14245
14629
|
what: "certificate request message",
|
|
14246
14630
|
topSchema: CERT_REQ_MESSAGES,
|
|
14247
14631
|
ns: NS
|
|
14248
|
-
});
|
|
14632
|
+
}, "crmf");
|
|
14249
14633
|
function pemDecode(text, label) {
|
|
14250
14634
|
return pkix.pemDecode(text, label || null, PemError);
|
|
14251
14635
|
}
|
|
@@ -15616,11 +16000,18 @@ var require_schema_attrcert = __commonJS({
|
|
|
15616
16000
|
function _legacyV1Error() {
|
|
15617
16001
|
return new AttrCertError("attrcert/legacy-v1-not-supported", "AttributeCertificateV1 (X.509-1997) is obsolete and not parsed by this build (RFC 5755 sec. 1)");
|
|
15618
16002
|
}
|
|
15619
|
-
function
|
|
16003
|
+
function _parseAc(input) {
|
|
15620
16004
|
var root = pkix.decodeRoot(pkix.coerceToDer(input, PARSE_OPTS), PARSE_OPTS);
|
|
15621
16005
|
if (matchesV1(root)) throw _legacyV1Error();
|
|
15622
16006
|
return schema.walk(ATTRIBUTE_CERTIFICATE, root, NS).result;
|
|
15623
16007
|
}
|
|
16008
|
+
var parse = guard.parsed.recordingParser(
|
|
16009
|
+
"attributeCertificate",
|
|
16010
|
+
_parseAc,
|
|
16011
|
+
AttrCertError,
|
|
16012
|
+
"attrcert/bad-input",
|
|
16013
|
+
"an attribute certificate"
|
|
16014
|
+
);
|
|
15624
16015
|
function parseV1(input) {
|
|
15625
16016
|
pkix.decodeRoot(pkix.coerceToDer(input, PARSE_OPTS), PARSE_OPTS);
|
|
15626
16017
|
throw _legacyV1Error();
|
|
@@ -15672,6 +16063,9 @@ var require_schema_attrcert = __commonJS({
|
|
|
15672
16063
|
var gn = schema.walk(_GN, node, NS);
|
|
15673
16064
|
return { tagNumber: gn.tagNumber, value: gn.value };
|
|
15674
16065
|
}
|
|
16066
|
+
function readGeneralName(der, code) {
|
|
16067
|
+
return _oneGN(asn1.decode(der), code || "attrcert/bad-input");
|
|
16068
|
+
}
|
|
15675
16069
|
function _svceAuthInfo(authInfoAllowed, code) {
|
|
15676
16070
|
return function(buf) {
|
|
15677
16071
|
var kids = _seqChildren(buf, code, "SvceAuthInfo");
|
|
@@ -15920,6 +16314,7 @@ var require_schema_attrcert = __commonJS({
|
|
|
15920
16314
|
pemEncode,
|
|
15921
16315
|
matches,
|
|
15922
16316
|
matchesV1,
|
|
16317
|
+
readGeneralName,
|
|
15923
16318
|
validateAttributeValue,
|
|
15924
16319
|
validateExtensionValue
|
|
15925
16320
|
};
|
|
@@ -17344,20 +17739,88 @@ var require_ocsp_verify = __commonJS({
|
|
|
17344
17739
|
}
|
|
17345
17740
|
});
|
|
17346
17741
|
|
|
17742
|
+
// node_modules/@blamejs/pki/lib/verify-seam.js
|
|
17743
|
+
var require_verify_seam = __commonJS({
|
|
17744
|
+
"node_modules/@blamejs/pki/lib/verify-seam.js"(exports2, module2) {
|
|
17745
|
+
"use strict";
|
|
17746
|
+
var guard = require_guard_all();
|
|
17747
|
+
function makeSeam(name, ErrorClass, code) {
|
|
17748
|
+
var engine = null;
|
|
17749
|
+
return {
|
|
17750
|
+
setEngine: function(verifyWithSpki) {
|
|
17751
|
+
engine = verifyWithSpki;
|
|
17752
|
+
},
|
|
17753
|
+
verify: function(sigAlg, signature, spkiBytes, preimage) {
|
|
17754
|
+
if (engine == null) {
|
|
17755
|
+
throw new ErrorClass(code, "the " + name + " signature engine is not initialized (require pki before use)");
|
|
17756
|
+
}
|
|
17757
|
+
if (!guard.crypto.isOctetAligned(signature)) return Promise.resolve(false);
|
|
17758
|
+
return engine(sigAlg, signature.bytes, spkiBytes, preimage);
|
|
17759
|
+
}
|
|
17760
|
+
};
|
|
17761
|
+
}
|
|
17762
|
+
module2.exports = { makeSeam };
|
|
17763
|
+
}
|
|
17764
|
+
});
|
|
17765
|
+
|
|
17347
17766
|
// node_modules/@blamejs/pki/lib/crl-verify.js
|
|
17348
17767
|
var require_crl_verify = __commonJS({
|
|
17349
17768
|
"node_modules/@blamejs/pki/lib/crl-verify.js"(exports2, module2) {
|
|
17350
17769
|
"use strict";
|
|
17351
|
-
var
|
|
17352
|
-
var
|
|
17353
|
-
|
|
17354
|
-
_engine = verifyWithSpki;
|
|
17355
|
-
}
|
|
17770
|
+
var frameworkError = require_framework_error();
|
|
17771
|
+
var seam = require_verify_seam();
|
|
17772
|
+
var _seam = seam.makeSeam("crl-verify", frameworkError.CrlError, "crl/bad-input");
|
|
17356
17773
|
function verifyCrlSignature(crl, spkiBytes) {
|
|
17357
|
-
|
|
17358
|
-
|
|
17774
|
+
return _seam.verify(crl.signatureAlgorithm, crl.signatureValue, spkiBytes, crl.tbsBytes);
|
|
17775
|
+
}
|
|
17776
|
+
module2.exports = { setEngine: _seam.setEngine, verifyCrlSignature };
|
|
17777
|
+
}
|
|
17778
|
+
});
|
|
17779
|
+
|
|
17780
|
+
// node_modules/@blamejs/pki/lib/csr-verify.js
|
|
17781
|
+
var require_csr_verify = __commonJS({
|
|
17782
|
+
"node_modules/@blamejs/pki/lib/csr-verify.js"(exports2, module2) {
|
|
17783
|
+
"use strict";
|
|
17784
|
+
var frameworkError = require_framework_error();
|
|
17785
|
+
var seam = require_verify_seam();
|
|
17786
|
+
var _seam = seam.makeSeam("csr-verify", frameworkError.CsrError, "csr/bad-input");
|
|
17787
|
+
function verifyCsrSignature(parsed) {
|
|
17788
|
+
return _seam.verify(
|
|
17789
|
+
parsed.signatureAlgorithm,
|
|
17790
|
+
parsed.signatureValue,
|
|
17791
|
+
parsed.subjectPublicKeyInfo.bytes,
|
|
17792
|
+
parsed.certificationRequestInfoBytes
|
|
17793
|
+
);
|
|
17794
|
+
}
|
|
17795
|
+
module2.exports = { setEngine: _seam.setEngine, verifyCsrSignature };
|
|
17796
|
+
}
|
|
17797
|
+
});
|
|
17798
|
+
|
|
17799
|
+
// node_modules/@blamejs/pki/lib/crmf-verify.js
|
|
17800
|
+
var require_crmf_verify = __commonJS({
|
|
17801
|
+
"node_modules/@blamejs/pki/lib/crmf-verify.js"(exports2, module2) {
|
|
17802
|
+
"use strict";
|
|
17803
|
+
var frameworkError = require_framework_error();
|
|
17804
|
+
var seam = require_verify_seam();
|
|
17805
|
+
var _seam = seam.makeSeam("crmf-verify", frameworkError.CrmfError, "crmf/bad-input");
|
|
17806
|
+
function verifyPopSignature(popo, spkiBytes, preimage) {
|
|
17807
|
+
return _seam.verify(popo.algorithmIdentifier, popo.signature, spkiBytes, preimage);
|
|
17808
|
+
}
|
|
17809
|
+
module2.exports = { setEngine: _seam.setEngine, verifyPopSignature };
|
|
17810
|
+
}
|
|
17811
|
+
});
|
|
17812
|
+
|
|
17813
|
+
// node_modules/@blamejs/pki/lib/attrcert-verify.js
|
|
17814
|
+
var require_attrcert_verify = __commonJS({
|
|
17815
|
+
"node_modules/@blamejs/pki/lib/attrcert-verify.js"(exports2, module2) {
|
|
17816
|
+
"use strict";
|
|
17817
|
+
var frameworkError = require_framework_error();
|
|
17818
|
+
var seam = require_verify_seam();
|
|
17819
|
+
var _seam = seam.makeSeam("attrcert-verify", frameworkError.AttrCertError, "attrcert/bad-input");
|
|
17820
|
+
function verifyAcSignature(ac, spkiBytes) {
|
|
17821
|
+
return _seam.verify(ac.signatureAlgorithm, ac.signatureValue, spkiBytes, ac.tbsBytes);
|
|
17359
17822
|
}
|
|
17360
|
-
module2.exports = { setEngine,
|
|
17823
|
+
module2.exports = { setEngine: _seam.setEngine, verifyAcSignature };
|
|
17361
17824
|
}
|
|
17362
17825
|
});
|
|
17363
17826
|
|
|
@@ -18090,6 +18553,8 @@ var require_crmf_sign = __commonJS({
|
|
|
18090
18553
|
var pkiBuild = require_pki_build();
|
|
18091
18554
|
var frameworkError = require_framework_error();
|
|
18092
18555
|
var guard = require_guard_all();
|
|
18556
|
+
require_path_validate();
|
|
18557
|
+
var crmfVerify = require_crmf_verify();
|
|
18093
18558
|
var CrmfError = frameworkError.CrmfError;
|
|
18094
18559
|
var b = asn1.build;
|
|
18095
18560
|
function _err(code, message, cause) {
|
|
@@ -18305,7 +18770,75 @@ var require_crmf_sign = __commonJS({
|
|
|
18305
18770
|
function buildCertTemplate(template) {
|
|
18306
18771
|
return _encodeCertTemplate(template, { revocation: true }).der;
|
|
18307
18772
|
}
|
|
18308
|
-
|
|
18773
|
+
function _coerceMessages(input) {
|
|
18774
|
+
return guard.parsed.acceptDerived(input, "crmf", crmf.parse, _err, "crmf/bad-input", "the certificate request messages");
|
|
18775
|
+
}
|
|
18776
|
+
function _verifyOne(msg) {
|
|
18777
|
+
var t = msg.certReq && msg.certReq.certTemplate;
|
|
18778
|
+
var base = {
|
|
18779
|
+
certReqId: msg.certReq && msg.certReq.certReqId,
|
|
18780
|
+
subject: t && t.subject || null,
|
|
18781
|
+
subjectBound: false,
|
|
18782
|
+
publicKey: t && t.publicKey && t.publicKey.bytes || null
|
|
18783
|
+
};
|
|
18784
|
+
function settle(extra) {
|
|
18785
|
+
return Promise.resolve(Object.assign({}, base, extra));
|
|
18786
|
+
}
|
|
18787
|
+
var popo = msg.popo;
|
|
18788
|
+
if (popo == null) {
|
|
18789
|
+
return settle({
|
|
18790
|
+
verified: false,
|
|
18791
|
+
method: null,
|
|
18792
|
+
cryptographicallyVerified: false,
|
|
18793
|
+
reason: "the request carries no proof of possession"
|
|
18794
|
+
});
|
|
18795
|
+
}
|
|
18796
|
+
if (popo.type === "raVerified") {
|
|
18797
|
+
return settle({
|
|
18798
|
+
verified: false,
|
|
18799
|
+
method: "raVerified",
|
|
18800
|
+
cryptographicallyVerified: false,
|
|
18801
|
+
reason: "raVerified asserts the RA checked possession out of band -- this is not a proof and cannot be verified from the message"
|
|
18802
|
+
});
|
|
18803
|
+
}
|
|
18804
|
+
if (popo.type !== "signature") {
|
|
18805
|
+
return settle({
|
|
18806
|
+
verified: false,
|
|
18807
|
+
method: popo.type,
|
|
18808
|
+
cryptographicallyVerified: false,
|
|
18809
|
+
reason: "a " + popo.type + " proof of possession completes over an exchange this verifier does not hold (RFC 4211 sec. 4.2, 4.3)"
|
|
18810
|
+
});
|
|
18811
|
+
}
|
|
18812
|
+
var pin = popo.poposkInput;
|
|
18813
|
+
var preimage = pin ? pin.signedBytes : msg.certReq.certReqBytes;
|
|
18814
|
+
var spki = pin ? pin.publicKey : base.publicKey;
|
|
18815
|
+
var bound = !pin;
|
|
18816
|
+
return crmfVerify.verifyPopSignature(popo, spki, preimage).then(function(ok) {
|
|
18817
|
+
return Object.assign({}, base, {
|
|
18818
|
+
verified: ok === true,
|
|
18819
|
+
method: "signature",
|
|
18820
|
+
cryptographicallyVerified: ok === true,
|
|
18821
|
+
subject: bound ? base.subject : null,
|
|
18822
|
+
subjectBound: bound,
|
|
18823
|
+
publicKey: spki || null,
|
|
18824
|
+
reason: ok === true ? void 0 : "the proof-of-possession signature does not verify under the requested public key"
|
|
18825
|
+
});
|
|
18826
|
+
});
|
|
18827
|
+
}
|
|
18828
|
+
function verifyPop(messages) {
|
|
18829
|
+
return guard.async.deferred(function() {
|
|
18830
|
+
return _verifyPop(messages);
|
|
18831
|
+
});
|
|
18832
|
+
}
|
|
18833
|
+
function _verifyPop(messages) {
|
|
18834
|
+
var parsed = _coerceMessages(messages);
|
|
18835
|
+
return Promise.all(parsed.messages.map(_verifyOne)).then(function(out) {
|
|
18836
|
+
return { verified: out.length > 0 && out.every(function(m) {
|
|
18837
|
+
return m.verified === true;
|
|
18838
|
+
}), messages: out };
|
|
18839
|
+
});
|
|
18840
|
+
}
|
|
18841
|
+
module2.exports = { build, buildCertTemplate, verifyPop };
|
|
18309
18842
|
}
|
|
18310
18843
|
});
|
|
18311
18844
|
|
|
@@ -19256,6 +19789,33 @@ var require_cmp_build = __commonJS({
|
|
|
19256
19789
|
var require_cmp_verify = __commonJS({
|
|
19257
19790
|
"node_modules/@blamejs/pki/lib/cmp-verify.js"(exports2, module2) {
|
|
19258
19791
|
"use strict";
|
|
19792
|
+
var intrinsic = require_guard_intrinsic();
|
|
19793
|
+
var _sizeOf = intrinsic.sizeOf;
|
|
19794
|
+
var util = { types: intrinsic.types };
|
|
19795
|
+
var _isBuffer = intrinsic.isBuffer;
|
|
19796
|
+
var _bufferFrom = intrinsic.bufferFrom;
|
|
19797
|
+
var _fromCharCode = intrinsic.fromCharCode;
|
|
19798
|
+
var _stringify = intrinsic.stringify;
|
|
19799
|
+
var _getOwnPropertyNames = intrinsic.getOwnPropertyNames;
|
|
19800
|
+
var _charAt = intrinsic.uncurry(String.prototype.charAt);
|
|
19801
|
+
var _create = intrinsic.create;
|
|
19802
|
+
var _floor = intrinsic.floor;
|
|
19803
|
+
var _ceil = intrinsic.ceil;
|
|
19804
|
+
var _min = intrinsic.min;
|
|
19805
|
+
var _charCodeAt = intrinsic.uncurry(String.prototype.charCodeAt);
|
|
19806
|
+
var _toLowerCase = intrinsic.uncurry(String.prototype.toLowerCase);
|
|
19807
|
+
var _strIndexOf = intrinsic.uncurry(String.prototype.indexOf);
|
|
19808
|
+
var _compare = intrinsic.compare;
|
|
19809
|
+
var _toString = intrinsic.uncurry(Buffer.prototype.toString);
|
|
19810
|
+
var _map = intrinsic.map;
|
|
19811
|
+
var _String = intrinsic.String;
|
|
19812
|
+
var _isFinite = intrinsic.isFinite;
|
|
19813
|
+
var _strSlice = intrinsic.uncurry(String.prototype.slice);
|
|
19814
|
+
var _strLastIndexOf = intrinsic.uncurry(String.prototype.lastIndexOf);
|
|
19815
|
+
var _strSearch = intrinsic.uncurry(String.prototype.search);
|
|
19816
|
+
var _reTest = intrinsic.uncurry(RegExp.prototype.test);
|
|
19817
|
+
var _reExec = intrinsic.uncurry(RegExp.prototype.exec);
|
|
19818
|
+
var _isArray = Array.isArray;
|
|
19259
19819
|
var asn1 = require_asn1_der();
|
|
19260
19820
|
var oid = require_oid();
|
|
19261
19821
|
var cmpBuild = require_cmp_build();
|
|
@@ -19287,7 +19847,7 @@ var require_cmp_verify = __commonJS({
|
|
|
19287
19847
|
revocationChecker: 1,
|
|
19288
19848
|
maxIterations: 1
|
|
19289
19849
|
};
|
|
19290
|
-
var PRF_HASH =
|
|
19850
|
+
var PRF_HASH = _create(null);
|
|
19291
19851
|
PRF_HASH[oid.byName("hmacWithSHA256")] = "SHA-256";
|
|
19292
19852
|
PRF_HASH[oid.byName("hmacWithSHA384")] = "SHA-384";
|
|
19293
19853
|
PRF_HASH[oid.byName("hmacWithSHA512")] = "SHA-512";
|
|
@@ -19298,7 +19858,7 @@ var require_cmp_verify = __commonJS({
|
|
|
19298
19858
|
var PBMAC1_KEYLEN_MIN = 20;
|
|
19299
19859
|
var PBMAC1_KEYLEN_MAX = 1024;
|
|
19300
19860
|
var PRF_HLEN = { "SHA-256": 32, "SHA-384": 48, "SHA-512": 64 };
|
|
19301
|
-
var UNSUPPORTED_MAC_OIDS =
|
|
19861
|
+
var UNSUPPORTED_MAC_OIDS = _create(null);
|
|
19302
19862
|
["passwordBasedMac", "dhBasedMac", "kemBasedMac"].forEach(function(n) {
|
|
19303
19863
|
var o = oid.byName(n);
|
|
19304
19864
|
if (o) UNSUPPORTED_MAC_OIDS[o] = n;
|
|
@@ -19333,28 +19893,28 @@ var require_cmp_verify = __commonJS({
|
|
|
19333
19893
|
return _verdict(m, type, alg, false, false, code, reason, signer || null);
|
|
19334
19894
|
}
|
|
19335
19895
|
function _coerce(message) {
|
|
19336
|
-
if (message && typeof message === "object" && !
|
|
19896
|
+
if (message && typeof message === "object" && !_isBuffer(message) && !util.types.isUint8Array(message) && message.headerBytes !== void 0 && message.bodyBytes !== void 0 && message.header !== void 0 && message.body !== void 0) {
|
|
19337
19897
|
try {
|
|
19338
19898
|
return cmp.parse(_reassemble(message));
|
|
19339
19899
|
} catch (e) {
|
|
19340
19900
|
throw e instanceof CmpError ? e : _err("cmp/bad-input", "the parsed PKIMessage object carries a malformed raw slice (headerBytes / bodyBytes / protection / extraCerts): " + (e && e.message || e), e);
|
|
19341
19901
|
}
|
|
19342
19902
|
}
|
|
19343
|
-
if (
|
|
19903
|
+
if (_isBuffer(message) || util.types.isUint8Array(message)) return cmp.parse(_bufferFrom(message));
|
|
19344
19904
|
return cmp.parse(message);
|
|
19345
19905
|
}
|
|
19346
19906
|
function _reassemble(m) {
|
|
19347
19907
|
var kids = [b.raw(m.headerBytes), b.raw(m.bodyBytes)];
|
|
19348
|
-
if (m.protection != null) kids
|
|
19908
|
+
if (m.protection != null) _append(kids, b.explicit(0, b.bitString(m.protection.bytes, m.protection.unusedBits)));
|
|
19349
19909
|
if (m.extraCerts != null && m.extraCerts.length) {
|
|
19350
|
-
kids
|
|
19910
|
+
_append(kids, b.explicit(1, b.sequence(_map(m.extraCerts, function(c) {
|
|
19351
19911
|
return b.raw(c);
|
|
19352
19912
|
}))));
|
|
19353
19913
|
}
|
|
19354
19914
|
return b.sequence(kids);
|
|
19355
19915
|
}
|
|
19356
19916
|
function _certDer(cert, what) {
|
|
19357
|
-
if (
|
|
19917
|
+
if (_isBuffer(cert) || util.types.isUint8Array(cert)) return guard.bytes.view(cert, CmpError, "cmp/bad-input", what);
|
|
19358
19918
|
if (typeof cert === "string") {
|
|
19359
19919
|
try {
|
|
19360
19920
|
return x509.pemDecode(cert);
|
|
@@ -19399,7 +19959,7 @@ var require_cmp_verify = __commonJS({
|
|
|
19399
19959
|
if (!sender || !sender.bytes) return false;
|
|
19400
19960
|
var subjectRdns = parsed.subject.rdns;
|
|
19401
19961
|
if (subjectRdns.length > 0) {
|
|
19402
|
-
var isDirName = sender.tagClass === "context" && sender.tagNumber === 4 && sender.value &&
|
|
19962
|
+
var isDirName = sender.tagClass === "context" && sender.tagNumber === 4 && sender.value && _isArray(sender.value.rdns);
|
|
19403
19963
|
if (isDirName && guard.name.dnEqual(sender.value.rdns, subjectRdns, NS.E, "cmp/sender-mismatch", "the header sender / signer subject")) return true;
|
|
19404
19964
|
}
|
|
19405
19965
|
var san = _sanGeneralNames(parsed);
|
|
@@ -19410,18 +19970,18 @@ var require_cmp_verify = __commonJS({
|
|
|
19410
19970
|
if (sanNode.tagClass !== sender.tagClass || sanNode.tagNumber !== sender.tagNumber) return false;
|
|
19411
19971
|
if (sanNode.tagClass === "context") {
|
|
19412
19972
|
if (sanNode.tagNumber === 2 && sanNode.content) {
|
|
19413
|
-
var dnsSan = sanNode.content
|
|
19973
|
+
var dnsSan = _toString(sanNode.content, "latin1"), dnsSender = _String(sender.value);
|
|
19414
19974
|
if (pkix.dnsNameProblem(dnsSan) !== null || pkix.dnsNameProblem(dnsSender) !== null) return dnsSan === dnsSender;
|
|
19415
|
-
return dnsSender
|
|
19975
|
+
return _toLowerCase(dnsSender) === _toLowerCase(dnsSan);
|
|
19416
19976
|
}
|
|
19417
19977
|
if (sanNode.tagNumber === 1 && sanNode.content) {
|
|
19418
|
-
return _rfc822Equal(
|
|
19978
|
+
return _rfc822Equal(_String(sender.value), _toString(sanNode.content, "latin1"));
|
|
19419
19979
|
}
|
|
19420
19980
|
if (sanNode.tagNumber === 6 && sanNode.content) {
|
|
19421
|
-
return _uriEqual(
|
|
19981
|
+
return _uriEqual(_String(sender.value), _toString(sanNode.content, "latin1"));
|
|
19422
19982
|
}
|
|
19423
19983
|
if (sanNode.tagNumber === 4 && sanNode.children && sanNode.children.length) {
|
|
19424
|
-
if (!sender.value || !
|
|
19984
|
+
if (!sender.value || !_isArray(sender.value.rdns)) return false;
|
|
19425
19985
|
var sanName;
|
|
19426
19986
|
try {
|
|
19427
19987
|
sanName = schema.embeddedDer(pkix.name(NS), sanNode.children[0].bytes, NS, { code: "cmp/sender-mismatch", what: "SAN directoryName" }).result;
|
|
@@ -19431,14 +19991,14 @@ var require_cmp_verify = __commonJS({
|
|
|
19431
19991
|
return guard.name.dnEqual(sender.value.rdns, sanName.rdns, NS.E, "cmp/sender-mismatch", "SAN directoryName");
|
|
19432
19992
|
}
|
|
19433
19993
|
}
|
|
19434
|
-
return sanNode.bytes
|
|
19994
|
+
return _compare(sanNode.bytes, sender.bytes) === 0;
|
|
19435
19995
|
}
|
|
19436
19996
|
function _mailboxSplit(s) {
|
|
19437
19997
|
var sep;
|
|
19438
|
-
if (s
|
|
19998
|
+
if (_charAt(s, 0) === '"') {
|
|
19439
19999
|
var i = 1;
|
|
19440
20000
|
while (i < s.length) {
|
|
19441
|
-
var c = s
|
|
20001
|
+
var c = _charAt(s, i);
|
|
19442
20002
|
if (c === "\\") {
|
|
19443
20003
|
i += 2;
|
|
19444
20004
|
continue;
|
|
@@ -19446,60 +20006,60 @@ var require_cmp_verify = __commonJS({
|
|
|
19446
20006
|
if (c === '"') break;
|
|
19447
20007
|
i++;
|
|
19448
20008
|
}
|
|
19449
|
-
if (i >= s.length || s
|
|
20009
|
+
if (i >= s.length || _charAt(s, i) !== '"' || _charAt(s, i + 1) !== "@") return -1;
|
|
19450
20010
|
sep = i + 1;
|
|
19451
20011
|
} else {
|
|
19452
|
-
sep = s
|
|
19453
|
-
if (sep < 0 || sep !== s
|
|
20012
|
+
sep = _strIndexOf(s, "@");
|
|
20013
|
+
if (sep < 0 || sep !== _strLastIndexOf(s, "@")) return -1;
|
|
19454
20014
|
}
|
|
19455
|
-
var local = s
|
|
20015
|
+
var local = _strSlice(s, 0, sep), domain = _strSlice(s, sep + 1);
|
|
19456
20016
|
if (pkix.dnsNameProblem(domain) !== null) return -1;
|
|
19457
|
-
if (s
|
|
20017
|
+
if (_charAt(s, 0) !== '"' && (local.length === 0 || _charAt(local, 0) === "." || _charAt(local, local.length - 1) === "." || _strIndexOf(local, "..") !== -1 || !_reTest(/^[A-Za-z0-9!#$%&'*+/=?^_`{|}~.-]+$/, local))) return -1;
|
|
19458
20018
|
return sep;
|
|
19459
20019
|
}
|
|
19460
20020
|
function _rfc822Equal(a, b2) {
|
|
19461
20021
|
var ai = _mailboxSplit(a), bi = _mailboxSplit(b2);
|
|
19462
20022
|
if (ai < 0 || bi < 0) return a === b2;
|
|
19463
|
-
return a
|
|
20023
|
+
return _strSlice(a, 0, ai) === _strSlice(b2, 0, bi) && _lowerAsciiDomain(_strSlice(a, ai + 1)) === _lowerAsciiDomain(_strSlice(b2, bi + 1));
|
|
19464
20024
|
}
|
|
19465
20025
|
function _lowerAsciiDomain(h) {
|
|
19466
20026
|
var out = "";
|
|
19467
20027
|
for (var i = 0; i < h.length; i++) {
|
|
19468
|
-
var c = h
|
|
19469
|
-
out += c >= 65 && c <= 90 ?
|
|
20028
|
+
var c = _charCodeAt(h, i);
|
|
20029
|
+
out += c >= 65 && c <= 90 ? _fromCharCode(c + 32) : _charAt(h, i);
|
|
19470
20030
|
}
|
|
19471
20031
|
return out;
|
|
19472
20032
|
}
|
|
19473
20033
|
function _normalizeUri(u) {
|
|
19474
|
-
if (
|
|
19475
|
-
var m = /^([a-zA-Z][a-zA-Z0-9+.-]*):(.*)
|
|
20034
|
+
if (!_reTest(/^[A-Za-z0-9._~:/?#@!$&'()*+,;=%[\]-]*$/, u) || _reTest(/%(?![0-9A-Fa-f]{2})/, u)) return null;
|
|
20035
|
+
var m = _reExec(/^([a-zA-Z][a-zA-Z0-9+.-]*):(.*)$/, u);
|
|
19476
20036
|
if (!m) return null;
|
|
19477
|
-
var scheme = m[1]
|
|
20037
|
+
var scheme = _toLowerCase(m[1]);
|
|
19478
20038
|
var rest = m[2];
|
|
19479
|
-
if (rest
|
|
19480
|
-
var body = rest
|
|
19481
|
-
var cut = body
|
|
20039
|
+
if (_strSlice(rest, 0, 2) !== "//") return null;
|
|
20040
|
+
var body = _strSlice(rest, 2);
|
|
20041
|
+
var cut = _strSearch(body, /[/?#]/);
|
|
19482
20042
|
var split = cut < 0 ? body.length : cut;
|
|
19483
|
-
var authority = body
|
|
19484
|
-
if (authority
|
|
19485
|
-
var at = authority
|
|
19486
|
-
var userinfo = at < 0 ? "" : authority
|
|
19487
|
-
var hostport = at < 0 ? authority : authority
|
|
20043
|
+
var authority = _strSlice(body, 0, split), tail = _strSlice(body, split);
|
|
20044
|
+
if (_strIndexOf(authority, "@") !== _strLastIndexOf(authority, "@")) return null;
|
|
20045
|
+
var at = _strLastIndexOf(authority, "@");
|
|
20046
|
+
var userinfo = at < 0 ? "" : _strSlice(authority, 0, at + 1);
|
|
20047
|
+
var hostport = at < 0 ? authority : _strSlice(authority, at + 1);
|
|
19488
20048
|
var host, port;
|
|
19489
|
-
if (hostport
|
|
19490
|
-
var rb = hostport
|
|
20049
|
+
if (_charAt(hostport, 0) === "[") {
|
|
20050
|
+
var rb = _strIndexOf(hostport, "]");
|
|
19491
20051
|
if (rb < 0) return null;
|
|
19492
|
-
host = hostport
|
|
19493
|
-
port = hostport
|
|
20052
|
+
host = _strSlice(hostport, 0, rb + 1);
|
|
20053
|
+
port = _strSlice(hostport, rb + 1);
|
|
19494
20054
|
} else {
|
|
19495
|
-
var ci = hostport
|
|
19496
|
-
host = ci < 0 ? hostport : hostport
|
|
19497
|
-
port = ci < 0 ? "" : hostport
|
|
20055
|
+
var ci = _strIndexOf(hostport, ":");
|
|
20056
|
+
host = ci < 0 ? hostport : _strSlice(hostport, 0, ci);
|
|
20057
|
+
port = ci < 0 ? "" : _strSlice(hostport, ci);
|
|
19498
20058
|
}
|
|
19499
|
-
if (port !== "" &&
|
|
19500
|
-
var hostOk = host
|
|
20059
|
+
if (port !== "" && !_reTest(/^:[0-9]*$/, port)) return null;
|
|
20060
|
+
var hostOk = _charAt(host, 0) === "[" ? _charAt(host, host.length - 1) === "]" && ipUtils.expandIpv6Hex(_strSlice(host, 1, -1)) !== null : pkix.dnsNameProblem(host) === null;
|
|
19501
20061
|
if (!hostOk) return null;
|
|
19502
|
-
return scheme + "://" + userinfo + host
|
|
20062
|
+
return scheme + "://" + userinfo + _toLowerCase(host) + port + tail;
|
|
19503
20063
|
}
|
|
19504
20064
|
function _uriEqual(a, b2) {
|
|
19505
20065
|
var na = _normalizeUri(a), nb = _normalizeUri(b2);
|
|
@@ -19525,7 +20085,7 @@ var require_cmp_verify = __commonJS({
|
|
|
19525
20085
|
return _signerObj(der, p);
|
|
19526
20086
|
}
|
|
19527
20087
|
if (opts.signerCert != null) {
|
|
19528
|
-
var scDer =
|
|
20088
|
+
var scDer = _bufferFrom(_certDer(opts.signerCert, "opts.signerCert"));
|
|
19529
20089
|
var scParsed;
|
|
19530
20090
|
try {
|
|
19531
20091
|
scParsed = x509.parse(scDer);
|
|
@@ -19545,12 +20105,12 @@ var require_cmp_verify = __commonJS({
|
|
|
19545
20105
|
return null;
|
|
19546
20106
|
}
|
|
19547
20107
|
function _bufEq(a, x) {
|
|
19548
|
-
if (!
|
|
19549
|
-
if (!
|
|
19550
|
-
if (x
|
|
20108
|
+
if (!_isBuffer(a)) return false;
|
|
20109
|
+
if (!_isBuffer(x)) {
|
|
20110
|
+
if (util.types.isUint8Array(x)) x = _bufferFrom(x);
|
|
19551
20111
|
else return false;
|
|
19552
20112
|
}
|
|
19553
|
-
return a
|
|
20113
|
+
return _compare(a, x) === 0;
|
|
19554
20114
|
}
|
|
19555
20115
|
function _headerChecks(m, opts) {
|
|
19556
20116
|
if (opts.transactionID != null && !_bufEq(m.header.transactionID, opts.transactionID)) {
|
|
@@ -19589,10 +20149,10 @@ var require_cmp_verify = __commonJS({
|
|
|
19589
20149
|
var kdf = params.kdf;
|
|
19590
20150
|
var prfHash = PRF_HASH[kdf.prfOid];
|
|
19591
20151
|
var macHash = PRF_HASH[params.schemeOid];
|
|
19592
|
-
if (!prfHash) return _fail(m, "mac", protectionAlg, "cmp/unsupported-algorithm", "unsupported PBMAC1 PBKDF2 PRF " +
|
|
19593
|
-
if (!macHash) return _fail(m, "mac", protectionAlg, "cmp/unsupported-algorithm", "unsupported PBMAC1 messageAuthScheme " +
|
|
20152
|
+
if (!prfHash) return _fail(m, "mac", protectionAlg, "cmp/unsupported-algorithm", "unsupported PBMAC1 PBKDF2 PRF " + _stringify(kdf.prfName) + " (SHA-256/384/512 only; RFC 9481 sec. 7, RFC 9579 sec. 7)");
|
|
20153
|
+
if (!macHash) return _fail(m, "mac", protectionAlg, "cmp/unsupported-algorithm", "unsupported PBMAC1 messageAuthScheme " + _stringify(params.schemeName) + " (SHA-256/384/512 only)");
|
|
19594
20154
|
_capWork(kdf.iterationCount, kdf.salt, kdf.keyLength, prfHash, opts);
|
|
19595
|
-
var secret = typeof opts.sharedSecret === "string" ?
|
|
20155
|
+
var secret = typeof opts.sharedSecret === "string" ? _bufferFrom(opts.sharedSecret, "utf8") : guard.bytes.view(opts.sharedSecret, CmpError, "cmp/bad-input", "opts.sharedSecret");
|
|
19596
20156
|
var computed = await pbes2.pbmac1(secret, kdf.salt, kdf.iterationCount, kdf.keyLength, prfHash, macHash, protectedPart);
|
|
19597
20157
|
if (!guard.crypto.constantTimeEqual(computed, protection.bytes)) {
|
|
19598
20158
|
return _fail(m, "mac", protectionAlg, "cmp/protection-failed", "the PBMAC1 MAC does not verify (a wrong shared secret or a tampered ProtectedPart)");
|
|
@@ -19604,16 +20164,17 @@ var require_cmp_verify = __commonJS({
|
|
|
19604
20164
|
function _capWork(iterationCount, salt, keyLength, prfHash, opts) {
|
|
19605
20165
|
var cap = PBMAC1_MAX_ITER;
|
|
19606
20166
|
if (opts.maxIterations != null) {
|
|
19607
|
-
if (typeof opts.maxIterations !== "number" || !
|
|
20167
|
+
if (typeof opts.maxIterations !== "number" || !_isFinite(opts.maxIterations) || opts.maxIterations < 1 || _floor(opts.maxIterations) !== opts.maxIterations) {
|
|
19608
20168
|
throw _err("cmp/bad-input", "opts.maxIterations must be a positive integer");
|
|
19609
20169
|
}
|
|
19610
|
-
cap =
|
|
20170
|
+
cap = _min(opts.maxIterations, cap);
|
|
19611
20171
|
}
|
|
19612
20172
|
if (iterationCount < PBMAC1_MIN_ITER) throw _err("cmp/bad-input", "the PBMAC1 iterationCount " + iterationCount + " is below the floor " + PBMAC1_MIN_ITER + " (RFC 8018 sec. 4.2)");
|
|
19613
20173
|
if (iterationCount > cap) throw _err("cmp/bad-input", "the PBMAC1 iterationCount " + iterationCount + " exceeds the cap " + cap);
|
|
19614
|
-
|
|
20174
|
+
var saltLen = salt ? _sizeOf(salt) : 0;
|
|
20175
|
+
if (!salt || saltLen < PBMAC1_MIN_SALT || saltLen > PBMAC1_MAX_SALT) throw _err("cmp/bad-input", "the PBMAC1 salt length must be in [" + PBMAC1_MIN_SALT + ", " + PBMAC1_MAX_SALT + "] octets (RFC 8018 sec. 4.1)");
|
|
19615
20176
|
if (keyLength < PBMAC1_KEYLEN_MIN || keyLength > PBMAC1_KEYLEN_MAX) throw _err("cmp/bad-input", "the PBMAC1 keyLength must be in [" + PBMAC1_KEYLEN_MIN + ", " + PBMAC1_KEYLEN_MAX + "] (RFC 9579 sec. 9)");
|
|
19616
|
-
var blocks =
|
|
20177
|
+
var blocks = _ceil(keyLength / (PRF_HLEN[prfHash] || 32));
|
|
19617
20178
|
if (iterationCount * blocks > cap) throw _err("cmp/bad-input", "the PBMAC1 combined work (iterationCount " + iterationCount + " x " + blocks + " derived blocks) exceeds the cap " + cap);
|
|
19618
20179
|
}
|
|
19619
20180
|
async function _verifySignature(m, protectedPart, protectionAlg, protection, opts) {
|
|
@@ -19636,7 +20197,7 @@ var require_cmp_verify = __commonJS({
|
|
|
19636
20197
|
try {
|
|
19637
20198
|
var p = guard.parsed.acceptDerived(c, "certificate", x509.parse, _err, "cmp/bad-input", "a pool certificate");
|
|
19638
20199
|
if (!guard.parsed.isCert(p)) return null;
|
|
19639
|
-
return p.tbsBytes
|
|
20200
|
+
return _toString(p.tbsBytes, "base64") + "|" + _toString(p.signatureValue.bytes, "base64");
|
|
19640
20201
|
} catch (_e) {
|
|
19641
20202
|
return null;
|
|
19642
20203
|
}
|
|
@@ -19645,43 +20206,48 @@ var require_cmp_verify = __commonJS({
|
|
|
19645
20206
|
if (!_keyUsageAllowsSigning(signer.parsed)) {
|
|
19646
20207
|
return { trusted: false, reason: "the signer certificate keyUsage does not assert digitalSignature (RFC 9483 sec. 3.2)" };
|
|
19647
20208
|
}
|
|
19648
|
-
var time = opts.time != null ? opts.time :
|
|
20209
|
+
var time = opts.time != null ? opts.time : new _Date();
|
|
19649
20210
|
var anchors = _certList(opts.trustAnchors);
|
|
19650
20211
|
var pool = _certList(opts.intermediates);
|
|
19651
20212
|
var room = constants.LIMITS.PATH_BUILD_MAX_CANDIDATES - pool.length;
|
|
19652
20213
|
if (room > 0) {
|
|
19653
|
-
var seen =
|
|
20214
|
+
var seen = _create(null);
|
|
19654
20215
|
var sk = _certKey(signer.parsed);
|
|
19655
20216
|
if (sk) seen[sk] = 1;
|
|
19656
|
-
|
|
19657
|
-
|
|
19658
|
-
|
|
19659
|
-
|
|
19660
|
-
|
|
19661
|
-
|
|
19662
|
-
|
|
19663
|
-
|
|
19664
|
-
|
|
20217
|
+
var pi, pk;
|
|
20218
|
+
for (pi = 0; pi < pool.length; pi++) {
|
|
20219
|
+
pk = _certKey(pool[pi]);
|
|
20220
|
+
if (pk) seen[pk] = 1;
|
|
20221
|
+
}
|
|
20222
|
+
var merged = [];
|
|
20223
|
+
for (pi = 0; pi < pool.length; pi++) _append(merged, pool[pi]);
|
|
20224
|
+
for (pi = 0; pi < extra.length && merged.length - pool.length < room; pi++) {
|
|
20225
|
+
pk = _certKey(extra[pi]);
|
|
20226
|
+
if (pk == null || !seen[pk]) _append(merged, extra[pi]);
|
|
20227
|
+
}
|
|
20228
|
+
pool = merged;
|
|
19665
20229
|
}
|
|
19666
20230
|
var buildOpts = { trustAnchors: anchors, intermediates: pool, validate: true, time };
|
|
19667
20231
|
if (opts.revocationChecker != null) buildOpts.revocationChecker = opts.revocationChecker;
|
|
19668
20232
|
try {
|
|
19669
20233
|
var res = await _engine.build(signer.der, buildOpts);
|
|
19670
20234
|
if (!res || res.valid !== true) return { trusted: false, reason: "the signer certificate did not chain to a supplied trust anchor" };
|
|
19671
|
-
var byKey =
|
|
20235
|
+
var byKey = _create(null);
|
|
19672
20236
|
var skey = _certKey(signer.parsed);
|
|
19673
20237
|
if (skey) byKey[skey] = signer.der;
|
|
19674
|
-
|
|
19675
|
-
|
|
19676
|
-
|
|
19677
|
-
|
|
19678
|
-
|
|
19679
|
-
|
|
19680
|
-
|
|
19681
|
-
|
|
19682
|
-
|
|
19683
|
-
|
|
19684
|
-
|
|
20238
|
+
var ci, ck;
|
|
20239
|
+
for (ci = 0; ci < pool.length; ci++) {
|
|
20240
|
+
var pc = pool[ci];
|
|
20241
|
+
if (!_isBuffer(pc) && !util.types.isUint8Array(pc)) continue;
|
|
20242
|
+
ck = _certKey(pc);
|
|
20243
|
+
if (ck && !byKey[ck]) byKey[ck] = pc;
|
|
20244
|
+
}
|
|
20245
|
+
var chain = [];
|
|
20246
|
+
for (ci = 0; ci < res.path.length; ci++) {
|
|
20247
|
+
ck = _certKey(res.path[ci]);
|
|
20248
|
+
var d = ck ? byKey[ck] : null;
|
|
20249
|
+
if (d) _append(chain, _bufferFrom(d));
|
|
20250
|
+
}
|
|
19685
20251
|
return { trusted: true, reason: null, chain };
|
|
19686
20252
|
} catch (e) {
|
|
19687
20253
|
if (e && e.code === "path/bad-input") {
|
|
@@ -19693,12 +20259,12 @@ var require_cmp_verify = __commonJS({
|
|
|
19693
20259
|
var MAX_EXTRA_CERTS = 32;
|
|
19694
20260
|
var MAX_EXTRA_SCAN = 256;
|
|
19695
20261
|
function _boundExtraCerts(extra) {
|
|
19696
|
-
if (!
|
|
19697
|
-
var out = [], seen =
|
|
20262
|
+
if (!_isArray(extra) || !extra.length) return [];
|
|
20263
|
+
var out = [], seen = _create(null);
|
|
19698
20264
|
for (var i = 0; i < extra.length && out.length < MAX_EXTRA_CERTS && i < MAX_EXTRA_SCAN; i++) {
|
|
19699
20265
|
var c = extra[i];
|
|
19700
|
-
if (!
|
|
19701
|
-
var key =
|
|
20266
|
+
if (!_isBuffer(c) && !util.types.isUint8Array(c)) continue;
|
|
20267
|
+
var key = _toString(_bufferFrom(c), "base64");
|
|
19702
20268
|
if (seen[key]) continue;
|
|
19703
20269
|
seen[key] = true;
|
|
19704
20270
|
try {
|
|
@@ -19706,33 +20272,105 @@ var require_cmp_verify = __commonJS({
|
|
|
19706
20272
|
} catch (_e) {
|
|
19707
20273
|
continue;
|
|
19708
20274
|
}
|
|
19709
|
-
out
|
|
20275
|
+
_append(out, c);
|
|
19710
20276
|
}
|
|
19711
20277
|
return out;
|
|
19712
20278
|
}
|
|
20279
|
+
var _defineOwn = Object.defineProperty;
|
|
20280
|
+
var _Date = Date;
|
|
20281
|
+
function _append(arr, v) {
|
|
20282
|
+
_defineOwn(arr, arr.length, { value: v, writable: true, enumerable: true, configurable: true });
|
|
20283
|
+
}
|
|
19713
20284
|
function _certList(v) {
|
|
19714
20285
|
if (v == null) return [];
|
|
19715
|
-
var arr =
|
|
19716
|
-
|
|
19717
|
-
|
|
19718
|
-
|
|
20286
|
+
var arr = _isArray(v) ? v : [v];
|
|
20287
|
+
var out = [];
|
|
20288
|
+
for (var i = 0, n = arr.length; i < n; i++) {
|
|
20289
|
+
var c = arr[i];
|
|
20290
|
+
_append(out, _isBuffer(c) || util.types.isUint8Array(c) || typeof c === "string" ? _certDer(c, "a trust anchor / intermediate") : c);
|
|
20291
|
+
}
|
|
20292
|
+
return out;
|
|
19719
20293
|
}
|
|
19720
20294
|
function _nonEmptySecret(s) {
|
|
19721
|
-
if (typeof s === "string") return s
|
|
19722
|
-
|
|
20295
|
+
if (typeof s === "string") return _sizeOf(s) > 0;
|
|
20296
|
+
if (!_isBuffer(s) && !util.types.isUint8Array(s)) return false;
|
|
20297
|
+
return _sizeOf(s) > 0;
|
|
19723
20298
|
}
|
|
19724
20299
|
function verify(message, opts) {
|
|
19725
|
-
|
|
19726
|
-
|
|
20300
|
+
var made = [];
|
|
20301
|
+
return guard.async.deferred(async function() {
|
|
20302
|
+
try {
|
|
20303
|
+
return await _verify(message, _fixVerifyOptions(opts, made));
|
|
20304
|
+
} finally {
|
|
20305
|
+
guard.secret.zeroizeAll(made, CmpError, "cmp/bad-input", "the copied PBMAC1 shared secret");
|
|
20306
|
+
}
|
|
19727
20307
|
});
|
|
19728
20308
|
}
|
|
19729
|
-
|
|
20309
|
+
function _fixByteish(v, label) {
|
|
20310
|
+
if (!util.types.isUint8Array(v)) return v;
|
|
20311
|
+
return guard.bytes.snapshot(v, CmpError, "cmp/bad-input", "opts." + label);
|
|
20312
|
+
}
|
|
20313
|
+
function _assertEchoBytes(v, name) {
|
|
20314
|
+
if (v == null) return;
|
|
20315
|
+
if (util.types.isUint8Array(v)) return;
|
|
20316
|
+
throw _err("cmp/bad-input", "opts." + name + " must be a Buffer / Uint8Array");
|
|
20317
|
+
}
|
|
20318
|
+
function _fixSecret(v, made) {
|
|
20319
|
+
if (typeof v === "string") {
|
|
20320
|
+
var fromString = _bufferFrom(v, "utf8");
|
|
20321
|
+
_append(made, fromString);
|
|
20322
|
+
return fromString;
|
|
20323
|
+
}
|
|
20324
|
+
var copy = _fixByteish(v, "sharedSecret");
|
|
20325
|
+
if (util.types.isUint8Array(copy)) _append(made, copy);
|
|
20326
|
+
return copy;
|
|
20327
|
+
}
|
|
20328
|
+
function _fixCertList(v, label) {
|
|
20329
|
+
if (v == null) return v;
|
|
20330
|
+
if (!_isArray(v)) return _fixByteish(v, label);
|
|
20331
|
+
var indices = guard.identifier.readableIndices(v, _err, "cmp/bad-input", "opts." + label);
|
|
20332
|
+
guard.identifier.refuseAccessorFields(v, indices, _err, "cmp/bad-input", "opts." + label);
|
|
20333
|
+
var n = v.length;
|
|
20334
|
+
var names = _getOwnPropertyNames(v);
|
|
20335
|
+
var own = 0, j, k, ix;
|
|
20336
|
+
for (j = 0; j < names.length; j++) {
|
|
20337
|
+
k = names[j];
|
|
20338
|
+
ix = k >>> 0;
|
|
20339
|
+
if (_String(ix) === k && ix !== 4294967295 && ix < n) own += 1;
|
|
20340
|
+
}
|
|
20341
|
+
if (own !== n) {
|
|
20342
|
+
throw _err("cmp/bad-input", "a certificate list must be a dense array of certificates; this one holds " + own + " of its " + n + " positions as its own elements, so the rest are holes or come from its prototype");
|
|
20343
|
+
}
|
|
20344
|
+
var out = [];
|
|
20345
|
+
for (var i = 0; i < n; i++) _append(out, _fixByteish(v[i], label + "[" + i + "]"));
|
|
20346
|
+
return out;
|
|
20347
|
+
}
|
|
20348
|
+
function _fixTime(v) {
|
|
20349
|
+
return guard.time.isDate(v) ? new _Date(guard.time.instantOf(v)) : v;
|
|
20350
|
+
}
|
|
20351
|
+
function _fixVerifyOptions(opts, made) {
|
|
19730
20352
|
if (opts == null) opts = {};
|
|
19731
|
-
|
|
20353
|
+
opts = guard.identifier.optionsObject(opts, _err, "cmp/bad-input", "pki.cmp.verify options");
|
|
19732
20354
|
guard.identifier.assertKnownKeys(opts, KNOWN_VERIFY_OPTS, _err, "cmp/bad-input", "unknown opts field ");
|
|
19733
|
-
|
|
19734
|
-
|
|
19735
|
-
|
|
20355
|
+
var f = {
|
|
20356
|
+
// Recorded in `made` the instant it is copied. Only the byte form: a string secret is a
|
|
20357
|
+
// JavaScript string, immutable and interned wherever the caller created it, so there is nothing
|
|
20358
|
+
// here to wipe -- a caller who needs the secret gone from memory passes it as bytes.
|
|
20359
|
+
sharedSecret: _fixSecret(opts.sharedSecret, made),
|
|
20360
|
+
signerCert: _fixByteish(opts.signerCert, "signerCert"),
|
|
20361
|
+
trustAnchors: _fixCertList(opts.trustAnchors, "trustAnchors"),
|
|
20362
|
+
intermediates: _fixCertList(opts.intermediates, "intermediates"),
|
|
20363
|
+
time: _fixTime(opts.time),
|
|
20364
|
+
transactionID: _fixByteish(opts.transactionID, "transactionID"),
|
|
20365
|
+
expectRecipNonce: _fixByteish(opts.expectRecipNonce, "expectRecipNonce"),
|
|
20366
|
+
revocationChecker: opts.revocationChecker,
|
|
20367
|
+
maxIterations: opts.maxIterations
|
|
20368
|
+
};
|
|
20369
|
+
_assertEchoBytes(f.transactionID, "transactionID");
|
|
20370
|
+
_assertEchoBytes(f.expectRecipNonce, "expectRecipNonce");
|
|
20371
|
+
return f;
|
|
20372
|
+
}
|
|
20373
|
+
async function _verify(message, opts) {
|
|
19736
20374
|
if (_engine == null) throw _err("cmp/bad-input", "the cmp-verify signature engine is not initialized (require pki before use)");
|
|
19737
20375
|
var m = _coerce(message);
|
|
19738
20376
|
var protectionAlg = m.header.protectionAlg;
|
|
@@ -23012,6 +23650,9 @@ var require_path_validate = __commonJS({
|
|
|
23012
23650
|
var ocsp = require_schema_ocsp();
|
|
23013
23651
|
var ocspVerify = require_ocsp_verify();
|
|
23014
23652
|
var crlVerify = require_crl_verify();
|
|
23653
|
+
var csrVerify = require_csr_verify();
|
|
23654
|
+
var crmfVerify = require_crmf_verify();
|
|
23655
|
+
var attrcertVerify = require_attrcert_verify();
|
|
23015
23656
|
var cmpVerify = require_cmp_verify();
|
|
23016
23657
|
var cmsVerify = require_cms_verify();
|
|
23017
23658
|
var cmpSession = require_cmp_session();
|
|
@@ -24524,6 +25165,9 @@ var require_path_validate = __commonJS({
|
|
|
24524
25165
|
});
|
|
24525
25166
|
}
|
|
24526
25167
|
crlVerify.setEngine(_verifyWithSpki);
|
|
25168
|
+
csrVerify.setEngine(_verifyWithSpki);
|
|
25169
|
+
crmfVerify.setEngine(_verifyWithSpki);
|
|
25170
|
+
attrcertVerify.setEngine(_verifyWithSpki);
|
|
24527
25171
|
var ocspCore = ocspVerify.makeOcspVerify({
|
|
24528
25172
|
verifyWithSpki: _verifyWithSpki,
|
|
24529
25173
|
decodeExt,
|
|
@@ -28224,6 +28868,8 @@ var require_csr_sign = __commonJS({
|
|
|
28224
28868
|
var pkiBuild = require_pki_build();
|
|
28225
28869
|
var frameworkError = require_framework_error();
|
|
28226
28870
|
var guard = require_guard_all();
|
|
28871
|
+
require_path_validate();
|
|
28872
|
+
var csrVerify = require_csr_verify();
|
|
28227
28873
|
var CsrError = frameworkError.CsrError;
|
|
28228
28874
|
var KNOWN_SPEC_KEYS = { subject: 1, subjectPublicKey: 1, extensionRequest: 1, challengePassword: 1, attributes: 1 };
|
|
28229
28875
|
var b = asn1.build;
|
|
@@ -28319,7 +28965,27 @@ var require_csr_sign = __commonJS({
|
|
|
28319
28965
|
throw _err("csr/bad-input", "signing the certification request failed -- the signing key does not match the subject public key or is invalid", e);
|
|
28320
28966
|
});
|
|
28321
28967
|
}
|
|
28322
|
-
|
|
28968
|
+
function _coerceCsr(request) {
|
|
28969
|
+
return guard.parsed.acceptDerived(request, "csr", csr.parse, _err, "csr/bad-input", "the certification request");
|
|
28970
|
+
}
|
|
28971
|
+
function verify(request) {
|
|
28972
|
+
return guard.async.deferred(function() {
|
|
28973
|
+
return _verify(request);
|
|
28974
|
+
});
|
|
28975
|
+
}
|
|
28976
|
+
function _verify(request) {
|
|
28977
|
+
var parsed = _coerceCsr(request);
|
|
28978
|
+
return Promise.resolve(csrVerify.verifyCsrSignature(parsed)).then(function(ok) {
|
|
28979
|
+
return {
|
|
28980
|
+
verified: ok === true,
|
|
28981
|
+
subject: parsed.subject,
|
|
28982
|
+
subjectPublicKeyInfo: parsed.subjectPublicKeyInfo,
|
|
28983
|
+
attributes: parsed.attributes,
|
|
28984
|
+
certificationRequestInfoBytes: parsed.certificationRequestInfoBytes
|
|
28985
|
+
};
|
|
28986
|
+
});
|
|
28987
|
+
}
|
|
28988
|
+
module2.exports = { sign, verify };
|
|
28323
28989
|
}
|
|
28324
28990
|
});
|
|
28325
28991
|
|
|
@@ -28334,6 +29000,9 @@ var require_attrcert_sign = __commonJS({
|
|
|
28334
29000
|
var signScheme = require_sign_scheme();
|
|
28335
29001
|
var guard = require_guard_all();
|
|
28336
29002
|
var pkix = require_schema_pkix();
|
|
29003
|
+
var schema = require_schema_engine();
|
|
29004
|
+
require_path_validate();
|
|
29005
|
+
var attrcertVerify = require_attrcert_verify();
|
|
28337
29006
|
var pkiBuild = require_pki_build();
|
|
28338
29007
|
var frameworkError = require_framework_error();
|
|
28339
29008
|
var AttrCertError = frameworkError.AttrCertError;
|
|
@@ -28660,6 +29329,15 @@ var require_attrcert_sign = __commonJS({
|
|
|
28660
29329
|
if (!attrs.length) throw _err("attrcert/bad-attributes", "attributes must carry at least one Attribute (RFC 5755 sec. 4.2.7)");
|
|
28661
29330
|
return b.sequence(attrs);
|
|
28662
29331
|
}
|
|
29332
|
+
function _assertRevocationSchemesExclusive(seen) {
|
|
29333
|
+
if (!Object.prototype.hasOwnProperty.call(seen, O("noRevAvail"))) return;
|
|
29334
|
+
var names = Object.keys(REVOCATION_POINTERS);
|
|
29335
|
+
for (var i = 0; i < names.length; i++) {
|
|
29336
|
+
if (Object.prototype.hasOwnProperty.call(seen, names[i])) {
|
|
29337
|
+
throw _err("attrcert/bad-input", "an attribute certificate must not carry both noRevAvail and a " + REVOCATION_POINTERS[names[i]] + " revocation pointer (RFC 5755 sec. 6)");
|
|
29338
|
+
}
|
|
29339
|
+
}
|
|
29340
|
+
}
|
|
28663
29341
|
function _buildExtensions(extSpec, aaSpki) {
|
|
28664
29342
|
if (extSpec == null) return null;
|
|
28665
29343
|
if (Array.isArray(extSpec)) {
|
|
@@ -28686,6 +29364,7 @@ var require_attrcert_sign = __commonJS({
|
|
|
28686
29364
|
}
|
|
28687
29365
|
return b.raw(der);
|
|
28688
29366
|
});
|
|
29367
|
+
_assertRevocationSchemesExclusive(seenA);
|
|
28689
29368
|
return b.sequence(exts);
|
|
28690
29369
|
}
|
|
28691
29370
|
if (typeof extSpec !== "object") throw _err("attrcert/bad-input", "extensions must be an object or an array of pre-encoded Extension DER");
|
|
@@ -28700,6 +29379,7 @@ var require_attrcert_sign = __commonJS({
|
|
|
28700
29379
|
seen[eOid] = true;
|
|
28701
29380
|
out.push(_b.ext(eOid, meta.critical, _extensionValue(k, extSpec[k], aaSpki)));
|
|
28702
29381
|
});
|
|
29382
|
+
_assertRevocationSchemesExclusive(seen);
|
|
28703
29383
|
if (!out.length) return null;
|
|
28704
29384
|
return b.sequence(out);
|
|
28705
29385
|
}
|
|
@@ -28755,7 +29435,284 @@ var require_attrcert_sign = __commonJS({
|
|
|
28755
29435
|
throw _err("attrcert/bad-input", "signing the attribute certificate failed -- the signing key does not match the resolved algorithm or is invalid", e);
|
|
28756
29436
|
});
|
|
28757
29437
|
}
|
|
28758
|
-
|
|
29438
|
+
var KNOWN_VERIFY_OPTS = { time: 1, target: 1, revocationStatus: 1 };
|
|
29439
|
+
var REVOCATION_STATUS = /* @__PURE__ */ Object.create(null);
|
|
29440
|
+
REVOCATION_STATUS.notRevoked = 1;
|
|
29441
|
+
REVOCATION_STATUS.revoked = 1;
|
|
29442
|
+
var _NAME_SCHEMA = pkix.name(NS);
|
|
29443
|
+
function _readName(der, what) {
|
|
29444
|
+
try {
|
|
29445
|
+
return schema.walk(_NAME_SCHEMA, asn1.decode(der), NS).result;
|
|
29446
|
+
} catch (e) {
|
|
29447
|
+
if (e instanceof AttrCertError) throw e;
|
|
29448
|
+
throw _err("attrcert/bad-input", what + " is not a readable distinguished name", e);
|
|
29449
|
+
}
|
|
29450
|
+
}
|
|
29451
|
+
function _acIssuerName(parsed) {
|
|
29452
|
+
var node = asn1.decode(parsed.issuer.v2Form.issuerName.names[0].bytes);
|
|
29453
|
+
if (!node.children || node.children.length !== 1) {
|
|
29454
|
+
throw _err("attrcert/bad-issuer-name", "the AC issuerName directoryName does not wrap exactly one Name");
|
|
29455
|
+
}
|
|
29456
|
+
return _readName(node.children[0].bytes, "the AC issuer name");
|
|
29457
|
+
}
|
|
29458
|
+
function _coerceAc(input) {
|
|
29459
|
+
return guard.parsed.acceptDerived(
|
|
29460
|
+
input,
|
|
29461
|
+
"attributeCertificate",
|
|
29462
|
+
attrcert.parse,
|
|
29463
|
+
_err,
|
|
29464
|
+
"attrcert/bad-input",
|
|
29465
|
+
"the attribute certificate"
|
|
29466
|
+
);
|
|
29467
|
+
}
|
|
29468
|
+
function _resolveIssuer(issuer) {
|
|
29469
|
+
if (issuer == null || typeof issuer !== "object" || Buffer.isBuffer(issuer)) {
|
|
29470
|
+
throw _err("attrcert/bad-input", "an issuer { name, publicKey } is required -- RFC 5755 sec. 5 item 4 makes trusting an AC issuer the verifier's own configuration");
|
|
29471
|
+
}
|
|
29472
|
+
guard.identifier.assertKnownKeys(
|
|
29473
|
+
issuer,
|
|
29474
|
+
{ name: 1, publicKey: 1 },
|
|
29475
|
+
_err,
|
|
29476
|
+
"attrcert/bad-input",
|
|
29477
|
+
"the issuer has an unknown key "
|
|
29478
|
+
);
|
|
29479
|
+
if (issuer.publicKey == null) throw _err("attrcert/bad-input", "issuer.publicKey (the AC issuer's SubjectPublicKeyInfo DER) is required");
|
|
29480
|
+
if (issuer.name == null) {
|
|
29481
|
+
throw _err("attrcert/bad-input", "issuer.name (the distinguished name this verifier trusts as an AC issuer) is required");
|
|
29482
|
+
}
|
|
29483
|
+
var trustedDer;
|
|
29484
|
+
try {
|
|
29485
|
+
trustedDer = _b.encodeName(issuer.name);
|
|
29486
|
+
} catch (e) {
|
|
29487
|
+
if (e instanceof AttrCertError) throw e;
|
|
29488
|
+
throw _err("attrcert/bad-input", "issuer.name is not a distinguished name", e);
|
|
29489
|
+
}
|
|
29490
|
+
var rdns = _readName(trustedDer, "issuer.name").rdns;
|
|
29491
|
+
if (!rdns.length) {
|
|
29492
|
+
throw _err("attrcert/bad-input", "issuer.name is an empty distinguished name, which names no AC issuer (RFC 5755 sec. 4.2.3)");
|
|
29493
|
+
}
|
|
29494
|
+
return {
|
|
29495
|
+
rdns,
|
|
29496
|
+
// Copied, never viewed. Signature verification suspends this call, and the signature engine
|
|
29497
|
+
// holds this buffer across that suspension -- a composite arm keeps slices of it and imports
|
|
29498
|
+
// them only after its digest settles. A view would leave the trust key writable for that whole
|
|
29499
|
+
// window, so a caller could hand in an unrelated key of the same length, overwrite it with the
|
|
29500
|
+
// real issuer's while the digest ran, and be told the certificate verified under the key they
|
|
29501
|
+
// named. The verdict answers for the key the call was made with.
|
|
29502
|
+
spki: guard.bytes.snapshot(issuer.publicKey, AttrCertError, "attrcert/bad-input", "issuer.publicKey")
|
|
29503
|
+
};
|
|
29504
|
+
}
|
|
29505
|
+
function _callerTarget(target) {
|
|
29506
|
+
return attrcert.readGeneralName(_b.encodeGeneralName(target), "attrcert/bad-input");
|
|
29507
|
+
}
|
|
29508
|
+
function _mailboxEqual(a, bx) {
|
|
29509
|
+
var i = a.lastIndexOf("@"), j = bx.lastIndexOf("@");
|
|
29510
|
+
if (i < 0 || j < 0) return a === bx;
|
|
29511
|
+
return a.slice(0, i) === bx.slice(0, j) && a.slice(i + 1).toLowerCase() === bx.slice(j + 1).toLowerCase();
|
|
29512
|
+
}
|
|
29513
|
+
function _generalNameMatches(entry, want) {
|
|
29514
|
+
if (!entry || entry.tagNumber !== want.tagNumber) return false;
|
|
29515
|
+
switch (entry.tagNumber) {
|
|
29516
|
+
// RFC 5280 sec. 7.2: "When comparing DNS names for equality, conforming implementations MUST
|
|
29517
|
+
// perform a case-insensitive exact match on the entire DNS name."
|
|
29518
|
+
case 2:
|
|
29519
|
+
return String(entry.value).toLowerCase() === String(want.value).toLowerCase();
|
|
29520
|
+
// sec. 7.5, as above.
|
|
29521
|
+
case 1:
|
|
29522
|
+
return _mailboxEqual(String(entry.value), String(want.value));
|
|
29523
|
+
// A directoryName is a distinguished name, and sec. 7.1 identity is not string equality, so it
|
|
29524
|
+
// goes through the one DN comparator rather than comparing the printed form.
|
|
29525
|
+
case 4:
|
|
29526
|
+
return !!(entry.value && want.value) && guard.name.dnEqual(entry.value.rdns, want.value.rdns, _err, "attrcert/bad-input", "the target name");
|
|
29527
|
+
// sec. 7.4 makes a URI comparison a full RFC 3987 normalization: percent-encoding, path
|
|
29528
|
+
// segments and scheme-based rules, not merely lowercasing the scheme and host. A partial
|
|
29529
|
+
// normalization would be a guess that could match a URI it should not, so the encoded value is
|
|
29530
|
+
// compared as it stands. Re-open condition: an RFC 3987 normalizer in the toolkit.
|
|
29531
|
+
default:
|
|
29532
|
+
if (Buffer.isBuffer(entry.value) && Buffer.isBuffer(want.value)) return entry.value.equals(want.value);
|
|
29533
|
+
if (typeof entry.value === "string" && typeof want.value === "string") return entry.value === want.value;
|
|
29534
|
+
return null;
|
|
29535
|
+
}
|
|
29536
|
+
}
|
|
29537
|
+
function _checkTargeting(ac, want) {
|
|
29538
|
+
var ext = null;
|
|
29539
|
+
for (var i = 0; i < ac.extensions.length; i++) {
|
|
29540
|
+
if (ac.extensions[i].name === "targetInformation") ext = ac.extensions[i];
|
|
29541
|
+
}
|
|
29542
|
+
if (!ext) return { checked: true, ok: true };
|
|
29543
|
+
if (want === void 0) {
|
|
29544
|
+
return {
|
|
29545
|
+
checked: false,
|
|
29546
|
+
ok: false,
|
|
29547
|
+
reason: "this attribute certificate is targeted, and no opts.target names this verifier (RFC 5755 sec. 4.3.2)"
|
|
29548
|
+
};
|
|
29549
|
+
}
|
|
29550
|
+
var groups = ext.decoded || [];
|
|
29551
|
+
for (var g0 = 0; g0 < groups.length; g0++) {
|
|
29552
|
+
for (var t0 = 0; t0 < groups[g0].length; t0++) {
|
|
29553
|
+
if (groups[g0][t0].kind !== "targetCert") continue;
|
|
29554
|
+
return {
|
|
29555
|
+
checked: false,
|
|
29556
|
+
ok: false,
|
|
29557
|
+
reason: "this attribute certificate carries a targetCert target, which RFC 5755 sec. 4.3.2 says MUST NOT be used, so the targeting check did not run"
|
|
29558
|
+
};
|
|
29559
|
+
}
|
|
29560
|
+
}
|
|
29561
|
+
var uncomparable = null;
|
|
29562
|
+
for (var g = 0; g < groups.length; g++) {
|
|
29563
|
+
for (var t = 0; t < groups[g].length; t++) {
|
|
29564
|
+
var entry = groups[g][t];
|
|
29565
|
+
if (entry.kind !== "targetName" && entry.kind !== "targetGroup") continue;
|
|
29566
|
+
var m = _generalNameMatches(entry.name, want);
|
|
29567
|
+
if (m === true) return { checked: true, ok: true };
|
|
29568
|
+
if (m === null) uncomparable = entry.name && entry.name.tagNumber;
|
|
29569
|
+
}
|
|
29570
|
+
}
|
|
29571
|
+
if (uncomparable !== null) {
|
|
29572
|
+
return {
|
|
29573
|
+
checked: false,
|
|
29574
|
+
ok: false,
|
|
29575
|
+
reason: "this attribute certificate names a target in a GeneralName form ([" + uncomparable + "]) this verifier does not compare, so the RFC 5755 sec. 4.3.2 check did not run"
|
|
29576
|
+
};
|
|
29577
|
+
}
|
|
29578
|
+
return {
|
|
29579
|
+
checked: true,
|
|
29580
|
+
ok: false,
|
|
29581
|
+
reason: "this attribute certificate does not name this verifier among its targets (RFC 5755 sec. 4.3.2)"
|
|
29582
|
+
};
|
|
29583
|
+
}
|
|
29584
|
+
var SUPPORTED_CRITICAL = {};
|
|
29585
|
+
SUPPORTED_CRITICAL[O("targetInformation")] = 1;
|
|
29586
|
+
SUPPORTED_CRITICAL[O("acAuditIdentity")] = 1;
|
|
29587
|
+
function _unsupportedCritical(ac) {
|
|
29588
|
+
for (var i = 0; i < ac.extensions.length; i++) {
|
|
29589
|
+
var e = ac.extensions[i];
|
|
29590
|
+
if (e.critical !== true) continue;
|
|
29591
|
+
if (!Object.prototype.hasOwnProperty.call(SUPPORTED_CRITICAL, e.oid)) return e.oid;
|
|
29592
|
+
if (e.decoded === null || e.decoded === void 0 || e.decoded.opaque === true) return e.oid;
|
|
29593
|
+
}
|
|
29594
|
+
return null;
|
|
29595
|
+
}
|
|
29596
|
+
function verify(ac, issuer, opts) {
|
|
29597
|
+
return guard.async.deferred(function() {
|
|
29598
|
+
return _verify(ac, issuer, opts);
|
|
29599
|
+
});
|
|
29600
|
+
}
|
|
29601
|
+
function _fixVerifyOptions(opts) {
|
|
29602
|
+
var o = guard.identifier.optionsObject(opts, _err, "attrcert/bad-input", "pki.attrcert.verify options");
|
|
29603
|
+
guard.identifier.assertKnownKeys(
|
|
29604
|
+
o,
|
|
29605
|
+
KNOWN_VERIFY_OPTS,
|
|
29606
|
+
_err,
|
|
29607
|
+
"attrcert/bad-input",
|
|
29608
|
+
"pki.attrcert.verify has an unknown option "
|
|
29609
|
+
);
|
|
29610
|
+
var at = null;
|
|
29611
|
+
if (o.time !== void 0) {
|
|
29612
|
+
guard.time.assertValid(o.time, _err, "attrcert/bad-input", "pki.attrcert.verify opts.time");
|
|
29613
|
+
at = guard.time.instantOf(o.time);
|
|
29614
|
+
}
|
|
29615
|
+
var revocationStatus = null;
|
|
29616
|
+
if (o.revocationStatus !== void 0) {
|
|
29617
|
+
if (typeof o.revocationStatus !== "string" || !Object.prototype.hasOwnProperty.call(REVOCATION_STATUS, o.revocationStatus)) {
|
|
29618
|
+
throw _err("attrcert/bad-input", 'pki.attrcert.verify opts.revocationStatus must be "notRevoked" or "revoked"');
|
|
29619
|
+
}
|
|
29620
|
+
revocationStatus = o.revocationStatus;
|
|
29621
|
+
}
|
|
29622
|
+
return {
|
|
29623
|
+
at,
|
|
29624
|
+
revocationStatus,
|
|
29625
|
+
target: o.target === void 0 ? void 0 : _callerTarget(o.target)
|
|
29626
|
+
};
|
|
29627
|
+
}
|
|
29628
|
+
var REVOCATION_POINTERS = /* @__PURE__ */ Object.create(null);
|
|
29629
|
+
REVOCATION_POINTERS[O("cRLDistributionPoints")] = "crlDistributionPoints";
|
|
29630
|
+
REVOCATION_POINTERS[O("authorityInfoAccess")] = "authorityInfoAccess";
|
|
29631
|
+
function _revocationScheme(ac) {
|
|
29632
|
+
var out = { noRevAvail: false, pointer: null };
|
|
29633
|
+
for (var i = 0; i < ac.extensions.length; i++) {
|
|
29634
|
+
var e = ac.extensions[i];
|
|
29635
|
+
if (e.name === "noRevAvail") out.noRevAvail = true;
|
|
29636
|
+
var p = REVOCATION_POINTERS[e.oid];
|
|
29637
|
+
if (p !== void 0 && Object.prototype.hasOwnProperty.call(REVOCATION_POINTERS, e.oid)) out.pointer = p;
|
|
29638
|
+
}
|
|
29639
|
+
return out;
|
|
29640
|
+
}
|
|
29641
|
+
function _verify(ac, issuer, opts) {
|
|
29642
|
+
var fixed = _fixVerifyOptions(opts);
|
|
29643
|
+
var parsed = _coerceAc(ac);
|
|
29644
|
+
var trust = _resolveIssuer(issuer);
|
|
29645
|
+
var acIssuer = _acIssuerName(parsed);
|
|
29646
|
+
var result = {
|
|
29647
|
+
holder: parsed.holder,
|
|
29648
|
+
issuer: acIssuer,
|
|
29649
|
+
attributes: parsed.attributes,
|
|
29650
|
+
// Carried so a caller can act on what rode along: sec. 4.3.1 asks that an audit identity be
|
|
29651
|
+
// used for audit and logging, which it cannot be if the verdict drops it.
|
|
29652
|
+
extensions: parsed.extensions,
|
|
29653
|
+
notBefore: parsed.validity.notBeforeTime,
|
|
29654
|
+
notAfter: parsed.validity.notAfterTime,
|
|
29655
|
+
serialNumberHex: parsed.serialNumberHex,
|
|
29656
|
+
signatureValid: false,
|
|
29657
|
+
validityChecked: false,
|
|
29658
|
+
targetingChecked: false,
|
|
29659
|
+
revocationChecked: false,
|
|
29660
|
+
noRevAvail: false,
|
|
29661
|
+
holderBindingChecked: false,
|
|
29662
|
+
// item 1 needs the holder's certificate, which this verb is not given
|
|
29663
|
+
issuerPathChecked: false,
|
|
29664
|
+
// items 2 and 3 need the issuer's chain, likewise
|
|
29665
|
+
verified: false,
|
|
29666
|
+
reason: void 0
|
|
29667
|
+
};
|
|
29668
|
+
return Promise.resolve(attrcertVerify.verifyAcSignature(parsed, trust.spki)).then(function(sigOk) {
|
|
29669
|
+
result.signatureValid = sigOk === true;
|
|
29670
|
+
var fail = function(reason) {
|
|
29671
|
+
result.reason = reason;
|
|
29672
|
+
return result;
|
|
29673
|
+
};
|
|
29674
|
+
if (!result.signatureValid) return fail("the signature does not verify under the issuer public key");
|
|
29675
|
+
if (!guard.name.dnEqual(
|
|
29676
|
+
acIssuer.rdns,
|
|
29677
|
+
trust.rdns,
|
|
29678
|
+
_err,
|
|
29679
|
+
"attrcert/bad-input",
|
|
29680
|
+
"the AC issuer"
|
|
29681
|
+
)) {
|
|
29682
|
+
return fail("this attribute certificate names issuer " + JSON.stringify(acIssuer.dn) + ", which is not the AC issuer this verifier trusts");
|
|
29683
|
+
}
|
|
29684
|
+
var badExt = _unsupportedCritical(parsed);
|
|
29685
|
+
if (badExt) return fail("this attribute certificate carries an unsupported critical extension (" + badExt + "), which RFC 5755 sec. 5 item 7 requires be rejected");
|
|
29686
|
+
var targeting = _checkTargeting(parsed, fixed.target);
|
|
29687
|
+
result.targetingChecked = targeting.checked;
|
|
29688
|
+
if (!targeting.ok) return fail(targeting.reason);
|
|
29689
|
+
if (fixed.at === null) {
|
|
29690
|
+
return fail("no opts.time was supplied, so RFC 5755 sec. 5 item 5 (the evaluation instant lies within the validity) went unasked");
|
|
29691
|
+
}
|
|
29692
|
+
result.validityChecked = true;
|
|
29693
|
+
if (fixed.at < guard.time.instantOf(result.notBefore) || fixed.at > guard.time.instantOf(result.notAfter)) {
|
|
29694
|
+
return fail("the evaluation instant lies outside this attribute certificate's validity");
|
|
29695
|
+
}
|
|
29696
|
+
var scheme = _revocationScheme(parsed);
|
|
29697
|
+
result.noRevAvail = scheme.noRevAvail;
|
|
29698
|
+
if (scheme.noRevAvail && scheme.pointer) {
|
|
29699
|
+
return fail("this attribute certificate carries both noRevAvail and a " + scheme.pointer + " revocation pointer, which RFC 5755 sec. 6 says an AC MUST NOT do");
|
|
29700
|
+
}
|
|
29701
|
+
if (fixed.revocationStatus !== null) {
|
|
29702
|
+
result.revocationChecked = true;
|
|
29703
|
+
if (fixed.revocationStatus === "revoked") {
|
|
29704
|
+
return fail("this attribute certificate is revoked, as opts.revocationStatus reports");
|
|
29705
|
+
}
|
|
29706
|
+
} else if (result.noRevAvail) {
|
|
29707
|
+
result.revocationChecked = true;
|
|
29708
|
+
} else {
|
|
29709
|
+
return fail("this attribute certificate carries no noRevAvail extension, so its issuer supports revocation status checks and RFC 5755 sec. 6 requires one; establish the status from the certificate's own pointers and pass it as opts.revocationStatus");
|
|
29710
|
+
}
|
|
29711
|
+
result.verified = true;
|
|
29712
|
+
return result;
|
|
29713
|
+
});
|
|
29714
|
+
}
|
|
29715
|
+
module2.exports = { sign, verify };
|
|
28759
29716
|
}
|
|
28760
29717
|
});
|
|
28761
29718
|
|
|
@@ -29217,9 +30174,33 @@ var require_crl_sign = __commonJS({
|
|
|
29217
30174
|
if (v <= 0n) throw _err("crl/bad-input", "serialNumber must be a positive integer");
|
|
29218
30175
|
return asn1.decode(b.integer(v)).content.toString("hex");
|
|
29219
30176
|
}
|
|
29220
|
-
|
|
30177
|
+
var KNOWN_IS_REVOKED_KEYS = { time: 1, historicalMode: 1 };
|
|
30178
|
+
function isRevoked(crl, serialNumber, opts) {
|
|
30179
|
+
var o = guard.identifier.optionsObject(opts, _err, "crl/bad-input", "pki.crl.isRevoked options");
|
|
30180
|
+
guard.identifier.assertKnownKeys(o, KNOWN_IS_REVOKED_KEYS, _err, "crl/bad-input", function(k) {
|
|
30181
|
+
return "pki.crl.isRevoked has an unknown option " + JSON.stringify(k) + "; it takes `time` and `historicalMode`";
|
|
30182
|
+
});
|
|
30183
|
+
if (o.historicalMode !== void 0 && o.time === void 0) {
|
|
30184
|
+
throw _err("crl/bad-input", "pki.crl.isRevoked opts.historicalMode says how to read an entry against the instant asked about, so it needs opts.time as well");
|
|
30185
|
+
}
|
|
30186
|
+
if (o.historicalMode !== void 0 && typeof o.historicalMode !== "boolean") {
|
|
30187
|
+
throw _err("crl/bad-input", "pki.crl.isRevoked opts.historicalMode must be a boolean");
|
|
30188
|
+
}
|
|
29221
30189
|
var parsed = _coerceCrl(crl);
|
|
29222
30190
|
var hex = _serialHexOf(serialNumber);
|
|
30191
|
+
if (o.time !== void 0) {
|
|
30192
|
+
guard.time.assertValid(o.time, _err, "crl/bad-input", "pki.crl.isRevoked opts.time");
|
|
30193
|
+
var at = guard.time.instantOf(o.time);
|
|
30194
|
+
if (at < guard.time.instantOf(parsed.thisUpdate)) {
|
|
30195
|
+
throw _err("crl/not-current", "this CRL takes effect at " + parsed.thisUpdate.toISOString() + ", after the time asked about, so it says nothing about the certificate then");
|
|
30196
|
+
}
|
|
30197
|
+
if (!parsed.nextUpdate) {
|
|
30198
|
+
throw _err("crl/not-current", "this CRL carries no nextUpdate, so it states no window it speaks for and a replayed copy cannot be told from a current one (RFC 5280 sec. 5.1.2.5 requires one of a conforming CA); ask pki.path.crlChecker, which decides currency against the material it fetched");
|
|
30199
|
+
}
|
|
30200
|
+
if (at > guard.time.instantOf(parsed.nextUpdate)) {
|
|
30201
|
+
throw _err("crl/not-current", "this CRL was superseded after " + parsed.nextUpdate.toISOString() + "; a serial missing from it says nothing about the certificate at the time asked about, since the issuer promised a further list by then");
|
|
30202
|
+
}
|
|
30203
|
+
}
|
|
29223
30204
|
if (_findExtOid(parsed.crlExtensions, "deltaCRLIndicator")) {
|
|
29224
30205
|
throw _err("crl/delta-not-authoritative", "this is a delta CRL: it lists changes since a base CRL, so a serial appearing in it may be RELEASED rather than revoked. Merge it with its base -- pki.path.crlChecker does -- rather than reading a revocation status out of the delta alone");
|
|
29225
30206
|
}
|
|
@@ -29231,7 +30212,9 @@ var require_crl_sign = __commonJS({
|
|
|
29231
30212
|
}
|
|
29232
30213
|
}
|
|
29233
30214
|
for (var j = 0; j < parsed.revokedCertificates.length; j++) {
|
|
29234
|
-
if (parsed.revokedCertificates[j].serialNumberHex
|
|
30215
|
+
if (parsed.revokedCertificates[j].serialNumberHex !== hex) continue;
|
|
30216
|
+
if (o.historicalMode === true && guard.time.instantOf(parsed.revokedCertificates[j].revocationDate) > guard.time.instantOf(o.time)) continue;
|
|
30217
|
+
return parsed.revokedCertificates[j];
|
|
29235
30218
|
}
|
|
29236
30219
|
return null;
|
|
29237
30220
|
}
|