@blamejs/core 0.18.38 → 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 +121 -1
- 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-sql.js +7 -1
- 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 +15 -15
- package/lib/vendor/blamejs-pki.cjs +2120 -508
- 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,21 +698,623 @@ 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 };
|
|
713
899
|
}
|
|
714
900
|
});
|
|
715
901
|
|
|
902
|
+
// node_modules/@blamejs/pki/lib/guard-identifier.js
|
|
903
|
+
var require_guard_identifier = __commonJS({
|
|
904
|
+
"node_modules/@blamejs/pki/lib/guard-identifier.js"(exports2, module2) {
|
|
905
|
+
"use strict";
|
|
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
|
+
}
|
|
944
|
+
function _isDottedDecimal(str) {
|
|
945
|
+
if (str.length === 0) return false;
|
|
946
|
+
var arcs = 0, digits = 0, leadingZero = false;
|
|
947
|
+
for (var i = 0; i < str.length; i++) {
|
|
948
|
+
var c = _charCodeAt(str, i);
|
|
949
|
+
if (c === 46) {
|
|
950
|
+
if (digits === 0 || leadingZero) return false;
|
|
951
|
+
arcs++;
|
|
952
|
+
digits = 0;
|
|
953
|
+
leadingZero = false;
|
|
954
|
+
continue;
|
|
955
|
+
}
|
|
956
|
+
if (c < 48 || c > 57) return false;
|
|
957
|
+
if (digits === 1 && _charCodeAt(str, i - 1) === 48) leadingZero = true;
|
|
958
|
+
digits++;
|
|
959
|
+
}
|
|
960
|
+
if (digits === 0 || leadingZero) return false;
|
|
961
|
+
return arcs >= 1;
|
|
962
|
+
}
|
|
963
|
+
function assertCanonicalOid(str, E, code, label, boundsCode) {
|
|
964
|
+
var who = label || "OID";
|
|
965
|
+
if (typeof str !== "string" || !_isDottedDecimal(str)) {
|
|
966
|
+
throw E(code, who + " must be a canonical dotted-decimal OID string of two or more arcs with no leading-zero component");
|
|
967
|
+
}
|
|
968
|
+
if (boundsCode === null) return str;
|
|
969
|
+
var bcode = boundsCode === void 0 ? code : boundsCode;
|
|
970
|
+
var parts = _strSplit(str, ".");
|
|
971
|
+
var root = _BigInt(parts[0]);
|
|
972
|
+
var second = _BigInt(parts[1]);
|
|
973
|
+
if (root > 2n) throw E(bcode, who + " root arc must be 0, 1, or 2 (X.660)");
|
|
974
|
+
if (root < 2n && second > 39n) throw E(bcode, who + " second arc must be 0..39 under roots 0 and 1 (X.660)");
|
|
975
|
+
return str;
|
|
976
|
+
}
|
|
977
|
+
function assertKnownKeys(obj, known, E, code, message) {
|
|
978
|
+
_refuseUnenumerable(obj, E, code, "the options");
|
|
979
|
+
var describe = typeof message === "function" ? message : function(k) {
|
|
980
|
+
return message + _stringify(k);
|
|
981
|
+
};
|
|
982
|
+
_forEach(_readableNames(obj), function(k) {
|
|
983
|
+
if (_hasOwn(known, k)) return;
|
|
984
|
+
throw E(code, describe(typeof k === "symbol" ? _String(k) : k));
|
|
985
|
+
});
|
|
986
|
+
}
|
|
987
|
+
var _PRISTINE_OBJECT_PROTO = (function() {
|
|
988
|
+
var s = _create(null);
|
|
989
|
+
_forEach([
|
|
990
|
+
"constructor",
|
|
991
|
+
"hasOwnProperty",
|
|
992
|
+
"isPrototypeOf",
|
|
993
|
+
"propertyIsEnumerable",
|
|
994
|
+
"toLocaleString",
|
|
995
|
+
"toString",
|
|
996
|
+
"valueOf",
|
|
997
|
+
"__defineGetter__",
|
|
998
|
+
"__defineSetter__",
|
|
999
|
+
"__lookupGetter__",
|
|
1000
|
+
"__lookupSetter__",
|
|
1001
|
+
"__proto__"
|
|
1002
|
+
], function(k) {
|
|
1003
|
+
s[k] = 1;
|
|
1004
|
+
});
|
|
1005
|
+
return s;
|
|
1006
|
+
})();
|
|
1007
|
+
function _looksBuiltIn(d) {
|
|
1008
|
+
return !!d && (!!d.get || !!d.set || typeof d.value === "function");
|
|
1009
|
+
}
|
|
1010
|
+
function _requireFactory(E) {
|
|
1011
|
+
if (typeof E !== "function") {
|
|
1012
|
+
throw new TypeError("guard.identifier needs an error factory called as E(code, message); a class is not one, so adapt it at the call site");
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
function _refuseUnenumerable(v, E, code, label) {
|
|
1016
|
+
_requireFactory(E);
|
|
1017
|
+
if (v === null || typeof v !== "object") return;
|
|
1018
|
+
var visited = new _Set();
|
|
1019
|
+
for (var o = v; o && !_setHas(visited, o); o = _getPrototypeOf(o)) {
|
|
1020
|
+
_setAdd(visited, o);
|
|
1021
|
+
if (!util.types.isProxy(o)) continue;
|
|
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");
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
function _isMethodOf(from, k, fn) {
|
|
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);
|
|
1030
|
+
if (!d) continue;
|
|
1031
|
+
return !d.get && !d.set && d.value === fn;
|
|
1032
|
+
}
|
|
1033
|
+
return false;
|
|
1034
|
+
}
|
|
1035
|
+
function _isArrayIndex(k) {
|
|
1036
|
+
var n = _Number(k);
|
|
1037
|
+
return _isInteger(n) && n >= 0 && n < 4294967295 && _String(n) === k;
|
|
1038
|
+
}
|
|
1039
|
+
function _isIndexedKind(v) {
|
|
1040
|
+
return _isArray(v) || _isView(v) && !util.types.isDataView(v);
|
|
1041
|
+
}
|
|
1042
|
+
var _ARRAY_PROTO_MEMBERS = ["length", Symbol.unscopables];
|
|
1043
|
+
var _REGEXP_PROTO_MEMBERS = [
|
|
1044
|
+
"source",
|
|
1045
|
+
"flags",
|
|
1046
|
+
"global",
|
|
1047
|
+
"ignoreCase",
|
|
1048
|
+
"multiline",
|
|
1049
|
+
"dotAll",
|
|
1050
|
+
"unicode",
|
|
1051
|
+
"unicodeSets",
|
|
1052
|
+
"sticky",
|
|
1053
|
+
"hasIndices"
|
|
1054
|
+
];
|
|
1055
|
+
var _SIZED_PROTO_MEMBERS = ["size", Symbol.toStringTag];
|
|
1056
|
+
var _WEAK_PROTO_MEMBERS = [Symbol.toStringTag];
|
|
1057
|
+
var _ARRAYBUFFER_PROTO_MEMBERS = [
|
|
1058
|
+
"byteLength",
|
|
1059
|
+
"maxByteLength",
|
|
1060
|
+
"resizable",
|
|
1061
|
+
"detached",
|
|
1062
|
+
Symbol.toStringTag
|
|
1063
|
+
];
|
|
1064
|
+
var _SHARED_PROTO_MEMBERS = ["byteLength", "maxByteLength", "growable", Symbol.toStringTag];
|
|
1065
|
+
var _DATAVIEW_PROTO_MEMBERS = ["buffer", "byteLength", "byteOffset", Symbol.toStringTag];
|
|
1066
|
+
var _TYPED_PROTO_MEMBERS = ["buffer", "byteLength", "byteOffset", "length", Symbol.toStringTag];
|
|
1067
|
+
var _CONCRETE_TYPED_MEMBERS = ["BYTES_PER_ELEMENT"];
|
|
1068
|
+
var _BUFFER_PROTO_MEMBERS = ["parent", "offset"];
|
|
1069
|
+
var _ARRAY_MEMBERS = _ARRAY_PROTO_MEMBERS;
|
|
1070
|
+
var _REGEXP_MEMBERS = ["lastIndex"].concat(_REGEXP_PROTO_MEMBERS);
|
|
1071
|
+
var _VIEW_MEMBERS = _TYPED_PROTO_MEMBERS.concat(_CONCRETE_TYPED_MEMBERS);
|
|
1072
|
+
var _BUFFER_KIND_MEMBERS = _VIEW_MEMBERS.concat(_BUFFER_PROTO_MEMBERS);
|
|
1073
|
+
var _DATAVIEW_MEMBERS = _DATAVIEW_PROTO_MEMBERS;
|
|
1074
|
+
var _ARRAYBUFFER_MEMBERS = _ARRAYBUFFER_PROTO_MEMBERS;
|
|
1075
|
+
var _SHARED_MEMBERS = _SHARED_PROTO_MEMBERS;
|
|
1076
|
+
var _TYPED_ARRAY_PROTO = _getPrototypeOf(Uint8Array.prototype);
|
|
1077
|
+
var _INTRINSIC_HOLDERS = (function() {
|
|
1078
|
+
var m = new _Map([[_TYPED_ARRAY_PROTO, _TYPED_PROTO_MEMBERS]]);
|
|
1079
|
+
function pair(ctor, members) {
|
|
1080
|
+
if (ctor && ctor.prototype) _mapSet(m, ctor.prototype, members);
|
|
1081
|
+
}
|
|
1082
|
+
pair(Array, _ARRAY_PROTO_MEMBERS);
|
|
1083
|
+
pair(RegExp, _REGEXP_PROTO_MEMBERS);
|
|
1084
|
+
_forEach([Map, Set], function(c) {
|
|
1085
|
+
pair(c, _SIZED_PROTO_MEMBERS);
|
|
1086
|
+
});
|
|
1087
|
+
_forEach([WeakMap, WeakSet], function(c) {
|
|
1088
|
+
pair(c, _WEAK_PROTO_MEMBERS);
|
|
1089
|
+
});
|
|
1090
|
+
pair(ArrayBuffer, _ARRAYBUFFER_PROTO_MEMBERS);
|
|
1091
|
+
pair(typeof SharedArrayBuffer === "function" ? SharedArrayBuffer : null, _SHARED_PROTO_MEMBERS);
|
|
1092
|
+
pair(DataView, _DATAVIEW_PROTO_MEMBERS);
|
|
1093
|
+
pair(Buffer, _BUFFER_PROTO_MEMBERS);
|
|
1094
|
+
_forEach(_getOwnPropertyNames(globalThis), function(n) {
|
|
1095
|
+
var C;
|
|
1096
|
+
try {
|
|
1097
|
+
C = globalThis[n];
|
|
1098
|
+
} catch (_e) {
|
|
1099
|
+
return;
|
|
1100
|
+
}
|
|
1101
|
+
if (typeof C !== "function" || typeof C.BYTES_PER_ELEMENT !== "number") return;
|
|
1102
|
+
if (!C.prototype || _getPrototypeOf(C.prototype) !== _TYPED_ARRAY_PROTO) return;
|
|
1103
|
+
_mapSet(m, C.prototype, _CONCRETE_TYPED_MEMBERS);
|
|
1104
|
+
});
|
|
1105
|
+
return m;
|
|
1106
|
+
})();
|
|
1107
|
+
function _holderMembers(o) {
|
|
1108
|
+
return _mapHas(_INTRINSIC_HOLDERS, o) ? _mapGet(_INTRINSIC_HOLDERS, o) : null;
|
|
1109
|
+
}
|
|
1110
|
+
function _isNodeBuffer(v) {
|
|
1111
|
+
if (!util.types.isUint8Array(v)) return false;
|
|
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;
|
|
1116
|
+
}
|
|
1117
|
+
return false;
|
|
1118
|
+
}
|
|
1119
|
+
function _kindMembers(v) {
|
|
1120
|
+
if (v === null || v === void 0) return [];
|
|
1121
|
+
if (_isArray(v)) return _ARRAY_MEMBERS;
|
|
1122
|
+
if (_isNodeBuffer(v)) return _BUFFER_KIND_MEMBERS;
|
|
1123
|
+
if (util.types.isDataView(v)) return _DATAVIEW_MEMBERS;
|
|
1124
|
+
if (_isView(v)) return _VIEW_MEMBERS;
|
|
1125
|
+
if (util.types.isArrayBuffer(v)) return _ARRAYBUFFER_MEMBERS;
|
|
1126
|
+
if (util.types.isSharedArrayBuffer(v)) return _SHARED_MEMBERS;
|
|
1127
|
+
if (util.types.isRegExp(v)) return _REGEXP_MEMBERS;
|
|
1128
|
+
if (util.types.isWeakMap(v) || util.types.isWeakSet(v)) return _WEAK_PROTO_MEMBERS;
|
|
1129
|
+
if (util.types.isMap(v) || util.types.isSet(v)) return _SIZED_PROTO_MEMBERS;
|
|
1130
|
+
return [];
|
|
1131
|
+
}
|
|
1132
|
+
function _isOwnStructuralName(v, k) {
|
|
1133
|
+
return util.types.isRegExp(v) && k === "lastIndex";
|
|
1134
|
+
}
|
|
1135
|
+
function _looksIntrinsic(d) {
|
|
1136
|
+
return !!d && (!!d.get || !!d.set || typeof d.value === "function" || d.writable === false || d.configurable === false);
|
|
1137
|
+
}
|
|
1138
|
+
function _shadowsAnother(v, k, holder) {
|
|
1139
|
+
var visited = new _Set();
|
|
1140
|
+
var past = false;
|
|
1141
|
+
for (var o = v; o !== null && o !== void 0 && !_setHas(visited, o); o = _getPrototypeOf(o)) {
|
|
1142
|
+
_setAdd(visited, o);
|
|
1143
|
+
if (o === holder) {
|
|
1144
|
+
past = true;
|
|
1145
|
+
continue;
|
|
1146
|
+
}
|
|
1147
|
+
if (past && _getOwnPropertyDescriptor(o, k)) return true;
|
|
1148
|
+
}
|
|
1149
|
+
return false;
|
|
1150
|
+
}
|
|
1151
|
+
function _readableNames(obj) {
|
|
1152
|
+
var seen = _create(null);
|
|
1153
|
+
var out = [];
|
|
1154
|
+
var o = obj === null || obj === void 0 ? null : _Object(obj);
|
|
1155
|
+
var indexedSelf = _isIndexedKind(o);
|
|
1156
|
+
var members = _kindMembers(o);
|
|
1157
|
+
var visited = new _Set();
|
|
1158
|
+
while (o && !_setHas(visited, o)) {
|
|
1159
|
+
_setAdd(visited, o);
|
|
1160
|
+
var inherited = o !== obj;
|
|
1161
|
+
var above = _getPrototypeOf(o);
|
|
1162
|
+
var atObjectProto = inherited && above === null;
|
|
1163
|
+
_forEach(_ownKeys(o), function(k) {
|
|
1164
|
+
if (seen[k]) return;
|
|
1165
|
+
if (indexedSelf && typeof k === "string" && _isArrayIndex(k)) return;
|
|
1166
|
+
if (indexedSelf && k === "length" && !inherited) return;
|
|
1167
|
+
if (_isOwnStructuralName(obj, k)) return;
|
|
1168
|
+
var d = _getOwnPropertyDescriptor(o, k);
|
|
1169
|
+
var here = _holderMembers(o);
|
|
1170
|
+
if (inherited && _looksIntrinsic(d) && !_shadowsAnother(obj, k, o) && (here === null ? _indexOf(members, k) !== -1 : _indexOf(here, k) !== -1)) return;
|
|
1171
|
+
if (atObjectProto) {
|
|
1172
|
+
if (_PRISTINE_OBJECT_PROTO[k] && _looksBuiltIn(d)) return;
|
|
1173
|
+
seen[k] = 1;
|
|
1174
|
+
_append(out, k);
|
|
1175
|
+
return;
|
|
1176
|
+
}
|
|
1177
|
+
if (d && !d.get && !d.set && typeof d.value === "function" && (inherited || _isMethodOf(above, k, d.value))) return;
|
|
1178
|
+
seen[k] = 1;
|
|
1179
|
+
_append(out, k);
|
|
1180
|
+
});
|
|
1181
|
+
o = above;
|
|
1182
|
+
}
|
|
1183
|
+
return out;
|
|
1184
|
+
}
|
|
1185
|
+
function readableNames(obj, E, code, label) {
|
|
1186
|
+
_refuseUnenumerable(obj, E, code, label);
|
|
1187
|
+
return _readableNames(obj);
|
|
1188
|
+
}
|
|
1189
|
+
function readableIndices(obj, E, code, label) {
|
|
1190
|
+
_refuseUnenumerable(obj, E, code, label);
|
|
1191
|
+
if (!_isArray(obj)) return [];
|
|
1192
|
+
var own = _getOwnPropertyDescriptor(obj, "length");
|
|
1193
|
+
var limit = own ? own.value : 0;
|
|
1194
|
+
var seen = _create(null);
|
|
1195
|
+
var out = [];
|
|
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) {
|
|
1200
|
+
if (typeof k !== "string" || !_isArrayIndex(k) || seen[k]) return;
|
|
1201
|
+
if (_Number(k) >= limit) return;
|
|
1202
|
+
seen[k] = 1;
|
|
1203
|
+
_append(out, k);
|
|
1204
|
+
});
|
|
1205
|
+
}
|
|
1206
|
+
return _sort(out, function(a, b) {
|
|
1207
|
+
return _Number(a) - _Number(b);
|
|
1208
|
+
});
|
|
1209
|
+
}
|
|
1210
|
+
function _notAnOptionsBag(v) {
|
|
1211
|
+
if (util.types.isBoxedPrimitive(v)) return "a boxed primitive";
|
|
1212
|
+
if (util.types.isNativeError(v)) return "an Error";
|
|
1213
|
+
if (util.types.isPromise(v)) return "a Promise";
|
|
1214
|
+
if (util.types.isArgumentsObject(v)) return "an arguments object";
|
|
1215
|
+
return null;
|
|
1216
|
+
}
|
|
1217
|
+
function optionsObject(opts, E, code, label) {
|
|
1218
|
+
if (opts === null || opts === void 0) return _create(null);
|
|
1219
|
+
if (typeof opts !== "object") throw E(code, label + " must be an object");
|
|
1220
|
+
_refuseUnenumerable(opts, E, code, label);
|
|
1221
|
+
if (_isNodeBuffer(opts)) throw E(code, label + " must be an object");
|
|
1222
|
+
var wrong = _notAnOptionsBag(opts);
|
|
1223
|
+
if (wrong) throw E(code, label + ": " + wrong + " is not an options bag; pass a plain object");
|
|
1224
|
+
return _settle(opts, E, code, label);
|
|
1225
|
+
}
|
|
1226
|
+
function _descriptorHolder(v, k) {
|
|
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);
|
|
1231
|
+
if (d) return d;
|
|
1232
|
+
}
|
|
1233
|
+
return null;
|
|
1234
|
+
}
|
|
1235
|
+
function refuseAccessorFields(obj, names, E, code, label) {
|
|
1236
|
+
for (var i = 0; i < names.length; i++) {
|
|
1237
|
+
var holder = _descriptorHolder(obj, names[i]);
|
|
1238
|
+
if (holder && (holder.get || holder.set)) {
|
|
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");
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1243
|
+
function _settle(opts, E, code, label) {
|
|
1244
|
+
function readAll(names) {
|
|
1245
|
+
for (var i = 0; i < names.length; i++) {
|
|
1246
|
+
try {
|
|
1247
|
+
void opts[names[i]];
|
|
1248
|
+
} catch (_e) {
|
|
1249
|
+
throw E(code, label + ": reading " + _stringify(typeof names[i] === "symbol" ? _String(names[i]) : names[i]) + " threw");
|
|
1250
|
+
}
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
var before = _readableNames(opts);
|
|
1254
|
+
refuseAccessorFields(opts, before, E, code, label);
|
|
1255
|
+
readAll(before);
|
|
1256
|
+
var after = _readableNames(opts);
|
|
1257
|
+
var same = after.length === before.length;
|
|
1258
|
+
for (var j = 0; same && j < after.length; j++) same = _indexOf(before, after[j]) !== -1;
|
|
1259
|
+
if (!same) {
|
|
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");
|
|
1261
|
+
}
|
|
1262
|
+
return opts;
|
|
1263
|
+
}
|
|
1264
|
+
module2.exports = {
|
|
1265
|
+
assertCanonicalOid,
|
|
1266
|
+
assertKnownKeys,
|
|
1267
|
+
optionsObject,
|
|
1268
|
+
refuseAccessorFields,
|
|
1269
|
+
// Exported so a caller that forwards an options bag copies the same surface this module
|
|
1270
|
+
// accepts. A narrower enumeration such as `Object.keys` admits a name here and then drops
|
|
1271
|
+
// it on the way, which is worse than refusing it. The option is reported valid and then
|
|
1272
|
+
// does nothing at the place it was meant to act.
|
|
1273
|
+
readableNames,
|
|
1274
|
+
// Exported for the same reason as its sibling: a caller copying an array has to reach the
|
|
1275
|
+
// elements a read reaches, and the own keys are not that set.
|
|
1276
|
+
readableIndices
|
|
1277
|
+
};
|
|
1278
|
+
}
|
|
1279
|
+
});
|
|
1280
|
+
|
|
1281
|
+
// node_modules/@blamejs/pki/lib/guard-time.js
|
|
1282
|
+
var require_guard_time = __commonJS({
|
|
1283
|
+
"node_modules/@blamejs/pki/lib/guard-time.js"(exports2, module2) {
|
|
1284
|
+
"use strict";
|
|
1285
|
+
var util = { types: require_guard_intrinsic().types };
|
|
1286
|
+
var _isNaN = Number.isNaN;
|
|
1287
|
+
var _dateGetTime = require_guard_intrinsic().uncurry(Date.prototype.getTime);
|
|
1288
|
+
function instantOf(value) {
|
|
1289
|
+
return _dateGetTime(value);
|
|
1290
|
+
}
|
|
1291
|
+
function assertValid(value, E, code, label) {
|
|
1292
|
+
if (!util.types.isDate(value) || _isNaN(instantOf(value))) {
|
|
1293
|
+
throw E(code, (label || "value") + " must be a valid Date");
|
|
1294
|
+
}
|
|
1295
|
+
return value;
|
|
1296
|
+
}
|
|
1297
|
+
function within(instant, lower, upper, E, code, label, opts) {
|
|
1298
|
+
assertValid(instant, E, code, label);
|
|
1299
|
+
assertValid(lower, E, code, (label || "window") + " lower bound");
|
|
1300
|
+
assertValid(upper, E, code, (label || "window") + " upper bound");
|
|
1301
|
+
var t = instantOf(instant);
|
|
1302
|
+
var lo = instantOf(lower);
|
|
1303
|
+
var hi = instantOf(upper);
|
|
1304
|
+
return t >= lo && (opts && opts.upperInclusive ? t <= hi : t < hi);
|
|
1305
|
+
}
|
|
1306
|
+
function isDate(value) {
|
|
1307
|
+
return util.types.isDate(value);
|
|
1308
|
+
}
|
|
1309
|
+
module2.exports = {
|
|
1310
|
+
assertValid,
|
|
1311
|
+
instantOf,
|
|
1312
|
+
isDate,
|
|
1313
|
+
within
|
|
1314
|
+
};
|
|
1315
|
+
}
|
|
1316
|
+
});
|
|
1317
|
+
|
|
716
1318
|
// node_modules/@blamejs/pki/lib/oid.js
|
|
717
1319
|
var require_oid = __commonJS({
|
|
718
1320
|
"node_modules/@blamejs/pki/lib/oid.js"(exports2, module2) {
|
|
@@ -2482,10 +3084,11 @@ var require_webcrypto = __commonJS({
|
|
|
2482
3084
|
if (!ArrayBuffer.isView(typedArray) || typedArray instanceof Float32Array || typedArray instanceof Float64Array || typedArray instanceof DataView) {
|
|
2483
3085
|
throw new WebCryptoError("webcrypto/data", "getRandomValues: expected an integer TypedArray");
|
|
2484
3086
|
}
|
|
2485
|
-
|
|
3087
|
+
var out = guard.bytes.outputView(typedArray, WebCryptoError, "webcrypto/data", "getRandomValues");
|
|
3088
|
+
if (out.length > MAX_RANDOM_BYTES) {
|
|
2486
3089
|
throw new WebCryptoError("webcrypto/data", "getRandomValues: byteLength exceeds " + MAX_RANDOM_BYTES);
|
|
2487
3090
|
}
|
|
2488
|
-
nodeCrypto.randomFillSync(
|
|
3091
|
+
nodeCrypto.randomFillSync(out);
|
|
2489
3092
|
return typedArray;
|
|
2490
3093
|
};
|
|
2491
3094
|
Crypto.prototype.randomUUID = function randomUUID() {
|
|
@@ -2569,44 +3172,62 @@ var require_guard_parsed = __commonJS({
|
|
|
2569
3172
|
"node_modules/@blamejs/pki/lib/guard-parsed.js"(exports2, module2) {
|
|
2570
3173
|
"use strict";
|
|
2571
3174
|
var bytes = require_guard_bytes();
|
|
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
|
+
}
|
|
2572
3193
|
function _isBytes(x) {
|
|
2573
|
-
return
|
|
3194
|
+
return bytes.isByteSource(x);
|
|
2574
3195
|
}
|
|
2575
3196
|
function _isAttributeTypeAndValue(a) {
|
|
2576
3197
|
return !!a && typeof a.type === "string" && _isOptName(a.name) && typeof a.value === "string";
|
|
2577
3198
|
}
|
|
2578
3199
|
function _isRdnSequence(rdns) {
|
|
2579
|
-
if (!
|
|
3200
|
+
if (!_isArray(rdns)) return false;
|
|
2580
3201
|
for (var i = 0; i < rdns.length; i++) {
|
|
2581
|
-
if (!
|
|
2582
|
-
if (!rdns[i]
|
|
3202
|
+
if (!_isArray(rdns[i]) || rdns[i].length === 0) return false;
|
|
3203
|
+
if (!_every(rdns[i], _isAttributeTypeAndValue)) return false;
|
|
2583
3204
|
}
|
|
2584
3205
|
return true;
|
|
2585
3206
|
}
|
|
2586
3207
|
function _isName(n) {
|
|
2587
|
-
return !!n && _isRdnSequence(n.rdns) &&
|
|
3208
|
+
return !!n && _isRdnSequence(n.rdns) && _isBuffer(n.bytes) && typeof n.dn === "string";
|
|
2588
3209
|
}
|
|
2589
3210
|
function _isOptName(v) {
|
|
2590
3211
|
return typeof v === "string" || v === null;
|
|
2591
3212
|
}
|
|
2592
3213
|
function _isAlgorithmIdentifier(a) {
|
|
2593
|
-
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);
|
|
2594
3215
|
}
|
|
2595
3216
|
function _isBitString(b) {
|
|
2596
|
-
return !!b &&
|
|
3217
|
+
return !!b && _isBuffer(b.bytes) && typeof b.unusedBits === "number";
|
|
2597
3218
|
}
|
|
2598
3219
|
function _isExtensionEntry(e) {
|
|
2599
|
-
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);
|
|
2600
3221
|
}
|
|
2601
3222
|
function _isCrlExtensionEntry(e) {
|
|
2602
3223
|
return !!e && typeof e.oid === "string" && _isOptName(e.name) && typeof e.critical === "boolean" && e.value !== void 0;
|
|
2603
3224
|
}
|
|
2604
3225
|
function isCert(o) {
|
|
2605
|
-
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);
|
|
2606
3227
|
}
|
|
2607
3228
|
function isCrl(o) {
|
|
2608
|
-
return !!o && typeof o === "object" &&
|
|
2609
|
-
return !!e && typeof e.serialNumber === "bigint" && typeof e.serialNumberHex === "string" && 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);
|
|
2610
3231
|
});
|
|
2611
3232
|
}
|
|
2612
3233
|
function _safe(shape) {
|
|
@@ -2620,7 +3241,7 @@ var require_guard_parsed = __commonJS({
|
|
|
2620
3241
|
}
|
|
2621
3242
|
var certShape = _safe(isCert);
|
|
2622
3243
|
var crlShape = _safe(isCrl);
|
|
2623
|
-
var _SHAPES = { certificate: certShape, crl: crlShape };
|
|
3244
|
+
var _SHAPES = _assign(_create(null), { certificate: certShape, crl: crlShape });
|
|
2624
3245
|
function accept(input, kind, parse, E, code, label) {
|
|
2625
3246
|
var who = label || "the argument";
|
|
2626
3247
|
var shape = _SHAPES[kind];
|
|
@@ -2642,16 +3263,16 @@ var require_guard_parsed = __commonJS({
|
|
|
2642
3263
|
}
|
|
2643
3264
|
throw E(code, who + " must be a " + kind + " DER Buffer, a PEM string, or a parsed " + kind);
|
|
2644
3265
|
}
|
|
2645
|
-
var PROVENANCE =
|
|
3266
|
+
var PROVENANCE = new _WeakMap();
|
|
2646
3267
|
function recordingParser(kind, parse, ErrorClass, code, label) {
|
|
2647
3268
|
return function(input) {
|
|
2648
3269
|
var isText = typeof input === "string";
|
|
2649
3270
|
var snap = isText ? input : bytes.snapshotSource(input, ErrorClass, code, label);
|
|
2650
3271
|
var out = parse(snap);
|
|
2651
3272
|
if (out && typeof out === "object") {
|
|
2652
|
-
PROVENANCE
|
|
3273
|
+
_weakSet(PROVENANCE, out, {
|
|
2653
3274
|
kind,
|
|
2654
|
-
source: isText ? snap :
|
|
3275
|
+
source: isText ? snap : _bufferFrom(snap),
|
|
2655
3276
|
shape: _shapeOf(out)
|
|
2656
3277
|
});
|
|
2657
3278
|
}
|
|
@@ -2662,9 +3283,9 @@ var require_guard_parsed = __commonJS({
|
|
|
2662
3283
|
return function(node) {
|
|
2663
3284
|
var out = walkNode(node);
|
|
2664
3285
|
if (out && typeof out === "object" && node && _isBytes(node.bytes)) {
|
|
2665
|
-
PROVENANCE
|
|
3286
|
+
_weakSet(PROVENANCE, out, {
|
|
2666
3287
|
kind,
|
|
2667
|
-
source:
|
|
3288
|
+
source: _bufferFrom(node.bytes),
|
|
2668
3289
|
shape: _shapeOf(out),
|
|
2669
3290
|
derive: function(src) {
|
|
2670
3291
|
return walkNode(decodeBytes(src));
|
|
@@ -2676,15 +3297,15 @@ var require_guard_parsed = __commonJS({
|
|
|
2676
3297
|
}
|
|
2677
3298
|
function _recordOf(obj, kind) {
|
|
2678
3299
|
if (!obj || typeof obj !== "object") return void 0;
|
|
2679
|
-
var rec = PROVENANCE
|
|
3300
|
+
var rec = _weakGet(PROVENANCE, obj);
|
|
2680
3301
|
return rec && rec.kind === kind ? rec : void 0;
|
|
2681
3302
|
}
|
|
2682
3303
|
function isRecorded(obj) {
|
|
2683
|
-
return !!obj && typeof obj === "object" && PROVENANCE
|
|
3304
|
+
return !!obj && typeof obj === "object" && _weakHas(PROVENANCE, obj);
|
|
2684
3305
|
}
|
|
2685
3306
|
function isRecordedAsProduced(obj) {
|
|
2686
3307
|
if (!isRecorded(obj)) return false;
|
|
2687
|
-
var shape = PROVENANCE
|
|
3308
|
+
var shape = _weakGet(PROVENANCE, obj).shape;
|
|
2688
3309
|
var keys = _allNames(obj);
|
|
2689
3310
|
for (var i = 0; i < keys.length; i++) {
|
|
2690
3311
|
if (!shape[keys[i]]) return false;
|
|
@@ -2692,20 +3313,20 @@ var require_guard_parsed = __commonJS({
|
|
|
2692
3313
|
return true;
|
|
2693
3314
|
}
|
|
2694
3315
|
function _shapeOf(obj) {
|
|
2695
|
-
var shape =
|
|
3316
|
+
var shape = _create(null);
|
|
2696
3317
|
var keys = _allNames(obj);
|
|
2697
3318
|
for (var i = 0; i < keys.length; i++) shape[keys[i]] = true;
|
|
2698
3319
|
return shape;
|
|
2699
3320
|
}
|
|
2700
3321
|
function _allNames(obj) {
|
|
2701
3322
|
var names = [];
|
|
2702
|
-
var seen =
|
|
2703
|
-
for (var o = obj; o && o !==
|
|
2704
|
-
var own =
|
|
3323
|
+
var seen = _create(null);
|
|
3324
|
+
for (var o = obj; o && o !== _ObjectProto; o = _getPrototypeOf(o)) {
|
|
3325
|
+
var own = _getOwnPropertyNames(o);
|
|
2705
3326
|
for (var i = 0; i < own.length; i++) {
|
|
2706
3327
|
if (seen[own[i]]) continue;
|
|
2707
3328
|
seen[own[i]] = true;
|
|
2708
|
-
names
|
|
3329
|
+
_append(names, own[i]);
|
|
2709
3330
|
}
|
|
2710
3331
|
}
|
|
2711
3332
|
return names;
|
|
@@ -2726,16 +3347,22 @@ var require_guard_parsed = __commonJS({
|
|
|
2726
3347
|
}
|
|
2727
3348
|
return parse(input);
|
|
2728
3349
|
}
|
|
2729
|
-
var _CLAIMS = {
|
|
3350
|
+
var _CLAIMS = _assign(_create(null), {
|
|
2730
3351
|
certificate: ["tbsBytes", "subjectPublicKeyInfo", "serialNumberHex"],
|
|
2731
3352
|
crl: ["tbsBytes", "revokedCertificates", "crlExtensions"],
|
|
2732
|
-
cms: ["signerInfos", "encapContentInfo"]
|
|
2733
|
-
|
|
2734
|
-
|
|
3353
|
+
cms: ["signerInfos", "encapContentInfo"],
|
|
3354
|
+
csr: ["certificationRequestInfoBytes", "subjectPublicKeyInfo", "attributes"],
|
|
3355
|
+
crmf: ["messages"],
|
|
3356
|
+
attributeCertificate: ["tbsBytes", "holder", "attributes"]
|
|
3357
|
+
});
|
|
3358
|
+
var _WHY = _assign(_create(null), {
|
|
2735
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",
|
|
2736
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",
|
|
2737
|
-
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"
|
|
2738
|
-
|
|
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
|
+
});
|
|
2739
3366
|
function acceptDerived(input, kind, parse, E, code, label) {
|
|
2740
3367
|
var claims = _CLAIMS[kind];
|
|
2741
3368
|
if (!claims) throw new TypeError("guard.parsed.acceptDerived: unknown kind " + kind);
|
|
@@ -2753,7 +3380,14 @@ var require_guard_parsed = __commonJS({
|
|
|
2753
3380
|
throw E(code, who + " must be a " + kind + " DER Buffer, a PEM string, or a parsed " + kind);
|
|
2754
3381
|
}
|
|
2755
3382
|
}
|
|
2756
|
-
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];
|
|
2757
3391
|
return fromTrustedSource(
|
|
2758
3392
|
input,
|
|
2759
3393
|
kind,
|
|
@@ -2783,10 +3417,12 @@ var require_guard_secret = __commonJS({
|
|
|
2783
3417
|
"node_modules/@blamejs/pki/lib/guard-secret.js"(exports2, module2) {
|
|
2784
3418
|
"use strict";
|
|
2785
3419
|
var bytes = require_guard_bytes();
|
|
3420
|
+
var intrinsic = require_guard_intrinsic();
|
|
3421
|
+
var _fill = intrinsic.uncurry(Uint8Array.prototype.fill);
|
|
2786
3422
|
function zeroize(value, ErrorClass, code, label) {
|
|
2787
3423
|
if (value === null || value === void 0) return value;
|
|
2788
3424
|
var view = bytes.view(value, ErrorClass, code, label);
|
|
2789
|
-
view
|
|
3425
|
+
_fill(view, 0);
|
|
2790
3426
|
return value;
|
|
2791
3427
|
}
|
|
2792
3428
|
function zeroizeAll(list, ErrorClass, code, label) {
|
|
@@ -2803,13 +3439,149 @@ var require_guard_bytes = __commonJS({
|
|
|
2803
3439
|
"node_modules/@blamejs/pki/lib/guard-bytes.js"(exports2, module2) {
|
|
2804
3440
|
"use strict";
|
|
2805
3441
|
var async = require_guard_async();
|
|
3442
|
+
var identifier = require_guard_identifier();
|
|
3443
|
+
var time = require_guard_time();
|
|
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
|
+
}
|
|
3481
|
+
function isByteSource(x) {
|
|
3482
|
+
return _isBuffer(x) || _isView(x) || _isArrayBuffer(x);
|
|
3483
|
+
}
|
|
3484
|
+
function _isArrayBuffer(v) {
|
|
3485
|
+
return util.types.isArrayBuffer(v);
|
|
3486
|
+
}
|
|
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");
|
|
3493
|
+
function _storeOf(v) {
|
|
3494
|
+
return util.types.isDataView(v) ? _dvBuffer(v) : _taBuffer(v);
|
|
3495
|
+
}
|
|
3496
|
+
function _offsetOf(v) {
|
|
3497
|
+
return util.types.isDataView(v) ? _dvByteOffset(v) : _taByteOffset(v);
|
|
3498
|
+
}
|
|
3499
|
+
function _lengthOf(v) {
|
|
3500
|
+
return intrinsic.sizeOf(v);
|
|
3501
|
+
}
|
|
3502
|
+
function _reView(v) {
|
|
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
|
+
);
|
|
3520
|
+
function _concreteKindOf(v) {
|
|
3521
|
+
for (var i = 0; i < _CONCRETE_KINDS.length; i++) {
|
|
3522
|
+
if (_CONCRETE_KINDS[i][0](v)) return _CONCRETE_KINDS[i][1];
|
|
3523
|
+
}
|
|
3524
|
+
return null;
|
|
3525
|
+
}
|
|
3526
|
+
var _NAMED_KINDS = _filter([
|
|
3527
|
+
["isNativeError", "Error"],
|
|
3528
|
+
["isRegExp", "RegExp"],
|
|
3529
|
+
["isPromise", "Promise"],
|
|
3530
|
+
["isWeakMap", "WeakMap"],
|
|
3531
|
+
["isWeakSet", "WeakSet"],
|
|
3532
|
+
["isMap", "Map"],
|
|
3533
|
+
["isSet", "Set"],
|
|
3534
|
+
["isDate", "Date"],
|
|
3535
|
+
["isProxy", "Proxy"]
|
|
3536
|
+
], function(row) {
|
|
3537
|
+
return typeof util.types[row[0]] === "function";
|
|
3538
|
+
});
|
|
3539
|
+
function _kindName(v) {
|
|
3540
|
+
for (var i = 0; i < _NAMED_KINDS.length; i++) {
|
|
3541
|
+
if (util.types[_NAMED_KINDS[i][0]](v)) return _NAMED_KINDS[i][1];
|
|
3542
|
+
}
|
|
3543
|
+
return typeof v === "function" ? "function" : "value";
|
|
3544
|
+
}
|
|
3545
|
+
function _article(name) {
|
|
3546
|
+
return _reTest(/^[AEIOU]/i, name) ? "an" : "a";
|
|
3547
|
+
}
|
|
3548
|
+
function outputView(input, ErrorClass, code, label) {
|
|
3549
|
+
if (!util.types.isUint8Array(input) && !_isView(input)) {
|
|
3550
|
+
throw _raise(ErrorClass, code, label + ": expected a Buffer / TypedArray to write into");
|
|
3551
|
+
}
|
|
3552
|
+
try {
|
|
3553
|
+
return _reView(input);
|
|
3554
|
+
} catch (e) {
|
|
3555
|
+
throw _raise(ErrorClass, code, label + ": output is not a usable byte view (detached backing buffer?)", e);
|
|
3556
|
+
}
|
|
3557
|
+
}
|
|
3558
|
+
function lengthOf(view2) {
|
|
3559
|
+
return _lengthOf(view2);
|
|
3560
|
+
}
|
|
3561
|
+
function _refuseShared(v, ErrorClass, code, label) {
|
|
3562
|
+
if (util.types.isSharedArrayBuffer(v) || _isView(v) && util.types.isSharedArrayBuffer(_storeOf(v))) {
|
|
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");
|
|
3564
|
+
}
|
|
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
|
+
}
|
|
2806
3577
|
function _raise(E, code, message, cause) {
|
|
2807
|
-
return E
|
|
3578
|
+
return _isErrorClass(E) ? new E(code, message, cause) : E(code, message, cause);
|
|
2808
3579
|
}
|
|
2809
3580
|
function view(input, ErrorClass, code, label) {
|
|
2810
|
-
|
|
3581
|
+
_refuseShared(input, ErrorClass, code, label);
|
|
3582
|
+
if (util.types.isUint8Array(input)) {
|
|
2811
3583
|
try {
|
|
2812
|
-
return
|
|
3584
|
+
return _reView(input);
|
|
2813
3585
|
} catch (e) {
|
|
2814
3586
|
throw _raise(ErrorClass, code, label + ": input is not a usable byte view (detached backing buffer?)", e);
|
|
2815
3587
|
}
|
|
@@ -2817,10 +3589,11 @@ var require_guard_bytes = __commonJS({
|
|
|
2817
3589
|
throw _raise(ErrorClass, code, label + ": expected a Buffer / Uint8Array");
|
|
2818
3590
|
}
|
|
2819
3591
|
function source(input, ErrorClass, code, label) {
|
|
2820
|
-
|
|
2821
|
-
|
|
3592
|
+
_refuseShared(input, ErrorClass, code, label);
|
|
3593
|
+
var isAb = _isArrayBuffer(input);
|
|
3594
|
+
if (isAb || _isView(input)) {
|
|
2822
3595
|
try {
|
|
2823
|
-
return isAb ?
|
|
3596
|
+
return isAb ? _bufferFrom(input) : _reView(input);
|
|
2824
3597
|
} catch (e) {
|
|
2825
3598
|
throw _raise(ErrorClass, code, label + ": input is not a usable byte source (detached backing buffer?)", e);
|
|
2826
3599
|
}
|
|
@@ -2828,39 +3601,62 @@ var require_guard_bytes = __commonJS({
|
|
|
2828
3601
|
throw _raise(ErrorClass, code, label + ": expected a BufferSource (ArrayBuffer / TypedArray / Buffer)");
|
|
2829
3602
|
}
|
|
2830
3603
|
function snapshot(input, ErrorClass, code, label) {
|
|
2831
|
-
return
|
|
3604
|
+
return _bufferFrom(view(input, ErrorClass, code, label));
|
|
2832
3605
|
}
|
|
2833
3606
|
function snapshotSource(input, ErrorClass, code, label) {
|
|
2834
|
-
return
|
|
3607
|
+
return _bufferFrom(source(input, ErrorClass, code, label));
|
|
2835
3608
|
}
|
|
2836
3609
|
function snapshotDeep(value, ErrorClass, code, label, opts) {
|
|
2837
3610
|
var o = opts || {};
|
|
2838
3611
|
var cap = o.maxDepth == null ? 64 : o.maxDepth;
|
|
2839
3612
|
return _deep(value, ErrorClass, code, label, cap, 0, o.collect || null);
|
|
2840
3613
|
}
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
3614
|
+
function _surface(names) {
|
|
3615
|
+
var t = _create(null);
|
|
3616
|
+
_forEach(names, function(n) {
|
|
3617
|
+
t[n] = 1;
|
|
3618
|
+
});
|
|
3619
|
+
t[Symbol.toStringTag] = 1;
|
|
3620
|
+
return t;
|
|
3621
|
+
}
|
|
3622
|
+
var _CRYPTO_KEY_SURFACE = _surface([
|
|
3623
|
+
"type",
|
|
3624
|
+
"extractable",
|
|
3625
|
+
"algorithm",
|
|
3626
|
+
"usages",
|
|
3627
|
+
"asymmetricKeyType",
|
|
3628
|
+
"asymmetricKeyDetails",
|
|
3629
|
+
"_handle"
|
|
3630
|
+
]);
|
|
3631
|
+
var _ERROR_SURFACE = _surface(["message", "stack", "name", "cause"]);
|
|
3632
|
+
var _REGEXP_SURFACE = _surface([
|
|
3633
|
+
"lastIndex",
|
|
3634
|
+
"source",
|
|
3635
|
+
"flags",
|
|
3636
|
+
"global",
|
|
3637
|
+
"ignoreCase",
|
|
3638
|
+
"multiline",
|
|
3639
|
+
"sticky",
|
|
3640
|
+
"unicode",
|
|
3641
|
+
"unicodeSets",
|
|
3642
|
+
"hasIndices",
|
|
3643
|
+
"dotAll"
|
|
3644
|
+
]);
|
|
3645
|
+
var _THENABLE_SURFACE = _surface(["then", "catch", "finally"]);
|
|
2857
3646
|
function _opaqueSurface(v, ErrorClass, code, label) {
|
|
2858
|
-
var proto =
|
|
2859
|
-
if (proto ===
|
|
2860
|
-
if (v
|
|
2861
|
-
if (v
|
|
2862
|
-
if (v
|
|
2863
|
-
if (
|
|
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;
|
|
3651
|
+
if (util.types.isRegExp(v)) return _REGEXP_SURFACE;
|
|
3652
|
+
if (util.types.isKeyObject(v)) return _CRYPTO_KEY_SURFACE;
|
|
3653
|
+
var keyLike;
|
|
3654
|
+
try {
|
|
3655
|
+
keyLike = require_webcrypto().isCryptoKeyLike(v);
|
|
3656
|
+
} catch (e) {
|
|
3657
|
+
throw _raise(ErrorClass, code, label + ": reading the key surface threw", e);
|
|
3658
|
+
}
|
|
3659
|
+
if (keyLike) return _CRYPTO_KEY_SURFACE;
|
|
2864
3660
|
var then;
|
|
2865
3661
|
try {
|
|
2866
3662
|
then = v.then;
|
|
@@ -2870,96 +3666,163 @@ var require_guard_bytes = __commonJS({
|
|
|
2870
3666
|
if (typeof then === "function") return _THENABLE_SURFACE;
|
|
2871
3667
|
return null;
|
|
2872
3668
|
}
|
|
2873
|
-
function
|
|
2874
|
-
var
|
|
2875
|
-
for (var
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
3669
|
+
function _canChangeAfterTheCheck(v, name) {
|
|
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);
|
|
3674
|
+
if (!d) continue;
|
|
3675
|
+
if (d.get || d.set || d.writable || d.configurable) return true;
|
|
3676
|
+
return o !== v && _isExtensible(v);
|
|
2879
3677
|
}
|
|
2880
|
-
return
|
|
3678
|
+
return false;
|
|
2881
3679
|
}
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
3680
|
+
var _SETTLED_DEPTH = 4;
|
|
3681
|
+
function _settledValueIsFixed(value, ErrorClass, code, label, depth) {
|
|
3682
|
+
if (value === null || typeof value !== "object" && typeof value !== "function") return true;
|
|
3683
|
+
if (depth >= _SETTLED_DEPTH) return false;
|
|
3684
|
+
if (util.types.isProxy(value)) return false;
|
|
3685
|
+
var surface = _opaqueSurface(value, ErrorClass, code, label);
|
|
3686
|
+
if (!surface) return false;
|
|
3687
|
+
return _opaqueFieldOutsideSurface(value, surface, ErrorClass, code, label, depth + 1) === null;
|
|
3688
|
+
}
|
|
3689
|
+
function _opaqueFieldOutsideSurface(v, surface, ErrorClass, code, label, depth) {
|
|
3690
|
+
var keys = _namesToCopy(v, ErrorClass, code, label);
|
|
3691
|
+
for (var i = 0; i < keys.length; i++) {
|
|
3692
|
+
if (surface[keys[i]]) continue;
|
|
3693
|
+
if (typeof keys[i] === "symbol") continue;
|
|
3694
|
+
if (!_canChangeAfterTheCheck(v, keys[i]) && _settledValueIsFixed(v[keys[i]], ErrorClass, code, label, depth || 0)) continue;
|
|
3695
|
+
return keys[i];
|
|
2892
3696
|
}
|
|
2893
|
-
return
|
|
3697
|
+
return null;
|
|
2894
3698
|
}
|
|
2895
3699
|
function _copyBytesSameKind(v, ErrorClass, code, label, collect) {
|
|
2896
3700
|
var src = source(v, ErrorClass, code, label);
|
|
2897
|
-
var
|
|
2898
|
-
new
|
|
2899
|
-
|
|
2900
|
-
if (
|
|
2901
|
-
if (v
|
|
2902
|
-
if (v
|
|
2903
|
-
return new
|
|
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);
|
|
3706
|
+
if (_isArrayBuffer(v)) return owned;
|
|
3707
|
+
if (util.types.isDataView(v)) return new _DataView(owned);
|
|
3708
|
+
var Ctor = _concreteKindOf(v);
|
|
3709
|
+
if (!Ctor) {
|
|
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");
|
|
3711
|
+
}
|
|
3712
|
+
return new Ctor(owned, 0, srcLen / Ctor.BYTES_PER_ELEMENT);
|
|
3713
|
+
}
|
|
3714
|
+
function _protoChainIsCyclic(v) {
|
|
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);
|
|
3719
|
+
}
|
|
3720
|
+
return false;
|
|
3721
|
+
}
|
|
3722
|
+
function _protoChainHasProxy(v) {
|
|
3723
|
+
var visited = new _Set();
|
|
3724
|
+
for (var o = v; o && !_setHas(visited, o); o = _getPrototypeOf(o)) {
|
|
3725
|
+
_setAdd(visited, o);
|
|
3726
|
+
if (util.types.isProxy(o)) return true;
|
|
3727
|
+
}
|
|
3728
|
+
return false;
|
|
3729
|
+
}
|
|
3730
|
+
function _plainCopy(copy) {
|
|
3731
|
+
return copy;
|
|
2904
3732
|
}
|
|
2905
3733
|
function _deep(v, ErrorClass, code, label, cap, depth, collect) {
|
|
2906
3734
|
if (depth > cap) throw _raise(ErrorClass, code, label + " is nested too deeply to copy");
|
|
2907
3735
|
if (v == null || typeof v !== "object") return v;
|
|
2908
|
-
|
|
3736
|
+
_refuseShared(v, ErrorClass, code, label);
|
|
3737
|
+
if (_protoChainHasProxy(v)) {
|
|
3738
|
+
throw _raise(ErrorClass, code, label + ": a Proxy cannot be copied faithfully, because the keys it reports need not be the ones it answers; pass a plain object");
|
|
3739
|
+
}
|
|
3740
|
+
if (_protoChainIsCyclic(v)) {
|
|
3741
|
+
throw _raise(ErrorClass, code, label + ": its prototype chain is a cycle, so it cannot be read or copied; pass a plain object");
|
|
3742
|
+
}
|
|
3743
|
+
if (_isBuffer(v) || _isView(v) || _isArrayBuffer(v)) {
|
|
2909
3744
|
var bytesCopy = _copyBytesSameKind(v, ErrorClass, code, label, collect);
|
|
2910
3745
|
_copyNamed(v, bytesCopy, ErrorClass, code, label, cap, depth, collect);
|
|
2911
3746
|
return bytesCopy;
|
|
2912
3747
|
}
|
|
2913
3748
|
if (require_guard_parsed().isRecordedAsProduced(v)) return v;
|
|
2914
|
-
if (
|
|
2915
|
-
|
|
3749
|
+
if (util.types.isDate(v)) {
|
|
3750
|
+
var dateCopy = new _Date(time.instantOf(v));
|
|
3751
|
+
_copyNamed(v, dateCopy, ErrorClass, code, label, cap, depth, collect, _DATE_BEHAVIOR);
|
|
3752
|
+
return _plainCopy(dateCopy);
|
|
3753
|
+
}
|
|
3754
|
+
if (_isArray(v)) {
|
|
2916
3755
|
var arr = [];
|
|
2917
|
-
|
|
3756
|
+
var indexE = function(c, m) {
|
|
3757
|
+
return _raise(ErrorClass, c, m);
|
|
3758
|
+
};
|
|
3759
|
+
var indices = identifier.readableIndices(v, indexE, code, label);
|
|
3760
|
+
if (depth === 0) identifier.refuseAccessorFields(v, indices, indexE, code, label);
|
|
3761
|
+
_forEach(indices, function(k) {
|
|
3762
|
+
var element;
|
|
3763
|
+
try {
|
|
3764
|
+
element = v[k];
|
|
3765
|
+
} catch (e) {
|
|
3766
|
+
throw _raise(ErrorClass, code, label + ": reading element " + k + " threw", e);
|
|
3767
|
+
}
|
|
3768
|
+
arr[k] = _deep(element, ErrorClass, code, label, cap, depth + 1, collect);
|
|
3769
|
+
});
|
|
3770
|
+
arr.length = v.length;
|
|
2918
3771
|
_copyNamed(v, arr, ErrorClass, code, label, cap, depth, collect);
|
|
2919
|
-
return arr;
|
|
3772
|
+
return _plainCopy(arr);
|
|
2920
3773
|
}
|
|
2921
3774
|
var surface = _opaqueSurface(v, ErrorClass, code, label);
|
|
2922
3775
|
if (surface) {
|
|
2923
|
-
|
|
2924
|
-
|
|
3776
|
+
var carried = _opaqueFieldOutsideSurface(v, surface, ErrorClass, code, label);
|
|
3777
|
+
if (carried === null) return v;
|
|
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");
|
|
2925
3779
|
}
|
|
2926
|
-
if (
|
|
2927
|
-
|
|
2928
|
-
|
|
3780
|
+
if (util.types.isMap(v)) {
|
|
3781
|
+
return _plainCopy(_copyEntries(v, new _Map(), ErrorClass, code, label, cap, depth, collect));
|
|
3782
|
+
}
|
|
3783
|
+
if (util.types.isSet(v)) {
|
|
3784
|
+
return _plainCopy(_copyEntries(v, new _Set(), ErrorClass, code, label, cap, depth, collect));
|
|
3785
|
+
}
|
|
3786
|
+
var out = _create(_getPrototypeOf(v) === null ? null : _ObjectProto);
|
|
2929
3787
|
_copyNamed(v, out, ErrorClass, code, label, cap, depth, collect);
|
|
2930
3788
|
return out;
|
|
2931
3789
|
}
|
|
2932
|
-
function _namesToCopy(src,
|
|
2933
|
-
var
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
var
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
if (own[i] === "length" || indexed && String(Number(own[i])) === own[i]) continue;
|
|
2940
|
-
out.push(own[i]);
|
|
2941
|
-
}
|
|
2942
|
-
return out;
|
|
3790
|
+
function _namesToCopy(src, ErrorClass, code, label, atArgument) {
|
|
3791
|
+
var E = function(c, m) {
|
|
3792
|
+
return _raise(ErrorClass, c, m);
|
|
3793
|
+
};
|
|
3794
|
+
var names = identifier.readableNames(src, E, code, label);
|
|
3795
|
+
if (atArgument) identifier.refuseAccessorFields(src, names, E, code, label);
|
|
3796
|
+
return names;
|
|
2943
3797
|
}
|
|
2944
3798
|
function _copyEntries(src, dst, ErrorClass, code, label, cap, depth, collect) {
|
|
2945
|
-
|
|
3799
|
+
var walk = util.types.isSet(src) ? _setForEach : _mapForEach;
|
|
3800
|
+
walk(src, function(value, key) {
|
|
2946
3801
|
var copiedValue = _deep(value, ErrorClass, code, label, cap, depth + 1, collect);
|
|
2947
|
-
if (dst
|
|
2948
|
-
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);
|
|
2949
3804
|
});
|
|
2950
3805
|
_copyNamed(src, dst, ErrorClass, code, label, cap, depth, collect);
|
|
2951
3806
|
return dst;
|
|
2952
3807
|
}
|
|
2953
|
-
|
|
2954
|
-
var
|
|
3808
|
+
var _DATE_BEHAVIOR = (function() {
|
|
3809
|
+
var t = _create(null);
|
|
3810
|
+
_forEach(_ownKeys(Date.prototype), function(n) {
|
|
3811
|
+
t[n] = 1;
|
|
3812
|
+
});
|
|
3813
|
+
return t;
|
|
3814
|
+
})();
|
|
3815
|
+
function _copyNamed(src, dst, ErrorClass, code, label, cap, depth, collect, behavior) {
|
|
3816
|
+
var keys = _namesToCopy(src, ErrorClass, code, label, depth === 0);
|
|
2955
3817
|
for (var k = 0; k < keys.length; k++) {
|
|
2956
3818
|
var value;
|
|
2957
3819
|
try {
|
|
2958
3820
|
value = src[keys[k]];
|
|
2959
3821
|
} catch (e) {
|
|
2960
|
-
throw _raise(ErrorClass, code, label + ": reading " +
|
|
3822
|
+
throw _raise(ErrorClass, code, label + ": reading " + _stringify(keys[k]) + " threw", e);
|
|
2961
3823
|
}
|
|
2962
|
-
|
|
3824
|
+
if (behavior && behavior[keys[k]] && typeof value === "function") continue;
|
|
3825
|
+
_defineProperty(dst, keys[k], {
|
|
2963
3826
|
value: typeof value === "function" ? value : _deep(value, ErrorClass, code, label, cap, depth + 1, collect),
|
|
2964
3827
|
writable: true,
|
|
2965
3828
|
enumerable: _wasEnumerable(src, keys[k]),
|
|
@@ -2968,8 +3831,8 @@ var require_guard_bytes = __commonJS({
|
|
|
2968
3831
|
}
|
|
2969
3832
|
}
|
|
2970
3833
|
function _wasEnumerable(v, name) {
|
|
2971
|
-
for (var o = v; o && o !==
|
|
2972
|
-
var d =
|
|
3834
|
+
for (var o = v; o && o !== _ObjectProto; o = _getPrototypeOf(o)) {
|
|
3835
|
+
var d = _getOwnPropertyDescriptor(o, name);
|
|
2973
3836
|
if (d) return !!d.enumerable;
|
|
2974
3837
|
}
|
|
2975
3838
|
return false;
|
|
@@ -2988,7 +3851,7 @@ var require_guard_bytes = __commonJS({
|
|
|
2988
3851
|
}
|
|
2989
3852
|
try {
|
|
2990
3853
|
for (var i = 0; i < args.length; i++) {
|
|
2991
|
-
values
|
|
3854
|
+
_append(values, snapshotDeep(args[i][0], ErrorClass, code, args[i][1], { collect: copies }));
|
|
2992
3855
|
}
|
|
2993
3856
|
} catch (e) {
|
|
2994
3857
|
release();
|
|
@@ -2998,10 +3861,10 @@ var require_guard_bytes = __commonJS({
|
|
|
2998
3861
|
}
|
|
2999
3862
|
function fixedCall(ErrorClass, code, args, body) {
|
|
3000
3863
|
var handle = null;
|
|
3001
|
-
return async.deferred(function() {
|
|
3864
|
+
return _promiseFinally(async.deferred(function() {
|
|
3002
3865
|
handle = fixArguments(ErrorClass, code, args);
|
|
3003
|
-
return body
|
|
3004
|
-
})
|
|
3866
|
+
return _apply(body, null, handle.values);
|
|
3867
|
+
}), function() {
|
|
3005
3868
|
if (handle) handle.release();
|
|
3006
3869
|
});
|
|
3007
3870
|
}
|
|
@@ -3010,6 +3873,9 @@ var require_guard_bytes = __commonJS({
|
|
|
3010
3873
|
source,
|
|
3011
3874
|
snapshot,
|
|
3012
3875
|
snapshotSource,
|
|
3876
|
+
isByteSource,
|
|
3877
|
+
lengthOf,
|
|
3878
|
+
outputView,
|
|
3013
3879
|
snapshotDeep,
|
|
3014
3880
|
fixArguments,
|
|
3015
3881
|
fixedCall
|
|
@@ -3022,26 +3888,33 @@ var require_guard_text = __commonJS({
|
|
|
3022
3888
|
"node_modules/@blamejs/pki/lib/guard-text.js"(exports2, module2) {
|
|
3023
3889
|
"use strict";
|
|
3024
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;
|
|
3025
3898
|
var LATIN1 = "latin1";
|
|
3026
3899
|
function decode(input, maxBytes, ErrorClass, spec) {
|
|
3027
|
-
if (!
|
|
3900
|
+
if (!_isInteger(maxBytes) || maxBytes < 0) {
|
|
3028
3901
|
throw new TypeError("guard.text.decode: maxBytes must be a non-negative integer");
|
|
3029
3902
|
}
|
|
3030
3903
|
var charset = spec.charset || LATIN1;
|
|
3031
|
-
if (
|
|
3904
|
+
if (_isBuffer(input)) {
|
|
3032
3905
|
input = bytes.view(input, ErrorClass, spec.badInput, spec.label);
|
|
3033
|
-
if (input
|
|
3906
|
+
if (bytes.lengthOf(input) > maxBytes) throw new ErrorClass(spec.tooLarge, spec.label + " exceeds the size cap");
|
|
3034
3907
|
if (spec.fatal) {
|
|
3035
3908
|
try {
|
|
3036
|
-
return new
|
|
3909
|
+
return _decode(new _TextDecoder(charset, { fatal: true }), input);
|
|
3037
3910
|
} catch (e) {
|
|
3038
3911
|
throw new ErrorClass(spec.badDecode, spec.label + " is not valid " + charset, e);
|
|
3039
3912
|
}
|
|
3040
3913
|
}
|
|
3041
|
-
return input
|
|
3914
|
+
return _toString(input, charset);
|
|
3042
3915
|
}
|
|
3043
3916
|
if (typeof input === "string") {
|
|
3044
|
-
var byteLen = charset === LATIN1 ? input.length :
|
|
3917
|
+
var byteLen = charset === LATIN1 ? input.length : _byteLength(input, "utf8");
|
|
3045
3918
|
if (byteLen > maxBytes) throw new ErrorClass(spec.tooLarge, spec.label + " exceeds the size cap");
|
|
3046
3919
|
return input;
|
|
3047
3920
|
}
|
|
@@ -3056,14 +3929,16 @@ var require_guard_limits = __commonJS({
|
|
|
3056
3929
|
"node_modules/@blamejs/pki/lib/guard-limits.js"(exports2, module2) {
|
|
3057
3930
|
"use strict";
|
|
3058
3931
|
var constants = require_constants();
|
|
3932
|
+
var _isInteger = require_guard_intrinsic().isInteger;
|
|
3933
|
+
var _sizeOf = require_guard_intrinsic().sizeOf;
|
|
3059
3934
|
function cap(value, key, dflt, opts) {
|
|
3060
3935
|
if (value === void 0) return dflt;
|
|
3061
3936
|
opts = opts || {};
|
|
3062
3937
|
var min = opts.min === void 0 ? 0 : opts.min;
|
|
3063
|
-
if (!
|
|
3938
|
+
if (!_isInteger(min) || opts.max !== void 0 && !_isInteger(opts.max)) {
|
|
3064
3939
|
throw new TypeError("guard.limits.cap: the min/max bounds for " + key + " must be integers");
|
|
3065
3940
|
}
|
|
3066
|
-
if (!
|
|
3941
|
+
if (!_isInteger(value) || value < min || opts.max !== void 0 && value > opts.max) {
|
|
3067
3942
|
var want = "an integer >= " + min + (opts.max !== void 0 ? " and <= " + opts.max : "");
|
|
3068
3943
|
if (min === 0 && opts.max === void 0) want = "a non-negative integer";
|
|
3069
3944
|
if (opts.E) throw opts.E(opts.code, (opts.label || key) + " must be " + want);
|
|
@@ -3079,7 +3954,7 @@ var require_guard_limits = __commonJS({
|
|
|
3079
3954
|
return n;
|
|
3080
3955
|
}
|
|
3081
3956
|
function counter(max, E, code, label) {
|
|
3082
|
-
if (!
|
|
3957
|
+
if (!_isInteger(max) || max < 0) {
|
|
3083
3958
|
throw new TypeError("guard.limits.counter: max must be a non-negative integer");
|
|
3084
3959
|
}
|
|
3085
3960
|
var n = 0;
|
|
@@ -3091,11 +3966,12 @@ var require_guard_limits = __commonJS({
|
|
|
3091
3966
|
};
|
|
3092
3967
|
}
|
|
3093
3968
|
function byteCap(buf, max, E, code, label) {
|
|
3094
|
-
if (!
|
|
3969
|
+
if (!_isInteger(max) || max < 0) {
|
|
3095
3970
|
throw new TypeError("guard.limits.byteCap: max must be a non-negative integer");
|
|
3096
3971
|
}
|
|
3097
|
-
|
|
3098
|
-
|
|
3972
|
+
var size = _sizeOf(buf);
|
|
3973
|
+
if (size > max) {
|
|
3974
|
+
throw E(code, (label || "input") + " is " + size + " bytes, over the " + max + "-byte cap");
|
|
3099
3975
|
}
|
|
3100
3976
|
return buf;
|
|
3101
3977
|
}
|
|
@@ -3128,6 +4004,9 @@ var require_guard_crypto = __commonJS({
|
|
|
3128
4004
|
var require_guard_range = __commonJS({
|
|
3129
4005
|
"node_modules/@blamejs/pki/lib/guard-range.js"(exports2, module2) {
|
|
3130
4006
|
"use strict";
|
|
4007
|
+
var _isSafeInteger = require_guard_intrinsic().isSafeInteger;
|
|
4008
|
+
var _Number = require_guard_intrinsic().Number;
|
|
4009
|
+
var _BigInt = require_guard_intrinsic().BigInt;
|
|
3131
4010
|
var UINT31_MAX = 2147483647n;
|
|
3132
4011
|
var SAFE_MAX = 9007199254740991n;
|
|
3133
4012
|
var SAFE_MIN = -9007199254740991n;
|
|
@@ -3145,7 +4024,7 @@ var require_guard_range = __commonJS({
|
|
|
3145
4024
|
if (typeof value !== "bigint" || value < min || value > max) {
|
|
3146
4025
|
throw E(code, label + " must be an integer within " + min + ".." + max);
|
|
3147
4026
|
}
|
|
3148
|
-
return
|
|
4027
|
+
return _Number(value);
|
|
3149
4028
|
}
|
|
3150
4029
|
function uint31(value, E, code, label) {
|
|
3151
4030
|
return int(value, 0n, UINT31_MAX, E, code, label);
|
|
@@ -3157,8 +4036,8 @@ var require_guard_range = __commonJS({
|
|
|
3157
4036
|
var v;
|
|
3158
4037
|
if (typeof value === "bigint") {
|
|
3159
4038
|
v = value;
|
|
3160
|
-
} else if (typeof value === "number" &&
|
|
3161
|
-
v =
|
|
4039
|
+
} else if (typeof value === "number" && _isSafeInteger(value) && value >= 0) {
|
|
4040
|
+
v = _BigInt(value);
|
|
3162
4041
|
} else {
|
|
3163
4042
|
throw E(code, label + " must be a non-negative safe-integer Number or a BigInt (a uint64)");
|
|
3164
4043
|
}
|
|
@@ -3169,7 +4048,7 @@ var require_guard_range = __commonJS({
|
|
|
3169
4048
|
}
|
|
3170
4049
|
function authoredInteger(value, E, code, label) {
|
|
3171
4050
|
if (typeof value === "bigint") return value;
|
|
3172
|
-
if (typeof value === "number" &&
|
|
4051
|
+
if (typeof value === "number" && _isSafeInteger(value)) return _BigInt(value);
|
|
3173
4052
|
throw E(code, label + " must be an integer (a safe-integer number, or a bigint for a large value)");
|
|
3174
4053
|
}
|
|
3175
4054
|
module2.exports = {
|
|
@@ -3182,39 +4061,26 @@ var require_guard_range = __commonJS({
|
|
|
3182
4061
|
}
|
|
3183
4062
|
});
|
|
3184
4063
|
|
|
3185
|
-
// node_modules/@blamejs/pki/lib/guard-time.js
|
|
3186
|
-
var require_guard_time = __commonJS({
|
|
3187
|
-
"node_modules/@blamejs/pki/lib/guard-time.js"(exports2, module2) {
|
|
3188
|
-
"use strict";
|
|
3189
|
-
function assertValid(value, E, code, label) {
|
|
3190
|
-
if (!(value instanceof Date) || isNaN(value.getTime())) {
|
|
3191
|
-
throw E(code, (label || "value") + " must be a valid Date");
|
|
3192
|
-
}
|
|
3193
|
-
return value;
|
|
3194
|
-
}
|
|
3195
|
-
function within(instant, lower, upper, E, code, label, opts) {
|
|
3196
|
-
assertValid(instant, E, code, label);
|
|
3197
|
-
assertValid(lower, E, code, (label || "window") + " lower bound");
|
|
3198
|
-
assertValid(upper, E, code, (label || "window") + " upper bound");
|
|
3199
|
-
var t = instant.getTime();
|
|
3200
|
-
var lo = lower.getTime();
|
|
3201
|
-
var hi = upper.getTime();
|
|
3202
|
-
return t >= lo && (opts && opts.upperInclusive ? t <= hi : t < hi);
|
|
3203
|
-
}
|
|
3204
|
-
module2.exports = {
|
|
3205
|
-
assertValid,
|
|
3206
|
-
within
|
|
3207
|
-
};
|
|
3208
|
-
}
|
|
3209
|
-
});
|
|
3210
|
-
|
|
3211
4064
|
// node_modules/@blamejs/pki/lib/guard-name.js
|
|
3212
4065
|
var require_guard_name = __commonJS({
|
|
3213
4066
|
"node_modules/@blamejs/pki/lib/guard-name.js"(exports2, module2) {
|
|
3214
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;
|
|
3215
4081
|
function assertNoControlBytes(str, E, code, label) {
|
|
3216
4082
|
for (var i = 0; i < str.length; i++) {
|
|
3217
|
-
var c = str
|
|
4083
|
+
var c = _charCodeAt(str, i);
|
|
3218
4084
|
if (c === 0 || c < 32 && c !== 9) {
|
|
3219
4085
|
throw E(code, label + " contains an embedded control byte (CVE-2009-2408)");
|
|
3220
4086
|
}
|
|
@@ -3222,7 +4088,8 @@ var require_guard_name = __commonJS({
|
|
|
3222
4088
|
return str;
|
|
3223
4089
|
}
|
|
3224
4090
|
function assertPrintableIa5(buf, E, code, label) {
|
|
3225
|
-
|
|
4091
|
+
var n = intrinsic.sizeOf(buf);
|
|
4092
|
+
for (var i = 0; i < n; i++) {
|
|
3226
4093
|
if (buf[i] < 32 || buf[i] > 126) {
|
|
3227
4094
|
throw E(code, label + " must be a printable IA5String (no control bytes)");
|
|
3228
4095
|
}
|
|
@@ -3237,25 +4104,34 @@ var require_guard_name = __commonJS({
|
|
|
3237
4104
|
assertNoControlBytes(v, E, code, label);
|
|
3238
4105
|
var out = "", lastWasSpace = true;
|
|
3239
4106
|
for (var i = 0; i < v.length; i++) {
|
|
3240
|
-
if (_isSpace(v
|
|
4107
|
+
if (_isSpace(_charCodeAt(v, i))) {
|
|
3241
4108
|
lastWasSpace = true;
|
|
3242
4109
|
continue;
|
|
3243
4110
|
}
|
|
3244
4111
|
if (lastWasSpace && out.length) out += " ";
|
|
3245
4112
|
lastWasSpace = false;
|
|
3246
|
-
out += v
|
|
4113
|
+
out += _charAt(v, i);
|
|
3247
4114
|
}
|
|
3248
|
-
return out
|
|
4115
|
+
return _toLowerCase(out);
|
|
3249
4116
|
}
|
|
3250
4117
|
function _assertSequence(a, b, E, code, label, what) {
|
|
3251
|
-
if (!
|
|
4118
|
+
if (!_isArray(a) || !_isArray(b)) {
|
|
3252
4119
|
throw E(code, "cannot compare " + label + ": " + what + " comparison requires the RDN sequence on both sides (pass name.rdns, not the parsed Name)");
|
|
3253
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;
|
|
3254
4130
|
}
|
|
3255
4131
|
function rdnEqual(a, b, E, code, label) {
|
|
3256
4132
|
_assertSequence(a, b, E, code, label, "an RDN");
|
|
3257
4133
|
if (a.length !== b.length) return false;
|
|
3258
|
-
var used =
|
|
4134
|
+
var used = _create(null);
|
|
3259
4135
|
for (var i = 0; i < a.length; i++) {
|
|
3260
4136
|
var found = false;
|
|
3261
4137
|
for (var j = 0; j < b.length; j++) {
|
|
@@ -3279,46 +4155,46 @@ var require_guard_name = __commonJS({
|
|
|
3279
4155
|
return true;
|
|
3280
4156
|
}
|
|
3281
4157
|
function escapeControlBytes(str) {
|
|
3282
|
-
var s =
|
|
4158
|
+
var s = _String(str), out = "";
|
|
3283
4159
|
for (var i = 0; i < s.length; i++) {
|
|
3284
|
-
var c = s
|
|
3285
|
-
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);
|
|
3286
4162
|
}
|
|
3287
4163
|
return out;
|
|
3288
4164
|
}
|
|
3289
4165
|
var DN_SPECIAL = { 44: 1, 43: 1, 34: 1, 92: 1, 60: 1, 62: 1, 59: 1 };
|
|
3290
4166
|
function escapeDnValue(v) {
|
|
3291
|
-
var s =
|
|
4167
|
+
var s = _String(v), out = "";
|
|
3292
4168
|
for (var i = 0; i < s.length; i++) {
|
|
3293
|
-
var c = s
|
|
3294
|
-
if (c < 32 || c === 127) out += "\\" + (c < 16 ? "0" : "") + c
|
|
3295
|
-
else if (DN_SPECIAL[c] === 1) out += "\\" + s
|
|
3296
|
-
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);
|
|
3297
4173
|
}
|
|
3298
|
-
if (out.length &&
|
|
3299
|
-
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;
|
|
3300
4176
|
return out;
|
|
3301
4177
|
}
|
|
3302
4178
|
function emailEqual(a, b) {
|
|
3303
4179
|
if (typeof a !== "string" || typeof b !== "string") return "not-comparable";
|
|
3304
|
-
var ai = a
|
|
4180
|
+
var ai = _lastIndexOf(a, "@"), bi = _lastIndexOf(b, "@");
|
|
3305
4181
|
if (ai <= 0 || bi <= 0 || ai === a.length - 1 || bi === b.length - 1) return "not-comparable";
|
|
3306
|
-
var aLocal = a
|
|
3307
|
-
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);
|
|
3308
4184
|
if (!_asciiHost(aHost) || !_asciiHost(bHost)) return "not-comparable";
|
|
3309
4185
|
if (aLocal !== bLocal) return "no-match";
|
|
3310
4186
|
return _lowerAscii(aHost) === _lowerAscii(bHost) ? "match" : "no-match";
|
|
3311
4187
|
}
|
|
3312
4188
|
function _asciiHost(h) {
|
|
3313
4189
|
if (h.length === 0) return false;
|
|
3314
|
-
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;
|
|
3315
4191
|
return true;
|
|
3316
4192
|
}
|
|
3317
4193
|
function _lowerAscii(s) {
|
|
3318
4194
|
var out = "";
|
|
3319
4195
|
for (var i = 0; i < s.length; i++) {
|
|
3320
|
-
var c = s
|
|
3321
|
-
out += c >= 65 && c <= 90 ?
|
|
4196
|
+
var c = _charCodeAt(s, i);
|
|
4197
|
+
out += c >= 65 && c <= 90 ? _fromCharCode(c + 32) : _charAt(s, i);
|
|
3322
4198
|
}
|
|
3323
4199
|
return out;
|
|
3324
4200
|
}
|
|
@@ -3340,9 +4216,17 @@ var require_guard_encoding = __commonJS({
|
|
|
3340
4216
|
"use strict";
|
|
3341
4217
|
function _alphabet(chars) {
|
|
3342
4218
|
var t = new Uint8Array(128);
|
|
3343
|
-
for (var i = 0; i < chars.length; i++) t[chars
|
|
4219
|
+
for (var i = 0; i < chars.length; i++) t[_charCodeAt(chars, i)] = 1;
|
|
3344
4220
|
return t;
|
|
3345
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;
|
|
3346
4230
|
var UPPER = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
3347
4231
|
var LOWER = "abcdefghijklmnopqrstuvwxyz";
|
|
3348
4232
|
var DIGITS = "0123456789";
|
|
@@ -3351,17 +4235,17 @@ var require_guard_encoding = __commonJS({
|
|
|
3351
4235
|
var HEX_ALPHABET = _alphabet(DIGITS + "abcdefABCDEF");
|
|
3352
4236
|
function _inAlphabet(text, table) {
|
|
3353
4237
|
for (var i = 0; i < text.length; i++) {
|
|
3354
|
-
var c = text
|
|
4238
|
+
var c = _charCodeAt(text, i);
|
|
3355
4239
|
if (c > 127 || table[c] !== 1) return false;
|
|
3356
4240
|
}
|
|
3357
4241
|
return true;
|
|
3358
4242
|
}
|
|
3359
4243
|
function _capBefore(nChars, perByteChars, maxBytes, E, code, label) {
|
|
3360
4244
|
if (maxBytes == null) return;
|
|
3361
|
-
if (!
|
|
4245
|
+
if (!_isInteger(maxBytes) || maxBytes < 0) {
|
|
3362
4246
|
throw new TypeError("guard.encoding: maxBytes must be a non-negative integer or null");
|
|
3363
4247
|
}
|
|
3364
|
-
if (
|
|
4248
|
+
if (_floor(nChars / perByteChars) > maxBytes) {
|
|
3365
4249
|
throw E(code, label + " exceeds the maximum decoded size of " + maxBytes + " bytes");
|
|
3366
4250
|
}
|
|
3367
4251
|
}
|
|
@@ -3370,19 +4254,19 @@ var require_guard_encoding = __commonJS({
|
|
|
3370
4254
|
if (!_inAlphabet(text, B64URL_ALPHABET)) throw E(code, label + " is not base64url (padding or a non-alphabet character)");
|
|
3371
4255
|
if (text.length % 4 === 1) throw E(code, label + " has an impossible base64url length");
|
|
3372
4256
|
_capBefore(text.length * 3, 4, maxBytes, E, code, label);
|
|
3373
|
-
var buf =
|
|
3374
|
-
if (buf
|
|
4257
|
+
var buf = _bufferFrom(text, "base64url");
|
|
4258
|
+
if (_toString(buf, "base64url") !== text) throw E(code, label + " is not canonical base64url");
|
|
3375
4259
|
return buf;
|
|
3376
4260
|
}
|
|
3377
4261
|
function base64(text, maxBytes, E, code, label) {
|
|
3378
4262
|
if (typeof text !== "string") throw E(code, label + " must be a string");
|
|
3379
4263
|
var pad = 0;
|
|
3380
|
-
while (pad < 2 && text.length > pad &&
|
|
3381
|
-
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)");
|
|
3382
4266
|
if (text.length % 4 !== 0) throw E(code, label + " must be whole 4-character base64 groups (RFC 4648 sec. 3.5)");
|
|
3383
4267
|
_capBefore(text.length * 3, 4, maxBytes, E, code, label);
|
|
3384
|
-
var buf =
|
|
3385
|
-
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)");
|
|
3386
4270
|
return buf;
|
|
3387
4271
|
}
|
|
3388
4272
|
function hex(text, maxBytes, E, code, label) {
|
|
@@ -3390,8 +4274,8 @@ var require_guard_encoding = __commonJS({
|
|
|
3390
4274
|
if (!_inAlphabet(text, HEX_ALPHABET)) throw E(code, label + " is not hexadecimal");
|
|
3391
4275
|
if (text.length % 2 !== 0) throw E(code, label + " must have an even number of hex digits");
|
|
3392
4276
|
_capBefore(text.length, 2, maxBytes, E, code, label);
|
|
3393
|
-
var buf =
|
|
3394
|
-
if (buf
|
|
4277
|
+
var buf = _bufferFrom(text, "hex");
|
|
4278
|
+
if (_toString(buf, "hex") !== _toLowerCase(text)) throw E(code, label + " is not canonical hexadecimal");
|
|
3395
4279
|
return buf;
|
|
3396
4280
|
}
|
|
3397
4281
|
module2.exports = { base64url, base64, hex };
|
|
@@ -3402,6 +4286,10 @@ var require_guard_encoding = __commonJS({
|
|
|
3402
4286
|
var require_guard_der = __commonJS({
|
|
3403
4287
|
"node_modules/@blamejs/pki/lib/guard-der.js"(exports2, module2) {
|
|
3404
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;
|
|
3405
4293
|
var asn1 = null;
|
|
3406
4294
|
function _asn1() {
|
|
3407
4295
|
if (asn1 === null) asn1 = require_asn1_der();
|
|
@@ -3411,7 +4299,7 @@ var require_guard_der = __commonJS({
|
|
|
3411
4299
|
function _readers() {
|
|
3412
4300
|
if (VALUE_READERS !== null) return VALUE_READERS;
|
|
3413
4301
|
var asn12 = _asn1();
|
|
3414
|
-
var m =
|
|
4302
|
+
var m = _create(null), R = asn12.read, T = asn12.TAGS;
|
|
3415
4303
|
m[T.BOOLEAN] = R.boolean;
|
|
3416
4304
|
m[T.INTEGER] = R.integer;
|
|
3417
4305
|
m[T.ENUMERATED] = R.enumerated;
|
|
@@ -3422,7 +4310,7 @@ var require_guard_der = __commonJS({
|
|
|
3422
4310
|
m[T.UTC_TIME] = R.time;
|
|
3423
4311
|
m[T.GENERALIZED_TIME] = R.time;
|
|
3424
4312
|
m[T.NUMERIC_STRING] = R.numericString;
|
|
3425
|
-
[
|
|
4313
|
+
_forEach([
|
|
3426
4314
|
T.UTF8_STRING,
|
|
3427
4315
|
T.PRINTABLE_STRING,
|
|
3428
4316
|
T.IA5_STRING,
|
|
@@ -3430,15 +4318,19 @@ var require_guard_der = __commonJS({
|
|
|
3430
4318
|
T.VISIBLE_STRING,
|
|
3431
4319
|
T.BMP_STRING,
|
|
3432
4320
|
T.UNIVERSAL_STRING
|
|
3433
|
-
]
|
|
4321
|
+
], function(t) {
|
|
3434
4322
|
m[t] = R.string;
|
|
3435
4323
|
});
|
|
3436
4324
|
VALUE_READERS = m;
|
|
3437
4325
|
return VALUE_READERS;
|
|
3438
4326
|
}
|
|
3439
|
-
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;
|
|
3440
4332
|
function setOrderOk(kids) {
|
|
3441
|
-
var i, dup = false, seen =
|
|
4333
|
+
var i, dup = false, seen = _create(null);
|
|
3442
4334
|
for (i = 0; i < kids.length; i++) {
|
|
3443
4335
|
var key = kids[i].tagClass + ":" + kids[i].tagNumber;
|
|
3444
4336
|
if (seen[key]) {
|
|
@@ -3449,7 +4341,7 @@ var require_guard_der = __commonJS({
|
|
|
3449
4341
|
}
|
|
3450
4342
|
var octetAsc = true, tagAsc = true;
|
|
3451
4343
|
for (i = 1; i < kids.length; i++) {
|
|
3452
|
-
if (
|
|
4344
|
+
if (_compare(kids[i - 1].bytes, kids[i].bytes) > 0) octetAsc = false;
|
|
3453
4345
|
var pc = TAG_CLASS_RANK[kids[i - 1].tagClass], cc = TAG_CLASS_RANK[kids[i].tagClass];
|
|
3454
4346
|
if (pc !== cc ? pc > cc : kids[i - 1].tagNumber > kids[i].tagNumber) tagAsc = false;
|
|
3455
4347
|
}
|
|
@@ -3482,7 +4374,7 @@ var require_guard_der = __commonJS({
|
|
|
3482
4374
|
}
|
|
3483
4375
|
}
|
|
3484
4376
|
function tlv(content, E, code, label) {
|
|
3485
|
-
if (!content || content
|
|
4377
|
+
if (!content || _sizeOf(content) === 0) throw E(code, label + " must be a non-empty DER element");
|
|
3486
4378
|
var node;
|
|
3487
4379
|
try {
|
|
3488
4380
|
node = _asn1().decode(content);
|
|
@@ -3501,6 +4393,17 @@ var require_guard_json = __commonJS({
|
|
|
3501
4393
|
"node_modules/@blamejs/pki/lib/guard-json.js"(exports2, module2) {
|
|
3502
4394
|
"use strict";
|
|
3503
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
|
+
}
|
|
3504
4407
|
var limits = require_guard_limits();
|
|
3505
4408
|
function _hexVal(c) {
|
|
3506
4409
|
if (c >= 48 && c <= 57) return c - 48;
|
|
@@ -3528,7 +4431,7 @@ var require_guard_json = __commonJS({
|
|
|
3528
4431
|
var i = 0, n = str.length;
|
|
3529
4432
|
function ws() {
|
|
3530
4433
|
while (i < n) {
|
|
3531
|
-
var c = str
|
|
4434
|
+
var c = _charCodeAt(str, i);
|
|
3532
4435
|
if (c === 32 || c === 9 || c === 10 || c === 13) i++;
|
|
3533
4436
|
else break;
|
|
3534
4437
|
}
|
|
@@ -3545,15 +4448,15 @@ var require_guard_json = __commonJS({
|
|
|
3545
4448
|
if (c === "[") return array(depth);
|
|
3546
4449
|
if (c === '"') return string();
|
|
3547
4450
|
if (c === "-" || c >= "0" && c <= "9") return number();
|
|
3548
|
-
if (str
|
|
4451
|
+
if (_strSlice(str, i, i + 4) === "true") {
|
|
3549
4452
|
i += 4;
|
|
3550
4453
|
return true;
|
|
3551
4454
|
}
|
|
3552
|
-
if (str
|
|
4455
|
+
if (_strSlice(str, i, i + 5) === "false") {
|
|
3553
4456
|
i += 5;
|
|
3554
4457
|
return false;
|
|
3555
4458
|
}
|
|
3556
|
-
if (str
|
|
4459
|
+
if (_strSlice(str, i, i + 4) === "null") {
|
|
3557
4460
|
i += 4;
|
|
3558
4461
|
return null;
|
|
3559
4462
|
}
|
|
@@ -3572,11 +4475,11 @@ var require_guard_json = __commonJS({
|
|
|
3572
4475
|
ws();
|
|
3573
4476
|
if (str[i] !== '"') fail("expected a string key");
|
|
3574
4477
|
var key = string();
|
|
3575
|
-
if (
|
|
4478
|
+
if (_hasOwn(out, key)) throw E(spec.duplicateMember, "duplicate JSON member " + _stringify(key));
|
|
3576
4479
|
ws();
|
|
3577
4480
|
if (str[i] !== ":") fail("expected ':'");
|
|
3578
4481
|
i++;
|
|
3579
|
-
|
|
4482
|
+
_defineProperty(out, key, { value: value(depth + 1), writable: true, enumerable: true, configurable: true });
|
|
3580
4483
|
ws();
|
|
3581
4484
|
if (str[i] === ",") {
|
|
3582
4485
|
i++;
|
|
@@ -3598,7 +4501,7 @@ var require_guard_json = __commonJS({
|
|
|
3598
4501
|
return out;
|
|
3599
4502
|
}
|
|
3600
4503
|
for (; ; ) {
|
|
3601
|
-
out
|
|
4504
|
+
_append(out, value(depth + 1));
|
|
3602
4505
|
ws();
|
|
3603
4506
|
if (str[i] === ",") {
|
|
3604
4507
|
i++;
|
|
@@ -3633,14 +4536,14 @@ var require_guard_json = __commonJS({
|
|
|
3633
4536
|
var cp = 0;
|
|
3634
4537
|
if (i + 4 > n) fail("bad \\u escape");
|
|
3635
4538
|
for (var h = 0; h < 4; h++) {
|
|
3636
|
-
var d = _hexVal(str
|
|
4539
|
+
var d = _hexVal(_charCodeAt(str, i + h));
|
|
3637
4540
|
if (d < 0) fail("bad \\u escape");
|
|
3638
4541
|
cp = cp << 4 | d;
|
|
3639
4542
|
}
|
|
3640
|
-
s +=
|
|
4543
|
+
s += _fromCharCode(cp);
|
|
3641
4544
|
i += 4;
|
|
3642
4545
|
} else fail("bad escape");
|
|
3643
|
-
} else if (c
|
|
4546
|
+
} else if (_charCodeAt(c, 0) < 32) {
|
|
3644
4547
|
fail("control character in string");
|
|
3645
4548
|
} else s += c;
|
|
3646
4549
|
}
|
|
@@ -3666,8 +4569,8 @@ var require_guard_json = __commonJS({
|
|
|
3666
4569
|
while (i < n && str[i] >= "0" && str[i] <= "9") i++;
|
|
3667
4570
|
if (i === expStart) fail("malformed number");
|
|
3668
4571
|
}
|
|
3669
|
-
var v =
|
|
3670
|
-
if (!
|
|
4572
|
+
var v = _Number(_strSlice(str, start, i));
|
|
4573
|
+
if (!_isFinite(v)) fail("bad number");
|
|
3671
4574
|
return v;
|
|
3672
4575
|
}
|
|
3673
4576
|
var result = value(0);
|
|
@@ -3679,73 +4582,28 @@ var require_guard_json = __commonJS({
|
|
|
3679
4582
|
}
|
|
3680
4583
|
});
|
|
3681
4584
|
|
|
3682
|
-
// node_modules/@blamejs/pki/lib/guard-identifier.js
|
|
3683
|
-
var require_guard_identifier = __commonJS({
|
|
3684
|
-
"node_modules/@blamejs/pki/lib/guard-identifier.js"(exports2, module2) {
|
|
3685
|
-
"use strict";
|
|
3686
|
-
function _isDottedDecimal(str) {
|
|
3687
|
-
if (str.length === 0) return false;
|
|
3688
|
-
var arcs = 0, digits = 0, leadingZero = false;
|
|
3689
|
-
for (var i = 0; i < str.length; i++) {
|
|
3690
|
-
var c = str.charCodeAt(i);
|
|
3691
|
-
if (c === 46) {
|
|
3692
|
-
if (digits === 0 || leadingZero) return false;
|
|
3693
|
-
arcs++;
|
|
3694
|
-
digits = 0;
|
|
3695
|
-
leadingZero = false;
|
|
3696
|
-
continue;
|
|
3697
|
-
}
|
|
3698
|
-
if (c < 48 || c > 57) return false;
|
|
3699
|
-
if (digits === 1 && str.charCodeAt(i - 1) === 48) leadingZero = true;
|
|
3700
|
-
digits++;
|
|
3701
|
-
}
|
|
3702
|
-
if (digits === 0 || leadingZero) return false;
|
|
3703
|
-
return arcs >= 1;
|
|
3704
|
-
}
|
|
3705
|
-
function assertCanonicalOid(str, E, code, label, boundsCode) {
|
|
3706
|
-
var who = label || "OID";
|
|
3707
|
-
if (typeof str !== "string" || !_isDottedDecimal(str)) {
|
|
3708
|
-
throw E(code, who + " must be a canonical dotted-decimal OID string of two or more arcs with no leading-zero component");
|
|
3709
|
-
}
|
|
3710
|
-
if (boundsCode === null) return str;
|
|
3711
|
-
var bcode = boundsCode === void 0 ? code : boundsCode;
|
|
3712
|
-
var parts = str.split(".");
|
|
3713
|
-
var root = BigInt(parts[0]);
|
|
3714
|
-
var second = BigInt(parts[1]);
|
|
3715
|
-
if (root > 2n) throw E(bcode, who + " root arc must be 0, 1, or 2 (X.660)");
|
|
3716
|
-
if (root < 2n && second > 39n) throw E(bcode, who + " second arc must be 0..39 under roots 0 and 1 (X.660)");
|
|
3717
|
-
return str;
|
|
3718
|
-
}
|
|
3719
|
-
function assertKnownKeys(obj, known, E, code, message) {
|
|
3720
|
-
var describe = typeof message === "function" ? message : function(k) {
|
|
3721
|
-
return message + JSON.stringify(k);
|
|
3722
|
-
};
|
|
3723
|
-
Object.keys(obj).forEach(function(k) {
|
|
3724
|
-
if (!Object.prototype.hasOwnProperty.call(known, k)) throw E(code, describe(k));
|
|
3725
|
-
});
|
|
3726
|
-
}
|
|
3727
|
-
module2.exports = { assertCanonicalOid, assertKnownKeys };
|
|
3728
|
-
}
|
|
3729
|
-
});
|
|
3730
|
-
|
|
3731
4585
|
// node_modules/@blamejs/pki/lib/guard-header.js
|
|
3732
4586
|
var require_guard_header = __commonJS({
|
|
3733
4587
|
"node_modules/@blamejs/pki/lib/guard-header.js"(exports2, module2) {
|
|
3734
4588
|
"use strict";
|
|
3735
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;
|
|
3736
4594
|
function assertField(name, value, E, code) {
|
|
3737
4595
|
if (typeof name !== "string" || name.length === 0) throw new E(code, "a header field name must be a non-empty string");
|
|
3738
4596
|
for (var i = 0; i < name.length; i++) {
|
|
3739
|
-
var nc = name
|
|
3740
|
-
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));
|
|
3741
4599
|
}
|
|
3742
|
-
var v = typeof value === "string" ? value :
|
|
4600
|
+
var v = typeof value === "string" ? value : _String(value);
|
|
3743
4601
|
for (var j = 0; j < v.length; j++) {
|
|
3744
|
-
var vc = v
|
|
3745
|
-
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));
|
|
3746
4604
|
}
|
|
3747
|
-
if (
|
|
3748
|
-
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));
|
|
3749
4607
|
}
|
|
3750
4608
|
return v;
|
|
3751
4609
|
}
|
|
@@ -3758,6 +4616,16 @@ var require_guard_compress = __commonJS({
|
|
|
3758
4616
|
"node_modules/@blamejs/pki/lib/guard-compress.js"(exports2, module2) {
|
|
3759
4617
|
"use strict";
|
|
3760
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;
|
|
3761
4629
|
var DECOMPRESS = {
|
|
3762
4630
|
zlib: zlib.inflateSync,
|
|
3763
4631
|
// RFC 1950
|
|
@@ -3775,41 +4643,41 @@ var require_guard_compress = __commonJS({
|
|
|
3775
4643
|
var compress = _PROBE_COMPRESS[name];
|
|
3776
4644
|
var decompress = DECOMPRESS[name];
|
|
3777
4645
|
if (typeof compress !== "function" || typeof decompress !== "function") return false;
|
|
3778
|
-
var sample =
|
|
4646
|
+
var sample = _bufferFrom("0123456789abcdefghijklmnopqrstuvwxyz0123456789");
|
|
3779
4647
|
var frame, whole;
|
|
3780
4648
|
try {
|
|
3781
4649
|
frame = compress(sample);
|
|
3782
4650
|
} catch (_e) {
|
|
3783
4651
|
return false;
|
|
3784
4652
|
}
|
|
3785
|
-
if (!
|
|
4653
|
+
if (!_isBuffer(frame) || _sizeOf(frame) < 4) return false;
|
|
3786
4654
|
try {
|
|
3787
4655
|
whole = decompress(frame, { maxOutputLength: 4096 });
|
|
3788
4656
|
} catch (_e2) {
|
|
3789
4657
|
return false;
|
|
3790
4658
|
}
|
|
3791
|
-
if (!
|
|
4659
|
+
if (!_isBuffer(whole) || _compare(whole, sample) !== 0) return false;
|
|
3792
4660
|
var cutAccepted = false;
|
|
3793
4661
|
try {
|
|
3794
|
-
decompress(frame
|
|
4662
|
+
decompress(_subarray(frame, 0, _sizeOf(frame) - 2), { maxOutputLength: 4096 });
|
|
3795
4663
|
cutAccepted = true;
|
|
3796
4664
|
} catch (_e3) {
|
|
3797
4665
|
}
|
|
3798
4666
|
return !cutAccepted;
|
|
3799
4667
|
}
|
|
3800
4668
|
var SAFE = {};
|
|
3801
|
-
|
|
4669
|
+
_intrinsic.forEach(_objectKeys(DECOMPRESS), function(n) {
|
|
3802
4670
|
if (_reportsTruncation(n)) SAFE[n] = true;
|
|
3803
4671
|
});
|
|
3804
4672
|
function bounded(algorithm, stream, cap, E, codes, label) {
|
|
3805
4673
|
var decompress = DECOMPRESS[algorithm];
|
|
3806
|
-
if (!
|
|
3807
|
-
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));
|
|
3808
4676
|
}
|
|
3809
|
-
if (!
|
|
4677
|
+
if (!_isBuffer(stream)) {
|
|
3810
4678
|
throw new TypeError("guard.compress.bounded: stream must be a Buffer (route the input through guard.bytes.view first)");
|
|
3811
4679
|
}
|
|
3812
|
-
if (!
|
|
4680
|
+
if (!_isInteger(cap) || cap < 1) {
|
|
3813
4681
|
throw new TypeError("guard.compress.bounded: cap must be a positive integer");
|
|
3814
4682
|
}
|
|
3815
4683
|
var what = label || "the compressed input";
|
|
@@ -3823,13 +4691,14 @@ var require_guard_compress = __commonJS({
|
|
|
3823
4691
|
throw E(codes.failed, what + " could not be decompressed", e);
|
|
3824
4692
|
}
|
|
3825
4693
|
var consumed = res.engine.bytesWritten;
|
|
3826
|
-
|
|
3827
|
-
|
|
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");
|
|
3828
4697
|
}
|
|
3829
4698
|
return res.buffer;
|
|
3830
4699
|
}
|
|
3831
4700
|
function algorithms() {
|
|
3832
|
-
return
|
|
4701
|
+
return _objectKeys(SAFE);
|
|
3833
4702
|
}
|
|
3834
4703
|
module2.exports = { bounded, algorithms };
|
|
3835
4704
|
}
|
|
@@ -3855,6 +4724,7 @@ var require_guard_all = __commonJS({
|
|
|
3855
4724
|
var secret = require_guard_secret();
|
|
3856
4725
|
var parsed = require_guard_parsed();
|
|
3857
4726
|
var async_ = require_guard_async();
|
|
4727
|
+
var intrinsic = require_guard_intrinsic();
|
|
3858
4728
|
module2.exports = {
|
|
3859
4729
|
bytes,
|
|
3860
4730
|
text,
|
|
@@ -3871,7 +4741,8 @@ var require_guard_all = __commonJS({
|
|
|
3871
4741
|
compress,
|
|
3872
4742
|
secret,
|
|
3873
4743
|
parsed,
|
|
3874
|
-
async: async_
|
|
4744
|
+
async: async_,
|
|
4745
|
+
intrinsic
|
|
3875
4746
|
};
|
|
3876
4747
|
}
|
|
3877
4748
|
});
|
|
@@ -4363,7 +5234,7 @@ var require_asn1_der = __commonJS({
|
|
|
4363
5234
|
var d = /* @__PURE__ */ new Date(0);
|
|
4364
5235
|
d.setUTCFullYear(year, month - 1, day);
|
|
4365
5236
|
d.setUTCHours(hour, min, sec, ms);
|
|
4366
|
-
if (isNaN(
|
|
5237
|
+
if (isNaN(guard.time.instantOf(d))) throw new Asn1Error("asn1/bad-time", "unparseable time " + JSON.stringify(s));
|
|
4367
5238
|
if (d.getUTCFullYear() !== year || d.getUTCMonth() !== month - 1 || d.getUTCDate() !== day || d.getUTCHours() !== hour || d.getUTCMinutes() !== min || d.getUTCSeconds() !== sec) {
|
|
4368
5239
|
throw new Asn1Error("asn1/bad-time", "time component out of range " + JSON.stringify(s));
|
|
4369
5240
|
}
|
|
@@ -4938,7 +5809,7 @@ var require_cbor_det = __commonJS({
|
|
|
4938
5809
|
}
|
|
4939
5810
|
var ns = Number(secs);
|
|
4940
5811
|
var d = new Date(ns < 0 ? -constants.TIME.seconds(-ns) : constants.TIME.seconds(ns));
|
|
4941
|
-
if (isNaN(
|
|
5812
|
+
if (isNaN(guard.time.instantOf(d))) throw new CborError("cbor/bad-time", "epoch time out of range");
|
|
4942
5813
|
return d;
|
|
4943
5814
|
}
|
|
4944
5815
|
function readOid(node) {
|
|
@@ -5071,12 +5942,12 @@ var require_cbor_det = __commonJS({
|
|
|
5071
5942
|
},
|
|
5072
5943
|
time: function(v) {
|
|
5073
5944
|
var ms;
|
|
5074
|
-
if (v
|
|
5075
|
-
ms =
|
|
5945
|
+
if (guard.time.isDate(v)) {
|
|
5946
|
+
ms = guard.time.instantOf(v);
|
|
5076
5947
|
if (Number.isNaN(ms)) throw new CborError("cbor/bad-time", "build.time: an Invalid Date has no epoch value");
|
|
5077
5948
|
if (ms % 1e3 !== 0) throw new CborError("cbor/bad-time", "build.time: a Date with sub-second precision cannot be a second-granularity CBOR epoch; round to whole seconds");
|
|
5078
5949
|
}
|
|
5079
|
-
var secs = v
|
|
5950
|
+
var secs = guard.time.isDate(v) ? BigInt(Math.floor(ms / 1e3)) : typeof v === "bigint" ? v : BigInt(v);
|
|
5080
5951
|
if (secs < -_MAX_EPOCH_SECONDS || secs > _MAX_EPOCH_SECONDS) throw new CborError("cbor/bad-time", "build.time: epoch seconds " + secs + " are outside the representable Date range");
|
|
5081
5952
|
return build.tag(1, build.int(secs));
|
|
5082
5953
|
},
|
|
@@ -7476,7 +8347,7 @@ var require_ct = __commonJS({
|
|
|
7476
8347
|
if (typeof ti !== "object") throw _ctErr("ct/bad-log-list", "a CT log temporal_interval must be an object");
|
|
7477
8348
|
var start = rfc3339.parse(ti.start_inclusive, _ctErr, "ct/bad-date", "temporal_interval.start_inclusive");
|
|
7478
8349
|
var end = rfc3339.parse(ti.end_exclusive, _ctErr, "ct/bad-date", "temporal_interval.end_exclusive");
|
|
7479
|
-
if (
|
|
8350
|
+
if (guard.time.instantOf(start) >= guard.time.instantOf(end)) throw _ctErr("ct/bad-log-list", "a CT log temporal_interval start_inclusive must be strictly before end_exclusive");
|
|
7480
8351
|
return { startInclusive: start, endExclusive: end };
|
|
7481
8352
|
}
|
|
7482
8353
|
function _parseLog(log, operatorName) {
|
|
@@ -7505,10 +8376,10 @@ var require_ct = __commonJS({
|
|
|
7505
8376
|
function _sameTemporal(a, b) {
|
|
7506
8377
|
if (a == null && b == null) return true;
|
|
7507
8378
|
if (a == null || b == null) return false;
|
|
7508
|
-
return a.startInclusive
|
|
8379
|
+
return guard.time.instantOf(a.startInclusive) === guard.time.instantOf(b.startInclusive) && guard.time.instantOf(a.endExclusive) === guard.time.instantOf(b.endExclusive);
|
|
7509
8380
|
}
|
|
7510
8381
|
function _logsAgree(a, b) {
|
|
7511
|
-
return a.state.name === b.state.name && a.state.since
|
|
8382
|
+
return a.state.name === b.state.name && guard.time.instantOf(a.state.since) === guard.time.instantOf(b.state.since) && _sameTemporal(a.temporalInterval, b.temporalInterval);
|
|
7512
8383
|
}
|
|
7513
8384
|
function parseLogList(json, opts) {
|
|
7514
8385
|
void opts;
|
|
@@ -7550,7 +8421,7 @@ var require_ct = __commonJS({
|
|
|
7550
8421
|
return { logs, byLogId, version, timestamp };
|
|
7551
8422
|
}
|
|
7552
8423
|
function _resolveNotAfter(entry, opts) {
|
|
7553
|
-
if (opts.certNotAfter
|
|
8424
|
+
if (guard.time.isDate(opts.certNotAfter)) return opts.certNotAfter;
|
|
7554
8425
|
if (entry && entry.entryType === 0 && entry.leafCert != null) {
|
|
7555
8426
|
var x509 = require_schema_x509();
|
|
7556
8427
|
try {
|
|
@@ -7570,7 +8441,7 @@ var require_ct = __commonJS({
|
|
|
7570
8441
|
if (!log.state.trusted) {
|
|
7571
8442
|
if (!log.state.conditional) throw _ctErr("ct/log-untrusted", "the CT log state '" + log.state.name + "' is not trusted");
|
|
7572
8443
|
var ts = guard.range.uint64(sct.timestamp, _ctErr, "ct/bad-input", "sct.timestamp");
|
|
7573
|
-
if (ts >= BigInt(log.state.since
|
|
8444
|
+
if (ts >= BigInt(guard.time.instantOf(log.state.since))) throw _ctErr("ct/log-untrusted", "the CT log is retired and the SCT is not timestamped before its retirement (" + log.state.since.toISOString() + ")");
|
|
7574
8445
|
}
|
|
7575
8446
|
if (log.temporalInterval) {
|
|
7576
8447
|
var notAfter = _resolveNotAfter(entry, opts);
|
|
@@ -10716,12 +11587,12 @@ var require_schema_c509 = __commonJS({
|
|
|
10716
11587
|
if (r.serialNumber == null && r.serialNumberHex == null) throw _err("c509/bad-input", "a C509 result must carry serialNumber or serialNumberHex");
|
|
10717
11588
|
if (!r.signatureAlgorithm || typeof r.signatureAlgorithm.name !== "string") throw _err("c509/bad-input", "a C509 result must carry signatureAlgorithm.name");
|
|
10718
11589
|
if (!r.subjectPublicKeyAlgorithm || typeof r.subjectPublicKeyAlgorithm.name !== "string") throw _err("c509/bad-input", "a C509 result must carry subjectPublicKeyAlgorithm.name");
|
|
10719
|
-
if (!r.validity || !(r.validity.notBefore
|
|
11590
|
+
if (!r.validity || !guard.time.isDate(r.validity.notBefore) || r.validity.notAfter !== null && !guard.time.isDate(r.validity.notAfter)) throw _err("c509/bad-input", "a C509 result must carry validity.notBefore (Date) and notAfter (Date or null)");
|
|
10720
11591
|
if (!Array.isArray(r.extensions)) throw _err("c509/bad-input", "a C509 result must carry an extensions array");
|
|
10721
11592
|
if (!Buffer.isBuffer(r.signatureValue)) throw _err("c509/bad-input", "a C509 result must carry a Buffer signatureValue");
|
|
10722
11593
|
}
|
|
10723
11594
|
function _validityUint(date, label) {
|
|
10724
|
-
var secs = Math.floor(
|
|
11595
|
+
var secs = Math.floor(guard.time.instantOf(date) / 1e3);
|
|
10725
11596
|
if (!isFinite(secs) || secs < 0) throw _err("c509/bad-validity", label + " is before the Unix epoch or not a valid date; C509 ~time is a non-negative CBOR epoch");
|
|
10726
11597
|
return cbor.build.uint(BigInt(secs));
|
|
10727
11598
|
}
|
|
@@ -10869,7 +11740,7 @@ var require_schema_c509 = __commonJS({
|
|
|
10869
11740
|
// against a UTF8String of the same characters) would rebuild different bytes and break the
|
|
10870
11741
|
// signature that covers them. Byte-identical is exactly the condition under which that is safe.
|
|
10871
11742
|
issuer: c.issuer.bytes.equals(c.subject.bytes) ? null : _c509NameFromDer(c.issuer.bytes),
|
|
10872
|
-
validity: { notBefore: c.validity.notBefore, notAfter: c.validity.notAfter
|
|
11743
|
+
validity: { notBefore: c.validity.notBefore, notAfter: guard.time.instantOf(c.validity.notAfter) === _NO_EXPIRY ? null : c.validity.notAfter },
|
|
10873
11744
|
subject: _c509NameFromDer(c.subject.bytes),
|
|
10874
11745
|
subjectPublicKeyAlgorithm: { name: "ecPublicKey", oid: c.subjectPublicKeyInfo.algorithm.oid, curve },
|
|
10875
11746
|
subjectPublicKey: _compressEcPoint(asn1.read.bitString(spkiNode.children[1]).bytes, coordLen),
|
|
@@ -11164,7 +12035,7 @@ var require_schema_csr = __commonJS({
|
|
|
11164
12035
|
};
|
|
11165
12036
|
}
|
|
11166
12037
|
});
|
|
11167
|
-
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");
|
|
11168
12039
|
function pemDecode(text, label) {
|
|
11169
12040
|
return pkix.pemDecode(text, label || "CERTIFICATE REQUEST", PemError);
|
|
11170
12041
|
}
|
|
@@ -13750,7 +14621,7 @@ var require_schema_crmf = __commonJS({
|
|
|
13750
14621
|
}) };
|
|
13751
14622
|
}
|
|
13752
14623
|
});
|
|
13753
|
-
var parse = pkix.
|
|
14624
|
+
var parse = pkix.makeRecordingParser({
|
|
13754
14625
|
pemLabel: null,
|
|
13755
14626
|
PemError,
|
|
13756
14627
|
ErrorClass: CrmfError,
|
|
@@ -13758,7 +14629,7 @@ var require_schema_crmf = __commonJS({
|
|
|
13758
14629
|
what: "certificate request message",
|
|
13759
14630
|
topSchema: CERT_REQ_MESSAGES,
|
|
13760
14631
|
ns: NS
|
|
13761
|
-
});
|
|
14632
|
+
}, "crmf");
|
|
13762
14633
|
function pemDecode(text, label) {
|
|
13763
14634
|
return pkix.pemDecode(text, label || null, PemError);
|
|
13764
14635
|
}
|
|
@@ -15129,11 +16000,18 @@ var require_schema_attrcert = __commonJS({
|
|
|
15129
16000
|
function _legacyV1Error() {
|
|
15130
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)");
|
|
15131
16002
|
}
|
|
15132
|
-
function
|
|
16003
|
+
function _parseAc(input) {
|
|
15133
16004
|
var root = pkix.decodeRoot(pkix.coerceToDer(input, PARSE_OPTS), PARSE_OPTS);
|
|
15134
16005
|
if (matchesV1(root)) throw _legacyV1Error();
|
|
15135
16006
|
return schema.walk(ATTRIBUTE_CERTIFICATE, root, NS).result;
|
|
15136
16007
|
}
|
|
16008
|
+
var parse = guard.parsed.recordingParser(
|
|
16009
|
+
"attributeCertificate",
|
|
16010
|
+
_parseAc,
|
|
16011
|
+
AttrCertError,
|
|
16012
|
+
"attrcert/bad-input",
|
|
16013
|
+
"an attribute certificate"
|
|
16014
|
+
);
|
|
15137
16015
|
function parseV1(input) {
|
|
15138
16016
|
pkix.decodeRoot(pkix.coerceToDer(input, PARSE_OPTS), PARSE_OPTS);
|
|
15139
16017
|
throw _legacyV1Error();
|
|
@@ -15185,6 +16063,9 @@ var require_schema_attrcert = __commonJS({
|
|
|
15185
16063
|
var gn = schema.walk(_GN, node, NS);
|
|
15186
16064
|
return { tagNumber: gn.tagNumber, value: gn.value };
|
|
15187
16065
|
}
|
|
16066
|
+
function readGeneralName(der, code) {
|
|
16067
|
+
return _oneGN(asn1.decode(der), code || "attrcert/bad-input");
|
|
16068
|
+
}
|
|
15188
16069
|
function _svceAuthInfo(authInfoAllowed, code) {
|
|
15189
16070
|
return function(buf) {
|
|
15190
16071
|
var kids = _seqChildren(buf, code, "SvceAuthInfo");
|
|
@@ -15433,6 +16314,7 @@ var require_schema_attrcert = __commonJS({
|
|
|
15433
16314
|
pemEncode,
|
|
15434
16315
|
matches,
|
|
15435
16316
|
matchesV1,
|
|
16317
|
+
readGeneralName,
|
|
15436
16318
|
validateAttributeValue,
|
|
15437
16319
|
validateExtensionValue
|
|
15438
16320
|
};
|
|
@@ -16683,6 +17565,7 @@ var require_ocsp_verify = __commonJS({
|
|
|
16683
17565
|
"node_modules/@blamejs/pki/lib/ocsp-verify.js"(exports2, module2) {
|
|
16684
17566
|
"use strict";
|
|
16685
17567
|
var asn1 = require_asn1_der();
|
|
17568
|
+
var guard = require_guard_all();
|
|
16686
17569
|
var oid = require_oid();
|
|
16687
17570
|
var x509 = require_schema_x509();
|
|
16688
17571
|
var compositeSig = require_composite_sig();
|
|
@@ -16781,7 +17664,7 @@ var require_ocsp_verify = __commonJS({
|
|
|
16781
17664
|
if (!issuedByCa) continue;
|
|
16782
17665
|
if (!isOctetAligned(rc.signatureValue)) continue;
|
|
16783
17666
|
if (!await verifyWithSpki(rc.signatureAlgorithm, rc.signatureValue.bytes, issuer.workingPublicKey, rc.tbsBytes)) continue;
|
|
16784
|
-
if (time < rc.validity.notBefore || time > rc.validity.notAfter) continue;
|
|
17667
|
+
if (guard.time.instantOf(time) < guard.time.instantOf(rc.validity.notBefore) || guard.time.instantOf(time) > guard.time.instantOf(rc.validity.notAfter)) continue;
|
|
16785
17668
|
var eku;
|
|
16786
17669
|
try {
|
|
16787
17670
|
eku = decodeExt(rc, OID_EKU);
|
|
@@ -16824,14 +17707,14 @@ var require_ocsp_verify = __commonJS({
|
|
|
16824
17707
|
var sr = br.responses[s];
|
|
16825
17708
|
if (!await ocspCertIdMatches(sr.certID, cert, issuerNameCandidates, issuerKeyBits)) continue;
|
|
16826
17709
|
if (ocspHasCriticalExtension(sr.singleExtensions)) continue;
|
|
16827
|
-
if (sr.thisUpdate > time) continue;
|
|
16828
|
-
if (!sr.nextUpdate || sr.nextUpdate < time) continue;
|
|
17710
|
+
if (guard.time.instantOf(sr.thisUpdate) > guard.time.instantOf(time)) continue;
|
|
17711
|
+
if (!sr.nextUpdate || guard.time.instantOf(sr.nextUpdate) < guard.time.instantOf(time)) continue;
|
|
16829
17712
|
out.matched = true;
|
|
16830
17713
|
out.thisUpdate = sr.thisUpdate;
|
|
16831
17714
|
out.nextUpdate = sr.nextUpdate;
|
|
16832
17715
|
var st = sr.certStatus;
|
|
16833
17716
|
if (st.type === "revoked") {
|
|
16834
|
-
if (historical && st.revocationTime
|
|
17717
|
+
if (historical && guard.time.isDate(st.revocationTime) && guard.time.instantOf(st.revocationTime) > guard.time.instantOf(time)) {
|
|
16835
17718
|
out.sawGood = true;
|
|
16836
17719
|
} else if (!out.revoked) {
|
|
16837
17720
|
out.revoked = { revocationReason: st.revocationReason || null, reason: "certificate reported revoked by an authorized OCSP responder" + (st.revocationReason ? " (" + st.revocationReason + ")" : "") };
|
|
@@ -16856,20 +17739,88 @@ var require_ocsp_verify = __commonJS({
|
|
|
16856
17739
|
}
|
|
16857
17740
|
});
|
|
16858
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
|
+
|
|
16859
17766
|
// node_modules/@blamejs/pki/lib/crl-verify.js
|
|
16860
17767
|
var require_crl_verify = __commonJS({
|
|
16861
17768
|
"node_modules/@blamejs/pki/lib/crl-verify.js"(exports2, module2) {
|
|
16862
17769
|
"use strict";
|
|
16863
|
-
var
|
|
16864
|
-
var
|
|
16865
|
-
|
|
16866
|
-
_engine = verifyWithSpki;
|
|
16867
|
-
}
|
|
17770
|
+
var frameworkError = require_framework_error();
|
|
17771
|
+
var seam = require_verify_seam();
|
|
17772
|
+
var _seam = seam.makeSeam("crl-verify", frameworkError.CrlError, "crl/bad-input");
|
|
16868
17773
|
function verifyCrlSignature(crl, spkiBytes) {
|
|
16869
|
-
|
|
16870
|
-
|
|
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);
|
|
16871
17808
|
}
|
|
16872
|
-
module2.exports = { setEngine,
|
|
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);
|
|
17822
|
+
}
|
|
17823
|
+
module2.exports = { setEngine: _seam.setEngine, verifyAcSignature };
|
|
16873
17824
|
}
|
|
16874
17825
|
});
|
|
16875
17826
|
|
|
@@ -17602,6 +18553,8 @@ var require_crmf_sign = __commonJS({
|
|
|
17602
18553
|
var pkiBuild = require_pki_build();
|
|
17603
18554
|
var frameworkError = require_framework_error();
|
|
17604
18555
|
var guard = require_guard_all();
|
|
18556
|
+
require_path_validate();
|
|
18557
|
+
var crmfVerify = require_crmf_verify();
|
|
17605
18558
|
var CrmfError = frameworkError.CrmfError;
|
|
17606
18559
|
var b = asn1.build;
|
|
17607
18560
|
function _err(code, message, cause) {
|
|
@@ -17647,7 +18600,7 @@ var require_crmf_sign = __commonJS({
|
|
|
17647
18600
|
var parts = [];
|
|
17648
18601
|
if (nb != null) parts.push(b.explicit(0, _b.timeDer(nb, "validity notBefore")));
|
|
17649
18602
|
if (na != null) parts.push(b.explicit(1, _b.timeDer(na, "validity notAfter")));
|
|
17650
|
-
if (nb != null && na != null &&
|
|
18603
|
+
if (nb != null && na != null && guard.time.instantOf(nb) > guard.time.instantOf(na)) throw _err("crmf/bad-validity", "notBefore must not be after notAfter");
|
|
17651
18604
|
return b.implicit(4, b.sequence(parts));
|
|
17652
18605
|
}
|
|
17653
18606
|
function _encodeCertTemplate(tpl, opts) {
|
|
@@ -17817,7 +18770,75 @@ var require_crmf_sign = __commonJS({
|
|
|
17817
18770
|
function buildCertTemplate(template) {
|
|
17818
18771
|
return _encodeCertTemplate(template, { revocation: true }).der;
|
|
17819
18772
|
}
|
|
17820
|
-
|
|
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 };
|
|
17821
18842
|
}
|
|
17822
18843
|
});
|
|
17823
18844
|
|
|
@@ -18768,6 +19789,33 @@ var require_cmp_build = __commonJS({
|
|
|
18768
19789
|
var require_cmp_verify = __commonJS({
|
|
18769
19790
|
"node_modules/@blamejs/pki/lib/cmp-verify.js"(exports2, module2) {
|
|
18770
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;
|
|
18771
19819
|
var asn1 = require_asn1_der();
|
|
18772
19820
|
var oid = require_oid();
|
|
18773
19821
|
var cmpBuild = require_cmp_build();
|
|
@@ -18799,7 +19847,7 @@ var require_cmp_verify = __commonJS({
|
|
|
18799
19847
|
revocationChecker: 1,
|
|
18800
19848
|
maxIterations: 1
|
|
18801
19849
|
};
|
|
18802
|
-
var PRF_HASH =
|
|
19850
|
+
var PRF_HASH = _create(null);
|
|
18803
19851
|
PRF_HASH[oid.byName("hmacWithSHA256")] = "SHA-256";
|
|
18804
19852
|
PRF_HASH[oid.byName("hmacWithSHA384")] = "SHA-384";
|
|
18805
19853
|
PRF_HASH[oid.byName("hmacWithSHA512")] = "SHA-512";
|
|
@@ -18810,7 +19858,7 @@ var require_cmp_verify = __commonJS({
|
|
|
18810
19858
|
var PBMAC1_KEYLEN_MIN = 20;
|
|
18811
19859
|
var PBMAC1_KEYLEN_MAX = 1024;
|
|
18812
19860
|
var PRF_HLEN = { "SHA-256": 32, "SHA-384": 48, "SHA-512": 64 };
|
|
18813
|
-
var UNSUPPORTED_MAC_OIDS =
|
|
19861
|
+
var UNSUPPORTED_MAC_OIDS = _create(null);
|
|
18814
19862
|
["passwordBasedMac", "dhBasedMac", "kemBasedMac"].forEach(function(n) {
|
|
18815
19863
|
var o = oid.byName(n);
|
|
18816
19864
|
if (o) UNSUPPORTED_MAC_OIDS[o] = n;
|
|
@@ -18845,28 +19893,28 @@ var require_cmp_verify = __commonJS({
|
|
|
18845
19893
|
return _verdict(m, type, alg, false, false, code, reason, signer || null);
|
|
18846
19894
|
}
|
|
18847
19895
|
function _coerce(message) {
|
|
18848
|
-
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) {
|
|
18849
19897
|
try {
|
|
18850
19898
|
return cmp.parse(_reassemble(message));
|
|
18851
19899
|
} catch (e) {
|
|
18852
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);
|
|
18853
19901
|
}
|
|
18854
19902
|
}
|
|
18855
|
-
if (
|
|
19903
|
+
if (_isBuffer(message) || util.types.isUint8Array(message)) return cmp.parse(_bufferFrom(message));
|
|
18856
19904
|
return cmp.parse(message);
|
|
18857
19905
|
}
|
|
18858
19906
|
function _reassemble(m) {
|
|
18859
19907
|
var kids = [b.raw(m.headerBytes), b.raw(m.bodyBytes)];
|
|
18860
|
-
if (m.protection != null) kids
|
|
19908
|
+
if (m.protection != null) _append(kids, b.explicit(0, b.bitString(m.protection.bytes, m.protection.unusedBits)));
|
|
18861
19909
|
if (m.extraCerts != null && m.extraCerts.length) {
|
|
18862
|
-
kids
|
|
19910
|
+
_append(kids, b.explicit(1, b.sequence(_map(m.extraCerts, function(c) {
|
|
18863
19911
|
return b.raw(c);
|
|
18864
19912
|
}))));
|
|
18865
19913
|
}
|
|
18866
19914
|
return b.sequence(kids);
|
|
18867
19915
|
}
|
|
18868
19916
|
function _certDer(cert, what) {
|
|
18869
|
-
if (
|
|
19917
|
+
if (_isBuffer(cert) || util.types.isUint8Array(cert)) return guard.bytes.view(cert, CmpError, "cmp/bad-input", what);
|
|
18870
19918
|
if (typeof cert === "string") {
|
|
18871
19919
|
try {
|
|
18872
19920
|
return x509.pemDecode(cert);
|
|
@@ -18911,7 +19959,7 @@ var require_cmp_verify = __commonJS({
|
|
|
18911
19959
|
if (!sender || !sender.bytes) return false;
|
|
18912
19960
|
var subjectRdns = parsed.subject.rdns;
|
|
18913
19961
|
if (subjectRdns.length > 0) {
|
|
18914
|
-
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);
|
|
18915
19963
|
if (isDirName && guard.name.dnEqual(sender.value.rdns, subjectRdns, NS.E, "cmp/sender-mismatch", "the header sender / signer subject")) return true;
|
|
18916
19964
|
}
|
|
18917
19965
|
var san = _sanGeneralNames(parsed);
|
|
@@ -18922,18 +19970,18 @@ var require_cmp_verify = __commonJS({
|
|
|
18922
19970
|
if (sanNode.tagClass !== sender.tagClass || sanNode.tagNumber !== sender.tagNumber) return false;
|
|
18923
19971
|
if (sanNode.tagClass === "context") {
|
|
18924
19972
|
if (sanNode.tagNumber === 2 && sanNode.content) {
|
|
18925
|
-
var dnsSan = sanNode.content
|
|
19973
|
+
var dnsSan = _toString(sanNode.content, "latin1"), dnsSender = _String(sender.value);
|
|
18926
19974
|
if (pkix.dnsNameProblem(dnsSan) !== null || pkix.dnsNameProblem(dnsSender) !== null) return dnsSan === dnsSender;
|
|
18927
|
-
return dnsSender
|
|
19975
|
+
return _toLowerCase(dnsSender) === _toLowerCase(dnsSan);
|
|
18928
19976
|
}
|
|
18929
19977
|
if (sanNode.tagNumber === 1 && sanNode.content) {
|
|
18930
|
-
return _rfc822Equal(
|
|
19978
|
+
return _rfc822Equal(_String(sender.value), _toString(sanNode.content, "latin1"));
|
|
18931
19979
|
}
|
|
18932
19980
|
if (sanNode.tagNumber === 6 && sanNode.content) {
|
|
18933
|
-
return _uriEqual(
|
|
19981
|
+
return _uriEqual(_String(sender.value), _toString(sanNode.content, "latin1"));
|
|
18934
19982
|
}
|
|
18935
19983
|
if (sanNode.tagNumber === 4 && sanNode.children && sanNode.children.length) {
|
|
18936
|
-
if (!sender.value || !
|
|
19984
|
+
if (!sender.value || !_isArray(sender.value.rdns)) return false;
|
|
18937
19985
|
var sanName;
|
|
18938
19986
|
try {
|
|
18939
19987
|
sanName = schema.embeddedDer(pkix.name(NS), sanNode.children[0].bytes, NS, { code: "cmp/sender-mismatch", what: "SAN directoryName" }).result;
|
|
@@ -18943,14 +19991,14 @@ var require_cmp_verify = __commonJS({
|
|
|
18943
19991
|
return guard.name.dnEqual(sender.value.rdns, sanName.rdns, NS.E, "cmp/sender-mismatch", "SAN directoryName");
|
|
18944
19992
|
}
|
|
18945
19993
|
}
|
|
18946
|
-
return sanNode.bytes
|
|
19994
|
+
return _compare(sanNode.bytes, sender.bytes) === 0;
|
|
18947
19995
|
}
|
|
18948
19996
|
function _mailboxSplit(s) {
|
|
18949
19997
|
var sep;
|
|
18950
|
-
if (s
|
|
19998
|
+
if (_charAt(s, 0) === '"') {
|
|
18951
19999
|
var i = 1;
|
|
18952
20000
|
while (i < s.length) {
|
|
18953
|
-
var c = s
|
|
20001
|
+
var c = _charAt(s, i);
|
|
18954
20002
|
if (c === "\\") {
|
|
18955
20003
|
i += 2;
|
|
18956
20004
|
continue;
|
|
@@ -18958,60 +20006,60 @@ var require_cmp_verify = __commonJS({
|
|
|
18958
20006
|
if (c === '"') break;
|
|
18959
20007
|
i++;
|
|
18960
20008
|
}
|
|
18961
|
-
if (i >= s.length || s
|
|
20009
|
+
if (i >= s.length || _charAt(s, i) !== '"' || _charAt(s, i + 1) !== "@") return -1;
|
|
18962
20010
|
sep = i + 1;
|
|
18963
20011
|
} else {
|
|
18964
|
-
sep = s
|
|
18965
|
-
if (sep < 0 || sep !== s
|
|
20012
|
+
sep = _strIndexOf(s, "@");
|
|
20013
|
+
if (sep < 0 || sep !== _strLastIndexOf(s, "@")) return -1;
|
|
18966
20014
|
}
|
|
18967
|
-
var local = s
|
|
20015
|
+
var local = _strSlice(s, 0, sep), domain = _strSlice(s, sep + 1);
|
|
18968
20016
|
if (pkix.dnsNameProblem(domain) !== null) return -1;
|
|
18969
|
-
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;
|
|
18970
20018
|
return sep;
|
|
18971
20019
|
}
|
|
18972
20020
|
function _rfc822Equal(a, b2) {
|
|
18973
20021
|
var ai = _mailboxSplit(a), bi = _mailboxSplit(b2);
|
|
18974
20022
|
if (ai < 0 || bi < 0) return a === b2;
|
|
18975
|
-
return a
|
|
20023
|
+
return _strSlice(a, 0, ai) === _strSlice(b2, 0, bi) && _lowerAsciiDomain(_strSlice(a, ai + 1)) === _lowerAsciiDomain(_strSlice(b2, bi + 1));
|
|
18976
20024
|
}
|
|
18977
20025
|
function _lowerAsciiDomain(h) {
|
|
18978
20026
|
var out = "";
|
|
18979
20027
|
for (var i = 0; i < h.length; i++) {
|
|
18980
|
-
var c = h
|
|
18981
|
-
out += c >= 65 && c <= 90 ?
|
|
20028
|
+
var c = _charCodeAt(h, i);
|
|
20029
|
+
out += c >= 65 && c <= 90 ? _fromCharCode(c + 32) : _charAt(h, i);
|
|
18982
20030
|
}
|
|
18983
20031
|
return out;
|
|
18984
20032
|
}
|
|
18985
20033
|
function _normalizeUri(u) {
|
|
18986
|
-
if (
|
|
18987
|
-
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);
|
|
18988
20036
|
if (!m) return null;
|
|
18989
|
-
var scheme = m[1]
|
|
20037
|
+
var scheme = _toLowerCase(m[1]);
|
|
18990
20038
|
var rest = m[2];
|
|
18991
|
-
if (rest
|
|
18992
|
-
var body = rest
|
|
18993
|
-
var cut = body
|
|
20039
|
+
if (_strSlice(rest, 0, 2) !== "//") return null;
|
|
20040
|
+
var body = _strSlice(rest, 2);
|
|
20041
|
+
var cut = _strSearch(body, /[/?#]/);
|
|
18994
20042
|
var split = cut < 0 ? body.length : cut;
|
|
18995
|
-
var authority = body
|
|
18996
|
-
if (authority
|
|
18997
|
-
var at = authority
|
|
18998
|
-
var userinfo = at < 0 ? "" : authority
|
|
18999
|
-
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);
|
|
19000
20048
|
var host, port;
|
|
19001
|
-
if (hostport
|
|
19002
|
-
var rb = hostport
|
|
20049
|
+
if (_charAt(hostport, 0) === "[") {
|
|
20050
|
+
var rb = _strIndexOf(hostport, "]");
|
|
19003
20051
|
if (rb < 0) return null;
|
|
19004
|
-
host = hostport
|
|
19005
|
-
port = hostport
|
|
20052
|
+
host = _strSlice(hostport, 0, rb + 1);
|
|
20053
|
+
port = _strSlice(hostport, rb + 1);
|
|
19006
20054
|
} else {
|
|
19007
|
-
var ci = hostport
|
|
19008
|
-
host = ci < 0 ? hostport : hostport
|
|
19009
|
-
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);
|
|
19010
20058
|
}
|
|
19011
|
-
if (port !== "" &&
|
|
19012
|
-
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;
|
|
19013
20061
|
if (!hostOk) return null;
|
|
19014
|
-
return scheme + "://" + userinfo + host
|
|
20062
|
+
return scheme + "://" + userinfo + _toLowerCase(host) + port + tail;
|
|
19015
20063
|
}
|
|
19016
20064
|
function _uriEqual(a, b2) {
|
|
19017
20065
|
var na = _normalizeUri(a), nb = _normalizeUri(b2);
|
|
@@ -19037,7 +20085,7 @@ var require_cmp_verify = __commonJS({
|
|
|
19037
20085
|
return _signerObj(der, p);
|
|
19038
20086
|
}
|
|
19039
20087
|
if (opts.signerCert != null) {
|
|
19040
|
-
var scDer =
|
|
20088
|
+
var scDer = _bufferFrom(_certDer(opts.signerCert, "opts.signerCert"));
|
|
19041
20089
|
var scParsed;
|
|
19042
20090
|
try {
|
|
19043
20091
|
scParsed = x509.parse(scDer);
|
|
@@ -19057,12 +20105,12 @@ var require_cmp_verify = __commonJS({
|
|
|
19057
20105
|
return null;
|
|
19058
20106
|
}
|
|
19059
20107
|
function _bufEq(a, x) {
|
|
19060
|
-
if (!
|
|
19061
|
-
if (!
|
|
19062
|
-
if (x
|
|
20108
|
+
if (!_isBuffer(a)) return false;
|
|
20109
|
+
if (!_isBuffer(x)) {
|
|
20110
|
+
if (util.types.isUint8Array(x)) x = _bufferFrom(x);
|
|
19063
20111
|
else return false;
|
|
19064
20112
|
}
|
|
19065
|
-
return a
|
|
20113
|
+
return _compare(a, x) === 0;
|
|
19066
20114
|
}
|
|
19067
20115
|
function _headerChecks(m, opts) {
|
|
19068
20116
|
if (opts.transactionID != null && !_bufEq(m.header.transactionID, opts.transactionID)) {
|
|
@@ -19101,10 +20149,10 @@ var require_cmp_verify = __commonJS({
|
|
|
19101
20149
|
var kdf = params.kdf;
|
|
19102
20150
|
var prfHash = PRF_HASH[kdf.prfOid];
|
|
19103
20151
|
var macHash = PRF_HASH[params.schemeOid];
|
|
19104
|
-
if (!prfHash) return _fail(m, "mac", protectionAlg, "cmp/unsupported-algorithm", "unsupported PBMAC1 PBKDF2 PRF " +
|
|
19105
|
-
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)");
|
|
19106
20154
|
_capWork(kdf.iterationCount, kdf.salt, kdf.keyLength, prfHash, opts);
|
|
19107
|
-
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");
|
|
19108
20156
|
var computed = await pbes2.pbmac1(secret, kdf.salt, kdf.iterationCount, kdf.keyLength, prfHash, macHash, protectedPart);
|
|
19109
20157
|
if (!guard.crypto.constantTimeEqual(computed, protection.bytes)) {
|
|
19110
20158
|
return _fail(m, "mac", protectionAlg, "cmp/protection-failed", "the PBMAC1 MAC does not verify (a wrong shared secret or a tampered ProtectedPart)");
|
|
@@ -19116,16 +20164,17 @@ var require_cmp_verify = __commonJS({
|
|
|
19116
20164
|
function _capWork(iterationCount, salt, keyLength, prfHash, opts) {
|
|
19117
20165
|
var cap = PBMAC1_MAX_ITER;
|
|
19118
20166
|
if (opts.maxIterations != null) {
|
|
19119
|
-
if (typeof opts.maxIterations !== "number" || !
|
|
20167
|
+
if (typeof opts.maxIterations !== "number" || !_isFinite(opts.maxIterations) || opts.maxIterations < 1 || _floor(opts.maxIterations) !== opts.maxIterations) {
|
|
19120
20168
|
throw _err("cmp/bad-input", "opts.maxIterations must be a positive integer");
|
|
19121
20169
|
}
|
|
19122
|
-
cap =
|
|
20170
|
+
cap = _min(opts.maxIterations, cap);
|
|
19123
20171
|
}
|
|
19124
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)");
|
|
19125
20173
|
if (iterationCount > cap) throw _err("cmp/bad-input", "the PBMAC1 iterationCount " + iterationCount + " exceeds the cap " + cap);
|
|
19126
|
-
|
|
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)");
|
|
19127
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)");
|
|
19128
|
-
var blocks =
|
|
20177
|
+
var blocks = _ceil(keyLength / (PRF_HLEN[prfHash] || 32));
|
|
19129
20178
|
if (iterationCount * blocks > cap) throw _err("cmp/bad-input", "the PBMAC1 combined work (iterationCount " + iterationCount + " x " + blocks + " derived blocks) exceeds the cap " + cap);
|
|
19130
20179
|
}
|
|
19131
20180
|
async function _verifySignature(m, protectedPart, protectionAlg, protection, opts) {
|
|
@@ -19148,7 +20197,7 @@ var require_cmp_verify = __commonJS({
|
|
|
19148
20197
|
try {
|
|
19149
20198
|
var p = guard.parsed.acceptDerived(c, "certificate", x509.parse, _err, "cmp/bad-input", "a pool certificate");
|
|
19150
20199
|
if (!guard.parsed.isCert(p)) return null;
|
|
19151
|
-
return p.tbsBytes
|
|
20200
|
+
return _toString(p.tbsBytes, "base64") + "|" + _toString(p.signatureValue.bytes, "base64");
|
|
19152
20201
|
} catch (_e) {
|
|
19153
20202
|
return null;
|
|
19154
20203
|
}
|
|
@@ -19157,43 +20206,48 @@ var require_cmp_verify = __commonJS({
|
|
|
19157
20206
|
if (!_keyUsageAllowsSigning(signer.parsed)) {
|
|
19158
20207
|
return { trusted: false, reason: "the signer certificate keyUsage does not assert digitalSignature (RFC 9483 sec. 3.2)" };
|
|
19159
20208
|
}
|
|
19160
|
-
var time = opts.time != null ? opts.time :
|
|
20209
|
+
var time = opts.time != null ? opts.time : new _Date();
|
|
19161
20210
|
var anchors = _certList(opts.trustAnchors);
|
|
19162
20211
|
var pool = _certList(opts.intermediates);
|
|
19163
20212
|
var room = constants.LIMITS.PATH_BUILD_MAX_CANDIDATES - pool.length;
|
|
19164
20213
|
if (room > 0) {
|
|
19165
|
-
var seen =
|
|
20214
|
+
var seen = _create(null);
|
|
19166
20215
|
var sk = _certKey(signer.parsed);
|
|
19167
20216
|
if (sk) seen[sk] = 1;
|
|
19168
|
-
|
|
19169
|
-
|
|
19170
|
-
|
|
19171
|
-
|
|
19172
|
-
|
|
19173
|
-
|
|
19174
|
-
|
|
19175
|
-
|
|
19176
|
-
|
|
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;
|
|
19177
20229
|
}
|
|
19178
20230
|
var buildOpts = { trustAnchors: anchors, intermediates: pool, validate: true, time };
|
|
19179
20231
|
if (opts.revocationChecker != null) buildOpts.revocationChecker = opts.revocationChecker;
|
|
19180
20232
|
try {
|
|
19181
20233
|
var res = await _engine.build(signer.der, buildOpts);
|
|
19182
20234
|
if (!res || res.valid !== true) return { trusted: false, reason: "the signer certificate did not chain to a supplied trust anchor" };
|
|
19183
|
-
var byKey =
|
|
20235
|
+
var byKey = _create(null);
|
|
19184
20236
|
var skey = _certKey(signer.parsed);
|
|
19185
20237
|
if (skey) byKey[skey] = signer.der;
|
|
19186
|
-
|
|
19187
|
-
|
|
19188
|
-
|
|
19189
|
-
|
|
19190
|
-
|
|
19191
|
-
|
|
19192
|
-
|
|
19193
|
-
|
|
19194
|
-
|
|
19195
|
-
|
|
19196
|
-
|
|
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
|
+
}
|
|
19197
20251
|
return { trusted: true, reason: null, chain };
|
|
19198
20252
|
} catch (e) {
|
|
19199
20253
|
if (e && e.code === "path/bad-input") {
|
|
@@ -19205,12 +20259,12 @@ var require_cmp_verify = __commonJS({
|
|
|
19205
20259
|
var MAX_EXTRA_CERTS = 32;
|
|
19206
20260
|
var MAX_EXTRA_SCAN = 256;
|
|
19207
20261
|
function _boundExtraCerts(extra) {
|
|
19208
|
-
if (!
|
|
19209
|
-
var out = [], seen =
|
|
20262
|
+
if (!_isArray(extra) || !extra.length) return [];
|
|
20263
|
+
var out = [], seen = _create(null);
|
|
19210
20264
|
for (var i = 0; i < extra.length && out.length < MAX_EXTRA_CERTS && i < MAX_EXTRA_SCAN; i++) {
|
|
19211
20265
|
var c = extra[i];
|
|
19212
|
-
if (!
|
|
19213
|
-
var key =
|
|
20266
|
+
if (!_isBuffer(c) && !util.types.isUint8Array(c)) continue;
|
|
20267
|
+
var key = _toString(_bufferFrom(c), "base64");
|
|
19214
20268
|
if (seen[key]) continue;
|
|
19215
20269
|
seen[key] = true;
|
|
19216
20270
|
try {
|
|
@@ -19218,33 +20272,105 @@ var require_cmp_verify = __commonJS({
|
|
|
19218
20272
|
} catch (_e) {
|
|
19219
20273
|
continue;
|
|
19220
20274
|
}
|
|
19221
|
-
out
|
|
20275
|
+
_append(out, c);
|
|
19222
20276
|
}
|
|
19223
20277
|
return out;
|
|
19224
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
|
+
}
|
|
19225
20284
|
function _certList(v) {
|
|
19226
20285
|
if (v == null) return [];
|
|
19227
|
-
var arr =
|
|
19228
|
-
|
|
19229
|
-
|
|
19230
|
-
|
|
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;
|
|
19231
20293
|
}
|
|
19232
20294
|
function _nonEmptySecret(s) {
|
|
19233
|
-
if (typeof s === "string") return s
|
|
19234
|
-
|
|
20295
|
+
if (typeof s === "string") return _sizeOf(s) > 0;
|
|
20296
|
+
if (!_isBuffer(s) && !util.types.isUint8Array(s)) return false;
|
|
20297
|
+
return _sizeOf(s) > 0;
|
|
19235
20298
|
}
|
|
19236
20299
|
function verify(message, opts) {
|
|
19237
|
-
|
|
19238
|
-
|
|
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
|
+
}
|
|
19239
20307
|
});
|
|
19240
20308
|
}
|
|
19241
|
-
|
|
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) {
|
|
19242
20352
|
if (opts == null) opts = {};
|
|
19243
|
-
|
|
20353
|
+
opts = guard.identifier.optionsObject(opts, _err, "cmp/bad-input", "pki.cmp.verify options");
|
|
19244
20354
|
guard.identifier.assertKnownKeys(opts, KNOWN_VERIFY_OPTS, _err, "cmp/bad-input", "unknown opts field ");
|
|
19245
|
-
|
|
19246
|
-
|
|
19247
|
-
|
|
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) {
|
|
19248
20374
|
if (_engine == null) throw _err("cmp/bad-input", "the cmp-verify signature engine is not initialized (require pki before use)");
|
|
19249
20375
|
var m = _coerce(message);
|
|
19250
20376
|
var protectionAlg = m.header.protectionAlg;
|
|
@@ -19466,7 +20592,7 @@ var require_cms_sign = __commonJS({
|
|
|
19466
20592
|
});
|
|
19467
20593
|
}
|
|
19468
20594
|
function _timeValue(when) {
|
|
19469
|
-
var d = when
|
|
20595
|
+
var d = guard.time.isDate(when) ? when : /* @__PURE__ */ new Date();
|
|
19470
20596
|
return d.getUTCFullYear() < 2050 ? b.utcTime(d) : b.generalizedTime(d);
|
|
19471
20597
|
}
|
|
19472
20598
|
function _keyOnlyCertStandIn(spkiDer) {
|
|
@@ -19537,8 +20663,7 @@ var require_cms_sign = __commonJS({
|
|
|
19537
20663
|
], _sign);
|
|
19538
20664
|
}
|
|
19539
20665
|
function _sign(content, signers, opts) {
|
|
19540
|
-
opts = opts
|
|
19541
|
-
if (typeof opts !== "object" || Buffer.isBuffer(opts)) throw _err("cms/bad-input", "pki.cms.sign options must be an object");
|
|
20666
|
+
opts = guard.identifier.optionsObject(opts, _err, "cms/bad-input", "pki.cms.sign options");
|
|
19542
20667
|
guard.identifier.assertKnownKeys(opts, KNOWN_SIGN_OPTS, _err, "cms/bad-input", "unknown opts field ");
|
|
19543
20668
|
var contentBuf = _toBuf(content, "content");
|
|
19544
20669
|
var list = Array.isArray(signers) ? signers : [signers];
|
|
@@ -19734,8 +20859,7 @@ var require_cms_sign = __commonJS({
|
|
|
19734
20859
|
], _countersign);
|
|
19735
20860
|
}
|
|
19736
20861
|
function _countersign(cmsInput, signers, opts) {
|
|
19737
|
-
opts = opts
|
|
19738
|
-
if (typeof opts !== "object" || Buffer.isBuffer(opts)) throw _err("cms/bad-input", "pki.cms.countersign options must be an object");
|
|
20862
|
+
opts = guard.identifier.optionsObject(opts, _err, "cms/bad-input", "pki.cms.countersign options");
|
|
19739
20863
|
guard.identifier.assertKnownKeys(opts, KNOWN_COUNTERSIGN_OPTS, _err, "cms/bad-input", "unknown opts field ");
|
|
19740
20864
|
var list = Array.isArray(signers) ? signers : [signers];
|
|
19741
20865
|
if (!list.length) throw _err("cms/bad-input", "pki.cms.countersign requires at least one countersigner");
|
|
@@ -21476,8 +22600,7 @@ var require_cms_verify = __commonJS({
|
|
|
21476
22600
|
});
|
|
21477
22601
|
}
|
|
21478
22602
|
function _verify(input, opts) {
|
|
21479
|
-
opts = opts
|
|
21480
|
-
if (typeof opts !== "object" || Buffer.isBuffer(opts)) throw _err("cms/bad-input", "pki.cms.verify options must be an object");
|
|
22603
|
+
opts = guard.identifier.optionsObject(opts, _err, "cms/bad-input", "pki.cms.verify options");
|
|
21481
22604
|
guard.identifier.assertKnownKeys(opts, _VERIFY_OPTS, _err, "cms/bad-input", "pki.cms.verify has an unknown option ");
|
|
21482
22605
|
var parsed = guard.parsed.acceptDerived(input, "cms", function(bytes) {
|
|
21483
22606
|
return cms.parse(_snapshotIfBytes(bytes, "pki.cms.verify"));
|
|
@@ -21533,7 +22656,7 @@ var require_cms_verify = __commonJS({
|
|
|
21533
22656
|
return _snapshotIfBytes(v, "opts.trustAnchors[]");
|
|
21534
22657
|
}
|
|
21535
22658
|
if (v === null || typeof v !== "object") return v;
|
|
21536
|
-
if (v
|
|
22659
|
+
if (guard.time.isDate(v)) return new Date(guard.time.instantOf(v));
|
|
21537
22660
|
if (depth >= _ANCHOR_CLONE_DEPTH) {
|
|
21538
22661
|
throw _err("cms/bad-input", "an opts.trustAnchors entry nests deeper than " + _ANCHOR_CLONE_DEPTH + " levels, so it cannot be copied before the chain is walked; pass the anchor as certificate DER or a { name, publicKey, algorithm } tuple");
|
|
21539
22662
|
}
|
|
@@ -21557,7 +22680,7 @@ var require_cms_verify = __commonJS({
|
|
|
21557
22680
|
}
|
|
21558
22681
|
return {
|
|
21559
22682
|
trustAnchors: anchors,
|
|
21560
|
-
time: opts.time
|
|
22683
|
+
time: guard.time.isDate(opts.time) ? new Date(guard.time.instantOf(opts.time)) : opts.time,
|
|
21561
22684
|
requiredEku: Array.isArray(opts.requiredEku) ? opts.requiredEku.slice() : opts.requiredEku,
|
|
21562
22685
|
checkPurpose: opts.checkPurpose
|
|
21563
22686
|
};
|
|
@@ -22527,6 +23650,9 @@ var require_path_validate = __commonJS({
|
|
|
22527
23650
|
var ocsp = require_schema_ocsp();
|
|
22528
23651
|
var ocspVerify = require_ocsp_verify();
|
|
22529
23652
|
var crlVerify = require_crl_verify();
|
|
23653
|
+
var csrVerify = require_csr_verify();
|
|
23654
|
+
var crmfVerify = require_crmf_verify();
|
|
23655
|
+
var attrcertVerify = require_attrcert_verify();
|
|
22530
23656
|
var cmpVerify = require_cmp_verify();
|
|
22531
23657
|
var cmsVerify = require_cms_verify();
|
|
22532
23658
|
var cmpSession = require_cmp_session();
|
|
@@ -23326,8 +24452,34 @@ var require_path_validate = __commonJS({
|
|
|
23326
24452
|
}
|
|
23327
24453
|
return null;
|
|
23328
24454
|
}
|
|
24455
|
+
var _VALIDATE_OPTS = {
|
|
24456
|
+
checkPurpose: 1,
|
|
24457
|
+
historicalMode: 1,
|
|
24458
|
+
initialAnyPolicyInhibit: 1,
|
|
24459
|
+
initialExcludedSubtrees: 1,
|
|
24460
|
+
initialExplicitPolicy: 1,
|
|
24461
|
+
initialPermittedSubtrees: 1,
|
|
24462
|
+
initialPolicyMappingInhibit: 1,
|
|
24463
|
+
maxPathCerts: 1,
|
|
24464
|
+
maxPolicyNodes: 1,
|
|
24465
|
+
requireRevocation: 1,
|
|
24466
|
+
requiredEku: 1,
|
|
24467
|
+
revocationChecker: 1,
|
|
24468
|
+
softFail: 1,
|
|
24469
|
+
time: 1,
|
|
24470
|
+
trustAnchor: 1,
|
|
24471
|
+
userInitialPolicySet: 1,
|
|
24472
|
+
verifier: 1
|
|
24473
|
+
};
|
|
23329
24474
|
async function validate(path, opts) {
|
|
23330
|
-
opts = opts
|
|
24475
|
+
opts = guard.identifier.optionsObject(opts, E, "path/bad-input", "validate: opts");
|
|
24476
|
+
guard.identifier.assertKnownKeys(
|
|
24477
|
+
opts,
|
|
24478
|
+
_VALIDATE_OPTS,
|
|
24479
|
+
E,
|
|
24480
|
+
"path/bad-input",
|
|
24481
|
+
"pki.path.validate has an unknown option. The anchor here is `trustAnchor`, singular; pki.path.build takes `trustAnchors`. The unknown option was: "
|
|
24482
|
+
);
|
|
23331
24483
|
if (!Array.isArray(path)) throw E("path/bad-input", "validate: path must be an array of certificates");
|
|
23332
24484
|
var maxCerts = guard.limits.cap(opts.maxPathCerts, "validate: opts.maxPathCerts", constants.LIMITS.PATH_MAX_CERTS, { E, code: "path/bad-input", min: 1 });
|
|
23333
24485
|
if (path.length > maxCerts) throw E("path/bad-input", "validate: the certification path has " + path.length + " certificates, exceeding the maxPathCerts limit (" + maxCerts + ")");
|
|
@@ -23401,12 +24553,12 @@ var require_path_validate = __commonJS({
|
|
|
23401
24553
|
checks.push({ name: "kemKeyUsage", ok: kku.ok, code: kku.ok ? void 0 : kku.code });
|
|
23402
24554
|
if (!kku.ok) failed = true;
|
|
23403
24555
|
}
|
|
23404
|
-
var t = opts.time;
|
|
24556
|
+
var t = guard.time.instantOf(opts.time);
|
|
23405
24557
|
var vOk = true, vCode;
|
|
23406
|
-
if (t < cert.validity.notBefore) {
|
|
24558
|
+
if (t < guard.time.instantOf(cert.validity.notBefore)) {
|
|
23407
24559
|
vOk = false;
|
|
23408
24560
|
vCode = "path/not-yet-valid";
|
|
23409
|
-
} else if (t > cert.validity.notAfter) {
|
|
24561
|
+
} else if (t > guard.time.instantOf(cert.validity.notAfter)) {
|
|
23410
24562
|
vOk = false;
|
|
23411
24563
|
vCode = "path/expired";
|
|
23412
24564
|
}
|
|
@@ -23528,7 +24680,7 @@ var require_path_validate = __commonJS({
|
|
|
23528
24680
|
var distrustDate = assertAnchorConstraints(ta, checkPurpose);
|
|
23529
24681
|
if (distrustDate != null) {
|
|
23530
24682
|
anchorDistrustApplied = true;
|
|
23531
|
-
if (cert.validity.notBefore > distrustDate) {
|
|
24683
|
+
if (guard.time.instantOf(cert.validity.notBefore) > guard.time.instantOf(distrustDate)) {
|
|
23532
24684
|
checks.push({ name: "distrustAfter", ok: false, code: "path/distrusted-after" });
|
|
23533
24685
|
failed = true;
|
|
23534
24686
|
}
|
|
@@ -23789,7 +24941,7 @@ var require_path_validate = __commonJS({
|
|
|
23789
24941
|
best = c;
|
|
23790
24942
|
continue;
|
|
23791
24943
|
}
|
|
23792
|
-
var t = c.crl.thisUpdate
|
|
24944
|
+
var t = guard.time.instantOf(c.crl.thisUpdate), bt = guard.time.instantOf(best.crl.thisUpdate);
|
|
23793
24945
|
if (t > bt) {
|
|
23794
24946
|
best = c;
|
|
23795
24947
|
continue;
|
|
@@ -23903,8 +25055,8 @@ var require_path_validate = __commonJS({
|
|
|
23903
25055
|
}
|
|
23904
25056
|
}
|
|
23905
25057
|
}
|
|
23906
|
-
if (theCrl.thisUpdate > time) return null;
|
|
23907
|
-
if (!theCrl.nextUpdate || theCrl.nextUpdate < time) return null;
|
|
25058
|
+
if (guard.time.instantOf(theCrl.thisUpdate) > guard.time.instantOf(time)) return null;
|
|
25059
|
+
if (!theCrl.nextUpdate || guard.time.instantOf(theCrl.nextUpdate) < guard.time.instantOf(time)) return null;
|
|
23908
25060
|
var sigOk = await crlVerify.verifyCrlSignature(theCrl, issuer.workingPublicKey);
|
|
23909
25061
|
if (!sigOk) return null;
|
|
23910
25062
|
void sawIdp;
|
|
@@ -23914,7 +25066,7 @@ var require_path_validate = __commonJS({
|
|
|
23914
25066
|
for (var r = 0; r < theCrl.revokedCertificates.length; r++) {
|
|
23915
25067
|
var entry = theCrl.revokedCertificates[r];
|
|
23916
25068
|
if (entry.serialNumberHex !== cert.serialNumberHex) continue;
|
|
23917
|
-
if (historical && entry.revocationDate
|
|
25069
|
+
if (historical && guard.time.isDate(entry.revocationDate) && guard.time.instantOf(entry.revocationDate) > guard.time.instantOf(time)) continue;
|
|
23918
25070
|
var rc = crlEntryReason(entry);
|
|
23919
25071
|
return rc === null ? 0 : rc;
|
|
23920
25072
|
}
|
|
@@ -24013,6 +25165,9 @@ var require_path_validate = __commonJS({
|
|
|
24013
25165
|
});
|
|
24014
25166
|
}
|
|
24015
25167
|
crlVerify.setEngine(_verifyWithSpki);
|
|
25168
|
+
csrVerify.setEngine(_verifyWithSpki);
|
|
25169
|
+
crmfVerify.setEngine(_verifyWithSpki);
|
|
25170
|
+
attrcertVerify.setEngine(_verifyWithSpki);
|
|
24016
25171
|
var ocspCore = ocspVerify.makeOcspVerify({
|
|
24017
25172
|
verifyWithSpki: _verifyWithSpki,
|
|
24018
25173
|
decodeExt,
|
|
@@ -24105,7 +25260,7 @@ var require_path_validate = __commonJS({
|
|
|
24105
25260
|
}
|
|
24106
25261
|
function _verifyOcspParsed(parsedResponse, cert, issuerCert, time, opts) {
|
|
24107
25262
|
opts = opts || {};
|
|
24108
|
-
if (!(time
|
|
25263
|
+
if (!guard.time.isDate(time) || isNaN(guard.time.instantOf(time))) {
|
|
24109
25264
|
return Promise.reject(E("path/bad-input", "verifyOcspResponse: time must be a valid Date (the currency + responder-validity check date)"));
|
|
24110
25265
|
}
|
|
24111
25266
|
function unbound(reason) {
|
|
@@ -24252,7 +25407,7 @@ var require_path_validate = __commonJS({
|
|
|
24252
25407
|
var ku = softDecode(cand, OID.keyUsage);
|
|
24253
25408
|
if (ku && ku.value && ku.value.keyCertSign === true) score += 10;
|
|
24254
25409
|
var v = cand.validity;
|
|
24255
|
-
if (v && v.notBefore
|
|
25410
|
+
if (v && guard.time.isDate(v.notBefore) && guard.time.isDate(v.notAfter) && guard.time.instantOf(v.notBefore) <= guard.time.instantOf(time) && guard.time.instantOf(time) <= guard.time.instantOf(v.notAfter)) score += 5;
|
|
24256
25411
|
return score;
|
|
24257
25412
|
}
|
|
24258
25413
|
function _pushCandidates(frame, scored, stack, counter) {
|
|
@@ -24352,9 +25507,39 @@ var require_path_validate = __commonJS({
|
|
|
24352
25507
|
}
|
|
24353
25508
|
return out;
|
|
24354
25509
|
}
|
|
25510
|
+
var _BUILD_OPTS = (function() {
|
|
25511
|
+
var o = {
|
|
25512
|
+
aiaTimeout: 1,
|
|
25513
|
+
candidates: 1,
|
|
25514
|
+
fetchAia: 1,
|
|
25515
|
+
intermediates: 1,
|
|
25516
|
+
maxAiaFetches: 1,
|
|
25517
|
+
maxAiaPerCert: 1,
|
|
25518
|
+
maxCandidatesConsidered: 1,
|
|
25519
|
+
maxDepth: 1,
|
|
25520
|
+
maxPathCerts: 1,
|
|
25521
|
+
maxResponseBytes: 1,
|
|
25522
|
+
time: 1,
|
|
25523
|
+
tls: 1,
|
|
25524
|
+
transport: 1,
|
|
25525
|
+
trustAnchors: 1,
|
|
25526
|
+
validate: 1
|
|
25527
|
+
};
|
|
25528
|
+
Object.keys(_VALIDATE_OPTS).forEach(function(k) {
|
|
25529
|
+
o[k] = 1;
|
|
25530
|
+
});
|
|
25531
|
+
delete o.trustAnchor;
|
|
25532
|
+
return o;
|
|
25533
|
+
})();
|
|
24355
25534
|
async function build(leaf, opts) {
|
|
24356
|
-
opts = opts
|
|
24357
|
-
|
|
25535
|
+
opts = guard.identifier.optionsObject(opts, E, "path/bad-input", "build: opts");
|
|
25536
|
+
guard.identifier.assertKnownKeys(
|
|
25537
|
+
opts,
|
|
25538
|
+
_BUILD_OPTS,
|
|
25539
|
+
E,
|
|
25540
|
+
"path/bad-input",
|
|
25541
|
+
"pki.path.build has an unknown option. The anchors here are `trustAnchors`, plural; pki.path.validate takes `trustAnchor`. The unknown option was: "
|
|
25542
|
+
);
|
|
24358
25543
|
var leafCert;
|
|
24359
25544
|
try {
|
|
24360
25545
|
leafCert = coerceCert(leaf);
|
|
@@ -24429,12 +25614,13 @@ var require_path_validate = __commonJS({
|
|
|
24429
25614
|
aiaTimeout: 1,
|
|
24430
25615
|
maxResponseBytes: 1
|
|
24431
25616
|
};
|
|
24432
|
-
var forwarded =
|
|
24433
|
-
Object.keys(
|
|
24434
|
-
if (
|
|
25617
|
+
var forwarded = /* @__PURE__ */ Object.create(null);
|
|
25618
|
+
Object.keys(_VALIDATE_OPTS).forEach(function(k) {
|
|
25619
|
+
if (Object.prototype.hasOwnProperty.call(BUILD_ONLY_OPT, k)) return;
|
|
25620
|
+
if (k in opts) forwarded[k] = opts[k];
|
|
24435
25621
|
});
|
|
24436
25622
|
function validateOpts(anchor) {
|
|
24437
|
-
var vo =
|
|
25623
|
+
var vo = /* @__PURE__ */ Object.create(null);
|
|
24438
25624
|
Object.keys(forwarded).forEach(function(f) {
|
|
24439
25625
|
vo[f] = forwarded[f];
|
|
24440
25626
|
});
|
|
@@ -26351,10 +27537,8 @@ var require_cmc_verify = __commonJS({
|
|
|
26351
27537
|
return input;
|
|
26352
27538
|
}
|
|
26353
27539
|
function _copyAnyBytes(v) {
|
|
26354
|
-
if (
|
|
26355
|
-
|
|
26356
|
-
if (v instanceof ArrayBuffer) return Buffer.from(new Uint8Array(v));
|
|
26357
|
-
return v;
|
|
27540
|
+
if (!guard.bytes.isByteSource(v)) return v;
|
|
27541
|
+
return guard.bytes.snapshotSource(v, CmcError, "cmc/bad-input", "a byte field of the request");
|
|
26358
27542
|
}
|
|
26359
27543
|
function _snapshotSent(sent) {
|
|
26360
27544
|
var out = {}, k;
|
|
@@ -26616,7 +27800,7 @@ var require_tsp_sign = __commonJS({
|
|
|
26616
27800
|
if (!NODE_DIGEST[certHashAlg]) throw _err("tsp/unsupported-algorithm", "unsupported certHashAlgorithm " + JSON.stringify(certHashAlg));
|
|
26617
27801
|
var imprint = b.sequence([_hashAlgId(mi.hashAlgorithm), b.octetString(Buffer.from(mi.hashedMessage))]);
|
|
26618
27802
|
if (opts.genTime != null) guard.time.assertValid(opts.genTime, _err, "tsp/bad-input", "genTime");
|
|
26619
|
-
var genTime = opts.genTime
|
|
27803
|
+
var genTime = guard.time.isDate(opts.genTime) ? opts.genTime : /* @__PURE__ */ new Date();
|
|
26620
27804
|
var serial = guard.range.authoredInteger(opts.serialNumber, _err, "tsp/bad-input", "serialNumber");
|
|
26621
27805
|
var fields = [b.integer(1n), _policy(opts.policy), imprint, b.integer(serial), b.generalizedTime(genTime)];
|
|
26622
27806
|
if (opts.accuracy) fields.push(_accuracy(opts.accuracy));
|
|
@@ -26947,7 +28131,7 @@ var require_tsp_sign = __commonJS({
|
|
|
26947
28131
|
if (opts.trustAnchor) {
|
|
26948
28132
|
var pathRes = null;
|
|
26949
28133
|
var floorT = tst.genTime;
|
|
26950
|
-
var ceilT = tst.genTimeFraction != null && /[1-9]/.test(tst.genTimeFraction.slice(3)) ? new Date(
|
|
28134
|
+
var ceilT = tst.genTimeFraction != null && /[1-9]/.test(tst.genTimeFraction.slice(3)) ? new Date(guard.time.instantOf(floorT) + 1) : floorT;
|
|
26951
28135
|
try {
|
|
26952
28136
|
var pool = (parsed.certificates || []).filter(function(c) {
|
|
26953
28137
|
return c.tagClass === "universal";
|
|
@@ -27120,8 +28304,23 @@ var require_ocsp = __commonJS({
|
|
|
27120
28304
|
[opts, "pki.ocsp.buildRequest options"]
|
|
27121
28305
|
], _buildRequest);
|
|
27122
28306
|
}
|
|
28307
|
+
var _BUILD_REQUEST_OPTS = {
|
|
28308
|
+
hashAlgorithm: 1,
|
|
28309
|
+
nonce: 1,
|
|
28310
|
+
pem: 1,
|
|
28311
|
+
profile: 1,
|
|
28312
|
+
requestorName: 1,
|
|
28313
|
+
signer: 1
|
|
28314
|
+
};
|
|
27123
28315
|
function _buildRequest(query, opts) {
|
|
27124
|
-
opts = opts
|
|
28316
|
+
opts = guard.identifier.optionsObject(opts, _err, "ocsp/bad-input", "pki.ocsp.buildRequest options");
|
|
28317
|
+
guard.identifier.assertKnownKeys(
|
|
28318
|
+
opts,
|
|
28319
|
+
_BUILD_REQUEST_OPTS,
|
|
28320
|
+
_err,
|
|
28321
|
+
"ocsp/bad-input",
|
|
28322
|
+
"pki.ocsp.buildRequest has an unknown option (the anti-replay nonce is `nonce`): "
|
|
28323
|
+
);
|
|
27125
28324
|
var lightweight = opts.profile === "lightweight";
|
|
27126
28325
|
var hashName = opts.hashAlgorithm || "sha1";
|
|
27127
28326
|
if (lightweight && hashName !== "sha1") throw _err("ocsp/bad-input", "the lightweight profile requires a SHA-1 CertID (RFC 5019 sec. 2.1.1)");
|
|
@@ -27195,8 +28394,16 @@ var require_ocsp = __commonJS({
|
|
|
27195
28394
|
[opts, "pki.ocsp.sign options"]
|
|
27196
28395
|
], _sign);
|
|
27197
28396
|
}
|
|
28397
|
+
var _SIGN_OPTS = { embedCert: 1, extendedRevoke: 1, nonce: 1, pem: 1 };
|
|
27198
28398
|
function _sign(responseData, responder, opts) {
|
|
27199
|
-
opts = opts
|
|
28399
|
+
opts = guard.identifier.optionsObject(opts, _err, "ocsp/bad-input", "pki.ocsp.sign options");
|
|
28400
|
+
guard.identifier.assertKnownKeys(
|
|
28401
|
+
opts,
|
|
28402
|
+
_SIGN_OPTS,
|
|
28403
|
+
_err,
|
|
28404
|
+
"ocsp/bad-input",
|
|
28405
|
+
"pki.ocsp.sign has an unknown option (the nonce to echo back is `nonce`): "
|
|
28406
|
+
);
|
|
27200
28407
|
responseData = responseData || {};
|
|
27201
28408
|
if (!responder || responder.cert == null || responder.key == null) throw _err("ocsp/bad-input", "a responder must be { cert, key }");
|
|
27202
28409
|
var respCertDer = _normCertDer(responder.cert, "the responder certificate");
|
|
@@ -27254,8 +28461,8 @@ var require_ocsp = __commonJS({
|
|
|
27254
28461
|
}
|
|
27255
28462
|
function _asDate(d) {
|
|
27256
28463
|
if (d == null) return null;
|
|
27257
|
-
var dt = d
|
|
27258
|
-
if (isNaN(
|
|
28464
|
+
var dt = guard.time.isDate(d) ? d : new Date(d);
|
|
28465
|
+
if (isNaN(guard.time.instantOf(dt))) throw _err("ocsp/bad-input", "an invalid date value " + JSON.stringify(d));
|
|
27259
28466
|
return dt;
|
|
27260
28467
|
}
|
|
27261
28468
|
function _snapshotSignerKey(key, owned) {
|
|
@@ -27313,8 +28520,20 @@ var require_ocsp = __commonJS({
|
|
|
27313
28520
|
if (code == null) throw _err("ocsp/bad-input", "an error responseStatus must be one of " + Object.keys(ERROR_STATUS).join(" / "));
|
|
27314
28521
|
return b.sequence([b.enumerated(BigInt(code))]);
|
|
27315
28522
|
}
|
|
28523
|
+
var _VERIFY_OPTS = { cert: 1, historicalMode: 1, issuer: 1, requestNonce: 1, time: 1 };
|
|
27316
28524
|
function verify(response, opts) {
|
|
27317
|
-
|
|
28525
|
+
try {
|
|
28526
|
+
opts = guard.identifier.optionsObject(opts, _err, "ocsp/bad-input", "pki.ocsp.verify options");
|
|
28527
|
+
guard.identifier.assertKnownKeys(
|
|
28528
|
+
opts,
|
|
28529
|
+
_VERIFY_OPTS,
|
|
28530
|
+
_err,
|
|
28531
|
+
"ocsp/bad-input",
|
|
28532
|
+
"pki.ocsp.verify has an unknown option (the request nonce to bind against is `requestNonce`): "
|
|
28533
|
+
);
|
|
28534
|
+
} catch (e) {
|
|
28535
|
+
return Promise.reject(e);
|
|
28536
|
+
}
|
|
27318
28537
|
if (opts.cert == null || opts.issuer == null) return Promise.reject(_err("ocsp/bad-input", "verify requires opts.cert and opts.issuer"));
|
|
27319
28538
|
var parsed, cert, issuerCert, time;
|
|
27320
28539
|
try {
|
|
@@ -27592,7 +28811,7 @@ var require_x509_sign = __commonJS({
|
|
|
27592
28811
|
var serialTlv = _serialInteger(spec.serialNumber);
|
|
27593
28812
|
guard.time.assertValid(spec.notBefore, _err, "x509/bad-input", "notBefore");
|
|
27594
28813
|
guard.time.assertValid(spec.notAfter, _err, "x509/bad-input", "notAfter");
|
|
27595
|
-
if (spec.notBefore
|
|
28814
|
+
if (guard.time.instantOf(spec.notBefore) > guard.time.instantOf(spec.notAfter)) throw _err("x509/bad-input", "notBefore must not be after notAfter (RFC 5280 sec. 4.1.2.5)");
|
|
27596
28815
|
var validityDer = b.sequence([_timeDer(spec.notBefore, "notBefore"), _timeDer(spec.notAfter, "notAfter")]);
|
|
27597
28816
|
var exts = _buildExtensions(spec.extensions, { spki, issuerSpki, issuerCert, subjectEmpty });
|
|
27598
28817
|
if (subjectEmpty && !_hasCriticalSan(spec.extensions)) {
|
|
@@ -27649,6 +28868,8 @@ var require_csr_sign = __commonJS({
|
|
|
27649
28868
|
var pkiBuild = require_pki_build();
|
|
27650
28869
|
var frameworkError = require_framework_error();
|
|
27651
28870
|
var guard = require_guard_all();
|
|
28871
|
+
require_path_validate();
|
|
28872
|
+
var csrVerify = require_csr_verify();
|
|
27652
28873
|
var CsrError = frameworkError.CsrError;
|
|
27653
28874
|
var KNOWN_SPEC_KEYS = { subject: 1, subjectPublicKey: 1, extensionRequest: 1, challengePassword: 1, attributes: 1 };
|
|
27654
28875
|
var b = asn1.build;
|
|
@@ -27744,7 +28965,27 @@ var require_csr_sign = __commonJS({
|
|
|
27744
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);
|
|
27745
28966
|
});
|
|
27746
28967
|
}
|
|
27747
|
-
|
|
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 };
|
|
27748
28989
|
}
|
|
27749
28990
|
});
|
|
27750
28991
|
|
|
@@ -27759,6 +29000,9 @@ var require_attrcert_sign = __commonJS({
|
|
|
27759
29000
|
var signScheme = require_sign_scheme();
|
|
27760
29001
|
var guard = require_guard_all();
|
|
27761
29002
|
var pkix = require_schema_pkix();
|
|
29003
|
+
var schema = require_schema_engine();
|
|
29004
|
+
require_path_validate();
|
|
29005
|
+
var attrcertVerify = require_attrcert_verify();
|
|
27762
29006
|
var pkiBuild = require_pki_build();
|
|
27763
29007
|
var frameworkError = require_framework_error();
|
|
27764
29008
|
var AttrCertError = frameworkError.AttrCertError;
|
|
@@ -27886,7 +29130,7 @@ var require_attrcert_sign = __commonJS({
|
|
|
27886
29130
|
function _encodeValidity(notBefore, notAfter) {
|
|
27887
29131
|
guard.time.assertValid(notBefore, _err, "attrcert/bad-input", "notBeforeTime");
|
|
27888
29132
|
guard.time.assertValid(notAfter, _err, "attrcert/bad-input", "notAfterTime");
|
|
27889
|
-
if (
|
|
29133
|
+
if (guard.time.instantOf(notBefore) > guard.time.instantOf(notAfter)) throw _err("attrcert/bad-input", "notBeforeTime must not be after notAfterTime (RFC 5755 sec. 4.2.6)");
|
|
27890
29134
|
return b.sequence([b.generalizedTime(notBefore), b.generalizedTime(notAfter)]);
|
|
27891
29135
|
}
|
|
27892
29136
|
function _encodeRole(role) {
|
|
@@ -28085,6 +29329,15 @@ var require_attrcert_sign = __commonJS({
|
|
|
28085
29329
|
if (!attrs.length) throw _err("attrcert/bad-attributes", "attributes must carry at least one Attribute (RFC 5755 sec. 4.2.7)");
|
|
28086
29330
|
return b.sequence(attrs);
|
|
28087
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
|
+
}
|
|
28088
29341
|
function _buildExtensions(extSpec, aaSpki) {
|
|
28089
29342
|
if (extSpec == null) return null;
|
|
28090
29343
|
if (Array.isArray(extSpec)) {
|
|
@@ -28111,6 +29364,7 @@ var require_attrcert_sign = __commonJS({
|
|
|
28111
29364
|
}
|
|
28112
29365
|
return b.raw(der);
|
|
28113
29366
|
});
|
|
29367
|
+
_assertRevocationSchemesExclusive(seenA);
|
|
28114
29368
|
return b.sequence(exts);
|
|
28115
29369
|
}
|
|
28116
29370
|
if (typeof extSpec !== "object") throw _err("attrcert/bad-input", "extensions must be an object or an array of pre-encoded Extension DER");
|
|
@@ -28125,6 +29379,7 @@ var require_attrcert_sign = __commonJS({
|
|
|
28125
29379
|
seen[eOid] = true;
|
|
28126
29380
|
out.push(_b.ext(eOid, meta.critical, _extensionValue(k, extSpec[k], aaSpki)));
|
|
28127
29381
|
});
|
|
29382
|
+
_assertRevocationSchemesExclusive(seen);
|
|
28128
29383
|
if (!out.length) return null;
|
|
28129
29384
|
return b.sequence(out);
|
|
28130
29385
|
}
|
|
@@ -28180,7 +29435,284 @@ var require_attrcert_sign = __commonJS({
|
|
|
28180
29435
|
throw _err("attrcert/bad-input", "signing the attribute certificate failed -- the signing key does not match the resolved algorithm or is invalid", e);
|
|
28181
29436
|
});
|
|
28182
29437
|
}
|
|
28183
|
-
|
|
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 };
|
|
28184
29716
|
}
|
|
28185
29717
|
});
|
|
28186
29718
|
|
|
@@ -28550,7 +30082,7 @@ var require_crl_sign = __commonJS({
|
|
|
28550
30082
|
var nextU = null;
|
|
28551
30083
|
if (spec.nextUpdate != null) {
|
|
28552
30084
|
nextU = _timeDer(spec.nextUpdate, "nextUpdate");
|
|
28553
|
-
if (spec.nextUpdate
|
|
30085
|
+
if (guard.time.instantOf(spec.nextUpdate) < guard.time.instantOf(spec.thisUpdate)) throw _err("crl/bad-input", "nextUpdate must not be before thisUpdate (RFC 5280 sec. 5.1.2.5)");
|
|
28554
30086
|
}
|
|
28555
30087
|
var extResult = _buildCrlExtensions(spec, { issuerCert, issuerSpki });
|
|
28556
30088
|
var crlExts = extResult.exts;
|
|
@@ -28642,9 +30174,33 @@ var require_crl_sign = __commonJS({
|
|
|
28642
30174
|
if (v <= 0n) throw _err("crl/bad-input", "serialNumber must be a positive integer");
|
|
28643
30175
|
return asn1.decode(b.integer(v)).content.toString("hex");
|
|
28644
30176
|
}
|
|
28645
|
-
|
|
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
|
+
}
|
|
28646
30189
|
var parsed = _coerceCrl(crl);
|
|
28647
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
|
+
}
|
|
28648
30204
|
if (_findExtOid(parsed.crlExtensions, "deltaCRLIndicator")) {
|
|
28649
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");
|
|
28650
30206
|
}
|
|
@@ -28656,7 +30212,9 @@ var require_crl_sign = __commonJS({
|
|
|
28656
30212
|
}
|
|
28657
30213
|
}
|
|
28658
30214
|
for (var j = 0; j < parsed.revokedCertificates.length; j++) {
|
|
28659
|
-
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];
|
|
28660
30218
|
}
|
|
28661
30219
|
return null;
|
|
28662
30220
|
}
|
|
@@ -28751,8 +30309,16 @@ var require_key = __commonJS({
|
|
|
28751
30309
|
}
|
|
28752
30310
|
return pkix.coerceToDer(input, { pemLabel: "PRIVATE KEY", PemError, ErrorClass: KeyError, prefix: "key" });
|
|
28753
30311
|
}
|
|
30312
|
+
var _ENCRYPT_OPTS = { cipher: 1, iterations: 1, pem: 1, prf: 1, salt: 1 };
|
|
28754
30313
|
async function encrypt(privateKey, password, opts) {
|
|
28755
|
-
opts = opts
|
|
30314
|
+
opts = guard.identifier.optionsObject(opts, _err, "key/bad-input", "pki.key.encrypt options");
|
|
30315
|
+
guard.identifier.assertKnownKeys(
|
|
30316
|
+
opts,
|
|
30317
|
+
_ENCRYPT_OPTS,
|
|
30318
|
+
_err,
|
|
30319
|
+
"key/bad-input",
|
|
30320
|
+
"pki.key.encrypt has an unknown option (the PBKDF2 count here is `iterations`; `maxIterations` is the decrypt-side cap): "
|
|
30321
|
+
);
|
|
28756
30322
|
var der = await _toPrivateKeyDer(privateKey);
|
|
28757
30323
|
try {
|
|
28758
30324
|
pkcs8.parse(der);
|
|
@@ -28783,8 +30349,16 @@ var require_key = __commonJS({
|
|
|
28783
30349
|
guard.secret.zeroize(dk, KeyError, "key/bad-input", "the password-derived encryption key");
|
|
28784
30350
|
}
|
|
28785
30351
|
}
|
|
30352
|
+
var _DECRYPT_OPTS = { maxIterations: 1, pem: 1 };
|
|
28786
30353
|
async function decrypt(encrypted, password, opts) {
|
|
28787
|
-
opts = opts
|
|
30354
|
+
opts = guard.identifier.optionsObject(opts, _err, "key/bad-input", "pki.key.decrypt options");
|
|
30355
|
+
guard.identifier.assertKnownKeys(
|
|
30356
|
+
opts,
|
|
30357
|
+
_DECRYPT_OPTS,
|
|
30358
|
+
_err,
|
|
30359
|
+
"key/bad-input",
|
|
30360
|
+
"pki.key.decrypt has an unknown option (the PBKDF2 cap here is `maxIterations`; `iterations` is the encrypt-side count): "
|
|
30361
|
+
);
|
|
28788
30362
|
if (opts.maxIterations != null && (typeof opts.maxIterations !== "number" || !isFinite(opts.maxIterations) || opts.maxIterations < 1 || Math.floor(opts.maxIterations) !== opts.maxIterations)) {
|
|
28789
30363
|
throw _err("key/bad-input", "maxIterations must be a positive integer");
|
|
28790
30364
|
}
|
|
@@ -28815,8 +30389,16 @@ var require_key = __commonJS({
|
|
|
28815
30389
|
}
|
|
28816
30390
|
return plaintext;
|
|
28817
30391
|
}
|
|
30392
|
+
var _EXPORT_OPTS = { format: 1, label: 1 };
|
|
28818
30393
|
async function export_(key, opts) {
|
|
28819
|
-
opts = opts
|
|
30394
|
+
opts = guard.identifier.optionsObject(opts, _err, "key/bad-input", "pki.key.export options");
|
|
30395
|
+
guard.identifier.assertKnownKeys(
|
|
30396
|
+
opts,
|
|
30397
|
+
_EXPORT_OPTS,
|
|
30398
|
+
_err,
|
|
30399
|
+
"key/bad-input",
|
|
30400
|
+
"pki.key.export has an unknown option. It serializes only. To protect a private key, call pki.key.encrypt(key, password) first and export its result. The unknown option was: "
|
|
30401
|
+
);
|
|
28820
30402
|
if (!_isCryptoKey(key)) throw _err("key/bad-input", "export expects a WebCrypto CryptoKey");
|
|
28821
30403
|
var defaultLabel;
|
|
28822
30404
|
if (key.type === "private") defaultLabel = "PRIVATE KEY";
|
|
@@ -28828,8 +30410,16 @@ var require_key = __commonJS({
|
|
|
28828
30410
|
if (fmt === "pem") return pkix.pemEncode(der, opts.label || defaultLabel, PemError);
|
|
28829
30411
|
throw _err("key/bad-input", "unsupported format " + JSON.stringify(opts.format) + " (der / pem)");
|
|
28830
30412
|
}
|
|
30413
|
+
var _IMPORT_OPTS = { algorithm: 1, extractable: 1, password: 1, usages: 1 };
|
|
28831
30414
|
async function import_(input, opts) {
|
|
28832
|
-
opts = opts
|
|
30415
|
+
opts = guard.identifier.optionsObject(opts, _err, "key/bad-input", "pki.key.import options");
|
|
30416
|
+
guard.identifier.assertKnownKeys(
|
|
30417
|
+
opts,
|
|
30418
|
+
_IMPORT_OPTS,
|
|
30419
|
+
_err,
|
|
30420
|
+
"key/bad-input",
|
|
30421
|
+
"pki.key.import has an unknown option: "
|
|
30422
|
+
);
|
|
28833
30423
|
var detected = _detectKeyInput(input);
|
|
28834
30424
|
if (detected.format === "encrypted") {
|
|
28835
30425
|
if (opts.password == null) throw _err("key/bad-input", "an ENCRYPTED PRIVATE KEY requires opts.password to import");
|
|
@@ -28846,8 +30436,16 @@ var require_key = __commonJS({
|
|
|
28846
30436
|
throw _err("key/bad-input", "importKey failed", e);
|
|
28847
30437
|
}
|
|
28848
30438
|
}
|
|
30439
|
+
var _GENERATE_OPTS = { extractable: 1, usages: 1 };
|
|
28849
30440
|
async function generate(algorithm, opts) {
|
|
28850
|
-
opts = opts
|
|
30441
|
+
opts = guard.identifier.optionsObject(opts, _err, "key/bad-input", "pki.key.generate options");
|
|
30442
|
+
guard.identifier.assertKnownKeys(
|
|
30443
|
+
opts,
|
|
30444
|
+
_GENERATE_OPTS,
|
|
30445
|
+
_err,
|
|
30446
|
+
"key/bad-input",
|
|
30447
|
+
"pki.key.generate has an unknown option (the WebCrypto spelling is `extractable`): "
|
|
30448
|
+
);
|
|
28851
30449
|
var extractable = opts.extractable != null ? opts.extractable : true;
|
|
28852
30450
|
var usages = opts.usages || _generateUsages(_algName(algorithm));
|
|
28853
30451
|
var pair;
|
|
@@ -28860,8 +30458,16 @@ var require_key = __commonJS({
|
|
|
28860
30458
|
if (!pair || !pair.privateKey || !pair.publicKey) throw _err("key/bad-input", "the algorithm does not generate an asymmetric key pair");
|
|
28861
30459
|
return { privateKey: pair.privateKey, publicKey: pair.publicKey };
|
|
28862
30460
|
}
|
|
30461
|
+
var _PUBLIC_FROM_PRIVATE_OPTS = { pem: 1 };
|
|
28863
30462
|
async function publicFromPrivate(privateKey, opts) {
|
|
28864
|
-
opts = opts
|
|
30463
|
+
opts = guard.identifier.optionsObject(opts, _err, "key/bad-input", "pki.key.publicFromPrivate options");
|
|
30464
|
+
guard.identifier.assertKnownKeys(
|
|
30465
|
+
opts,
|
|
30466
|
+
_PUBLIC_FROM_PRIVATE_OPTS,
|
|
30467
|
+
_err,
|
|
30468
|
+
"key/bad-input",
|
|
30469
|
+
"pki.key.publicFromPrivate has an unknown option: "
|
|
30470
|
+
);
|
|
28865
30471
|
var der = await _toPrivateKeyDer(privateKey);
|
|
28866
30472
|
var spki;
|
|
28867
30473
|
try {
|
|
@@ -30884,8 +32490,8 @@ var require_sigstore = __commonJS({
|
|
|
30884
32490
|
function _toMs(x) {
|
|
30885
32491
|
if (x == null) return null;
|
|
30886
32492
|
if (typeof x === "number") return Number.isFinite(x) ? x : null;
|
|
30887
|
-
if (x
|
|
30888
|
-
var d =
|
|
32493
|
+
if (guard.time.isDate(x)) {
|
|
32494
|
+
var d = guard.time.instantOf(x);
|
|
30889
32495
|
return isNaN(d) ? null : d;
|
|
30890
32496
|
}
|
|
30891
32497
|
if (typeof x === "string") {
|
|
@@ -31198,7 +32804,7 @@ var require_sigstore = __commonJS({
|
|
|
31198
32804
|
}
|
|
31199
32805
|
}
|
|
31200
32806
|
if (integratedTime === null) throw lastErr;
|
|
31201
|
-
var checkTime = opts.time
|
|
32807
|
+
var checkTime = guard.time.isDate(opts.time) ? guard.time.instantOf(opts.time) : C.TIME.seconds(integratedTime);
|
|
31202
32808
|
await _verifyChain(leaf, _chainDers(vm), fulcioRoots, checkTime);
|
|
31203
32809
|
var identity = _identity(leaf);
|
|
31204
32810
|
var identityChecked = _checkIdentity(identity, opts.identity);
|
|
@@ -31944,8 +33550,8 @@ var require_est = __commonJS({
|
|
|
31944
33550
|
return asn1.build.sequence([asn1.build.oid(typeOid), asn1.build.set(valueNodes)]);
|
|
31945
33551
|
}
|
|
31946
33552
|
function challengePasswordFromTlsUnique(channelBinding) {
|
|
31947
|
-
if (!Buffer.isBuffer(channelBinding) || channelBinding
|
|
31948
|
-
var b64 = channelBinding.toString("base64");
|
|
33553
|
+
if (!Buffer.isBuffer(channelBinding) || guard.bytes.lengthOf(channelBinding) === 0) throw E("est/bad-input", "challengePasswordFromTlsUnique requires the channel-binding bytes");
|
|
33554
|
+
var b64 = guard.bytes.view(channelBinding, EstError, "est/bad-input", "the channel-binding bytes").toString("base64");
|
|
31949
33555
|
if (b64.length > 255) throw E("est/tls-unique-too-long", "the base64 tls-unique value exceeds 255 octets (RFC 7030 sec. 3.5)");
|
|
31950
33556
|
return _attr(OID_CHALLENGE_PASSWORD, [asn1.build.printable(b64)]);
|
|
31951
33557
|
}
|
|
@@ -32125,7 +33731,7 @@ var require_est = __commonJS({
|
|
|
32125
33731
|
function step() {
|
|
32126
33732
|
return transport({ method, url: url.href, headers: _headersFor(url), body, tls: _tlsFor(url), timeout: budgets.timeout, maxResponseBytes: budgets.maxResponseBytes }).then(function(res) {
|
|
32127
33733
|
res = res || {};
|
|
32128
|
-
var blen = Buffer.isBuffer(res.body) ? res.body
|
|
33734
|
+
var blen = Buffer.isBuffer(res.body) ? guard.bytes.lengthOf(res.body) : Buffer.byteLength(String(res.body == null ? "" : res.body), "utf8");
|
|
32129
33735
|
if (blen > budgets.maxResponseBytes) throw E("est/response-too-large", "the response body (" + blen + " bytes) exceeds the " + budgets.maxResponseBytes + "-byte cap (RFC 7030 sec. 6)");
|
|
32130
33736
|
var h = {
|
|
32131
33737
|
location: _ciHeader(res.headers, "location"),
|
|
@@ -32221,7 +33827,7 @@ var require_est = __commonJS({
|
|
|
32221
33827
|
return { retry: true, retryAfterSeconds: verdict.retryAfterSeconds, retryAfterDate: verdict.retryAfterDate };
|
|
32222
33828
|
}
|
|
32223
33829
|
if (verdict.status !== "ok") throw E("est/http-error", "an EST " + op + " response must be HTTP 200 or 202 (RFC 7030 sec. 4.1.3 / 4.2.3), got " + res.status);
|
|
32224
|
-
var bodyLen = Buffer.isBuffer(res.body) ? res.body
|
|
33830
|
+
var bodyLen = Buffer.isBuffer(res.body) ? guard.bytes.lengthOf(res.body) : Buffer.byteLength(String(res.body == null ? "" : res.body), "utf8");
|
|
32225
33831
|
if (bodyLen === 0) throw E("est/empty-body", "a 200 " + op + " response carried an empty body (RFC 7030 sec. 4.1.3 / 4.2.3)");
|
|
32226
33832
|
var parsed = parseCertsOnly(transferDecode(res.body));
|
|
32227
33833
|
if (op === "cacerts") return { certificates: parsed.certificates, crls: parsed.crls };
|
|
@@ -32381,10 +33987,8 @@ var require_est = __commonJS({
|
|
|
32381
33987
|
};
|
|
32382
33988
|
}
|
|
32383
33989
|
function _copyBytes(v) {
|
|
32384
|
-
if (
|
|
32385
|
-
|
|
32386
|
-
if (v instanceof ArrayBuffer) return Buffer.from(new Uint8Array(v));
|
|
32387
|
-
return v;
|
|
33990
|
+
if (!guard.bytes.isByteSource(v)) return v;
|
|
33991
|
+
return guard.bytes.snapshotSource(v, EstError, "est/bad-input", "a byte field of the request");
|
|
32388
33992
|
}
|
|
32389
33993
|
function _requestBinding(der) {
|
|
32390
33994
|
var out = {
|
|
@@ -32526,7 +34130,7 @@ var require_est = __commonJS({
|
|
|
32526
34130
|
"an EST /fullcmc response must be HTTP 200 or 202 (RFC 7030 sec. 4.3.2), got " + res.status
|
|
32527
34131
|
);
|
|
32528
34132
|
}
|
|
32529
|
-
var bodyLen = Buffer.isBuffer(res.body) ? res.body
|
|
34133
|
+
var bodyLen = Buffer.isBuffer(res.body) ? guard.bytes.lengthOf(res.body) : Buffer.byteLength(String(res.body == null ? "" : res.body), "utf8");
|
|
32530
34134
|
if (bodyLen === 0) throw E("est/empty-body", "a 200 /fullcmc response carried an empty body (RFC 7030 sec. 4.3.2)");
|
|
32531
34135
|
var der = transferDecode(res.body);
|
|
32532
34136
|
var pt200 = _partMediaType(_ciHeader(res.headers, "content-type"));
|
|
@@ -32694,7 +34298,7 @@ var require_est = __commonJS({
|
|
|
32694
34298
|
var verdict = classifyResponse(res.status, res.headers, res.body, { op: "serverkeygen", now: opts.now });
|
|
32695
34299
|
if (verdict.status === "retry") return { retry: true, retryAfterSeconds: verdict.retryAfterSeconds, retryAfterDate: verdict.retryAfterDate };
|
|
32696
34300
|
if (verdict.status !== "ok") throw E("est/http-error", "an EST serverkeygen response must be HTTP 200 or 202 (RFC 7030 sec. 4.4.2), got " + res.status);
|
|
32697
|
-
var bodyLen = Buffer.isBuffer(res.body) ? res.body
|
|
34301
|
+
var bodyLen = Buffer.isBuffer(res.body) ? guard.bytes.lengthOf(res.body) : Buffer.byteLength(String(res.body == null ? "" : res.body), "utf8");
|
|
32698
34302
|
if (bodyLen === 0) throw E("est/empty-body", "a 200 serverkeygen response carried an empty body (RFC 7030 sec. 4.4.2)");
|
|
32699
34303
|
_assertConfidentialCipher(res);
|
|
32700
34304
|
var out = parseServerKeygenResponse(res.body, _ciHeader(res.headers, "content-type"), {
|
|
@@ -32749,7 +34353,7 @@ var require_est = __commonJS({
|
|
|
32749
34353
|
if (verdict.status === "none-available") return { available: false, attrs: null };
|
|
32750
34354
|
if (verdict.status === "retry") throw E("est/http-error", "a /csrattrs response must be HTTP 200, 204, or 404, not 202 (RFC 7030 sec. 4.5.2)");
|
|
32751
34355
|
if (verdict.status !== "ok") throw E("est/http-error", "an EST csrattrs response must be HTTP 200 / 204 / 404 (RFC 7030 sec. 4.5.2), got " + res.status);
|
|
32752
|
-
var bodyLen = Buffer.isBuffer(res.body) ? res.body
|
|
34356
|
+
var bodyLen = Buffer.isBuffer(res.body) ? guard.bytes.lengthOf(res.body) : Buffer.byteLength(String(res.body == null ? "" : res.body), "utf8");
|
|
32753
34357
|
if (bodyLen === 0) throw E("est/empty-body", "a 200 csrattrs response carried an empty body (RFC 7030 sec. 4.5.2)");
|
|
32754
34358
|
var attrs = csrattrsFmt.parse(transferDecode(res.body));
|
|
32755
34359
|
return { available: true, attrs, plan: buildEnrollAttributes(attrs) };
|
|
@@ -34191,7 +35795,7 @@ var require_acme = __commonJS({
|
|
|
34191
35795
|
Object.keys(res.headers || {}).forEach(function(k) {
|
|
34192
35796
|
h[k.toLowerCase()] = res.headers[k];
|
|
34193
35797
|
});
|
|
34194
|
-
var blen = Buffer.isBuffer(res.body) ? res.body
|
|
35798
|
+
var blen = Buffer.isBuffer(res.body) ? guard.bytes.lengthOf(res.body) : Buffer.byteLength(String(res.body == null ? "" : res.body), "utf8");
|
|
34195
35799
|
if (blen > budgets.maxResponseBytes) throw E("acme/response-too-large", "the response body (" + blen + " bytes) exceeds the " + budgets.maxResponseBytes + "-byte cap");
|
|
34196
35800
|
if ((method === "GET" || method === "HEAD") && res.status >= 300 && res.status < 400) {
|
|
34197
35801
|
if (redirects >= budgets.maxRedirects) throw E("acme/too-many-redirects", "the redirect budget of " + budgets.maxRedirects + " was exceeded");
|
|
@@ -34517,7 +36121,7 @@ var require_acme = __commonJS({
|
|
|
34517
36121
|
if (typeof t !== "number" || !isFinite(t)) throw E("acme/bad-input", "the renewalInfo clock returned a non-finite value");
|
|
34518
36122
|
return t;
|
|
34519
36123
|
}
|
|
34520
|
-
var notAfterMs = x509.parse(certDer).validity.notAfter
|
|
36124
|
+
var notAfterMs = guard.time.instantOf(x509.parse(certDer).validity.notAfter);
|
|
34521
36125
|
if (clk() > notAfterMs) throw E("acme/certificate-expired", "the certificate is already past its notAfter; a client MUST NOT check RenewalInfo after it has expired (RFC 9773 sec. 4.3)");
|
|
34522
36126
|
var certId = ariCertId(certDer);
|
|
34523
36127
|
return _resource("renewalInfo").then(function(base) {
|
|
@@ -34558,12 +36162,12 @@ var require_acme = __commonJS({
|
|
|
34558
36162
|
}
|
|
34559
36163
|
var notAfter = x509.parse(certDer).validity.notAfter;
|
|
34560
36164
|
var now = clk();
|
|
34561
|
-
if (now >
|
|
36165
|
+
if (now > guard.time.instantOf(notAfter)) throw E("acme/certificate-expired", "the certificate is already past its notAfter; there is nothing to renew (RFC 9773 sec. 4.3)");
|
|
34562
36166
|
if (o.replaced === true) throw E("acme/certificate-replaced", "the caller asserts this certificate has already been replaced (RFC 9773 sec. 4.3)");
|
|
34563
36167
|
return _renewalInfo(certDer, clk, RENEWAL_RETRY_MAX_SECONDS).then(function(ri) {
|
|
34564
36168
|
var w = ri.renewalInfo.suggestedWindow;
|
|
34565
36169
|
var startMs = Date.parse(w.start), endMs = Date.parse(w.end);
|
|
34566
|
-
var notAfterMs =
|
|
36170
|
+
var notAfterMs = guard.time.instantOf(notAfter);
|
|
34567
36171
|
var effEnd = Math.min(endMs, notAfterMs), effStart = Math.min(startMs, effEnd);
|
|
34568
36172
|
var pw = o.previous && _isObject(o.previous.suggestedWindow) ? o.previous.suggestedWindow : null;
|
|
34569
36173
|
var selectedMs;
|
|
@@ -34904,7 +36508,7 @@ var require_trust = __commonJS({
|
|
|
34904
36508
|
var out = {};
|
|
34905
36509
|
if (!src || typeof src !== "object") return out;
|
|
34906
36510
|
Object.keys(src).forEach(function(k) {
|
|
34907
|
-
out[k] = src[k]
|
|
36511
|
+
out[k] = guard.time.isDate(src[k]) ? new Date(guard.time.instantOf(src[k])) : src[k];
|
|
34908
36512
|
});
|
|
34909
36513
|
return out;
|
|
34910
36514
|
}
|
|
@@ -34923,7 +36527,7 @@ var require_trust = __commonJS({
|
|
|
34923
36527
|
var kx = Object.keys(x).sort(), ky = Object.keys(y).sort();
|
|
34924
36528
|
if (kx.join(",") !== ky.join(",")) return false;
|
|
34925
36529
|
return kx.every(function(k) {
|
|
34926
|
-
return x[k]
|
|
36530
|
+
return guard.time.instantOf(x[k]) === guard.time.instantOf(y[k]);
|
|
34927
36531
|
});
|
|
34928
36532
|
}
|
|
34929
36533
|
function _purposesEqual(x, y) {
|
|
@@ -35276,8 +36880,9 @@ var require_inspect = __commonJS({
|
|
|
35276
36880
|
return (n < 10 ? "0" : "") + n;
|
|
35277
36881
|
}
|
|
35278
36882
|
function _date(iso) {
|
|
35279
|
-
var
|
|
35280
|
-
if (isNaN(
|
|
36883
|
+
var held = guard.time.isDate(iso) ? guard.time.instantOf(iso) : Date.parse(String(iso));
|
|
36884
|
+
if (isNaN(held)) return String(iso);
|
|
36885
|
+
var d = new Date(held);
|
|
35281
36886
|
var day = d.getUTCDate(), dd = (day < 10 ? " " : "") + day;
|
|
35282
36887
|
return MONTHS[d.getUTCMonth()] + " " + dd + " " + _two(d.getUTCHours()) + ":" + _two(d.getUTCMinutes()) + ":" + _two(d.getUTCSeconds()) + " " + d.getUTCFullYear() + " GMT";
|
|
35283
36888
|
}
|
|
@@ -35756,7 +37361,7 @@ var require_inspect = __commonJS({
|
|
|
35756
37361
|
var inner = pad + " ";
|
|
35757
37362
|
if (ext.oid === OID_CRL_NUMBER && typeof ext.value === "bigint") return header + "\n" + inner + String(ext.value);
|
|
35758
37363
|
if (ext.oid === OID_REASON_CODE && typeof ext.value === "number") return header + "\n" + inner + (NAMES.CRL_REASON[ext.value] || String(ext.value));
|
|
35759
|
-
if (ext.oid === OID_INVALIDITY_DATE && ext.value
|
|
37364
|
+
if (ext.oid === OID_INVALIDITY_DATE && guard.time.isDate(ext.value)) return header + "\n" + inner + _date(ext.value);
|
|
35760
37365
|
if (ext.oid === OID_DELTA_CRL_INDICATOR && Buffer.isBuffer(ext.value)) {
|
|
35761
37366
|
try {
|
|
35762
37367
|
return header + "\n" + inner + "BaseCRLNumber: " + String(asn1.read.integer(asn1.decode(ext.value)));
|
|
@@ -36098,7 +37703,7 @@ var require_lint = __commonJS({
|
|
|
36098
37703
|
function _effective(rule, cert) {
|
|
36099
37704
|
if (!rule.effectiveDate) return true;
|
|
36100
37705
|
var nb = cert.validity && cert.validity.notBefore;
|
|
36101
|
-
return nb
|
|
37706
|
+
return guard.time.isDate(nb) && guard.time.instantOf(nb) >= guard.time.instantOf(rule.effectiveDate);
|
|
36102
37707
|
}
|
|
36103
37708
|
function _runLints(rules2, cert, ctx) {
|
|
36104
37709
|
var findings = [], counts = { fatal: 0, error: 0, warn: 0, notice: 0, pass: 0, na: 0, ne: 0 }, ran = [];
|
|
@@ -36275,7 +37880,7 @@ var require_lint = __commonJS({
|
|
|
36275
37880
|
message: "the certificate notBefore must not be later than notAfter",
|
|
36276
37881
|
check: function(cert) {
|
|
36277
37882
|
var v = cert.validity;
|
|
36278
|
-
return v.notBefore
|
|
37883
|
+
return guard.time.isDate(v.notBefore) && guard.time.isDate(v.notAfter) && guard.time.instantOf(v.notBefore) > guard.time.instantOf(v.notAfter) ? true : null;
|
|
36279
37884
|
}
|
|
36280
37885
|
},
|
|
36281
37886
|
{
|
|
@@ -36567,7 +38172,7 @@ var require_lint = __commonJS({
|
|
|
36567
38172
|
var VALIDITY_SCHEDULE_START = VALIDITY_SCHEDULE[VALIDITY_SCHEDULE.length - 1].from;
|
|
36568
38173
|
function _validityCeilingDays(notBefore) {
|
|
36569
38174
|
for (var i = 0; i < VALIDITY_SCHEDULE.length; i++) {
|
|
36570
|
-
if (
|
|
38175
|
+
if (guard.time.instantOf(notBefore) >= guard.time.instantOf(VALIDITY_SCHEDULE[i].from)) return VALIDITY_SCHEDULE[i].maxDays;
|
|
36571
38176
|
}
|
|
36572
38177
|
return VALIDITY_SCHEDULE[VALIDITY_SCHEDULE.length - 1].maxDays;
|
|
36573
38178
|
}
|
|
@@ -36666,9 +38271,9 @@ var require_lint = __commonJS({
|
|
|
36666
38271
|
effectiveDate: VALIDITY_SCHEDULE_START,
|
|
36667
38272
|
check: function(cert) {
|
|
36668
38273
|
var v = cert.validity;
|
|
36669
|
-
if (!(v.notBefore
|
|
38274
|
+
if (!guard.time.isDate(v.notBefore) || !guard.time.isDate(v.notAfter)) return null;
|
|
36670
38275
|
var maxDays = _validityCeilingDays(v.notBefore);
|
|
36671
|
-
var days = (v.notAfter
|
|
38276
|
+
var days = (guard.time.instantOf(v.notAfter) - guard.time.instantOf(v.notBefore)) / MS_PER_DAY;
|
|
36672
38277
|
return days > maxDays ? { context: { days: Math.round(days), maxDays } } : null;
|
|
36673
38278
|
}
|
|
36674
38279
|
}
|
|
@@ -36729,9 +38334,16 @@ var require_lint = __commonJS({
|
|
|
36729
38334
|
return (SEVERITY[f.severity] || 0) >= floor;
|
|
36730
38335
|
});
|
|
36731
38336
|
}
|
|
38337
|
+
var _CERTIFICATE_OPTS = { profile: 1, severity: 1 };
|
|
36732
38338
|
function certificate(input, opts) {
|
|
36733
|
-
opts = opts
|
|
36734
|
-
|
|
38339
|
+
opts = guard.identifier.optionsObject(opts, _cfg, "lint/bad-input", "pki.lint options");
|
|
38340
|
+
guard.identifier.assertKnownKeys(
|
|
38341
|
+
opts,
|
|
38342
|
+
_CERTIFICATE_OPTS,
|
|
38343
|
+
_cfg,
|
|
38344
|
+
"lint/bad-input",
|
|
38345
|
+
"pki.lint.certificate has an unknown option: "
|
|
38346
|
+
);
|
|
36735
38347
|
if (opts.severity != null && VALID_SEVERITY.indexOf(opts.severity) === -1) {
|
|
36736
38348
|
throw _cfg("lint/bad-severity", 'unknown severity threshold "' + opts.severity + '" (known: ' + VALID_SEVERITY.join(", ") + ")");
|
|
36737
38349
|
}
|
|
@@ -37116,11 +38728,11 @@ var require_webauthn_mds = __commonJS({
|
|
|
37116
38728
|
"webauthn/bad-metadata-blob",
|
|
37117
38729
|
"the metadata BLOB nextUpdate"
|
|
37118
38730
|
);
|
|
37119
|
-
return
|
|
38731
|
+
return guard.time.instantOf(d) + constants.TIME.days(1);
|
|
37120
38732
|
}
|
|
37121
38733
|
function assertFresh(metadata, at, label) {
|
|
37122
38734
|
if (!metadata || metadata.allowStale === true || typeof metadata.nextUpdate !== "string") return;
|
|
37123
|
-
var atMs = at
|
|
38735
|
+
var atMs = guard.time.isDate(at) ? guard.time.instantOf(at) : NaN;
|
|
37124
38736
|
var limit = _staleAfter(metadata.nextUpdate);
|
|
37125
38737
|
if (!isFinite(atMs) || !isFinite(limit)) return;
|
|
37126
38738
|
if (atMs >= limit) {
|
|
@@ -37151,7 +38763,7 @@ var require_webauthn_mds = __commonJS({
|
|
|
37151
38763
|
throw _err("webauthn/metadata-rollback", "the metadata BLOB no " + payload.no + " does not exceed the previously held " + opts.previousNo);
|
|
37152
38764
|
}
|
|
37153
38765
|
var staleAfter = _staleAfter(payload.nextUpdate);
|
|
37154
|
-
var atMs =
|
|
38766
|
+
var atMs = guard.time.instantOf(at);
|
|
37155
38767
|
if (!isFinite(atMs) || !isFinite(staleAfter)) {
|
|
37156
38768
|
throw _err("webauthn/bad-input", "the metadata freshness comparison has no usable instant");
|
|
37157
38769
|
}
|
|
@@ -37323,7 +38935,7 @@ var require_webauthn_mds = __commonJS({
|
|
|
37323
38935
|
"webauthn/bad-metadata-blob",
|
|
37324
38936
|
"a status report effectiveDate"
|
|
37325
38937
|
);
|
|
37326
|
-
return
|
|
38938
|
+
return guard.time.instantOf(d) <= atMs;
|
|
37327
38939
|
}
|
|
37328
38940
|
function statusDenied(entry, metadata, leaf, at) {
|
|
37329
38941
|
var policy = metadata && metadata.statusPolicy || "any";
|
|
@@ -37335,7 +38947,7 @@ var require_webauthn_mds = __commonJS({
|
|
|
37335
38947
|
var isDated = function(r) {
|
|
37336
38948
|
return r && typeof r.effectiveDate === "string" && rfc3339.isValidDate(r.effectiveDate);
|
|
37337
38949
|
};
|
|
37338
|
-
var atMs = at
|
|
38950
|
+
var atMs = guard.time.isDate(at) && isFinite(guard.time.instantOf(at)) ? guard.time.instantOf(at) : null;
|
|
37339
38951
|
if (atMs !== null) {
|
|
37340
38952
|
reports = reports.filter(function(r) {
|
|
37341
38953
|
return !isDated(r) || _reportInForceAt(r, atMs);
|