@keetanetwork/keetanet-client 0.12.0 → 0.12.2
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/client/index-browser.js +525 -257
- package/client/index.js +377 -136
- package/docs/assets/hierarchy.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.BaseSet.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.BlockHash.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperation.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationCREATE_IDENTIFIER.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationMANAGE_CERTIFICATE.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationMODIFY_PERMISSIONS.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationRECEIVE.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationSEND.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationSET_INFO.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationSET_REP.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationTOKEN_ADMIN_MODIFY_BALANCE.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationTOKEN_ADMIN_SUPPLY.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.Certificate.html +21 -7
- package/docs/classes/KeetaNetSDK.Referenced.CertificateBundle.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.CertificateHash.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ECDSAKeyPair.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256K1KeyPair.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256K1PrivateKey.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256K1PublicKey.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256K1Signature.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1KeyPair.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1PrivateKey.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1PublicKey.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1Signature.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ED25519KeyPair.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ED25519PrivateKey.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ED25519PublicKey.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ED25519Signature.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ExternalKeyPair.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ExternalSet.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.IdentifierKey.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.IdentifierKeyPair.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.KeetaNetError.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.KeyInterface.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.KeyStorage.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.PermissionSetHolder.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.PossiblyExpiredVote.html +3 -2
- package/docs/classes/KeetaNetSDK.Referenced.SignatureStorage.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.Vote.html +3 -2
- package/docs/classes/KeetaNetSDK.Referenced.VoteBlockBundle.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.VoteBlockHash.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.VoteBuilder.html +2 -1
- package/docs/classes/KeetaNetSDK.Referenced.VoteHash.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.VoteStaple.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.VoteStapleHash.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.default.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.src_lib_utils_buffer.BufferStorage.html +1 -1
- package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_asn1.isASN1Object.html +1 -0
- package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_buffer.ZlibDeflateAsync.html +1 -0
- package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_buffer.ZlibInflateAsync.html +1 -0
- package/docs/hierarchy.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.ACLEntry.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.ACLUpdate.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.ASN1ExplicitContextTag.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.ASN1ImplicitContextTag.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.ASN1Object.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BaseExternalKeyPairFunctions.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BaseGenerationConfig.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockCanonical.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperation.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationCREATE_IDENTIFIER.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationMANAGE_CERTIFICATE.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationMANAGE_CERTIFICATESerializable.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationMODIFY_PERMISSIONS.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationRECEIVE.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationSEND.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationSET_INFO.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationSET_REP.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationTOKEN_ADMIN_MODIFY_BALANCE.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationTOKEN_ADMIN_SUPPLY.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.Constructor.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.DisposableTimingHandle.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.ExternalKeyPairFunctionsNoEncryption.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.ExternalKeyPairFunctionsSupportsEncryption.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.FeeAmountAndToken.html +5 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.FeeAmountAndTokenJSON.html +4 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.InitialConfigSupply.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.InstanceSet.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.KVGenericOptionsType.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.KVSetOptionsType.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.ModifyTokenBalanceEntry.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.NumericValueEntry.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.P2PPeerBase.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.P2PPeerListener.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.P2PPeerRepBase.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.PublicKeyStorage.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.RequestTokenReceiveEntry.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.TokenNumericEntry.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.UserClientConfig.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.UserClientOptions.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.VoteJSON.html +3 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.VoteStapleJSON.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.WithIsInstance.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1BitString.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1Date.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1OID.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1Set.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1String.html +1 -1
- package/docs/modules/KeetaNetSDK.Referenced.html +1 -1
- package/docs/modules/KeetaNetSDK.Referenced.src_lib_utils_asn1.html +1 -1
- package/docs/modules/KeetaNetSDK.Referenced.src_lib_utils_buffer.html +1 -1
- package/docs/modules/KeetaNetSDK.Referenced.src_lib_utils_helper.html +1 -1
- package/docs/types/KeetaNetSDK.Referenced.CertificateExtensionData.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.CertificateExtensions.html +2 -2
- package/docs/types/KeetaNetSDK.Referenced.StorageAddress.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.VoteBuilderOptions.html +4 -0
- package/docs/variables/KeetaNetSDK.Referenced.VoteErrorCodes.html +1 -1
- package/docs/variables/KeetaNetSDK.Referenced.src_lib_utils_helper.crypto.html +1 -0
- package/lib/error/vote.d.ts +1 -1
- package/lib/utils/asn1.d.ts +1 -0
- package/lib/utils/buffer.d.ts +4 -0
- package/lib/utils/certificate.d.ts +44 -14
- package/lib/utils/helper.d.ts +7 -0
- package/lib/vote.d.ts +51 -10
- package/package.json +1 -1
- package/version.d.ts +1 -1
package/client/index-browser.js
CHANGED
|
@@ -76,7 +76,7 @@ class browserSHA3_256 {
|
|
|
76
76
|
|
|
77
77
|
function createHash(hashName, ...args) {
|
|
78
78
|
let hash;
|
|
79
|
-
if (hashName === 'sha3-256') {
|
|
79
|
+
if (hashName.toLowerCase() === 'sha3-256') {
|
|
80
80
|
hash = new browserSHA3_256();
|
|
81
81
|
} else {
|
|
82
82
|
hash = crypto.createHash(hashName, ...args);
|
|
@@ -86,7 +86,7 @@ function createHash(hashName, ...args) {
|
|
|
86
86
|
|
|
87
87
|
function createHmac(hashName, key, ...args) {
|
|
88
88
|
let hmac;
|
|
89
|
-
if (hashName === 'sha3-256') {
|
|
89
|
+
if (hashName.toLowerCase() === 'sha3-256') {
|
|
90
90
|
hmac = new browserSHA3_256(key);
|
|
91
91
|
} else {
|
|
92
92
|
hmac = crypto.createHmac(hashName, key, ...args);
|
|
@@ -20619,7 +20619,7 @@ var $TypeError = __webpack_require__(9675);
|
|
|
20619
20619
|
var $call = __webpack_require__(76);
|
|
20620
20620
|
var $actualApply = __webpack_require__(3144);
|
|
20621
20621
|
|
|
20622
|
-
/** @type {import('.')
|
|
20622
|
+
/** @type {(args: [Function, thisArg?: unknown, ...args: unknown[]]) => Function} TODO FIXME, find a way to use import('.') */
|
|
20623
20623
|
module.exports = function callBindBasic(args) {
|
|
20624
20624
|
if (args.length < 1 || typeof args[0] !== 'function') {
|
|
20625
20625
|
throw new $TypeError('a function is required');
|
|
@@ -20712,10 +20712,11 @@ var $indexOf = callBindBasic([GetIntrinsic('%String.prototype.indexOf%')]);
|
|
|
20712
20712
|
|
|
20713
20713
|
/** @type {import('.')} */
|
|
20714
20714
|
module.exports = function callBoundIntrinsic(name, allowMissing) {
|
|
20715
|
-
|
|
20716
|
-
|
|
20715
|
+
/* eslint no-extra-parens: 0 */
|
|
20716
|
+
|
|
20717
|
+
var intrinsic = /** @type {(this: unknown, ...args: unknown[]) => unknown} */ (GetIntrinsic(name, !!allowMissing));
|
|
20717
20718
|
if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {
|
|
20718
|
-
return callBindBasic([intrinsic]);
|
|
20719
|
+
return callBindBasic(/** @type {const} */ ([intrinsic]));
|
|
20719
20720
|
}
|
|
20720
20721
|
return intrinsic;
|
|
20721
20722
|
};
|
|
@@ -46167,6 +46168,7 @@ var isCallable = __webpack_require__(9600);
|
|
|
46167
46168
|
var toStr = Object.prototype.toString;
|
|
46168
46169
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
46169
46170
|
|
|
46171
|
+
/** @type {<This, A extends readonly unknown[]>(arr: A, iterator: (this: This | void, value: A[number], index: number, arr: A) => void, receiver: This | undefined) => void} */
|
|
46170
46172
|
var forEachArray = function forEachArray(array, iterator, receiver) {
|
|
46171
46173
|
for (var i = 0, len = array.length; i < len; i++) {
|
|
46172
46174
|
if (hasOwnProperty.call(array, i)) {
|
|
@@ -46179,6 +46181,7 @@ var forEachArray = function forEachArray(array, iterator, receiver) {
|
|
|
46179
46181
|
}
|
|
46180
46182
|
};
|
|
46181
46183
|
|
|
46184
|
+
/** @type {<This, S extends string>(string: S, iterator: (this: This | void, value: S[number], index: number, string: S) => void, receiver: This | undefined) => void} */
|
|
46182
46185
|
var forEachString = function forEachString(string, iterator, receiver) {
|
|
46183
46186
|
for (var i = 0, len = string.length; i < len; i++) {
|
|
46184
46187
|
// no such thing as a sparse string.
|
|
@@ -46190,6 +46193,7 @@ var forEachString = function forEachString(string, iterator, receiver) {
|
|
|
46190
46193
|
}
|
|
46191
46194
|
};
|
|
46192
46195
|
|
|
46196
|
+
/** @type {<This, O>(obj: O, iterator: (this: This | void, value: O[keyof O], index: keyof O, obj: O) => void, receiver: This | undefined) => void} */
|
|
46193
46197
|
var forEachObject = function forEachObject(object, iterator, receiver) {
|
|
46194
46198
|
for (var k in object) {
|
|
46195
46199
|
if (hasOwnProperty.call(object, k)) {
|
|
@@ -46202,7 +46206,13 @@ var forEachObject = function forEachObject(object, iterator, receiver) {
|
|
|
46202
46206
|
}
|
|
46203
46207
|
};
|
|
46204
46208
|
|
|
46205
|
-
|
|
46209
|
+
/** @type {(x: unknown) => x is readonly unknown[]} */
|
|
46210
|
+
function isArray(x) {
|
|
46211
|
+
return toStr.call(x) === '[object Array]';
|
|
46212
|
+
}
|
|
46213
|
+
|
|
46214
|
+
/** @type {import('.')._internal} */
|
|
46215
|
+
module.exports = function forEach(list, iterator, thisArg) {
|
|
46206
46216
|
if (!isCallable(iterator)) {
|
|
46207
46217
|
throw new TypeError('iterator must be a function');
|
|
46208
46218
|
}
|
|
@@ -46212,7 +46222,7 @@ var forEach = function forEach(list, iterator, thisArg) {
|
|
|
46212
46222
|
receiver = thisArg;
|
|
46213
46223
|
}
|
|
46214
46224
|
|
|
46215
|
-
if (
|
|
46225
|
+
if (isArray(list)) {
|
|
46216
46226
|
forEachArray(list, iterator, receiver);
|
|
46217
46227
|
} else if (typeof list === 'string') {
|
|
46218
46228
|
forEachString(list, iterator, receiver);
|
|
@@ -46221,8 +46231,6 @@ var forEach = function forEach(list, iterator, thisArg) {
|
|
|
46221
46231
|
}
|
|
46222
46232
|
};
|
|
46223
46233
|
|
|
46224
|
-
module.exports = forEach;
|
|
46225
|
-
|
|
46226
46234
|
|
|
46227
46235
|
/***/ }),
|
|
46228
46236
|
|
|
@@ -46610,6 +46618,7 @@ var INTRINSICS = {
|
|
|
46610
46618
|
'%Error%': $Error,
|
|
46611
46619
|
'%eval%': eval, // eslint-disable-line no-eval
|
|
46612
46620
|
'%EvalError%': $EvalError,
|
|
46621
|
+
'%Float16Array%': typeof Float16Array === 'undefined' ? undefined : Float16Array,
|
|
46613
46622
|
'%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array,
|
|
46614
46623
|
'%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array,
|
|
46615
46624
|
'%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry,
|
|
@@ -93306,8 +93315,8 @@ var availableTypedArrays = __webpack_require__(9209);
|
|
|
93306
93315
|
var callBind = __webpack_require__(487);
|
|
93307
93316
|
var callBound = __webpack_require__(6556);
|
|
93308
93317
|
var gOPD = __webpack_require__(5795);
|
|
93318
|
+
var getProto = __webpack_require__(3628);
|
|
93309
93319
|
|
|
93310
|
-
/** @type {(O: object) => string} */
|
|
93311
93320
|
var $toString = callBound('Object.prototype.toString');
|
|
93312
93321
|
var hasToStringTag = __webpack_require__(9092)();
|
|
93313
93322
|
|
|
@@ -93315,7 +93324,6 @@ var g = typeof globalThis === 'undefined' ? __webpack_require__.g : globalThis;
|
|
|
93315
93324
|
var typedArrays = availableTypedArrays();
|
|
93316
93325
|
|
|
93317
93326
|
var $slice = callBound('String.prototype.slice');
|
|
93318
|
-
var getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof');
|
|
93319
93327
|
|
|
93320
93328
|
/** @type {<T = unknown>(array: readonly T[], value: unknown) => number} */
|
|
93321
93329
|
var $indexOf = callBound('Array.prototype.indexOf', true) || function indexOf(array, value) {
|
|
@@ -93327,18 +93335,18 @@ var $indexOf = callBound('Array.prototype.indexOf', true) || function indexOf(ar
|
|
|
93327
93335
|
return -1;
|
|
93328
93336
|
};
|
|
93329
93337
|
|
|
93330
|
-
/** @typedef {
|
|
93331
|
-
/** @type {
|
|
93338
|
+
/** @typedef {import('./types').Getter} Getter */
|
|
93339
|
+
/** @type {import('./types').Cache} */
|
|
93332
93340
|
var cache = { __proto__: null };
|
|
93333
|
-
if (hasToStringTag && gOPD &&
|
|
93341
|
+
if (hasToStringTag && gOPD && getProto) {
|
|
93334
93342
|
forEach(typedArrays, function (typedArray) {
|
|
93335
93343
|
var arr = new g[typedArray]();
|
|
93336
|
-
if (Symbol.toStringTag in arr) {
|
|
93337
|
-
var proto =
|
|
93344
|
+
if (Symbol.toStringTag in arr && getProto) {
|
|
93345
|
+
var proto = getProto(arr);
|
|
93338
93346
|
// @ts-expect-error TS won't narrow inside a closure
|
|
93339
93347
|
var descriptor = gOPD(proto, Symbol.toStringTag);
|
|
93340
|
-
if (!descriptor) {
|
|
93341
|
-
var superProto =
|
|
93348
|
+
if (!descriptor && proto) {
|
|
93349
|
+
var superProto = getProto(proto);
|
|
93342
93350
|
// @ts-expect-error TS won't narrow inside a closure
|
|
93343
93351
|
descriptor = gOPD(superProto, Symbol.toStringTag);
|
|
93344
93352
|
}
|
|
@@ -93351,8 +93359,12 @@ if (hasToStringTag && gOPD && getPrototypeOf) {
|
|
|
93351
93359
|
var arr = new g[typedArray]();
|
|
93352
93360
|
var fn = arr.slice || arr.set;
|
|
93353
93361
|
if (fn) {
|
|
93354
|
-
|
|
93355
|
-
|
|
93362
|
+
cache[
|
|
93363
|
+
/** @type {`$${import('.').TypedArrayName}`} */ ('$' + typedArray)
|
|
93364
|
+
] = /** @type {import('./types').BoundSlice | import('./types').BoundSet} */ (
|
|
93365
|
+
// @ts-expect-error TODO FIXME
|
|
93366
|
+
callBind(fn)
|
|
93367
|
+
);
|
|
93356
93368
|
}
|
|
93357
93369
|
});
|
|
93358
93370
|
}
|
|
@@ -93361,15 +93373,14 @@ if (hasToStringTag && gOPD && getPrototypeOf) {
|
|
|
93361
93373
|
var tryTypedArrays = function tryAllTypedArrays(value) {
|
|
93362
93374
|
/** @type {ReturnType<typeof tryAllTypedArrays>} */ var found = false;
|
|
93363
93375
|
forEach(
|
|
93364
|
-
|
|
93365
|
-
/** @type {Record<`\$${TypedArrayName}`, Getter>} */ /** @type {any} */ (cache),
|
|
93376
|
+
/** @type {Record<`\$${import('.').TypedArrayName}`, Getter>} */ (cache),
|
|
93366
93377
|
/** @type {(getter: Getter, name: `\$${import('.').TypedArrayName}`) => void} */
|
|
93367
93378
|
function (getter, typedArray) {
|
|
93368
93379
|
if (!found) {
|
|
93369
93380
|
try {
|
|
93370
|
-
|
|
93381
|
+
// @ts-expect-error a throw is fine here
|
|
93371
93382
|
if ('$' + getter(value) === typedArray) {
|
|
93372
|
-
found = $slice(typedArray, 1);
|
|
93383
|
+
found = /** @type {import('.').TypedArrayName} */ ($slice(typedArray, 1));
|
|
93373
93384
|
}
|
|
93374
93385
|
} catch (e) { /**/ }
|
|
93375
93386
|
}
|
|
@@ -93382,14 +93393,13 @@ var tryTypedArrays = function tryAllTypedArrays(value) {
|
|
|
93382
93393
|
var trySlices = function tryAllSlices(value) {
|
|
93383
93394
|
/** @type {ReturnType<typeof tryAllSlices>} */ var found = false;
|
|
93384
93395
|
forEach(
|
|
93385
|
-
|
|
93386
|
-
/** @type {
|
|
93387
|
-
/** @type {(getter: typeof cache, name: `\$${import('.').TypedArrayName}`) => void} */ function (getter, name) {
|
|
93396
|
+
/** @type {Record<`\$${import('.').TypedArrayName}`, Getter>} */(cache),
|
|
93397
|
+
/** @type {(getter: Getter, name: `\$${import('.').TypedArrayName}`) => void} */ function (getter, name) {
|
|
93388
93398
|
if (!found) {
|
|
93389
93399
|
try {
|
|
93390
|
-
// @ts-expect-error
|
|
93400
|
+
// @ts-expect-error a throw is fine here
|
|
93391
93401
|
getter(value);
|
|
93392
|
-
found = $slice(name, 1);
|
|
93402
|
+
found = /** @type {import('.').TypedArrayName} */ ($slice(name, 1));
|
|
93393
93403
|
} catch (e) { /**/ }
|
|
93394
93404
|
}
|
|
93395
93405
|
}
|
|
@@ -101168,6 +101178,7 @@ __webpack_require__.d(client_helper_namespaceObject, {
|
|
|
101168
101178
|
booleanEnv: () => (client_booleanEnv),
|
|
101169
101179
|
bufferToArrayBuffer: () => (client_bufferToArrayBuffer),
|
|
101170
101180
|
checkableGenerator: () => (client_checkableGenerator),
|
|
101181
|
+
crypto: () => (client_helper_crypto),
|
|
101171
101182
|
debugPrintableObject: () => (client_debugPrintableObject),
|
|
101172
101183
|
env: () => (client_env),
|
|
101173
101184
|
internalLogger: () => (client_internalLogger),
|
|
@@ -101183,16 +101194,19 @@ __webpack_require__.d(client_helper_namespaceObject, {
|
|
|
101183
101194
|
});
|
|
101184
101195
|
|
|
101185
101196
|
// NAMESPACE OBJECT: ./src/lib/utils/buffer.ts
|
|
101186
|
-
var
|
|
101187
|
-
__webpack_require__.r(
|
|
101188
|
-
__webpack_require__.d(
|
|
101197
|
+
var client_utils_buffer_namespaceObject = {};
|
|
101198
|
+
__webpack_require__.r(client_utils_buffer_namespaceObject);
|
|
101199
|
+
__webpack_require__.d(client_utils_buffer_namespaceObject, {
|
|
101200
|
+
Buffer: () => (client_node_modules_buffer.Buffer),
|
|
101189
101201
|
BufferStorage: () => (src_client_BufferStorage),
|
|
101190
101202
|
DecodeBase32: () => (client_DecodeBase32),
|
|
101191
101203
|
DecodeBase64: () => (client_DecodeBase64),
|
|
101192
101204
|
EncodeBase32: () => (client_EncodeBase32),
|
|
101193
101205
|
EncodeBase64: () => (client_EncodeBase64),
|
|
101194
101206
|
ZlibDeflate: () => (client_ZlibDeflate),
|
|
101195
|
-
|
|
101207
|
+
ZlibDeflateAsync: () => (client_ZlibDeflateAsync),
|
|
101208
|
+
ZlibInflate: () => (client_ZlibInflate),
|
|
101209
|
+
ZlibInflateAsync: () => (client_ZlibInflateAsync)
|
|
101196
101210
|
});
|
|
101197
101211
|
|
|
101198
101212
|
// NAMESPACE OBJECT: ./node_modules/asn1js/src/asn1.js
|
|
@@ -101256,6 +101270,7 @@ __webpack_require__.d(client_utils_asn1_namespaceObject, {
|
|
|
101256
101270
|
ValidateASN1: () => (client_ValidateASN1),
|
|
101257
101271
|
_Testing: () => (client_Testing),
|
|
101258
101272
|
asn1: () => (client_asn1),
|
|
101273
|
+
isASN1Object: () => (client_isASN1Object),
|
|
101259
101274
|
isValidSequenceSchema: () => (client_isValidSequenceSchema)
|
|
101260
101275
|
});
|
|
101261
101276
|
|
|
@@ -105293,6 +105308,83 @@ function client_hash_Hash(data) {
|
|
|
105293
105308
|
}
|
|
105294
105309
|
client_hash_Hash.functionName = client_HashFunctionName;
|
|
105295
105310
|
client_hash_Hash.functionLength = client_HashFunctionLength;
|
|
105311
|
+
;// ./node_modules/uuid/dist/esm-browser/native.js
|
|
105312
|
+
const client_randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
105313
|
+
/* harmony default export */ const client_esm_browser_native = ({ randomUUID: client_randomUUID });
|
|
105314
|
+
|
|
105315
|
+
;// ./node_modules/uuid/dist/esm-browser/rng.js
|
|
105316
|
+
let client_getRandomValues;
|
|
105317
|
+
const client_rnds8 = new Uint8Array(16);
|
|
105318
|
+
function client_rng() {
|
|
105319
|
+
if (!client_getRandomValues) {
|
|
105320
|
+
if (typeof crypto === 'undefined' || !crypto.getRandomValues) {
|
|
105321
|
+
throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
|
|
105322
|
+
}
|
|
105323
|
+
client_getRandomValues = crypto.getRandomValues.bind(crypto);
|
|
105324
|
+
}
|
|
105325
|
+
return client_getRandomValues(client_rnds8);
|
|
105326
|
+
}
|
|
105327
|
+
|
|
105328
|
+
;// ./node_modules/uuid/dist/esm-browser/stringify.js
|
|
105329
|
+
|
|
105330
|
+
const client_byteToHex = [];
|
|
105331
|
+
for (let i = 0; i < 256; ++i) {
|
|
105332
|
+
client_byteToHex.push((i + 0x100).toString(16).slice(1));
|
|
105333
|
+
}
|
|
105334
|
+
function client_unsafeStringify(arr, offset = 0) {
|
|
105335
|
+
return (client_byteToHex[arr[offset + 0]] +
|
|
105336
|
+
client_byteToHex[arr[offset + 1]] +
|
|
105337
|
+
client_byteToHex[arr[offset + 2]] +
|
|
105338
|
+
client_byteToHex[arr[offset + 3]] +
|
|
105339
|
+
'-' +
|
|
105340
|
+
client_byteToHex[arr[offset + 4]] +
|
|
105341
|
+
client_byteToHex[arr[offset + 5]] +
|
|
105342
|
+
'-' +
|
|
105343
|
+
client_byteToHex[arr[offset + 6]] +
|
|
105344
|
+
client_byteToHex[arr[offset + 7]] +
|
|
105345
|
+
'-' +
|
|
105346
|
+
client_byteToHex[arr[offset + 8]] +
|
|
105347
|
+
client_byteToHex[arr[offset + 9]] +
|
|
105348
|
+
'-' +
|
|
105349
|
+
client_byteToHex[arr[offset + 10]] +
|
|
105350
|
+
client_byteToHex[arr[offset + 11]] +
|
|
105351
|
+
client_byteToHex[arr[offset + 12]] +
|
|
105352
|
+
client_byteToHex[arr[offset + 13]] +
|
|
105353
|
+
client_byteToHex[arr[offset + 14]] +
|
|
105354
|
+
client_byteToHex[arr[offset + 15]]).toLowerCase();
|
|
105355
|
+
}
|
|
105356
|
+
function client_stringify(arr, offset = 0) {
|
|
105357
|
+
const uuid = client_unsafeStringify(arr, offset);
|
|
105358
|
+
if (!validate(uuid)) {
|
|
105359
|
+
throw TypeError('Stringified UUID is invalid');
|
|
105360
|
+
}
|
|
105361
|
+
return uuid;
|
|
105362
|
+
}
|
|
105363
|
+
/* harmony default export */ const client_esm_browser_stringify = ((/* unused pure expression or super */ null && (client_stringify)));
|
|
105364
|
+
|
|
105365
|
+
;// ./node_modules/uuid/dist/esm-browser/v4.js
|
|
105366
|
+
|
|
105367
|
+
|
|
105368
|
+
|
|
105369
|
+
function client_v4(options, buf, offset) {
|
|
105370
|
+
if (client_esm_browser_native.randomUUID && !buf && !options) {
|
|
105371
|
+
return client_esm_browser_native.randomUUID();
|
|
105372
|
+
}
|
|
105373
|
+
options = options || {};
|
|
105374
|
+
const rnds = options.random || (options.rng || client_rng)();
|
|
105375
|
+
rnds[6] = (rnds[6] & 0x0f) | 0x40;
|
|
105376
|
+
rnds[8] = (rnds[8] & 0x3f) | 0x80;
|
|
105377
|
+
if (buf) {
|
|
105378
|
+
offset = offset || 0;
|
|
105379
|
+
for (let i = 0; i < 16; ++i) {
|
|
105380
|
+
buf[offset + i] = rnds[i];
|
|
105381
|
+
}
|
|
105382
|
+
return buf;
|
|
105383
|
+
}
|
|
105384
|
+
return client_unsafeStringify(rnds);
|
|
105385
|
+
}
|
|
105386
|
+
/* harmony default export */ const client_esm_browser_v4 = (client_v4);
|
|
105387
|
+
|
|
105296
105388
|
;// ./src/lib/utils/helper.ts
|
|
105297
105389
|
/* provided dependency */ var client_process = __webpack_require__(5606);
|
|
105298
105390
|
/* provided dependency */ var src_client_Buffer = __webpack_require__(8287)["Buffer"];
|
|
@@ -105309,9 +105401,14 @@ function src_client_assertClassBrand(e, t, n) { if ("function" == typeof e ? e =
|
|
|
105309
105401
|
|
|
105310
105402
|
|
|
105311
105403
|
|
|
105404
|
+
|
|
105312
105405
|
const client_loggingLevels = ['debug', 'error'];
|
|
105313
105406
|
const client_configuredLoggingLevel = (client_process$env$KEETANET = client_process.env['KEETANET_DEBUG']) === null || client_process$env$KEETANET === void 0 ? void 0 : client_process$env$KEETANET.toLowerCase();
|
|
105314
105407
|
const client_configuredLoggingFilter = new RegExp((client_process$env$KEETANET2 = client_process.env['KEETANET_DEBUG_FILTER']) !== null && client_process$env$KEETANET2 !== void 0 ? client_process$env$KEETANET2 : '', 'i');
|
|
105408
|
+
const client_helper_randomBytes = client_crypto_default().randomBytes.bind((client_crypto_default()));
|
|
105409
|
+
const client_helper_randomUUID = (client_crypto_default()).randomUUID ? client_crypto_default().randomUUID.bind((client_crypto_default())) : function () {
|
|
105410
|
+
return client_esm_browser_v4();
|
|
105411
|
+
};
|
|
105315
105412
|
function client_bufferToArrayBuffer(input) {
|
|
105316
105413
|
const out = new ArrayBuffer(input.length);
|
|
105317
105414
|
const view = new Uint8Array(out);
|
|
@@ -105403,7 +105500,7 @@ function client_randomString() {
|
|
|
105403
105500
|
}
|
|
105404
105501
|
|
|
105405
105502
|
// Generate bytes and convert to hex string
|
|
105406
|
-
let generated =
|
|
105503
|
+
let generated = client_helper_randomBytes(bytesToGen).toString('hex');
|
|
105407
105504
|
|
|
105408
105505
|
// If you requested an odd length, remove last character
|
|
105409
105506
|
// This is one byte is 2 characters, so we cannot directly generate odd lengths
|
|
@@ -105810,6 +105907,12 @@ function client_setGenerator(parent, rawEncode, rawDecode) {
|
|
|
105810
105907
|
}
|
|
105811
105908
|
};
|
|
105812
105909
|
}
|
|
105910
|
+
const client_helper_crypto = {
|
|
105911
|
+
randomUUID: client_helper_randomUUID,
|
|
105912
|
+
randomBytes: client_helper_randomBytes,
|
|
105913
|
+
createCipheriv: client_crypto_default().createCipheriv.bind((client_crypto_default())),
|
|
105914
|
+
createDecipheriv: client_crypto_default().createDecipheriv.bind((client_crypto_default()))
|
|
105915
|
+
};
|
|
105813
105916
|
;// ./node_modules/rfc4648/lib/rfc4648.js
|
|
105814
105917
|
/* eslint-disable @typescript-eslint/strict-boolean-expressions */
|
|
105815
105918
|
|
|
@@ -105841,7 +105944,7 @@ var client_base16 = {
|
|
|
105841
105944
|
return client_parse(string.toUpperCase(), client_base16Encoding, opts);
|
|
105842
105945
|
},
|
|
105843
105946
|
stringify: function stringify(data, opts) {
|
|
105844
|
-
return
|
|
105947
|
+
return src_client_stringify(data, client_base16Encoding, opts);
|
|
105845
105948
|
}
|
|
105846
105949
|
};
|
|
105847
105950
|
var client_base32 = {
|
|
@@ -105852,7 +105955,7 @@ var client_base32 = {
|
|
|
105852
105955
|
return client_parse(opts.loose ? string.toUpperCase().replace(/0/g, 'O').replace(/1/g, 'L').replace(/8/g, 'B') : string, client_base32Encoding, opts);
|
|
105853
105956
|
},
|
|
105854
105957
|
stringify: function stringify(data, opts) {
|
|
105855
|
-
return
|
|
105958
|
+
return src_client_stringify(data, client_base32Encoding, opts);
|
|
105856
105959
|
}
|
|
105857
105960
|
};
|
|
105858
105961
|
var client_base32hex = {
|
|
@@ -105860,7 +105963,7 @@ var client_base32hex = {
|
|
|
105860
105963
|
return client_parse(string, client_base32HexEncoding, opts);
|
|
105861
105964
|
},
|
|
105862
105965
|
stringify: function stringify(data, opts) {
|
|
105863
|
-
return
|
|
105966
|
+
return src_client_stringify(data, client_base32HexEncoding, opts);
|
|
105864
105967
|
}
|
|
105865
105968
|
};
|
|
105866
105969
|
var client_base64 = {
|
|
@@ -105868,7 +105971,7 @@ var client_base64 = {
|
|
|
105868
105971
|
return client_parse(string, client_base64Encoding, opts);
|
|
105869
105972
|
},
|
|
105870
105973
|
stringify: function stringify(data, opts) {
|
|
105871
|
-
return
|
|
105974
|
+
return src_client_stringify(data, client_base64Encoding, opts);
|
|
105872
105975
|
}
|
|
105873
105976
|
};
|
|
105874
105977
|
var client_base64url = {
|
|
@@ -105876,7 +105979,7 @@ var client_base64url = {
|
|
|
105876
105979
|
return client_parse(string, client_base64UrlEncoding, opts);
|
|
105877
105980
|
},
|
|
105878
105981
|
stringify: function stringify(data, opts) {
|
|
105879
|
-
return
|
|
105982
|
+
return src_client_stringify(data, client_base64UrlEncoding, opts);
|
|
105880
105983
|
}
|
|
105881
105984
|
};
|
|
105882
105985
|
|
|
@@ -105886,7 +105989,7 @@ var client_base64url = {
|
|
|
105886
105989
|
|
|
105887
105990
|
var client_codec = {
|
|
105888
105991
|
parse: client_parse,
|
|
105889
|
-
stringify:
|
|
105992
|
+
stringify: src_client_stringify
|
|
105890
105993
|
};
|
|
105891
105994
|
function client_parse(string, encoding, opts) {
|
|
105892
105995
|
var _opts$out;
|
|
@@ -105948,7 +106051,7 @@ function client_parse(string, encoding, opts) {
|
|
|
105948
106051
|
}
|
|
105949
106052
|
return out;
|
|
105950
106053
|
}
|
|
105951
|
-
function
|
|
106054
|
+
function src_client_stringify(data, encoding, opts) {
|
|
105952
106055
|
if (opts === void 0) {
|
|
105953
106056
|
opts = {};
|
|
105954
106057
|
}
|
|
@@ -105987,11 +106090,12 @@ function client_stringify(data, encoding, opts) {
|
|
|
105987
106090
|
|
|
105988
106091
|
|
|
105989
106092
|
|
|
106093
|
+
// EXTERNAL MODULE: ./node_modules/buffer/index.js
|
|
106094
|
+
var client_node_modules_buffer = __webpack_require__(8287);
|
|
105990
106095
|
// EXTERNAL MODULE: ./node_modules/browserify-zlib/lib/index.js
|
|
105991
106096
|
var src_client_lib = __webpack_require__(8559);
|
|
105992
106097
|
var client_lib_default = /*#__PURE__*/__webpack_require__.n(src_client_lib);
|
|
105993
106098
|
;// ./src/lib/utils/buffer.ts
|
|
105994
|
-
/* provided dependency */ var client_buffer_Buffer = __webpack_require__(8287)["Buffer"];
|
|
105995
106099
|
var client_BufferStorage;
|
|
105996
106100
|
function client_buffer_defineProperty(e, r, t) { return (r = client_buffer_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
105997
106101
|
function client_buffer_toPropertyKey(t) { var i = client_buffer_toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
@@ -106005,6 +106109,10 @@ function client_buffer_assertClassBrand(e, t, n) { if ("function" == typeof e ?
|
|
|
106005
106109
|
|
|
106006
106110
|
|
|
106007
106111
|
|
|
106112
|
+
|
|
106113
|
+
const client_inflateAsync = (0,client_util.promisify)((client_lib_default()).inflate);
|
|
106114
|
+
const client_deflateAsync = (0,client_util.promisify)((client_lib_default()).deflate);
|
|
106115
|
+
|
|
106008
106116
|
/**
|
|
106009
106117
|
* RFC 4648 Base32 Decoder
|
|
106010
106118
|
*/
|
|
@@ -106028,16 +106136,26 @@ function client_EncodeBase32(data) {
|
|
|
106028
106136
|
}).toLowerCase();
|
|
106029
106137
|
}
|
|
106030
106138
|
function client_DecodeBase64(data) {
|
|
106031
|
-
return client_bufferToArrayBuffer(
|
|
106139
|
+
return client_bufferToArrayBuffer(client_node_modules_buffer.Buffer.from(data, 'base64'));
|
|
106032
106140
|
}
|
|
106033
106141
|
function client_EncodeBase64(data) {
|
|
106034
|
-
return
|
|
106142
|
+
return client_node_modules_buffer.Buffer.from(data).toString('base64');
|
|
106035
106143
|
}
|
|
106036
106144
|
function client_ZlibInflate(data, options) {
|
|
106037
|
-
return client_bufferToArrayBuffer(client_lib_default().inflateSync(
|
|
106145
|
+
return client_bufferToArrayBuffer(client_lib_default().inflateSync(client_node_modules_buffer.Buffer.from(data), options));
|
|
106038
106146
|
}
|
|
106039
106147
|
function client_ZlibDeflate(data, options) {
|
|
106040
|
-
return client_bufferToArrayBuffer(client_lib_default().deflateSync(
|
|
106148
|
+
return client_bufferToArrayBuffer(client_lib_default().deflateSync(client_node_modules_buffer.Buffer.from(data), options));
|
|
106149
|
+
}
|
|
106150
|
+
async function client_ZlibInflateAsync(data) {
|
|
106151
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
106152
|
+
const buffer = await client_inflateAsync(client_node_modules_buffer.Buffer.from(data), options);
|
|
106153
|
+
return client_bufferToArrayBuffer(buffer);
|
|
106154
|
+
}
|
|
106155
|
+
async function client_ZlibDeflateAsync(data) {
|
|
106156
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
106157
|
+
const buffer = await client_deflateAsync(client_node_modules_buffer.Buffer.from(data), options);
|
|
106158
|
+
return client_bufferToArrayBuffer(buffer);
|
|
106041
106159
|
}
|
|
106042
106160
|
var client_key = /*#__PURE__*/new WeakMap();
|
|
106043
106161
|
class src_client_BufferStorage {
|
|
@@ -106048,7 +106166,7 @@ class src_client_BufferStorage {
|
|
|
106048
106166
|
/*
|
|
106049
106167
|
* Convert from a hex-encoded string into a buffer
|
|
106050
106168
|
*/
|
|
106051
|
-
const buffer_key =
|
|
106169
|
+
const buffer_key = client_node_modules_buffer.Buffer.from(key, 'hex');
|
|
106052
106170
|
if (buffer_key.length !== length) {
|
|
106053
106171
|
throw new Error(`When decoding buffer we got different number of bytes than expected (${buffer_key.length} expected ${length})`);
|
|
106054
106172
|
}
|
|
@@ -106060,10 +106178,10 @@ class src_client_BufferStorage {
|
|
|
106060
106178
|
}
|
|
106061
106179
|
value = '0'.repeat(length * 2) + value;
|
|
106062
106180
|
value = value.slice(length * 2 * -1);
|
|
106063
|
-
client_buffer_classPrivateFieldSet(client_key, this,
|
|
106181
|
+
client_buffer_classPrivateFieldSet(client_key, this, client_node_modules_buffer.Buffer.from(value, 'hex'));
|
|
106064
106182
|
} else {
|
|
106065
|
-
if (
|
|
106066
|
-
throw new Error(`When storing buffer we got different number of bytes than expected (${
|
|
106183
|
+
if (client_node_modules_buffer.Buffer.from(key).length !== length) {
|
|
106184
|
+
throw new Error(`When storing buffer we got different number of bytes than expected (${client_node_modules_buffer.Buffer.from(key).length} expected ${length})`);
|
|
106067
106185
|
}
|
|
106068
106186
|
client_buffer_classPrivateFieldSet(client_key, this, key);
|
|
106069
106187
|
}
|
|
@@ -106075,15 +106193,15 @@ class src_client_BufferStorage {
|
|
|
106075
106193
|
return client_buffer_classPrivateFieldGet(client_key, this).byteLength;
|
|
106076
106194
|
}
|
|
106077
106195
|
getBuffer() {
|
|
106078
|
-
return
|
|
106196
|
+
return client_node_modules_buffer.Buffer.from(client_buffer_classPrivateFieldGet(client_key, this));
|
|
106079
106197
|
}
|
|
106080
106198
|
toString() {
|
|
106081
106199
|
let encoding = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'hex';
|
|
106082
106200
|
switch (encoding) {
|
|
106083
106201
|
case 'hex':
|
|
106084
|
-
return
|
|
106202
|
+
return client_node_modules_buffer.Buffer.from(client_buffer_classPrivateFieldGet(client_key, this)).toString(encoding).toUpperCase();
|
|
106085
106203
|
case 'base64':
|
|
106086
|
-
return
|
|
106204
|
+
return client_node_modules_buffer.Buffer.from(client_buffer_classPrivateFieldGet(client_key, this)).toString(encoding);
|
|
106087
106205
|
case 'base32':
|
|
106088
106206
|
return client_EncodeBase32(client_buffer_classPrivateFieldGet(client_key, this));
|
|
106089
106207
|
default:
|
|
@@ -106108,17 +106226,18 @@ class src_client_BufferStorage {
|
|
|
106108
106226
|
return false;
|
|
106109
106227
|
}
|
|
106110
106228
|
if (typeof compareWith === 'string') {
|
|
106111
|
-
const asBuf =
|
|
106229
|
+
const asBuf = client_node_modules_buffer.Buffer.from(compareWith, 'hex');
|
|
106112
106230
|
if (asBuf.length !== this.length) {
|
|
106113
106231
|
return false;
|
|
106114
106232
|
}
|
|
106115
|
-
compareWith = new src_client_BufferStorage(
|
|
106233
|
+
compareWith = new src_client_BufferStorage(client_node_modules_buffer.Buffer.from(compareWith, 'hex'), this.length);
|
|
106116
106234
|
}
|
|
106117
106235
|
return this.toString('hex') === compareWith.toString('hex');
|
|
106118
106236
|
}
|
|
106119
106237
|
}
|
|
106120
106238
|
client_BufferStorage = src_client_BufferStorage;
|
|
106121
106239
|
client_buffer_defineProperty(src_client_BufferStorage, "isInstance", client_checkableGenerator(client_BufferStorage));
|
|
106240
|
+
|
|
106122
106241
|
;// ./node_modules/pvutils/build/utils.es.js
|
|
106123
106242
|
/*!
|
|
106124
106243
|
Copyright (c) Peculiar Ventures, LLC
|
|
@@ -112985,20 +113104,29 @@ function client_jsIntegerToBigInt(value) {
|
|
|
112985
113104
|
}
|
|
112986
113105
|
return BigInt(valueStr);
|
|
112987
113106
|
}
|
|
113107
|
+
function client_isASN1Object(input) {
|
|
113108
|
+
if (input === null || input === undefined || typeof input !== 'object') {
|
|
113109
|
+
return false;
|
|
113110
|
+
}
|
|
113111
|
+
if (!('type' in input) || typeof input.type !== 'string') {
|
|
113112
|
+
return false;
|
|
113113
|
+
}
|
|
113114
|
+
return true;
|
|
113115
|
+
}
|
|
112988
113116
|
function client_isASN1OID(input) {
|
|
112989
|
-
if (
|
|
113117
|
+
if (!client_isASN1Object(input)) {
|
|
112990
113118
|
return false;
|
|
112991
113119
|
}
|
|
112992
113120
|
if (input.type !== 'oid') {
|
|
112993
113121
|
return false;
|
|
112994
113122
|
}
|
|
112995
|
-
if (typeof input.oid !== 'string') {
|
|
113123
|
+
if (!('oid' in input) || typeof input.oid !== 'string') {
|
|
112996
113124
|
return false;
|
|
112997
113125
|
}
|
|
112998
113126
|
return true;
|
|
112999
113127
|
}
|
|
113000
113128
|
function client_isASN1String(input) {
|
|
113001
|
-
if (
|
|
113129
|
+
if (!client_isASN1Object(input)) {
|
|
113002
113130
|
return false;
|
|
113003
113131
|
}
|
|
113004
113132
|
if (!('type' in input) || input.type !== 'string') {
|
|
@@ -113021,13 +113149,16 @@ function client_isASN1String(input) {
|
|
|
113021
113149
|
return true;
|
|
113022
113150
|
}
|
|
113023
113151
|
function client_isASN1Set(input) {
|
|
113024
|
-
if (
|
|
113152
|
+
if (!client_isASN1Object(input)) {
|
|
113025
113153
|
return false;
|
|
113026
113154
|
}
|
|
113027
113155
|
if (input.type !== 'set') {
|
|
113028
113156
|
return false;
|
|
113029
113157
|
}
|
|
113030
|
-
if (!client_isASN1OID(input.name)) {
|
|
113158
|
+
if (!('name' in input) || !client_isASN1OID(input.name)) {
|
|
113159
|
+
return false;
|
|
113160
|
+
}
|
|
113161
|
+
if (!('value' in input)) {
|
|
113031
113162
|
return false;
|
|
113032
113163
|
}
|
|
113033
113164
|
if (typeof input.value !== 'string') {
|
|
@@ -113038,7 +113169,7 @@ function client_isASN1Set(input) {
|
|
|
113038
113169
|
return true;
|
|
113039
113170
|
}
|
|
113040
113171
|
function client_isASN1ContextTag(input) {
|
|
113041
|
-
if (
|
|
113172
|
+
if (!client_isASN1Object(input)) {
|
|
113042
113173
|
return false;
|
|
113043
113174
|
}
|
|
113044
113175
|
if (!('type' in input) || input.type !== 'context') {
|
|
@@ -113053,19 +113184,19 @@ function client_isASN1ContextTag(input) {
|
|
|
113053
113184
|
return true;
|
|
113054
113185
|
}
|
|
113055
113186
|
function client_isASN1BitString(input) {
|
|
113056
|
-
if (
|
|
113187
|
+
if (!client_isASN1Object(input)) {
|
|
113057
113188
|
return false;
|
|
113058
113189
|
}
|
|
113059
113190
|
if (input.type !== 'bitstring') {
|
|
113060
113191
|
return false;
|
|
113061
113192
|
}
|
|
113062
|
-
if (!client_isBuffer(input.value)) {
|
|
113193
|
+
if (!('value' in input) || !client_isBuffer(input.value)) {
|
|
113063
113194
|
return false;
|
|
113064
113195
|
}
|
|
113065
113196
|
return true;
|
|
113066
113197
|
}
|
|
113067
113198
|
function client_isASN1Date(input) {
|
|
113068
|
-
if (
|
|
113199
|
+
if (!client_isASN1Object(input)) {
|
|
113069
113200
|
return false;
|
|
113070
113201
|
}
|
|
113071
113202
|
if (!('type' in input) || input.type !== 'date') {
|
|
@@ -113972,17 +114103,39 @@ class client_ValidateASN1 {
|
|
|
113972
114103
|
if (input.length < minLength || input.length > maxLength) {
|
|
113973
114104
|
throw new Error(`Expected Array length between [${minLength}, ${maxLength}], got ${input.length}`);
|
|
113974
114105
|
}
|
|
114106
|
+
const output = [];
|
|
114107
|
+
for (let i = 0; i < schema.length; i++) {
|
|
114108
|
+
// If the schema is optional, we check two paths, if the value is present or not.
|
|
114109
|
+
// This will break the loop and leave the rest of the validation to the recursive call.
|
|
114110
|
+
if (typeof schema[i] === 'object' && 'optional' in schema[i]) {
|
|
114111
|
+
// We only need to take two paths for optional values when we are before the last value, and the value is not undefined
|
|
114112
|
+
if (i < schema.length - 1 && input[i] !== undefined) {
|
|
114113
|
+
const remainingSchema = schema.slice(i + 1);
|
|
114114
|
+
try {
|
|
114115
|
+
// Try to validate against schema assuming optional is present
|
|
114116
|
+
// @ts-ignore
|
|
114117
|
+
output.push(...client_ValidateASN1.againstSchema(input.slice(i), [schema[i].optional, ...remainingSchema]));
|
|
114118
|
+
} catch {
|
|
114119
|
+
/* ignore error because we are going to try without the optional value */
|
|
114120
|
+
|
|
114121
|
+
// @ts-ignore
|
|
114122
|
+
output.push(undefined, ...client_ValidateASN1.againstSchema(input.slice(i), remainingSchema));
|
|
114123
|
+
}
|
|
114124
|
+
break;
|
|
114125
|
+
}
|
|
114126
|
+
}
|
|
113975
114127
|
|
|
113976
|
-
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
113977
|
-
return schema.map(function (item, i) {
|
|
113978
|
-
/*
|
|
113979
|
-
* We need to cast to "any" to avoid
|
|
113980
|
-
* typing errors with TypeScript's
|
|
113981
|
-
* validation with recursive types
|
|
113982
|
-
*/
|
|
113983
114128
|
// @ts-ignore
|
|
113984
|
-
|
|
113985
|
-
}
|
|
114129
|
+
output.push(client_ValidateASN1.againstSchema(input[i], schema[i]));
|
|
114130
|
+
}
|
|
114131
|
+
|
|
114132
|
+
// If the end of the output is only optional values, exclude undefined values.
|
|
114133
|
+
while (output.length > 0 && output.at(-1) === undefined) {
|
|
114134
|
+
output.pop();
|
|
114135
|
+
}
|
|
114136
|
+
|
|
114137
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
114138
|
+
return output;
|
|
113986
114139
|
} else {
|
|
113987
114140
|
throw new Error(`Internal error: Unsupported schema type ${JSON.stringify(schema)}`);
|
|
113988
114141
|
}
|
|
@@ -115125,7 +115278,7 @@ client_KeetaNetCertificateError = src_client_KeetaNetCertificateError;
|
|
|
115125
115278
|
client_certificate_defineProperty(src_client_KeetaNetCertificateError, "isInstance", client_checkableGenerator(client_KeetaNetCertificateError));
|
|
115126
115279
|
;// ./src/lib/utils/certificate.ts
|
|
115127
115280
|
/* provided dependency */ var client_certificate_Buffer = __webpack_require__(8287)["Buffer"];
|
|
115128
|
-
var client_CertificateHash,
|
|
115281
|
+
var client_CertificateHash, client_CertificateBundle, client_Certificate;
|
|
115129
115282
|
function client_certificate_classPrivateMethodInitSpec(e, a) { client_certificate_checkPrivateRedeclaration(e, a), a.add(e); }
|
|
115130
115283
|
function client_utils_certificate_defineProperty(e, r, t) { return (r = client_utils_certificate_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
115131
115284
|
function client_utils_certificate_toPropertyKey(t) { var i = client_utils_certificate_toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
@@ -115557,7 +115710,85 @@ client_utils_certificate_defineProperty(src_client_CertificateHash, "Set", clien
|
|
|
115557
115710
|
}, function (value) {
|
|
115558
115711
|
return new client_CertificateHash(client_certificate_Buffer.from(value, 'hex'));
|
|
115559
115712
|
}));
|
|
115713
|
+
const client_CertificateBundleSchemaInternal = {
|
|
115714
|
+
sequenceOf: client_CertificateSchemaInternal
|
|
115715
|
+
};
|
|
115560
115716
|
var client_raw = /*#__PURE__*/new WeakMap();
|
|
115717
|
+
var client_contents = /*#__PURE__*/new WeakMap();
|
|
115718
|
+
class src_client_CertificateBundle {
|
|
115719
|
+
constructor(input) {
|
|
115720
|
+
client_certificate_classPrivateFieldInitSpec(this, client_raw, void 0);
|
|
115721
|
+
client_certificate_classPrivateFieldInitSpec(this, client_contents, void 0);
|
|
115722
|
+
if (src_client_CertificateBundle.isInstance(input)) {
|
|
115723
|
+
client_certificate_classPrivateFieldSet(client_raw, this, input.getDER());
|
|
115724
|
+
} else if (Array.isArray(input) || input instanceof Set) {
|
|
115725
|
+
if (input instanceof Set) {
|
|
115726
|
+
input = Array.from(input);
|
|
115727
|
+
}
|
|
115728
|
+
const decodedInput = input.map(function (certificate) {
|
|
115729
|
+
let decoded;
|
|
115730
|
+
|
|
115731
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
115732
|
+
if (src_client_Certificate.isCertificate(certificate)) {
|
|
115733
|
+
decoded = new client_BufferStorageASN1(certificate.toDER());
|
|
115734
|
+
} else {
|
|
115735
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
115736
|
+
decoded = new client_BufferStorageASN1(new src_client_Certificate(certificate).toDER());
|
|
115737
|
+
}
|
|
115738
|
+
// For some reason the typescript compiler cannot understand this, but we do not care about it being typed because we are validating it right after.
|
|
115739
|
+
// @ts-ignore
|
|
115740
|
+
const output = decoded.getASN1();
|
|
115741
|
+
return output;
|
|
115742
|
+
});
|
|
115743
|
+
client_certificate_classPrivateFieldSet(client_raw, this, new client_BufferStorageASN1(decodedInput, client_CertificateBundleSchemaInternal).getDER());
|
|
115744
|
+
} else {
|
|
115745
|
+
if (typeof input === 'string') {
|
|
115746
|
+
input = client_certificate_Buffer.from(input, 'base64');
|
|
115747
|
+
}
|
|
115748
|
+
if (client_certificate_Buffer.isBuffer(input)) {
|
|
115749
|
+
input = client_bufferToArrayBuffer(input);
|
|
115750
|
+
}
|
|
115751
|
+
client_certificate_classPrivateFieldSet(client_raw, this, input);
|
|
115752
|
+
}
|
|
115753
|
+
const decoded = new client_BufferStorageASN1(client_certificate_classPrivateFieldGet(client_raw, this), client_CertificateBundleSchemaInternal);
|
|
115754
|
+
client_certificate_classPrivateFieldSet(client_contents, this, []);
|
|
115755
|
+
const seenHashes = new src_client_CertificateHash.Set();
|
|
115756
|
+
for (const item of decoded.getASN1()) {
|
|
115757
|
+
const certificateValue = new client_BufferStorageASN1(item, client_CertificateSchemaInternal);
|
|
115758
|
+
|
|
115759
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
115760
|
+
const certificate = new src_client_Certificate(certificateValue.getDER());
|
|
115761
|
+
const hash = certificate.hash();
|
|
115762
|
+
if (seenHashes.has(hash)) {
|
|
115763
|
+
throw new src_client_KeetaNetCertificateError('CERTIFICATE_DUPLICATE_INCLUDED', `Duplicate certificate ${hash} within certificate bundle`);
|
|
115764
|
+
}
|
|
115765
|
+
seenHashes.add(hash);
|
|
115766
|
+
client_certificate_classPrivateFieldGet(client_contents, this).push(certificate);
|
|
115767
|
+
}
|
|
115768
|
+
}
|
|
115769
|
+
get bundleSize() {
|
|
115770
|
+
return client_certificate_classPrivateFieldGet(client_contents, this).length;
|
|
115771
|
+
}
|
|
115772
|
+
getDER() {
|
|
115773
|
+
return client_certificate_classPrivateFieldGet(client_raw, this);
|
|
115774
|
+
}
|
|
115775
|
+
getDERBuffer() {
|
|
115776
|
+
return client_certificate_Buffer.from(this.getDER());
|
|
115777
|
+
}
|
|
115778
|
+
getCertificates() {
|
|
115779
|
+
return client_certificate_classPrivateFieldGet(client_contents, this);
|
|
115780
|
+
}
|
|
115781
|
+
toJSON() {
|
|
115782
|
+
return {
|
|
115783
|
+
certificates: this.getCertificates().map(function (certificate) {
|
|
115784
|
+
return certificate.toPEM();
|
|
115785
|
+
})
|
|
115786
|
+
};
|
|
115787
|
+
}
|
|
115788
|
+
}
|
|
115789
|
+
client_CertificateBundle = src_client_CertificateBundle;
|
|
115790
|
+
client_utils_certificate_defineProperty(src_client_CertificateBundle, "isInstance", client_checkableGenerator(client_CertificateBundle));
|
|
115791
|
+
var client_raw2 = /*#__PURE__*/new WeakMap();
|
|
115561
115792
|
var client_hash = /*#__PURE__*/new WeakMap();
|
|
115562
115793
|
var client_extensionsRaw = /*#__PURE__*/new WeakMap();
|
|
115563
115794
|
var client_extensionsProcessed = /*#__PURE__*/new WeakMap();
|
|
@@ -115590,7 +115821,7 @@ class src_client_Certificate {
|
|
|
115590
115821
|
/**
|
|
115591
115822
|
* The raw certificate (DER encoded)
|
|
115592
115823
|
*/
|
|
115593
|
-
client_certificate_classPrivateFieldInitSpec(this,
|
|
115824
|
+
client_certificate_classPrivateFieldInitSpec(this, client_raw2, void 0);
|
|
115594
115825
|
client_certificate_classPrivateFieldInitSpec(this, client_hash, void 0);
|
|
115595
115826
|
/**
|
|
115596
115827
|
* Raw extensions, which can be processed by subclasses
|
|
@@ -115644,7 +115875,7 @@ class src_client_Certificate {
|
|
|
115644
115875
|
input = client_bufferToArrayBuffer(input);
|
|
115645
115876
|
}
|
|
115646
115877
|
const data = new client_BufferStorageASN1(input, client_CertificateSchemaInternal);
|
|
115647
|
-
client_certificate_classPrivateFieldSet(
|
|
115878
|
+
client_certificate_classPrivateFieldSet(client_raw2, this, data.getDER());
|
|
115648
115879
|
const parts = data.getASN1();
|
|
115649
115880
|
const tbsCertificate = parts[0];
|
|
115650
115881
|
const [version, serialNumber, signatureAlgorithmSigned, _issuer, [notBefore, notAfter], subject, subjectPublicKey, _extensions] = tbsCertificate;
|
|
@@ -115682,8 +115913,10 @@ class src_client_Certificate {
|
|
|
115682
115913
|
this.notAfter = notAfter.date;
|
|
115683
115914
|
this.subject = client_fromDNSequenceToString(subject);
|
|
115684
115915
|
this.issuer = client_fromDNSequenceToString(_issuer);
|
|
115685
|
-
this.subjectDN = subject;
|
|
115686
|
-
this.issuerDN = _issuer;
|
|
115916
|
+
this.subjectDN = client_fromDNSequence(subject);
|
|
115917
|
+
this.issuerDN = client_fromDNSequence(_issuer);
|
|
115918
|
+
this.subjectDNSet = subject;
|
|
115919
|
+
this.issuerDNSet = _issuer;
|
|
115687
115920
|
|
|
115688
115921
|
/*
|
|
115689
115922
|
* Compare the signature algorithm in the certificate with
|
|
@@ -115796,7 +116029,7 @@ class src_client_Certificate {
|
|
|
115796
116029
|
if (src_client_Certificate.isCertificate(account)) {
|
|
115797
116030
|
account = account.subjectPublicKey;
|
|
115798
116031
|
}
|
|
115799
|
-
const data = new client_BufferStorageASN1(client_certificate_classPrivateFieldGet(
|
|
116032
|
+
const data = new client_BufferStorageASN1(client_certificate_classPrivateFieldGet(client_raw2, this), client_CertificateSchemaInternal);
|
|
115800
116033
|
const [tbsCertificate, signatureAlgorithmObject, signatureObject] = data.getASN1();
|
|
115801
116034
|
const signatureAlgorithm = signatureAlgorithmObject[0].oid;
|
|
115802
116035
|
const tbsCertificateToVerify = new client_BufferStorageASN1(tbsCertificate).getDER();
|
|
@@ -116053,11 +116286,11 @@ class src_client_Certificate {
|
|
|
116053
116286
|
*/
|
|
116054
116287
|
equals(other) {
|
|
116055
116288
|
this.assertConstructed();
|
|
116056
|
-
if (client_certificate_classPrivateFieldGet(
|
|
116289
|
+
if (client_certificate_classPrivateFieldGet(client_raw2, this).byteLength !== client_certificate_classPrivateFieldGet(client_raw2, other).byteLength) {
|
|
116057
116290
|
return false;
|
|
116058
116291
|
}
|
|
116059
|
-
const thisBuffer = client_certificate_Buffer.from(client_certificate_classPrivateFieldGet(
|
|
116060
|
-
const otherBuffer = client_certificate_Buffer.from(client_certificate_classPrivateFieldGet(
|
|
116292
|
+
const thisBuffer = client_certificate_Buffer.from(client_certificate_classPrivateFieldGet(client_raw2, this));
|
|
116293
|
+
const otherBuffer = client_certificate_Buffer.from(client_certificate_classPrivateFieldGet(client_raw2, other));
|
|
116061
116294
|
return thisBuffer.equals(otherBuffer);
|
|
116062
116295
|
}
|
|
116063
116296
|
|
|
@@ -116074,7 +116307,7 @@ class src_client_Certificate {
|
|
|
116074
116307
|
*/
|
|
116075
116308
|
toDER() {
|
|
116076
116309
|
this.assertConstructed();
|
|
116077
|
-
return client_certificate_classPrivateFieldGet(
|
|
116310
|
+
return client_certificate_classPrivateFieldGet(client_raw2, this);
|
|
116078
116311
|
}
|
|
116079
116312
|
|
|
116080
116313
|
/**
|
|
@@ -116082,20 +116315,31 @@ class src_client_Certificate {
|
|
|
116082
116315
|
*/
|
|
116083
116316
|
toPEM() {
|
|
116084
116317
|
this.assertConstructed();
|
|
116085
|
-
const certificatePEMLines = client_certificate_Buffer.from(client_certificate_classPrivateFieldGet(
|
|
116318
|
+
const certificatePEMLines = client_certificate_Buffer.from(client_certificate_classPrivateFieldGet(client_raw2, this)).toString('base64').split(/(.{64})/g).filter(function (line) {
|
|
116086
116319
|
return line.length > 0;
|
|
116087
116320
|
});
|
|
116088
116321
|
const certificatePEM = ['-----BEGIN CERTIFICATE-----', ...certificatePEMLines, '-----END CERTIFICATE-----'].join('\n') + '\n';
|
|
116089
116322
|
return certificatePEM;
|
|
116090
116323
|
}
|
|
116091
116324
|
|
|
116325
|
+
/**
|
|
116326
|
+
* The string representation of the certificate
|
|
116327
|
+
* is a PEM encoded certificate -- this misses
|
|
116328
|
+
* some of the internal details like chain
|
|
116329
|
+
* and verified, but is usually what someone
|
|
116330
|
+
* wants to see when they call toString()
|
|
116331
|
+
*/
|
|
116332
|
+
toString() {
|
|
116333
|
+
return this.toPEM();
|
|
116334
|
+
}
|
|
116335
|
+
|
|
116092
116336
|
/**
|
|
116093
116337
|
* Compute a hash of the certificate
|
|
116094
116338
|
*/
|
|
116095
116339
|
hash() {
|
|
116096
116340
|
this.assertConstructed();
|
|
116097
116341
|
if (!client_certificate_classPrivateFieldGet(client_hash, this)) {
|
|
116098
|
-
client_certificate_classPrivateFieldSet(client_hash, this, src_client_CertificateHash.fromData(client_certificate_Buffer.from(client_certificate_classPrivateFieldGet(
|
|
116342
|
+
client_certificate_classPrivateFieldSet(client_hash, this, src_client_CertificateHash.fromData(client_certificate_Buffer.from(client_certificate_classPrivateFieldGet(client_raw2, this))));
|
|
116099
116343
|
}
|
|
116100
116344
|
return client_certificate_classPrivateFieldGet(client_hash, this);
|
|
116101
116345
|
}
|
|
@@ -116128,8 +116372,8 @@ class src_client_Certificate {
|
|
|
116128
116372
|
issuer: this.issuer,
|
|
116129
116373
|
subjectPublicKey: this.subjectPublicKey,
|
|
116130
116374
|
baseExtensions: this.baseExtensions,
|
|
116131
|
-
subjectDN: client_fromDNSequence(this.
|
|
116132
|
-
issuerDN: client_fromDNSequence(this.
|
|
116375
|
+
subjectDN: client_fromDNSequence(this.subjectDNSet),
|
|
116376
|
+
issuerDN: client_fromDNSequence(this.issuerDNSet),
|
|
116133
116377
|
$hash: this.hash(),
|
|
116134
116378
|
...additionalFields
|
|
116135
116379
|
};
|
|
@@ -116282,8 +116526,8 @@ function client_checkIssued(issuer) {
|
|
|
116282
116526
|
/**
|
|
116283
116527
|
* Compare the issuerDN and the subjectDN byte-for-byte
|
|
116284
116528
|
*/
|
|
116285
|
-
const issuerDN = new client_BufferStorageASN1(issuer.
|
|
116286
|
-
const subjectIssuerDN = new client_BufferStorageASN1(this.
|
|
116529
|
+
const issuerDN = new client_BufferStorageASN1(issuer.subjectDNSet);
|
|
116530
|
+
const subjectIssuerDN = new client_BufferStorageASN1(this.issuerDNSet);
|
|
116287
116531
|
const issuerDER = issuerDN.getDERBuffer();
|
|
116288
116532
|
const subjectIssuerDER = subjectIssuerDN.getDERBuffer();
|
|
116289
116533
|
if (!issuerDER.equals(subjectIssuerDER)) {
|
|
@@ -116354,83 +116598,18 @@ function client_checkIssued(issuer) {
|
|
|
116354
116598
|
* The Certificate Builder
|
|
116355
116599
|
*/
|
|
116356
116600
|
client_utils_certificate_defineProperty(src_client_Certificate, "Builder", client_CertificateBuilder);
|
|
116601
|
+
/**
|
|
116602
|
+
* The certificate bundle
|
|
116603
|
+
*/
|
|
116604
|
+
client_utils_certificate_defineProperty(src_client_Certificate, "Bundle", src_client_CertificateBundle);
|
|
116605
|
+
/**
|
|
116606
|
+
* The certificate hash information
|
|
116607
|
+
*/
|
|
116608
|
+
client_utils_certificate_defineProperty(src_client_Certificate, "Hash", src_client_CertificateHash);
|
|
116357
116609
|
/**
|
|
116358
116610
|
* Object type ID for {@link Certificate.isCertificate}
|
|
116359
116611
|
*/
|
|
116360
116612
|
client_utils_certificate_defineProperty(src_client_Certificate, "certificateObjectTypeID", '8d05dca5-5f42-4dc9-8bf9-f534c6570994:CERTIFICATE');
|
|
116361
|
-
const client_CertificateBundleSchemaInternal = {
|
|
116362
|
-
sequenceOf: client_CertificateSchemaInternal
|
|
116363
|
-
};
|
|
116364
|
-
var client_raw2 = /*#__PURE__*/new WeakMap();
|
|
116365
|
-
var client_contents = /*#__PURE__*/new WeakMap();
|
|
116366
|
-
class src_client_CertificateBundle {
|
|
116367
|
-
constructor(input) {
|
|
116368
|
-
client_certificate_classPrivateFieldInitSpec(this, client_raw2, void 0);
|
|
116369
|
-
client_certificate_classPrivateFieldInitSpec(this, client_contents, void 0);
|
|
116370
|
-
if (src_client_CertificateBundle.isInstance(input)) {
|
|
116371
|
-
client_certificate_classPrivateFieldSet(client_raw2, this, input.getDER());
|
|
116372
|
-
} else if (Array.isArray(input) || input instanceof Set) {
|
|
116373
|
-
if (input instanceof Set) {
|
|
116374
|
-
input = Array.from(input);
|
|
116375
|
-
}
|
|
116376
|
-
const decodedInput = input.map(function (certificate) {
|
|
116377
|
-
let decoded;
|
|
116378
|
-
if (src_client_Certificate.isCertificate(certificate)) {
|
|
116379
|
-
decoded = new client_BufferStorageASN1(certificate.toDER());
|
|
116380
|
-
} else {
|
|
116381
|
-
decoded = new client_BufferStorageASN1(new src_client_Certificate(certificate).toDER());
|
|
116382
|
-
}
|
|
116383
|
-
// For some reason the typescript compiler cannot understand this, but we do not care about it being typed because we are validating it right after.
|
|
116384
|
-
// @ts-ignore
|
|
116385
|
-
const output = decoded.getASN1();
|
|
116386
|
-
return output;
|
|
116387
|
-
});
|
|
116388
|
-
client_certificate_classPrivateFieldSet(client_raw2, this, new client_BufferStorageASN1(decodedInput, client_CertificateBundleSchemaInternal).getDER());
|
|
116389
|
-
} else {
|
|
116390
|
-
if (typeof input === 'string') {
|
|
116391
|
-
input = client_certificate_Buffer.from(input, 'base64');
|
|
116392
|
-
}
|
|
116393
|
-
if (client_certificate_Buffer.isBuffer(input)) {
|
|
116394
|
-
input = client_bufferToArrayBuffer(input);
|
|
116395
|
-
}
|
|
116396
|
-
client_certificate_classPrivateFieldSet(client_raw2, this, input);
|
|
116397
|
-
}
|
|
116398
|
-
const decoded = new client_BufferStorageASN1(client_certificate_classPrivateFieldGet(client_raw2, this), client_CertificateBundleSchemaInternal);
|
|
116399
|
-
client_certificate_classPrivateFieldSet(client_contents, this, []);
|
|
116400
|
-
const seenHashes = new src_client_CertificateHash.Set();
|
|
116401
|
-
for (const item of decoded.getASN1()) {
|
|
116402
|
-
const certificateValue = new client_BufferStorageASN1(item, client_CertificateSchemaInternal);
|
|
116403
|
-
const certificate = new src_client_Certificate(certificateValue.getDER());
|
|
116404
|
-
const hash = certificate.hash();
|
|
116405
|
-
if (seenHashes.has(hash)) {
|
|
116406
|
-
throw new src_client_KeetaNetCertificateError('CERTIFICATE_DUPLICATE_INCLUDED', `Duplicate certificate ${hash} within certificate bundle`);
|
|
116407
|
-
}
|
|
116408
|
-
seenHashes.add(hash);
|
|
116409
|
-
client_certificate_classPrivateFieldGet(client_contents, this).push(certificate);
|
|
116410
|
-
}
|
|
116411
|
-
}
|
|
116412
|
-
get bundleSize() {
|
|
116413
|
-
return client_certificate_classPrivateFieldGet(client_contents, this).length;
|
|
116414
|
-
}
|
|
116415
|
-
getDER() {
|
|
116416
|
-
return client_certificate_classPrivateFieldGet(client_raw2, this);
|
|
116417
|
-
}
|
|
116418
|
-
getDERBuffer() {
|
|
116419
|
-
return client_certificate_Buffer.from(this.getDER());
|
|
116420
|
-
}
|
|
116421
|
-
getCertificates() {
|
|
116422
|
-
return client_certificate_classPrivateFieldGet(client_contents, this);
|
|
116423
|
-
}
|
|
116424
|
-
toJSON() {
|
|
116425
|
-
return {
|
|
116426
|
-
certificates: this.getCertificates().map(function (certificate) {
|
|
116427
|
-
return certificate.toPEM();
|
|
116428
|
-
})
|
|
116429
|
-
};
|
|
116430
|
-
}
|
|
116431
|
-
}
|
|
116432
|
-
client_CertificateBundle = src_client_CertificateBundle;
|
|
116433
|
-
client_utils_certificate_defineProperty(src_client_CertificateBundle, "isInstance", client_checkableGenerator(client_CertificateBundle));
|
|
116434
116613
|
;// ./src/lib/error/ledger.ts
|
|
116435
116614
|
var client_KeetaNetLedgerError;
|
|
116436
116615
|
function client_ledger_defineProperty(e, r, t) { return (r = client_ledger_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
@@ -121207,13 +121386,15 @@ const client_VoteErrorCodes = [
|
|
|
121207
121386
|
*/
|
|
121208
121387
|
|
|
121209
121388
|
// Errors from constructing a vote
|
|
121210
|
-
'MALFORMED_WRAPPER', 'MALFORMED_VOTE_WRAPPER', 'MALFORMED_VOTE_CONTENT', 'MALFORMED_VOTE_CONTENT_EXTRA_DATA', 'MALFORMED_VOTE_VERSION', 'MALFORMED_VOTE_SERIAL', 'MALFORMED_VOTE_SIGNATURE_INFORMATION', 'MALFORMED_VOTE_ISSUER_INFORMATION', 'MALFORMED_VOTE_SUBJECT_INFORMATION', 'MALFORMED_VOTE_VALIDITY_INFORMATION', 'MALFORMED_VOTE_SERIAL', 'MALFORMED_VOTE_EXTENSIONS', 'MALFORMED_VOTE_EXTENSIONS_VALUE', 'MALFORMED_VOTE_EXTENSIONS_VALUE_OID', 'MALFORMED_VOTE_EXTENSIONS_VALUE_CRITICAL', 'MALFORMED_VOTE_EXTENSIONS_VALUE_CRITICAL_TYPE', '
|
|
121389
|
+
'MALFORMED_WRAPPER', 'MALFORMED_VOTE_WRAPPER', 'MALFORMED_VOTE_CONTENT', 'MALFORMED_VOTE_CONTENT_EXTRA_DATA', 'MALFORMED_VOTE_VERSION', 'MALFORMED_VOTE_SERIAL', 'MALFORMED_VOTE_SIGNATURE_INFORMATION', 'MALFORMED_VOTE_ISSUER_INFORMATION', 'MALFORMED_VOTE_SUBJECT_INFORMATION', 'MALFORMED_VOTE_VALIDITY_INFORMATION', 'MALFORMED_VOTE_SERIAL', 'MALFORMED_VOTE_EXTENSIONS', 'MALFORMED_VOTE_EXTENSIONS_DATA', 'MALFORMED_VOTE_EXTENSIONS_VALUE', 'MALFORMED_VOTE_EXTENSIONS_VALUE_OID', 'MALFORMED_VOTE_EXTENSIONS_VALUE_CRITICAL', 'MALFORMED_VOTE_EXTENSIONS_VALUE_CRITICAL_TYPE', 'MALFORMED_VOTE_SIGNATURE_SCHEME_DOES_NOT_MATCH_ISSUER', 'MALFORMED_VOTE_SIGNATURE_SCHEME_DOES_NOT_MATCH_WRAPPER', 'MALFORMED_VOTE_SIGNATURE_SCHEME_ECDSA_INVALID_CURVE', 'MALFORMED_VOTE_SIGNATURE_UNSUPPORTED_SCHEME', 'MALFORMED_VOTE_SUBJECT_PUBLIC_KEY_INFORMATION', 'MALFORMED_VOTE_SIGNATURE_VALUE', 'MALFORMED_VOTE_NO_BLOCKS_FOUND',
|
|
121211
121390
|
// Errors from constructing a staple
|
|
121212
121391
|
'MALFORMED_STAPLE', 'MALFORMED_STAPLE_BLOCKS', 'MALFORMED_STAPLE_BLOCKS_AT_LEAST_ONE', 'MALFORMED_STAPLE_VOTES', 'MALFORMED_STAPLE_VOTES_AT_LEAST_ONE',
|
|
121213
121392
|
// Errors created from the findRDN function
|
|
121214
121393
|
'MALFORMED_FIND_RDN_INVALID_TYPE', 'MALFORMED_FIND_RDN_MUST_HAVE_ONE', 'MALFORMED_FIND_RDN_PART_WELL_FORMED', 'MALFORMED_FIND_RDN_MUST_BE_SET', 'MALFORMED_FIND_RDN_TYPE_MUST_BE_OID',
|
|
121215
121394
|
// Errors from the blockHashesFromVote function
|
|
121216
|
-
'MALFORMED_HASHES_FROM_VOTE_INVALID_INPUT', 'MALFORMED_HASHES_FROM_VOTE_INVALID_TYPE', 'MALFORMED_HASHES_FROM_VOTE_INVALID_CONTEXT_SPECIFIC', 'MALFORMED_HASHES_FROM_VOTE_DATA_NEEDS_OID', 'MALFORMED_HASHES_FROM_VOTE_DATA_HASH_DATA_MUST_BE_SEQUENCE', 'MALFORMED_HASHES_FROM_VOTE_DATA_NOT_TWO_ITEMS', 'MALFORMED_HASHES_FROM_VOTE_DATA_UNSUPPORTED_HASH_FUNC', 'MALFORMED_HASHES_FROM_VOTE_DATA_UNSUPPORTED_HASH_TYPE', 'MALFORMED_HASHES_FROM_VOTE_DATA_SECOND_MUST_BE_SEQUENCE'
|
|
121395
|
+
'MALFORMED_HASHES_FROM_VOTE_INVALID_INPUT', 'MALFORMED_HASHES_FROM_VOTE_INVALID_TYPE', 'MALFORMED_HASHES_FROM_VOTE_INVALID_CONTEXT_SPECIFIC', 'MALFORMED_HASHES_FROM_VOTE_DATA_NEEDS_OID', 'MALFORMED_HASHES_FROM_VOTE_DATA_HASH_DATA_MUST_BE_SEQUENCE', 'MALFORMED_HASHES_FROM_VOTE_DATA_NOT_TWO_ITEMS', 'MALFORMED_HASHES_FROM_VOTE_DATA_UNSUPPORTED_HASH_FUNC', 'MALFORMED_HASHES_FROM_VOTE_DATA_UNSUPPORTED_HASH_TYPE', 'MALFORMED_HASHES_FROM_VOTE_DATA_SECOND_MUST_BE_SEQUENCE',
|
|
121396
|
+
// Errors from the feesFromVote function
|
|
121397
|
+
'MALFORMED_FEES_AMOUNT', 'MALFORMED_FEES_FROM_VOTE_INVALID_INPUT', 'MALFORMED_FEES_IN_PERMANENT_VOTE', 'MALFORMED_FEES_PAY_TO_INVALID', 'MALFORMED_FEES_TOKEN_NOT_TOKEN'];
|
|
121217
121398
|
class src_client_KeetaNetVoteError extends src_client_KeetaNetError {
|
|
121218
121399
|
constructor(code, message) {
|
|
121219
121400
|
super(code, message, {
|
|
@@ -121253,6 +121434,10 @@ function client_lib_vote_toPrimitive(t, r) { if ("object" != typeof t || !t) ret
|
|
|
121253
121434
|
|
|
121254
121435
|
|
|
121255
121436
|
|
|
121437
|
+
/**
|
|
121438
|
+
* Representation of the expected fee for this vote
|
|
121439
|
+
*/
|
|
121440
|
+
|
|
121256
121441
|
/**
|
|
121257
121442
|
* Representation of the vote
|
|
121258
121443
|
*/
|
|
@@ -121265,6 +121450,26 @@ class src_client_VoteHash extends src_client_BufferStorage {
|
|
|
121265
121450
|
}
|
|
121266
121451
|
client_VoteHash = src_client_VoteHash;
|
|
121267
121452
|
client_lib_vote_defineProperty(src_client_VoteHash, "isInstance", client_checkableGenerator(client_VoteHash));
|
|
121453
|
+
const client_feeExtensionSchema = {
|
|
121454
|
+
type: 'context',
|
|
121455
|
+
value: 0,
|
|
121456
|
+
kind: 'explicit',
|
|
121457
|
+
contains: [client_ValidateASN1.IsInteger, {
|
|
121458
|
+
optional: {
|
|
121459
|
+
type: 'context',
|
|
121460
|
+
value: 0,
|
|
121461
|
+
kind: 'implicit',
|
|
121462
|
+
contains: client_ValidateASN1.IsOctetString
|
|
121463
|
+
}
|
|
121464
|
+
}, {
|
|
121465
|
+
optional: {
|
|
121466
|
+
type: 'context',
|
|
121467
|
+
value: 1,
|
|
121468
|
+
kind: 'implicit',
|
|
121469
|
+
contains: client_ValidateASN1.IsOctetString
|
|
121470
|
+
}
|
|
121471
|
+
}]
|
|
121472
|
+
};
|
|
121268
121473
|
/**
|
|
121269
121474
|
* Parse a set of distinguished names
|
|
121270
121475
|
*/
|
|
@@ -121305,14 +121510,8 @@ function client_findRDN(input, findOID) {
|
|
|
121305
121510
|
}
|
|
121306
121511
|
function client_blockHashesFromVote(input) {
|
|
121307
121512
|
const blockHashInformation = client_ASN1toJS(input.buffer);
|
|
121308
|
-
if (blockHashInformation
|
|
121309
|
-
throw new src_client_KeetaNetVoteError('VOTE_MALFORMED_HASHES_FROM_VOTE_INVALID_INPUT', 'internal error: hashData
|
|
121310
|
-
}
|
|
121311
|
-
if (typeof blockHashInformation === 'bigint' || typeof blockHashInformation !== 'object') {
|
|
121312
|
-
throw new src_client_KeetaNetVoteError('VOTE_MALFORMED_HASHES_FROM_VOTE_INVALID_INPUT', 'internal error: hashData extension contains bigint or non object value');
|
|
121313
|
-
}
|
|
121314
|
-
if (client_vote_Buffer.isBuffer(blockHashInformation) || client_util.types.isDate(blockHashInformation) || Array.isArray(blockHashInformation)) {
|
|
121315
|
-
throw new src_client_KeetaNetVoteError('VOTE_MALFORMED_HASHES_FROM_VOTE_INVALID_INPUT', 'internal error: hashData extension contains incorrect data type');
|
|
121513
|
+
if (!client_isASN1Object(blockHashInformation)) {
|
|
121514
|
+
throw new src_client_KeetaNetVoteError('VOTE_MALFORMED_HASHES_FROM_VOTE_INVALID_INPUT', 'internal error: hashData extensions is not valid asn1 object');
|
|
121316
121515
|
}
|
|
121317
121516
|
if (blockHashInformation.type !== 'context') {
|
|
121318
121517
|
throw new src_client_KeetaNetVoteError('VOTE_MALFORMED_HASHES_FROM_VOTE_INVALID_TYPE', 'internal error: hashData extension does not contain a context-specific tag');
|
|
@@ -121350,6 +121549,47 @@ function client_blockHashesFromVote(input) {
|
|
|
121350
121549
|
}
|
|
121351
121550
|
return output;
|
|
121352
121551
|
}
|
|
121552
|
+
function client_feeFromVote(input) {
|
|
121553
|
+
const feeInformationAnyJS = client_ASN1toJS(input.buffer);
|
|
121554
|
+
const feeSchemaChecker = new client_ValidateASN1(client_feeExtensionSchema);
|
|
121555
|
+
const feeInformation = function () {
|
|
121556
|
+
try {
|
|
121557
|
+
return feeSchemaChecker.validate(feeInformationAnyJS);
|
|
121558
|
+
} catch (asn1ValidateError) {
|
|
121559
|
+
let message = 'internal error: fee asn1 schema is not the right format';
|
|
121560
|
+
if (asn1ValidateError instanceof Error) {
|
|
121561
|
+
message = `${message}: ${asn1ValidateError.message}`;
|
|
121562
|
+
}
|
|
121563
|
+
throw new src_client_KeetaNetVoteError('VOTE_MALFORMED_FEES_FROM_VOTE_INVALID_INPUT', message);
|
|
121564
|
+
}
|
|
121565
|
+
}();
|
|
121566
|
+
const feeData = feeInformation.contains;
|
|
121567
|
+
const retval = {
|
|
121568
|
+
amount: feeData[0]
|
|
121569
|
+
};
|
|
121570
|
+
const payToAsn1 = feeData[1];
|
|
121571
|
+
if (payToAsn1 !== undefined) {
|
|
121572
|
+
const payTo = client_lib_account.fromPublicKeyAndType(client_vote_Buffer.from(payToAsn1.contains));
|
|
121573
|
+
if (payTo.isStorage()) {
|
|
121574
|
+
retval.payTo = payTo;
|
|
121575
|
+
} else {
|
|
121576
|
+
try {
|
|
121577
|
+
retval.payTo = payTo.assertAccount();
|
|
121578
|
+
} catch {
|
|
121579
|
+
throw new src_client_KeetaNetVoteError('VOTE_MALFORMED_FEES_PAY_TO_INVALID', 'internal error: payTo is not an Account or Storage Address');
|
|
121580
|
+
}
|
|
121581
|
+
}
|
|
121582
|
+
}
|
|
121583
|
+
const tokenAsn1 = feeData[2];
|
|
121584
|
+
if (tokenAsn1 !== undefined) {
|
|
121585
|
+
const token = client_lib_account.fromPublicKeyAndType(client_vote_Buffer.from(tokenAsn1.contains));
|
|
121586
|
+
if (!token.isToken()) {
|
|
121587
|
+
throw new src_client_KeetaNetVoteError('VOTE_MALFORMED_FEES_TOKEN_NOT_TOKEN', 'internal error: fees extension token is not a valid token');
|
|
121588
|
+
}
|
|
121589
|
+
retval.token = token;
|
|
121590
|
+
}
|
|
121591
|
+
return retval;
|
|
121592
|
+
}
|
|
121353
121593
|
|
|
121354
121594
|
/**
|
|
121355
121595
|
* Convert an ASN1Date to a Date
|
|
@@ -121489,6 +121729,9 @@ class src_client_VoteBlockHash extends src_client_BufferStorage {
|
|
|
121489
121729
|
client_VoteBlockHash = src_client_VoteBlockHash;
|
|
121490
121730
|
client_lib_vote_defineProperty(src_client_VoteBlockHash, "isInstance", client_checkableGenerator(client_VoteBlockHash));
|
|
121491
121731
|
client_lib_vote_defineProperty(src_client_VoteBlockHash, "Map", client_VoteBlockHashMap);
|
|
121732
|
+
/**
|
|
121733
|
+
* Options for Vote Builder
|
|
121734
|
+
*/
|
|
121492
121735
|
var client_vote = /*#__PURE__*/new WeakMap();
|
|
121493
121736
|
var client_options = /*#__PURE__*/new WeakMap();
|
|
121494
121737
|
var client_vote_hash = /*#__PURE__*/new WeakMap();
|
|
@@ -121500,6 +121743,21 @@ class src_client_PossiblyExpiredVote {
|
|
|
121500
121743
|
return false;
|
|
121501
121744
|
}
|
|
121502
121745
|
}
|
|
121746
|
+
if ('fee' in voteJSON) {
|
|
121747
|
+
const fee = voteJSON['fee'];
|
|
121748
|
+
if (fee === undefined) {
|
|
121749
|
+
return false;
|
|
121750
|
+
}
|
|
121751
|
+
if (fee['amount'] === undefined) {
|
|
121752
|
+
return false;
|
|
121753
|
+
}
|
|
121754
|
+
if ('payTo' in fee && fee['payTo'] === undefined) {
|
|
121755
|
+
return false;
|
|
121756
|
+
}
|
|
121757
|
+
if ('token' in fee && fee['token'] === undefined) {
|
|
121758
|
+
return false;
|
|
121759
|
+
}
|
|
121760
|
+
}
|
|
121503
121761
|
return true;
|
|
121504
121762
|
}
|
|
121505
121763
|
static fromJSON(voteJSON) {
|
|
@@ -121522,6 +121780,9 @@ class src_client_PossiblyExpiredVote {
|
|
|
121522
121780
|
const validTo = new Date(voteJSON.validityTo);
|
|
121523
121781
|
const validFrom = new Date(voteJSON.validityFrom);
|
|
121524
121782
|
const signatureStorage = new src_client_BufferStorage(signature, signature.byteLength);
|
|
121783
|
+
if (voteJSON.fee !== undefined) {
|
|
121784
|
+
voteBuilder.addFee(voteJSON.fee);
|
|
121785
|
+
}
|
|
121525
121786
|
const {
|
|
121526
121787
|
voteData,
|
|
121527
121788
|
tbsCertificate,
|
|
@@ -121548,6 +121809,7 @@ class src_client_PossiblyExpiredVote {
|
|
|
121548
121809
|
this.validityFrom = vote.validityFrom;
|
|
121549
121810
|
this.validityTo = vote.validityTo;
|
|
121550
121811
|
this.signature = vote.signature;
|
|
121812
|
+
this.fee = vote.fee;
|
|
121551
121813
|
this.$trusted = vote.$trusted;
|
|
121552
121814
|
this.$permanent = vote.$permanent;
|
|
121553
121815
|
this.$uid = vote.$uid;
|
|
@@ -121761,6 +122023,7 @@ class src_client_PossiblyExpiredVote {
|
|
|
121761
122023
|
throw new src_client_KeetaNetVoteError('VOTE_MALFORMED_VOTE_EXTENSIONS', 'internal error: Expected extensions to be a Sequence');
|
|
121762
122024
|
}
|
|
121763
122025
|
let blocks;
|
|
122026
|
+
let fee;
|
|
121764
122027
|
for (const extensionInfo of extensions) {
|
|
121765
122028
|
if (!Array.isArray(extensionInfo)) {
|
|
121766
122029
|
throw new src_client_KeetaNetVoteError('VOTE_MALFORMED_VOTE_EXTENSIONS_VALUE', 'internal error: Expected each extension to be a Sequence');
|
|
@@ -121784,13 +122047,18 @@ class src_client_PossiblyExpiredVote {
|
|
|
121784
122047
|
critical = criticalCheck;
|
|
121785
122048
|
}
|
|
121786
122049
|
const extensionData = extensionInfo.shift();
|
|
122050
|
+
if (!client_vote_Buffer.isBuffer(extensionData)) {
|
|
122051
|
+
throw new src_client_KeetaNetVoteError('VOTE_MALFORMED_VOTE_EXTENSIONS_DATA', `internal error: ${extensionOID.oid} extensions are always Octet String`);
|
|
122052
|
+
}
|
|
121787
122053
|
switch (extensionOID.oid) {
|
|
121788
122054
|
case 'hashData':
|
|
121789
|
-
if (!client_vote_Buffer.isBuffer(extensionData)) {
|
|
121790
|
-
throw new src_client_KeetaNetVoteError('VOTE_MALFORMED_VOTE_EXTENSIONS_VALUE_HASH_DATA', 'internal error: hashData extensions are always Octet String');
|
|
121791
|
-
}
|
|
121792
122055
|
blocks = client_blockHashesFromVote(extensionData);
|
|
121793
122056
|
break;
|
|
122057
|
+
case '1.3.6.1.4.1.62675.0.1.0':
|
|
122058
|
+
case 'fees':
|
|
122059
|
+
// replace with fees 1.3.6.1.4.1.62675.0.1.0
|
|
122060
|
+
fee = client_feeFromVote(extensionData);
|
|
122061
|
+
break;
|
|
121794
122062
|
default:
|
|
121795
122063
|
if (critical) {
|
|
121796
122064
|
throw new src_client_KeetaNetVoteError('VOTE_MALFORMED_VOTE_EXTENSIONS_VALUE_CRITICAL_TYPE', `internal error: Unknown critical extension ${extensionOID.oid}`);
|
|
@@ -121804,6 +122072,12 @@ class src_client_PossiblyExpiredVote {
|
|
|
121804
122072
|
throw new src_client_KeetaNetVoteError('VOTE_MALFORMED_VOTE_NO_BLOCKS_FOUND', 'No block hashes found within vote');
|
|
121805
122073
|
}
|
|
121806
122074
|
this.blocks = blocks;
|
|
122075
|
+
if (fee !== undefined) {
|
|
122076
|
+
if (this.$permanent) {
|
|
122077
|
+
throw new src_client_KeetaNetVoteError('VOTE_MALFORMED_FEES_IN_PERMANENT_VOTE', 'Permanent Vote cannot have fees');
|
|
122078
|
+
}
|
|
122079
|
+
this.fee = fee;
|
|
122080
|
+
}
|
|
121807
122081
|
|
|
121808
122082
|
/**
|
|
121809
122083
|
* Get the signature data
|
|
@@ -121918,6 +122192,9 @@ class src_client_PossiblyExpiredVote {
|
|
|
121918
122192
|
if (options !== null && options !== void 0 && options.addBinary) {
|
|
121919
122193
|
additionalFields['$binary'] = client_vote_Buffer.from(this.toBytes()).toString('base64');
|
|
121920
122194
|
}
|
|
122195
|
+
if (this.fee !== undefined) {
|
|
122196
|
+
additionalFields['fee'] = this.fee;
|
|
122197
|
+
}
|
|
121921
122198
|
return {
|
|
121922
122199
|
issuer: this.issuer,
|
|
121923
122200
|
serial: this.serial,
|
|
@@ -122422,16 +122699,20 @@ client_VoteStaple = src_client_VoteStaple;
|
|
|
122422
122699
|
client_lib_vote_defineProperty(src_client_VoteStaple, "isInstance", client_checkableGenerator(client_VoteStaple));
|
|
122423
122700
|
var client_account = /*#__PURE__*/new WeakMap();
|
|
122424
122701
|
var client_blocks = /*#__PURE__*/new WeakMap();
|
|
122702
|
+
var client_fee = /*#__PURE__*/new WeakMap();
|
|
122425
122703
|
class src_client_VoteBuilder {
|
|
122426
122704
|
constructor(account) {
|
|
122427
122705
|
let blocks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
122706
|
+
let options = arguments.length > 2 ? arguments[2] : undefined;
|
|
122428
122707
|
client_vote_classPrivateFieldInitSpec(this, client_account, void 0);
|
|
122429
122708
|
client_vote_classPrivateFieldInitSpec(this, client_blocks, void 0);
|
|
122709
|
+
client_vote_classPrivateFieldInitSpec(this, client_fee, undefined);
|
|
122430
122710
|
if (!client_lib_account.isInstance(account)) {
|
|
122431
122711
|
throw new src_client_KeetaNetVoteError('VOTE_BUILDER_INVALID_CONSTRUCTION', 'internal error: account must be an Account');
|
|
122432
122712
|
}
|
|
122433
122713
|
client_vote_classPrivateFieldSet(client_account, this, account);
|
|
122434
122714
|
client_vote_classPrivateFieldSet(client_blocks, this, []);
|
|
122715
|
+
client_vote_classPrivateFieldSet(client_fee, this, options === null || options === void 0 ? void 0 : options.fee);
|
|
122435
122716
|
this.addBlocks(blocks);
|
|
122436
122717
|
}
|
|
122437
122718
|
addBlocks(blocks) {
|
|
@@ -122453,6 +122734,27 @@ class src_client_VoteBuilder {
|
|
|
122453
122734
|
addBlock(block) {
|
|
122454
122735
|
this.addBlocks([block]);
|
|
122455
122736
|
}
|
|
122737
|
+
addFee(feeInput) {
|
|
122738
|
+
const fee = {
|
|
122739
|
+
amount: BigInt(feeInput.amount)
|
|
122740
|
+
};
|
|
122741
|
+
const payTo = client_lib_account.toAccount(feeInput.payTo);
|
|
122742
|
+
if (payTo !== undefined) {
|
|
122743
|
+
if (payTo.isStorage()) {
|
|
122744
|
+
fee.payTo = payTo;
|
|
122745
|
+
} else {
|
|
122746
|
+
fee.payTo = payTo.assertAccount();
|
|
122747
|
+
}
|
|
122748
|
+
}
|
|
122749
|
+
const token = client_lib_account.toAccount(fee.token);
|
|
122750
|
+
if (token !== undefined) {
|
|
122751
|
+
if (token.isToken()) {
|
|
122752
|
+
fee.token = token;
|
|
122753
|
+
}
|
|
122754
|
+
throw new src_client_KeetaNetVoteError('VOTE_MALFORMED_FEES_TOKEN_NOT_TOKEN', 'Fee Token should be of type TOKEN');
|
|
122755
|
+
}
|
|
122756
|
+
client_vote_classPrivateFieldSet(client_fee, this, fee);
|
|
122757
|
+
}
|
|
122456
122758
|
generateVoteData(serial, validTo, validFrom) {
|
|
122457
122759
|
/**
|
|
122458
122760
|
* Signature algorithm identifier
|
|
@@ -122494,6 +122796,45 @@ class src_client_VoteBuilder {
|
|
|
122494
122796
|
type: 'oid',
|
|
122495
122797
|
oid: signatureInfoOID
|
|
122496
122798
|
}];
|
|
122799
|
+
let feeExtension = undefined;
|
|
122800
|
+
if (client_vote_classPrivateFieldGet(client_fee, this) !== undefined) {
|
|
122801
|
+
var _classPrivateFieldGet2, _classPrivateFieldGet3;
|
|
122802
|
+
/** Amount for this vote */
|
|
122803
|
+
const feeData = [client_vote_classPrivateFieldGet(client_fee, this).amount];
|
|
122804
|
+
|
|
122805
|
+
/** Account to pay the fee too */
|
|
122806
|
+
const payToPublicKey = (_classPrivateFieldGet2 = client_vote_classPrivateFieldGet(client_fee, this).payTo) === null || _classPrivateFieldGet2 === void 0 ? void 0 : _classPrivateFieldGet2.publicKeyAndType;
|
|
122807
|
+
if (payToPublicKey !== undefined) {
|
|
122808
|
+
feeData.push({
|
|
122809
|
+
type: 'context',
|
|
122810
|
+
value: 0,
|
|
122811
|
+
kind: 'implicit',
|
|
122812
|
+
contains: payToPublicKey
|
|
122813
|
+
});
|
|
122814
|
+
}
|
|
122815
|
+
|
|
122816
|
+
/** Token in which to pay the fee */
|
|
122817
|
+
const tokenPublicKey = (_classPrivateFieldGet3 = client_vote_classPrivateFieldGet(client_fee, this).token) === null || _classPrivateFieldGet3 === void 0 ? void 0 : _classPrivateFieldGet3.publicKeyAndType;
|
|
122818
|
+
if (tokenPublicKey !== undefined) {
|
|
122819
|
+
feeData.push({
|
|
122820
|
+
type: 'context',
|
|
122821
|
+
value: 1,
|
|
122822
|
+
kind: 'implicit',
|
|
122823
|
+
contains: tokenPublicKey
|
|
122824
|
+
});
|
|
122825
|
+
}
|
|
122826
|
+
feeExtension = [{
|
|
122827
|
+
type: 'oid',
|
|
122828
|
+
oid: '1.3.6.1.4.1.62675.0.1.0'
|
|
122829
|
+
},
|
|
122830
|
+
// replace with 'fees' - 1.3.6.1.4.1.62675.0.1.0
|
|
122831
|
+
true, client_vote_Buffer.from(client_JStoASN1({
|
|
122832
|
+
type: 'context',
|
|
122833
|
+
value: 0,
|
|
122834
|
+
kind: 'explicit',
|
|
122835
|
+
contains: feeData
|
|
122836
|
+
}).toBER(false))];
|
|
122837
|
+
}
|
|
122497
122838
|
|
|
122498
122839
|
/*
|
|
122499
122840
|
* Certificate to be signed
|
|
@@ -122572,7 +122913,7 @@ class src_client_VoteBuilder {
|
|
|
122572
122913
|
client_vote_classPrivateFieldGet(client_blocks, this).map(function (blockhash) {
|
|
122573
122914
|
return blockhash.getBuffer();
|
|
122574
122915
|
})]
|
|
122575
|
-
}).toBER(false))]]
|
|
122916
|
+
}).toBER(false))], ...(feeExtension ? [feeExtension] : [])]
|
|
122576
122917
|
}];
|
|
122577
122918
|
let toSign;
|
|
122578
122919
|
const tbsCertificateDER = client_vote_Buffer.from(client_JStoASN1(tbsCertificate).toBER(false));
|
|
@@ -122622,6 +122963,9 @@ class src_client_VoteBuilder {
|
|
|
122622
122963
|
if (typeof serial !== 'bigint') {
|
|
122623
122964
|
throw new src_client_KeetaNetVoteError('VOTE_BUILDER_INVALID_SERIAL', `internal error: serial must be a bigint, instead got ${serial}`);
|
|
122624
122965
|
}
|
|
122966
|
+
if (validTo === null && client_vote_classPrivateFieldGet(client_fee, this) !== undefined) {
|
|
122967
|
+
throw new src_client_KeetaNetVoteError('VOTE_MALFORMED_FEES_IN_PERMANENT_VOTE', 'internal error: permanent votes should not have fees');
|
|
122968
|
+
}
|
|
122625
122969
|
if (validTo === null) {
|
|
122626
122970
|
/**
|
|
122627
122971
|
* Issue a permanent vote
|
|
@@ -122655,7 +122999,8 @@ src_client_PossiblyExpiredVote.Builder = src_client_VoteBuilder;
|
|
|
122655
122999
|
/** @internal */
|
|
122656
123000
|
const src_client_Testing = {
|
|
122657
123001
|
findRDN: client_findRDN,
|
|
122658
|
-
blockHashesFromVote: client_blockHashesFromVote
|
|
123002
|
+
blockHashesFromVote: client_blockHashesFromVote,
|
|
123003
|
+
feeFromVote: client_feeFromVote
|
|
122659
123004
|
};
|
|
122660
123005
|
;// ./src/lib/ledger/effects.ts
|
|
122661
123006
|
|
|
@@ -125324,83 +125669,6 @@ function client_getDurationRange(duration) {
|
|
|
125324
125669
|
return range;
|
|
125325
125670
|
}
|
|
125326
125671
|
/* harmony default export */ const client_stats = (client_Stats);
|
|
125327
|
-
;// ./node_modules/uuid/dist/esm-browser/native.js
|
|
125328
|
-
const client_randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
125329
|
-
/* harmony default export */ const client_esm_browser_native = ({ randomUUID: client_randomUUID });
|
|
125330
|
-
|
|
125331
|
-
;// ./node_modules/uuid/dist/esm-browser/rng.js
|
|
125332
|
-
let client_getRandomValues;
|
|
125333
|
-
const client_rnds8 = new Uint8Array(16);
|
|
125334
|
-
function client_rng() {
|
|
125335
|
-
if (!client_getRandomValues) {
|
|
125336
|
-
if (typeof crypto === 'undefined' || !crypto.getRandomValues) {
|
|
125337
|
-
throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
|
|
125338
|
-
}
|
|
125339
|
-
client_getRandomValues = crypto.getRandomValues.bind(crypto);
|
|
125340
|
-
}
|
|
125341
|
-
return client_getRandomValues(client_rnds8);
|
|
125342
|
-
}
|
|
125343
|
-
|
|
125344
|
-
;// ./node_modules/uuid/dist/esm-browser/stringify.js
|
|
125345
|
-
|
|
125346
|
-
const client_byteToHex = [];
|
|
125347
|
-
for (let i = 0; i < 256; ++i) {
|
|
125348
|
-
client_byteToHex.push((i + 0x100).toString(16).slice(1));
|
|
125349
|
-
}
|
|
125350
|
-
function client_unsafeStringify(arr, offset = 0) {
|
|
125351
|
-
return (client_byteToHex[arr[offset + 0]] +
|
|
125352
|
-
client_byteToHex[arr[offset + 1]] +
|
|
125353
|
-
client_byteToHex[arr[offset + 2]] +
|
|
125354
|
-
client_byteToHex[arr[offset + 3]] +
|
|
125355
|
-
'-' +
|
|
125356
|
-
client_byteToHex[arr[offset + 4]] +
|
|
125357
|
-
client_byteToHex[arr[offset + 5]] +
|
|
125358
|
-
'-' +
|
|
125359
|
-
client_byteToHex[arr[offset + 6]] +
|
|
125360
|
-
client_byteToHex[arr[offset + 7]] +
|
|
125361
|
-
'-' +
|
|
125362
|
-
client_byteToHex[arr[offset + 8]] +
|
|
125363
|
-
client_byteToHex[arr[offset + 9]] +
|
|
125364
|
-
'-' +
|
|
125365
|
-
client_byteToHex[arr[offset + 10]] +
|
|
125366
|
-
client_byteToHex[arr[offset + 11]] +
|
|
125367
|
-
client_byteToHex[arr[offset + 12]] +
|
|
125368
|
-
client_byteToHex[arr[offset + 13]] +
|
|
125369
|
-
client_byteToHex[arr[offset + 14]] +
|
|
125370
|
-
client_byteToHex[arr[offset + 15]]).toLowerCase();
|
|
125371
|
-
}
|
|
125372
|
-
function src_client_stringify(arr, offset = 0) {
|
|
125373
|
-
const uuid = client_unsafeStringify(arr, offset);
|
|
125374
|
-
if (!validate(uuid)) {
|
|
125375
|
-
throw TypeError('Stringified UUID is invalid');
|
|
125376
|
-
}
|
|
125377
|
-
return uuid;
|
|
125378
|
-
}
|
|
125379
|
-
/* harmony default export */ const client_esm_browser_stringify = ((/* unused pure expression or super */ null && (src_client_stringify)));
|
|
125380
|
-
|
|
125381
|
-
;// ./node_modules/uuid/dist/esm-browser/v4.js
|
|
125382
|
-
|
|
125383
|
-
|
|
125384
|
-
|
|
125385
|
-
function client_v4(options, buf, offset) {
|
|
125386
|
-
if (client_esm_browser_native.randomUUID && !buf && !options) {
|
|
125387
|
-
return client_esm_browser_native.randomUUID();
|
|
125388
|
-
}
|
|
125389
|
-
options = options || {};
|
|
125390
|
-
const rnds = options.random || (options.rng || client_rng)();
|
|
125391
|
-
rnds[6] = (rnds[6] & 0x0f) | 0x40;
|
|
125392
|
-
rnds[8] = (rnds[8] & 0x3f) | 0x80;
|
|
125393
|
-
if (buf) {
|
|
125394
|
-
offset = offset || 0;
|
|
125395
|
-
for (let i = 0; i < 16; ++i) {
|
|
125396
|
-
buf[offset + i] = rnds[i];
|
|
125397
|
-
}
|
|
125398
|
-
return buf;
|
|
125399
|
-
}
|
|
125400
|
-
return client_unsafeStringify(rnds);
|
|
125401
|
-
}
|
|
125402
|
-
/* harmony default export */ const client_esm_browser_v4 = (client_v4);
|
|
125403
|
-
|
|
125404
125672
|
// EXTERNAL MODULE: ws (ignored)
|
|
125405
125673
|
var client_ws_ignored_ = __webpack_require__(4708);
|
|
125406
125674
|
;// ./src/lib/p2p.ts
|
|
@@ -127718,7 +127986,7 @@ async function client_generateInitialVoteStaple(options) {
|
|
|
127718
127986
|
Utils: {
|
|
127719
127987
|
ASN1: client_utils_asn1_namespaceObject,
|
|
127720
127988
|
Bloom: client_bloom_namespaceObject,
|
|
127721
|
-
Buffer:
|
|
127989
|
+
Buffer: client_utils_buffer_namespaceObject,
|
|
127722
127990
|
Hash: client_hash_namespaceObject,
|
|
127723
127991
|
Helper: client_helper_namespaceObject,
|
|
127724
127992
|
Initial: client_initial_namespaceObject,
|
|
@@ -127727,7 +127995,7 @@ async function client_generateInitialVoteStaple(options) {
|
|
|
127727
127995
|
}
|
|
127728
127996
|
});
|
|
127729
127997
|
;// ./src/version.ts
|
|
127730
|
-
const client_version = '0.12.
|
|
127998
|
+
const client_version = '0.12.2+g77a8a16ada9dfab5604b605cbe69d373a414d204';
|
|
127731
127999
|
/* harmony default export */ const client_src_version = ((/* unused pure expression or super */ null && (client_version)));
|
|
127732
128000
|
;// ./src/lib/error/client.ts
|
|
127733
128001
|
var client_KeetaNetClientError;
|