@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.js
CHANGED
|
@@ -64440,11 +64440,11 @@ const VoteErrorCodes = [
|
|
|
64440
64440
|
'MALFORMED_VOTE_VALIDITY_INFORMATION',
|
|
64441
64441
|
'MALFORMED_VOTE_SERIAL',
|
|
64442
64442
|
'MALFORMED_VOTE_EXTENSIONS',
|
|
64443
|
+
'MALFORMED_VOTE_EXTENSIONS_DATA',
|
|
64443
64444
|
'MALFORMED_VOTE_EXTENSIONS_VALUE',
|
|
64444
64445
|
'MALFORMED_VOTE_EXTENSIONS_VALUE_OID',
|
|
64445
64446
|
'MALFORMED_VOTE_EXTENSIONS_VALUE_CRITICAL',
|
|
64446
64447
|
'MALFORMED_VOTE_EXTENSIONS_VALUE_CRITICAL_TYPE',
|
|
64447
|
-
'MALFORMED_VOTE_EXTENSIONS_VALUE_HASH_DATA',
|
|
64448
64448
|
'MALFORMED_VOTE_SIGNATURE_SCHEME_DOES_NOT_MATCH_ISSUER',
|
|
64449
64449
|
'MALFORMED_VOTE_SIGNATURE_SCHEME_DOES_NOT_MATCH_WRAPPER',
|
|
64450
64450
|
'MALFORMED_VOTE_SIGNATURE_SCHEME_ECDSA_INVALID_CURVE',
|
|
@@ -64473,7 +64473,13 @@ const VoteErrorCodes = [
|
|
|
64473
64473
|
'MALFORMED_HASHES_FROM_VOTE_DATA_NOT_TWO_ITEMS',
|
|
64474
64474
|
'MALFORMED_HASHES_FROM_VOTE_DATA_UNSUPPORTED_HASH_FUNC',
|
|
64475
64475
|
'MALFORMED_HASHES_FROM_VOTE_DATA_UNSUPPORTED_HASH_TYPE',
|
|
64476
|
-
'MALFORMED_HASHES_FROM_VOTE_DATA_SECOND_MUST_BE_SEQUENCE'
|
|
64476
|
+
'MALFORMED_HASHES_FROM_VOTE_DATA_SECOND_MUST_BE_SEQUENCE',
|
|
64477
|
+
// Errors from the feesFromVote function
|
|
64478
|
+
'MALFORMED_FEES_AMOUNT',
|
|
64479
|
+
'MALFORMED_FEES_FROM_VOTE_INVALID_INPUT',
|
|
64480
|
+
'MALFORMED_FEES_IN_PERMANENT_VOTE',
|
|
64481
|
+
'MALFORMED_FEES_PAY_TO_INVALID',
|
|
64482
|
+
'MALFORMED_FEES_TOKEN_NOT_TOKEN'
|
|
64477
64483
|
];
|
|
64478
64484
|
class KeetaNetVoteError extends _1.KeetaNetError {
|
|
64479
64485
|
constructor(code, message) {
|
|
@@ -70389,6 +70395,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
70389
70395
|
var _ValidateASN1_schema, _BufferStorageASN1_data;
|
|
70390
70396
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
70391
70397
|
exports._Testing = exports.ASN1BigIntToBuffer = exports.ASN1IntegerToBigInt = exports.JStoASN1 = exports.ASN1toJS = exports.BufferStorageASN1 = exports.ValidateASN1 = exports.asn1 = void 0;
|
|
70398
|
+
exports.isASN1Object = isASN1Object;
|
|
70392
70399
|
exports.isValidSequenceSchema = isValidSequenceSchema;
|
|
70393
70400
|
const asn1js = __importStar(__webpack_require__(7813));
|
|
70394
70401
|
const helper_1 = __webpack_require__(3208);
|
|
@@ -70454,20 +70461,29 @@ function jsIntegerToBigInt(value) {
|
|
|
70454
70461
|
}
|
|
70455
70462
|
return (BigInt(valueStr));
|
|
70456
70463
|
}
|
|
70464
|
+
function isASN1Object(input) {
|
|
70465
|
+
if (input === null || input === undefined || typeof input !== 'object') {
|
|
70466
|
+
return (false);
|
|
70467
|
+
}
|
|
70468
|
+
if (!('type' in input) || typeof input.type !== 'string') {
|
|
70469
|
+
return (false);
|
|
70470
|
+
}
|
|
70471
|
+
return (true);
|
|
70472
|
+
}
|
|
70457
70473
|
function isASN1OID(input) {
|
|
70458
|
-
if (
|
|
70474
|
+
if (!isASN1Object(input)) {
|
|
70459
70475
|
return (false);
|
|
70460
70476
|
}
|
|
70461
70477
|
if (input.type !== 'oid') {
|
|
70462
70478
|
return (false);
|
|
70463
70479
|
}
|
|
70464
|
-
if (typeof input.oid !== 'string') {
|
|
70480
|
+
if (!('oid' in input) || typeof input.oid !== 'string') {
|
|
70465
70481
|
return (false);
|
|
70466
70482
|
}
|
|
70467
70483
|
return (true);
|
|
70468
70484
|
}
|
|
70469
70485
|
function isASN1String(input) {
|
|
70470
|
-
if (
|
|
70486
|
+
if (!isASN1Object(input)) {
|
|
70471
70487
|
return (false);
|
|
70472
70488
|
}
|
|
70473
70489
|
if (!('type' in input) || input.type !== 'string') {
|
|
@@ -70490,13 +70506,16 @@ function isASN1String(input) {
|
|
|
70490
70506
|
return (true);
|
|
70491
70507
|
}
|
|
70492
70508
|
function isASN1Set(input) {
|
|
70493
|
-
if (
|
|
70509
|
+
if (!isASN1Object(input)) {
|
|
70494
70510
|
return (false);
|
|
70495
70511
|
}
|
|
70496
70512
|
if (input.type !== 'set') {
|
|
70497
70513
|
return (false);
|
|
70498
70514
|
}
|
|
70499
|
-
if (!isASN1OID(input.name)) {
|
|
70515
|
+
if (!('name' in input) || !isASN1OID(input.name)) {
|
|
70516
|
+
return (false);
|
|
70517
|
+
}
|
|
70518
|
+
if (!('value' in input)) {
|
|
70500
70519
|
return (false);
|
|
70501
70520
|
}
|
|
70502
70521
|
if (typeof input.value !== 'string') {
|
|
@@ -70507,7 +70526,7 @@ function isASN1Set(input) {
|
|
|
70507
70526
|
return (true);
|
|
70508
70527
|
}
|
|
70509
70528
|
function isASN1ContextTag(input) {
|
|
70510
|
-
if (
|
|
70529
|
+
if (!isASN1Object(input)) {
|
|
70511
70530
|
return (false);
|
|
70512
70531
|
}
|
|
70513
70532
|
if (!('type' in input) || input.type !== 'context') {
|
|
@@ -70522,19 +70541,19 @@ function isASN1ContextTag(input) {
|
|
|
70522
70541
|
return (true);
|
|
70523
70542
|
}
|
|
70524
70543
|
function isASN1BitString(input) {
|
|
70525
|
-
if (
|
|
70544
|
+
if (!isASN1Object(input)) {
|
|
70526
70545
|
return (false);
|
|
70527
70546
|
}
|
|
70528
70547
|
if (input.type !== 'bitstring') {
|
|
70529
70548
|
return (false);
|
|
70530
70549
|
}
|
|
70531
|
-
if (!(0, helper_1.isBuffer)(input.value)) {
|
|
70550
|
+
if (!('value' in input) || !(0, helper_1.isBuffer)(input.value)) {
|
|
70532
70551
|
return (false);
|
|
70533
70552
|
}
|
|
70534
70553
|
return (true);
|
|
70535
70554
|
}
|
|
70536
70555
|
function isASN1Date(input) {
|
|
70537
|
-
if (
|
|
70556
|
+
if (!isASN1Object(input)) {
|
|
70538
70557
|
return (false);
|
|
70539
70558
|
}
|
|
70540
70559
|
if (!('type' in input) || input.type !== 'date') {
|
|
@@ -71397,16 +71416,36 @@ class ValidateASN1 {
|
|
|
71397
71416
|
if (input.length < minLength || input.length > maxLength) {
|
|
71398
71417
|
throw (new Error(`Expected Array length between [${minLength}, ${maxLength}], got ${input.length}`));
|
|
71399
71418
|
}
|
|
71400
|
-
|
|
71401
|
-
|
|
71402
|
-
|
|
71403
|
-
|
|
71404
|
-
|
|
71405
|
-
|
|
71406
|
-
|
|
71419
|
+
const output = [];
|
|
71420
|
+
for (let i = 0; i < schema.length; i++) {
|
|
71421
|
+
// If the schema is optional, we check two paths, if the value is present or not.
|
|
71422
|
+
// This will break the loop and leave the rest of the validation to the recursive call.
|
|
71423
|
+
if (typeof schema[i] === 'object' && 'optional' in schema[i]) {
|
|
71424
|
+
// We only need to take two paths for optional values when we are before the last value, and the value is not undefined
|
|
71425
|
+
if (i < schema.length - 1 && input[i] !== undefined) {
|
|
71426
|
+
const remainingSchema = schema.slice(i + 1);
|
|
71427
|
+
try {
|
|
71428
|
+
// Try to validate against schema assuming optional is present
|
|
71429
|
+
// @ts-ignore
|
|
71430
|
+
output.push(...ValidateASN1.againstSchema(input.slice(i), [schema[i].optional, ...remainingSchema]));
|
|
71431
|
+
}
|
|
71432
|
+
catch {
|
|
71433
|
+
/* ignore error because we are going to try without the optional value */
|
|
71434
|
+
// @ts-ignore
|
|
71435
|
+
output.push(undefined, ...ValidateASN1.againstSchema(input.slice(i), remainingSchema));
|
|
71436
|
+
}
|
|
71437
|
+
break;
|
|
71438
|
+
}
|
|
71439
|
+
}
|
|
71407
71440
|
// @ts-ignore
|
|
71408
|
-
|
|
71409
|
-
}
|
|
71441
|
+
output.push(ValidateASN1.againstSchema(input[i], schema[i]));
|
|
71442
|
+
}
|
|
71443
|
+
// If the end of the output is only optional values, exclude undefined values.
|
|
71444
|
+
while (output.length > 0 && output.at(-1) === undefined) {
|
|
71445
|
+
output.pop();
|
|
71446
|
+
}
|
|
71447
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
71448
|
+
return output;
|
|
71410
71449
|
}
|
|
71411
71450
|
else {
|
|
71412
71451
|
throw (new Error(`Internal error: Unsupported schema type ${JSON.stringify(schema)}`));
|
|
@@ -71697,16 +71736,23 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
71697
71736
|
};
|
|
71698
71737
|
var _BufferStorage_key;
|
|
71699
71738
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
71700
|
-
exports.BufferStorage = void 0;
|
|
71739
|
+
exports.Buffer = exports.BufferStorage = void 0;
|
|
71701
71740
|
exports.DecodeBase32 = DecodeBase32;
|
|
71702
71741
|
exports.EncodeBase32 = EncodeBase32;
|
|
71703
71742
|
exports.DecodeBase64 = DecodeBase64;
|
|
71704
71743
|
exports.EncodeBase64 = EncodeBase64;
|
|
71705
71744
|
exports.ZlibInflate = ZlibInflate;
|
|
71706
71745
|
exports.ZlibDeflate = ZlibDeflate;
|
|
71746
|
+
exports.ZlibInflateAsync = ZlibInflateAsync;
|
|
71747
|
+
exports.ZlibDeflateAsync = ZlibDeflateAsync;
|
|
71707
71748
|
const helper_1 = __webpack_require__(3208);
|
|
71708
71749
|
const rfc4648_1 = __webpack_require__(9211);
|
|
71750
|
+
const buffer_1 = __webpack_require__(181);
|
|
71751
|
+
Object.defineProperty(exports, "Buffer", ({ enumerable: true, get: function () { return buffer_1.Buffer; } }));
|
|
71752
|
+
const util_1 = __webpack_require__(9023);
|
|
71709
71753
|
const zlib_1 = __importDefault(__webpack_require__(3106));
|
|
71754
|
+
const inflateAsync = (0, util_1.promisify)(zlib_1.default.inflate);
|
|
71755
|
+
const deflateAsync = (0, util_1.promisify)(zlib_1.default.deflate);
|
|
71710
71756
|
/**
|
|
71711
71757
|
* RFC 4648 Base32 Decoder
|
|
71712
71758
|
*/
|
|
@@ -71729,16 +71775,24 @@ function EncodeBase32(data) {
|
|
|
71729
71775
|
}).toLowerCase());
|
|
71730
71776
|
}
|
|
71731
71777
|
function DecodeBase64(data) {
|
|
71732
|
-
return ((0, helper_1.bufferToArrayBuffer)(Buffer.from(data, 'base64')));
|
|
71778
|
+
return ((0, helper_1.bufferToArrayBuffer)(buffer_1.Buffer.from(data, 'base64')));
|
|
71733
71779
|
}
|
|
71734
71780
|
function EncodeBase64(data) {
|
|
71735
|
-
return (Buffer.from(data).toString('base64'));
|
|
71781
|
+
return (buffer_1.Buffer.from(data).toString('base64'));
|
|
71736
71782
|
}
|
|
71737
71783
|
function ZlibInflate(data, options) {
|
|
71738
|
-
return ((0, helper_1.bufferToArrayBuffer)(zlib_1.default.inflateSync(Buffer.from(data), options)));
|
|
71784
|
+
return ((0, helper_1.bufferToArrayBuffer)(zlib_1.default.inflateSync(buffer_1.Buffer.from(data), options)));
|
|
71739
71785
|
}
|
|
71740
71786
|
function ZlibDeflate(data, options) {
|
|
71741
|
-
return ((0, helper_1.bufferToArrayBuffer)(zlib_1.default.deflateSync(Buffer.from(data), options)));
|
|
71787
|
+
return ((0, helper_1.bufferToArrayBuffer)(zlib_1.default.deflateSync(buffer_1.Buffer.from(data), options)));
|
|
71788
|
+
}
|
|
71789
|
+
async function ZlibInflateAsync(data, options = {}) {
|
|
71790
|
+
const buffer = await inflateAsync(buffer_1.Buffer.from(data), options);
|
|
71791
|
+
return ((0, helper_1.bufferToArrayBuffer)(buffer));
|
|
71792
|
+
}
|
|
71793
|
+
async function ZlibDeflateAsync(data, options = {}) {
|
|
71794
|
+
const buffer = await deflateAsync(buffer_1.Buffer.from(data), options);
|
|
71795
|
+
return ((0, helper_1.bufferToArrayBuffer)(buffer));
|
|
71742
71796
|
}
|
|
71743
71797
|
class BufferStorage {
|
|
71744
71798
|
constructor(key, length) {
|
|
@@ -71748,7 +71802,7 @@ class BufferStorage {
|
|
|
71748
71802
|
/*
|
|
71749
71803
|
* Convert from a hex-encoded string into a buffer
|
|
71750
71804
|
*/
|
|
71751
|
-
const buffer_key = Buffer.from(key, 'hex');
|
|
71805
|
+
const buffer_key = buffer_1.Buffer.from(key, 'hex');
|
|
71752
71806
|
if (buffer_key.length !== length) {
|
|
71753
71807
|
throw (new Error(`When decoding buffer we got different number of bytes than expected (${buffer_key.length} expected ${length})`));
|
|
71754
71808
|
}
|
|
@@ -71761,11 +71815,11 @@ class BufferStorage {
|
|
|
71761
71815
|
}
|
|
71762
71816
|
value = '0'.repeat(length * 2) + value;
|
|
71763
71817
|
value = value.slice(length * 2 * -1);
|
|
71764
|
-
__classPrivateFieldSet(this, _BufferStorage_key, Buffer.from(value, 'hex'), "f");
|
|
71818
|
+
__classPrivateFieldSet(this, _BufferStorage_key, buffer_1.Buffer.from(value, 'hex'), "f");
|
|
71765
71819
|
}
|
|
71766
71820
|
else {
|
|
71767
|
-
if (Buffer.from(key).length !== length) {
|
|
71768
|
-
throw (new Error(`When storing buffer we got different number of bytes than expected (${Buffer.from(key).length} expected ${length})`));
|
|
71821
|
+
if (buffer_1.Buffer.from(key).length !== length) {
|
|
71822
|
+
throw (new Error(`When storing buffer we got different number of bytes than expected (${buffer_1.Buffer.from(key).length} expected ${length})`));
|
|
71769
71823
|
}
|
|
71770
71824
|
__classPrivateFieldSet(this, _BufferStorage_key, key, "f");
|
|
71771
71825
|
}
|
|
@@ -71777,14 +71831,14 @@ class BufferStorage {
|
|
|
71777
71831
|
return (__classPrivateFieldGet(this, _BufferStorage_key, "f").byteLength);
|
|
71778
71832
|
}
|
|
71779
71833
|
getBuffer() {
|
|
71780
|
-
return (Buffer.from(__classPrivateFieldGet(this, _BufferStorage_key, "f")));
|
|
71834
|
+
return (buffer_1.Buffer.from(__classPrivateFieldGet(this, _BufferStorage_key, "f")));
|
|
71781
71835
|
}
|
|
71782
71836
|
toString(encoding = 'hex') {
|
|
71783
71837
|
switch (encoding) {
|
|
71784
71838
|
case 'hex':
|
|
71785
|
-
return (Buffer.from(__classPrivateFieldGet(this, _BufferStorage_key, "f")).toString(encoding).toUpperCase());
|
|
71839
|
+
return (buffer_1.Buffer.from(__classPrivateFieldGet(this, _BufferStorage_key, "f")).toString(encoding).toUpperCase());
|
|
71786
71840
|
case 'base64':
|
|
71787
|
-
return (Buffer.from(__classPrivateFieldGet(this, _BufferStorage_key, "f")).toString(encoding));
|
|
71841
|
+
return (buffer_1.Buffer.from(__classPrivateFieldGet(this, _BufferStorage_key, "f")).toString(encoding));
|
|
71788
71842
|
case 'base32':
|
|
71789
71843
|
return (EncodeBase32(__classPrivateFieldGet(this, _BufferStorage_key, "f")));
|
|
71790
71844
|
default:
|
|
@@ -71809,11 +71863,11 @@ class BufferStorage {
|
|
|
71809
71863
|
return (false);
|
|
71810
71864
|
}
|
|
71811
71865
|
if (typeof compareWith === 'string') {
|
|
71812
|
-
const asBuf = Buffer.from(compareWith, 'hex');
|
|
71866
|
+
const asBuf = buffer_1.Buffer.from(compareWith, 'hex');
|
|
71813
71867
|
if (asBuf.length !== this.length) {
|
|
71814
71868
|
return (false);
|
|
71815
71869
|
}
|
|
71816
|
-
compareWith = new BufferStorage(Buffer.from(compareWith, 'hex'), this.length);
|
|
71870
|
+
compareWith = new BufferStorage(buffer_1.Buffer.from(compareWith, 'hex'), this.length);
|
|
71817
71871
|
}
|
|
71818
71872
|
return (this.toString('hex') === compareWith.toString('hex'));
|
|
71819
71873
|
}
|
|
@@ -71867,9 +71921,9 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
71867
71921
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
71868
71922
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
71869
71923
|
};
|
|
71870
|
-
var _CertificateBuilder_params, _Certificate_instances, _Certificate_raw, _Certificate_hash, _Certificate_extensionsRaw, _Certificate_extensionsProcessed, _Certificate_finalizeConstructionCalled, _Certificate_processExtensionsInternal, _Certificate_processBaseExtensions, _Certificate_processBaseExtension, _Certificate_assertAllCriticalExtensionsProcessed, _Certificate_checkValid, _Certificate_checkIssued
|
|
71924
|
+
var _CertificateBuilder_params, _CertificateBundle_raw, _CertificateBundle_contents, _Certificate_instances, _Certificate_raw, _Certificate_hash, _Certificate_extensionsRaw, _Certificate_extensionsProcessed, _Certificate_finalizeConstructionCalled, _Certificate_processExtensionsInternal, _Certificate_processBaseExtensions, _Certificate_processBaseExtension, _Certificate_assertAllCriticalExtensionsProcessed, _Certificate_checkValid, _Certificate_checkIssued;
|
|
71871
71925
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
71872
|
-
exports.
|
|
71926
|
+
exports.Certificate = exports.CertificateBundle = exports.CertificateHash = exports.CertificateBuilder = void 0;
|
|
71873
71927
|
const ASN1 = __importStar(__webpack_require__(6045));
|
|
71874
71928
|
const account_1 = __importStar(__webpack_require__(9415));
|
|
71875
71929
|
const never_1 = __webpack_require__(8692);
|
|
@@ -72292,6 +72346,84 @@ CertificateHash.Set = (0, helper_1.setGenerator)(CertificateHash, function (valu
|
|
|
72292
72346
|
}, function (value) {
|
|
72293
72347
|
return (new CertificateHash(Buffer.from(value, 'hex')));
|
|
72294
72348
|
});
|
|
72349
|
+
const CertificateBundleSchemaInternal = {
|
|
72350
|
+
sequenceOf: CertificateSchemaInternal
|
|
72351
|
+
};
|
|
72352
|
+
class CertificateBundle {
|
|
72353
|
+
constructor(input) {
|
|
72354
|
+
_CertificateBundle_raw.set(this, void 0);
|
|
72355
|
+
_CertificateBundle_contents.set(this, void 0);
|
|
72356
|
+
if (CertificateBundle.isInstance(input)) {
|
|
72357
|
+
__classPrivateFieldSet(this, _CertificateBundle_raw, input.getDER(), "f");
|
|
72358
|
+
}
|
|
72359
|
+
else if (Array.isArray(input) || input instanceof Set) {
|
|
72360
|
+
if (input instanceof Set) {
|
|
72361
|
+
input = Array.from(input);
|
|
72362
|
+
}
|
|
72363
|
+
const decodedInput = input.map(function (certificate) {
|
|
72364
|
+
let decoded;
|
|
72365
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
72366
|
+
if (Certificate.isCertificate(certificate)) {
|
|
72367
|
+
decoded = new ASN1.BufferStorageASN1(certificate.toDER());
|
|
72368
|
+
}
|
|
72369
|
+
else {
|
|
72370
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
72371
|
+
decoded = new ASN1.BufferStorageASN1(new Certificate(certificate).toDER());
|
|
72372
|
+
}
|
|
72373
|
+
// 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.
|
|
72374
|
+
// @ts-ignore
|
|
72375
|
+
const output = decoded.getASN1();
|
|
72376
|
+
return (output);
|
|
72377
|
+
});
|
|
72378
|
+
__classPrivateFieldSet(this, _CertificateBundle_raw, new ASN1.BufferStorageASN1(decodedInput, CertificateBundleSchemaInternal).getDER(), "f");
|
|
72379
|
+
}
|
|
72380
|
+
else {
|
|
72381
|
+
if (typeof input === 'string') {
|
|
72382
|
+
input = Buffer.from(input, 'base64');
|
|
72383
|
+
}
|
|
72384
|
+
if (Buffer.isBuffer(input)) {
|
|
72385
|
+
input = (0, helper_1.bufferToArrayBuffer)(input);
|
|
72386
|
+
}
|
|
72387
|
+
__classPrivateFieldSet(this, _CertificateBundle_raw, input, "f");
|
|
72388
|
+
}
|
|
72389
|
+
const decoded = new ASN1.BufferStorageASN1(__classPrivateFieldGet(this, _CertificateBundle_raw, "f"), CertificateBundleSchemaInternal);
|
|
72390
|
+
__classPrivateFieldSet(this, _CertificateBundle_contents, [], "f");
|
|
72391
|
+
const seenHashes = new CertificateHash.Set();
|
|
72392
|
+
for (const item of decoded.getASN1()) {
|
|
72393
|
+
const certificateValue = new ASN1.BufferStorageASN1(item, CertificateSchemaInternal);
|
|
72394
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
72395
|
+
const certificate = new Certificate(certificateValue.getDER());
|
|
72396
|
+
const hash = certificate.hash();
|
|
72397
|
+
if (seenHashes.has(hash)) {
|
|
72398
|
+
throw (new certificate_1.default('CERTIFICATE_DUPLICATE_INCLUDED', `Duplicate certificate ${hash} within certificate bundle`));
|
|
72399
|
+
}
|
|
72400
|
+
seenHashes.add(hash);
|
|
72401
|
+
__classPrivateFieldGet(this, _CertificateBundle_contents, "f").push(certificate);
|
|
72402
|
+
}
|
|
72403
|
+
}
|
|
72404
|
+
get bundleSize() {
|
|
72405
|
+
return (__classPrivateFieldGet(this, _CertificateBundle_contents, "f").length);
|
|
72406
|
+
}
|
|
72407
|
+
getDER() {
|
|
72408
|
+
return (__classPrivateFieldGet(this, _CertificateBundle_raw, "f"));
|
|
72409
|
+
}
|
|
72410
|
+
getDERBuffer() {
|
|
72411
|
+
return (Buffer.from(this.getDER()));
|
|
72412
|
+
}
|
|
72413
|
+
getCertificates() {
|
|
72414
|
+
return (__classPrivateFieldGet(this, _CertificateBundle_contents, "f"));
|
|
72415
|
+
}
|
|
72416
|
+
toJSON() {
|
|
72417
|
+
return ({
|
|
72418
|
+
certificates: this.getCertificates().map(function (certificate) {
|
|
72419
|
+
return (certificate.toPEM());
|
|
72420
|
+
})
|
|
72421
|
+
});
|
|
72422
|
+
}
|
|
72423
|
+
}
|
|
72424
|
+
exports.CertificateBundle = CertificateBundle;
|
|
72425
|
+
_CertificateBundle_raw = new WeakMap(), _CertificateBundle_contents = new WeakMap();
|
|
72426
|
+
CertificateBundle.isInstance = (0, helper_1.checkableGenerator)(CertificateBundle);
|
|
72295
72427
|
class Certificate {
|
|
72296
72428
|
/**
|
|
72297
72429
|
* Is a certificate object?
|
|
@@ -72400,8 +72532,10 @@ class Certificate {
|
|
|
72400
72532
|
this.notAfter = notAfter.date;
|
|
72401
72533
|
this.subject = fromDNSequenceToString(subject);
|
|
72402
72534
|
this.issuer = fromDNSequenceToString(issuer);
|
|
72403
|
-
this.subjectDN = subject;
|
|
72404
|
-
this.issuerDN = issuer;
|
|
72535
|
+
this.subjectDN = fromDNSequence(subject);
|
|
72536
|
+
this.issuerDN = fromDNSequence(issuer);
|
|
72537
|
+
this.subjectDNSet = subject;
|
|
72538
|
+
this.issuerDNSet = issuer;
|
|
72405
72539
|
/*
|
|
72406
72540
|
* Compare the signature algorithm in the certificate with
|
|
72407
72541
|
* the signature algorithm in the signature
|
|
@@ -72785,6 +72919,16 @@ class Certificate {
|
|
|
72785
72919
|
].join('\n') + '\n';
|
|
72786
72920
|
return (certificatePEM);
|
|
72787
72921
|
}
|
|
72922
|
+
/**
|
|
72923
|
+
* The string representation of the certificate
|
|
72924
|
+
* is a PEM encoded certificate -- this misses
|
|
72925
|
+
* some of the internal details like chain
|
|
72926
|
+
* and verified, but is usually what someone
|
|
72927
|
+
* wants to see when they call toString()
|
|
72928
|
+
*/
|
|
72929
|
+
toString() {
|
|
72930
|
+
return (this.toPEM());
|
|
72931
|
+
}
|
|
72788
72932
|
/**
|
|
72789
72933
|
* Compute a hash of the certificate
|
|
72790
72934
|
*/
|
|
@@ -72818,8 +72962,8 @@ class Certificate {
|
|
|
72818
72962
|
issuer: this.issuer,
|
|
72819
72963
|
subjectPublicKey: this.subjectPublicKey,
|
|
72820
72964
|
baseExtensions: this.baseExtensions,
|
|
72821
|
-
subjectDN: fromDNSequence(this.
|
|
72822
|
-
issuerDN: fromDNSequence(this.
|
|
72965
|
+
subjectDN: fromDNSequence(this.subjectDNSet),
|
|
72966
|
+
issuerDN: fromDNSequence(this.issuerDNSet),
|
|
72823
72967
|
$hash: this.hash(),
|
|
72824
72968
|
...additionalFields
|
|
72825
72969
|
});
|
|
@@ -72945,8 +73089,8 @@ _Certificate_raw = new WeakMap(), _Certificate_hash = new WeakMap(), _Certificat
|
|
|
72945
73089
|
/**
|
|
72946
73090
|
* Compare the issuerDN and the subjectDN byte-for-byte
|
|
72947
73091
|
*/
|
|
72948
|
-
const issuerDN = new ASN1.BufferStorageASN1(issuer.
|
|
72949
|
-
const subjectIssuerDN = new ASN1.BufferStorageASN1(this.
|
|
73092
|
+
const issuerDN = new ASN1.BufferStorageASN1(issuer.subjectDNSet);
|
|
73093
|
+
const subjectIssuerDN = new ASN1.BufferStorageASN1(this.issuerDNSet);
|
|
72950
73094
|
const issuerDER = issuerDN.getDERBuffer();
|
|
72951
73095
|
const subjectIssuerDER = subjectIssuerDN.getDERBuffer();
|
|
72952
73096
|
if (!issuerDER.equals(subjectIssuerDER)) {
|
|
@@ -72997,85 +73141,18 @@ _Certificate_raw = new WeakMap(), _Certificate_hash = new WeakMap(), _Certificat
|
|
|
72997
73141
|
* The Certificate Builder
|
|
72998
73142
|
*/
|
|
72999
73143
|
Certificate.Builder = CertificateBuilder;
|
|
73144
|
+
/**
|
|
73145
|
+
* The certificate bundle
|
|
73146
|
+
*/
|
|
73147
|
+
Certificate.Bundle = CertificateBundle;
|
|
73148
|
+
/**
|
|
73149
|
+
* The certificate hash information
|
|
73150
|
+
*/
|
|
73151
|
+
Certificate.Hash = CertificateHash;
|
|
73000
73152
|
/**
|
|
73001
73153
|
* Object type ID for {@link Certificate.isCertificate}
|
|
73002
73154
|
*/
|
|
73003
73155
|
Certificate.certificateObjectTypeID = '8d05dca5-5f42-4dc9-8bf9-f534c6570994:CERTIFICATE';
|
|
73004
|
-
const CertificateBundleSchemaInternal = {
|
|
73005
|
-
sequenceOf: CertificateSchemaInternal
|
|
73006
|
-
};
|
|
73007
|
-
class CertificateBundle {
|
|
73008
|
-
constructor(input) {
|
|
73009
|
-
_CertificateBundle_raw.set(this, void 0);
|
|
73010
|
-
_CertificateBundle_contents.set(this, void 0);
|
|
73011
|
-
if (CertificateBundle.isInstance(input)) {
|
|
73012
|
-
__classPrivateFieldSet(this, _CertificateBundle_raw, input.getDER(), "f");
|
|
73013
|
-
}
|
|
73014
|
-
else if (Array.isArray(input) || input instanceof Set) {
|
|
73015
|
-
if (input instanceof Set) {
|
|
73016
|
-
input = Array.from(input);
|
|
73017
|
-
}
|
|
73018
|
-
const decodedInput = input.map(function (certificate) {
|
|
73019
|
-
let decoded;
|
|
73020
|
-
if (Certificate.isCertificate(certificate)) {
|
|
73021
|
-
decoded = new ASN1.BufferStorageASN1(certificate.toDER());
|
|
73022
|
-
}
|
|
73023
|
-
else {
|
|
73024
|
-
decoded = new ASN1.BufferStorageASN1(new Certificate(certificate).toDER());
|
|
73025
|
-
}
|
|
73026
|
-
// 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.
|
|
73027
|
-
// @ts-ignore
|
|
73028
|
-
const output = decoded.getASN1();
|
|
73029
|
-
return (output);
|
|
73030
|
-
});
|
|
73031
|
-
__classPrivateFieldSet(this, _CertificateBundle_raw, new ASN1.BufferStorageASN1(decodedInput, CertificateBundleSchemaInternal).getDER(), "f");
|
|
73032
|
-
}
|
|
73033
|
-
else {
|
|
73034
|
-
if (typeof input === 'string') {
|
|
73035
|
-
input = Buffer.from(input, 'base64');
|
|
73036
|
-
}
|
|
73037
|
-
if (Buffer.isBuffer(input)) {
|
|
73038
|
-
input = (0, helper_1.bufferToArrayBuffer)(input);
|
|
73039
|
-
}
|
|
73040
|
-
__classPrivateFieldSet(this, _CertificateBundle_raw, input, "f");
|
|
73041
|
-
}
|
|
73042
|
-
const decoded = new ASN1.BufferStorageASN1(__classPrivateFieldGet(this, _CertificateBundle_raw, "f"), CertificateBundleSchemaInternal);
|
|
73043
|
-
__classPrivateFieldSet(this, _CertificateBundle_contents, [], "f");
|
|
73044
|
-
const seenHashes = new CertificateHash.Set();
|
|
73045
|
-
for (const item of decoded.getASN1()) {
|
|
73046
|
-
const certificateValue = new ASN1.BufferStorageASN1(item, CertificateSchemaInternal);
|
|
73047
|
-
const certificate = new Certificate(certificateValue.getDER());
|
|
73048
|
-
const hash = certificate.hash();
|
|
73049
|
-
if (seenHashes.has(hash)) {
|
|
73050
|
-
throw (new certificate_1.default('CERTIFICATE_DUPLICATE_INCLUDED', `Duplicate certificate ${hash} within certificate bundle`));
|
|
73051
|
-
}
|
|
73052
|
-
seenHashes.add(hash);
|
|
73053
|
-
__classPrivateFieldGet(this, _CertificateBundle_contents, "f").push(certificate);
|
|
73054
|
-
}
|
|
73055
|
-
}
|
|
73056
|
-
get bundleSize() {
|
|
73057
|
-
return (__classPrivateFieldGet(this, _CertificateBundle_contents, "f").length);
|
|
73058
|
-
}
|
|
73059
|
-
getDER() {
|
|
73060
|
-
return (__classPrivateFieldGet(this, _CertificateBundle_raw, "f"));
|
|
73061
|
-
}
|
|
73062
|
-
getDERBuffer() {
|
|
73063
|
-
return (Buffer.from(this.getDER()));
|
|
73064
|
-
}
|
|
73065
|
-
getCertificates() {
|
|
73066
|
-
return (__classPrivateFieldGet(this, _CertificateBundle_contents, "f"));
|
|
73067
|
-
}
|
|
73068
|
-
toJSON() {
|
|
73069
|
-
return ({
|
|
73070
|
-
certificates: this.getCertificates().map(function (certificate) {
|
|
73071
|
-
return (certificate.toPEM());
|
|
73072
|
-
})
|
|
73073
|
-
});
|
|
73074
|
-
}
|
|
73075
|
-
}
|
|
73076
|
-
exports.CertificateBundle = CertificateBundle;
|
|
73077
|
-
_CertificateBundle_raw = new WeakMap(), _CertificateBundle_contents = new WeakMap();
|
|
73078
|
-
CertificateBundle.isInstance = (0, helper_1.checkableGenerator)(CertificateBundle);
|
|
73079
73156
|
|
|
73080
73157
|
|
|
73081
73158
|
/***/ }),
|
|
@@ -73620,6 +73697,29 @@ Hash.functionLength = exports.HashFunctionLength;
|
|
|
73620
73697
|
|
|
73621
73698
|
"use strict";
|
|
73622
73699
|
|
|
73700
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
73701
|
+
if (k2 === undefined) k2 = k;
|
|
73702
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
73703
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
73704
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
73705
|
+
}
|
|
73706
|
+
Object.defineProperty(o, k2, desc);
|
|
73707
|
+
}) : (function(o, m, k, k2) {
|
|
73708
|
+
if (k2 === undefined) k2 = k;
|
|
73709
|
+
o[k2] = m[k];
|
|
73710
|
+
}));
|
|
73711
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
73712
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
73713
|
+
}) : function(o, v) {
|
|
73714
|
+
o["default"] = v;
|
|
73715
|
+
});
|
|
73716
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
73717
|
+
if (mod && mod.__esModule) return mod;
|
|
73718
|
+
var result = {};
|
|
73719
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
73720
|
+
__setModuleDefault(result, mod);
|
|
73721
|
+
return result;
|
|
73722
|
+
};
|
|
73623
73723
|
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
73624
73724
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
73625
73725
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
@@ -73636,7 +73736,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
73636
73736
|
};
|
|
73637
73737
|
var _AsyncDisposableStackPolyfill_instances, _AsyncDisposableStackPolyfill_toDispose, _AsyncDisposableStackPolyfill_validateNotDisposed, _a;
|
|
73638
73738
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
73639
|
-
exports.AsyncDisposableStack = void 0;
|
|
73739
|
+
exports.crypto = exports.AsyncDisposableStack = void 0;
|
|
73640
73740
|
exports.bufferToArrayBuffer = bufferToArrayBuffer;
|
|
73641
73741
|
exports.isIntegerOrBigInt = isIntegerOrBigInt;
|
|
73642
73742
|
exports.isBuffer = isBuffer;
|
|
@@ -73657,9 +73757,14 @@ exports.setGenerator = setGenerator;
|
|
|
73657
73757
|
const crypto_1 = __importDefault(__webpack_require__(6982));
|
|
73658
73758
|
const util_1 = __webpack_require__(9023);
|
|
73659
73759
|
const hash_1 = __webpack_require__(7908);
|
|
73760
|
+
const uuid = __importStar(__webpack_require__(5827));
|
|
73660
73761
|
const loggingLevels = ['debug', 'error'];
|
|
73661
73762
|
const configuredLoggingLevel = process.env['KEETANET_DEBUG']?.toLowerCase();
|
|
73662
73763
|
const configuredLoggingFilter = new RegExp(process.env['KEETANET_DEBUG_FILTER'] ?? '', 'i');
|
|
73764
|
+
const randomBytes = crypto_1.default.randomBytes.bind(crypto_1.default);
|
|
73765
|
+
const randomUUID = crypto_1.default.randomUUID ? crypto_1.default.randomUUID.bind(crypto_1.default) : function () {
|
|
73766
|
+
return (uuid.v4());
|
|
73767
|
+
};
|
|
73663
73768
|
function bufferToArrayBuffer(input) {
|
|
73664
73769
|
const out = new ArrayBuffer(input.length);
|
|
73665
73770
|
const view = new Uint8Array(out);
|
|
@@ -73741,7 +73846,7 @@ function randomString(requestedLength = 32) {
|
|
|
73741
73846
|
bytesToGen = 1;
|
|
73742
73847
|
}
|
|
73743
73848
|
// Generate bytes and convert to hex string
|
|
73744
|
-
let generated =
|
|
73849
|
+
let generated = randomBytes(bytesToGen).toString('hex');
|
|
73745
73850
|
// If you requested an odd length, remove last character
|
|
73746
73851
|
// This is one byte is 2 characters, so we cannot directly generate odd lengths
|
|
73747
73852
|
if (requestedLength % 2 === 1) {
|
|
@@ -74134,6 +74239,12 @@ function setGenerator(parent, rawEncode, rawDecode) {
|
|
|
74134
74239
|
}
|
|
74135
74240
|
});
|
|
74136
74241
|
}
|
|
74242
|
+
exports.crypto = {
|
|
74243
|
+
randomUUID: randomUUID,
|
|
74244
|
+
randomBytes: randomBytes,
|
|
74245
|
+
createCipheriv: crypto_1.default.createCipheriv.bind(crypto_1.default),
|
|
74246
|
+
createDecipheriv: crypto_1.default.createDecipheriv.bind(crypto_1.default)
|
|
74247
|
+
};
|
|
74137
74248
|
|
|
74138
74249
|
|
|
74139
74250
|
/***/ }),
|
|
@@ -74343,7 +74454,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
74343
74454
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
74344
74455
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
74345
74456
|
};
|
|
74346
|
-
var _VoteBlockHashMap_instances, _VoteBlockHashMap_valueMap, _VoteBlockHashMap_keyMap, _VoteBlockHashMap_getLookupKey, _a, _PossiblyExpiredVote_vote, _PossiblyExpiredVote_options, _PossiblyExpiredVote__hash, _PossiblyExpiredVote__blocksHash, _VoteBlockBundle_value, _VoteBlockBundle_valueCompressed, _VoteBlockBundle__hash, _VoteBlockBundle__blocksHash, _VoteBuilder_account, _VoteBuilder_blocks;
|
|
74457
|
+
var _VoteBlockHashMap_instances, _VoteBlockHashMap_valueMap, _VoteBlockHashMap_keyMap, _VoteBlockHashMap_getLookupKey, _a, _PossiblyExpiredVote_vote, _PossiblyExpiredVote_options, _PossiblyExpiredVote__hash, _PossiblyExpiredVote__blocksHash, _VoteBlockBundle_value, _VoteBlockBundle_valueCompressed, _VoteBlockBundle__hash, _VoteBlockBundle__blocksHash, _VoteBuilder_account, _VoteBuilder_blocks, _VoteBuilder_fee;
|
|
74347
74458
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
74348
74459
|
exports.Testing = exports.VoteBuilder = exports.VoteStaple = exports.VoteBlockBundle = exports.Vote = exports.PossiblyExpiredVote = exports.VoteBlockHash = exports.VoteBlockHashMap = void 0;
|
|
74349
74460
|
const block_1 = __webpack_require__(6158);
|
|
@@ -74362,6 +74473,16 @@ class VoteHash extends buffer_1.BufferStorage {
|
|
|
74362
74473
|
}
|
|
74363
74474
|
}
|
|
74364
74475
|
VoteHash.isInstance = (0, helper_1.checkableGenerator)(VoteHash);
|
|
74476
|
+
const feeExtensionSchema = {
|
|
74477
|
+
type: 'context',
|
|
74478
|
+
value: 0,
|
|
74479
|
+
kind: 'explicit',
|
|
74480
|
+
contains: [
|
|
74481
|
+
asn1_1.ValidateASN1.IsInteger,
|
|
74482
|
+
{ optional: { type: 'context', value: 0, kind: 'implicit', contains: asn1_1.ValidateASN1.IsOctetString } },
|
|
74483
|
+
{ optional: { type: 'context', value: 1, kind: 'implicit', contains: asn1_1.ValidateASN1.IsOctetString } }
|
|
74484
|
+
]
|
|
74485
|
+
};
|
|
74365
74486
|
/**
|
|
74366
74487
|
* Parse a set of distinguished names
|
|
74367
74488
|
*/
|
|
@@ -74402,14 +74523,8 @@ function findRDN(input, findOID) {
|
|
|
74402
74523
|
}
|
|
74403
74524
|
function blockHashesFromVote(input) {
|
|
74404
74525
|
const blockHashInformation = (0, asn1_1.ASN1toJS)(input.buffer);
|
|
74405
|
-
if (
|
|
74406
|
-
throw (new vote_1.default('VOTE_MALFORMED_HASHES_FROM_VOTE_INVALID_INPUT', 'internal error: hashData
|
|
74407
|
-
}
|
|
74408
|
-
if (typeof blockHashInformation === 'bigint' || typeof blockHashInformation !== 'object') {
|
|
74409
|
-
throw (new vote_1.default('VOTE_MALFORMED_HASHES_FROM_VOTE_INVALID_INPUT', 'internal error: hashData extension contains bigint or non object value'));
|
|
74410
|
-
}
|
|
74411
|
-
if (Buffer.isBuffer(blockHashInformation) || util_1.types.isDate(blockHashInformation) || Array.isArray(blockHashInformation)) {
|
|
74412
|
-
throw (new vote_1.default('VOTE_MALFORMED_HASHES_FROM_VOTE_INVALID_INPUT', 'internal error: hashData extension contains incorrect data type'));
|
|
74526
|
+
if (!(0, asn1_1.isASN1Object)(blockHashInformation)) {
|
|
74527
|
+
throw (new vote_1.default('VOTE_MALFORMED_HASHES_FROM_VOTE_INVALID_INPUT', 'internal error: hashData extensions is not valid asn1 object'));
|
|
74413
74528
|
}
|
|
74414
74529
|
if (blockHashInformation.type !== 'context') {
|
|
74415
74530
|
throw (new vote_1.default('VOTE_MALFORMED_HASHES_FROM_VOTE_INVALID_TYPE', 'internal error: hashData extension does not contain a context-specific tag'));
|
|
@@ -74447,6 +74562,48 @@ function blockHashesFromVote(input) {
|
|
|
74447
74562
|
}
|
|
74448
74563
|
return (output);
|
|
74449
74564
|
}
|
|
74565
|
+
function feeFromVote(input) {
|
|
74566
|
+
const feeInformationAnyJS = (0, asn1_1.ASN1toJS)(input.buffer);
|
|
74567
|
+
const feeSchemaChecker = new asn1_1.ValidateASN1(feeExtensionSchema);
|
|
74568
|
+
const feeInformation = (function () {
|
|
74569
|
+
try {
|
|
74570
|
+
return (feeSchemaChecker.validate(feeInformationAnyJS));
|
|
74571
|
+
}
|
|
74572
|
+
catch (asn1ValidateError) {
|
|
74573
|
+
let message = 'internal error: fee asn1 schema is not the right format';
|
|
74574
|
+
if (asn1ValidateError instanceof Error) {
|
|
74575
|
+
message = `${message}: ${asn1ValidateError.message}`;
|
|
74576
|
+
}
|
|
74577
|
+
throw (new vote_1.default('VOTE_MALFORMED_FEES_FROM_VOTE_INVALID_INPUT', message));
|
|
74578
|
+
}
|
|
74579
|
+
})();
|
|
74580
|
+
const feeData = feeInformation.contains;
|
|
74581
|
+
const retval = { amount: feeData[0] };
|
|
74582
|
+
const payToAsn1 = feeData[1];
|
|
74583
|
+
if (payToAsn1 !== undefined) {
|
|
74584
|
+
const payTo = account_1.default.fromPublicKeyAndType(Buffer.from(payToAsn1.contains));
|
|
74585
|
+
if (payTo.isStorage()) {
|
|
74586
|
+
retval.payTo = payTo;
|
|
74587
|
+
}
|
|
74588
|
+
else {
|
|
74589
|
+
try {
|
|
74590
|
+
retval.payTo = payTo.assertAccount();
|
|
74591
|
+
}
|
|
74592
|
+
catch {
|
|
74593
|
+
throw (new vote_1.default('VOTE_MALFORMED_FEES_PAY_TO_INVALID', 'internal error: payTo is not an Account or Storage Address'));
|
|
74594
|
+
}
|
|
74595
|
+
}
|
|
74596
|
+
}
|
|
74597
|
+
const tokenAsn1 = feeData[2];
|
|
74598
|
+
if (tokenAsn1 !== undefined) {
|
|
74599
|
+
const token = account_1.default.fromPublicKeyAndType(Buffer.from(tokenAsn1.contains));
|
|
74600
|
+
if (!token.isToken()) {
|
|
74601
|
+
throw (new vote_1.default('VOTE_MALFORMED_FEES_TOKEN_NOT_TOKEN', 'internal error: fees extension token is not a valid token'));
|
|
74602
|
+
}
|
|
74603
|
+
retval.token = token;
|
|
74604
|
+
}
|
|
74605
|
+
return (retval);
|
|
74606
|
+
}
|
|
74450
74607
|
/**
|
|
74451
74608
|
* Convert an ASN1Date to a Date
|
|
74452
74609
|
*/
|
|
@@ -74584,6 +74741,21 @@ class PossiblyExpiredVote {
|
|
|
74584
74741
|
return (false);
|
|
74585
74742
|
}
|
|
74586
74743
|
}
|
|
74744
|
+
if ('fee' in voteJSON) {
|
|
74745
|
+
const fee = voteJSON['fee'];
|
|
74746
|
+
if (fee === undefined) {
|
|
74747
|
+
return (false);
|
|
74748
|
+
}
|
|
74749
|
+
if (fee['amount'] === undefined) {
|
|
74750
|
+
return (false);
|
|
74751
|
+
}
|
|
74752
|
+
if ('payTo' in fee && fee['payTo'] === undefined) {
|
|
74753
|
+
return (false);
|
|
74754
|
+
}
|
|
74755
|
+
if ('token' in fee && fee['token'] === undefined) {
|
|
74756
|
+
return (false);
|
|
74757
|
+
}
|
|
74758
|
+
}
|
|
74587
74759
|
return (true);
|
|
74588
74760
|
}
|
|
74589
74761
|
static fromJSON(voteJSON, options = {}) {
|
|
@@ -74606,6 +74778,9 @@ class PossiblyExpiredVote {
|
|
|
74606
74778
|
const validTo = new Date(voteJSON.validityTo);
|
|
74607
74779
|
const validFrom = new Date(voteJSON.validityFrom);
|
|
74608
74780
|
const signatureStorage = new buffer_1.BufferStorage(signature, signature.byteLength);
|
|
74781
|
+
if (voteJSON.fee !== undefined) {
|
|
74782
|
+
voteBuilder.addFee(voteJSON.fee);
|
|
74783
|
+
}
|
|
74609
74784
|
const { voteData, tbsCertificate, signatureInfo } = voteBuilder.generateVoteData(BigInt(voteJSON.serial), validTo, validFrom);
|
|
74610
74785
|
const vote = voteBuilder.createVote(voteData, tbsCertificate, signatureInfo, signatureStorage, options);
|
|
74611
74786
|
return (vote);
|
|
@@ -74625,6 +74800,7 @@ class PossiblyExpiredVote {
|
|
|
74625
74800
|
this.validityFrom = vote.validityFrom;
|
|
74626
74801
|
this.validityTo = vote.validityTo;
|
|
74627
74802
|
this.signature = vote.signature;
|
|
74803
|
+
this.fee = vote.fee;
|
|
74628
74804
|
this.$trusted = vote.$trusted;
|
|
74629
74805
|
this.$permanent = vote.$permanent;
|
|
74630
74806
|
this.$uid = vote.$uid;
|
|
@@ -74825,6 +75001,7 @@ class PossiblyExpiredVote {
|
|
|
74825
75001
|
throw (new vote_1.default('VOTE_MALFORMED_VOTE_EXTENSIONS', 'internal error: Expected extensions to be a Sequence'));
|
|
74826
75002
|
}
|
|
74827
75003
|
let blocks;
|
|
75004
|
+
let fee;
|
|
74828
75005
|
for (const extensionInfo of extensions) {
|
|
74829
75006
|
if (!Array.isArray(extensionInfo)) {
|
|
74830
75007
|
throw (new vote_1.default('VOTE_MALFORMED_VOTE_EXTENSIONS_VALUE', 'internal error: Expected each extension to be a Sequence'));
|
|
@@ -74848,13 +75025,17 @@ class PossiblyExpiredVote {
|
|
|
74848
75025
|
critical = criticalCheck;
|
|
74849
75026
|
}
|
|
74850
75027
|
const extensionData = extensionInfo.shift();
|
|
75028
|
+
if (!(Buffer.isBuffer(extensionData))) {
|
|
75029
|
+
throw (new vote_1.default('VOTE_MALFORMED_VOTE_EXTENSIONS_DATA', `internal error: ${extensionOID.oid} extensions are always Octet String`));
|
|
75030
|
+
}
|
|
74851
75031
|
switch (extensionOID.oid) {
|
|
74852
75032
|
case 'hashData':
|
|
74853
|
-
if (!(Buffer.isBuffer(extensionData))) {
|
|
74854
|
-
throw (new vote_1.default('VOTE_MALFORMED_VOTE_EXTENSIONS_VALUE_HASH_DATA', 'internal error: hashData extensions are always Octet String'));
|
|
74855
|
-
}
|
|
74856
75033
|
blocks = blockHashesFromVote(extensionData);
|
|
74857
75034
|
break;
|
|
75035
|
+
case '1.3.6.1.4.1.62675.0.1.0':
|
|
75036
|
+
case 'fees': // replace with fees 1.3.6.1.4.1.62675.0.1.0
|
|
75037
|
+
fee = feeFromVote(extensionData);
|
|
75038
|
+
break;
|
|
74858
75039
|
default:
|
|
74859
75040
|
if (critical) {
|
|
74860
75041
|
throw (new vote_1.default('VOTE_MALFORMED_VOTE_EXTENSIONS_VALUE_CRITICAL_TYPE', `internal error: Unknown critical extension ${extensionOID.oid}`));
|
|
@@ -74868,6 +75049,12 @@ class PossiblyExpiredVote {
|
|
|
74868
75049
|
throw (new vote_1.default('VOTE_MALFORMED_VOTE_NO_BLOCKS_FOUND', 'No block hashes found within vote'));
|
|
74869
75050
|
}
|
|
74870
75051
|
this.blocks = blocks;
|
|
75052
|
+
if (fee !== undefined) {
|
|
75053
|
+
if (this.$permanent) {
|
|
75054
|
+
throw (new vote_1.default('VOTE_MALFORMED_FEES_IN_PERMANENT_VOTE', 'Permanent Vote cannot have fees'));
|
|
75055
|
+
}
|
|
75056
|
+
this.fee = fee;
|
|
75057
|
+
}
|
|
74871
75058
|
/**
|
|
74872
75059
|
* Get the signature data
|
|
74873
75060
|
*/
|
|
@@ -74976,6 +75163,9 @@ class PossiblyExpiredVote {
|
|
|
74976
75163
|
if (options?.addBinary) {
|
|
74977
75164
|
additionalFields['$binary'] = Buffer.from(this.toBytes()).toString('base64');
|
|
74978
75165
|
}
|
|
75166
|
+
if (this.fee !== undefined) {
|
|
75167
|
+
additionalFields['fee'] = this.fee;
|
|
75168
|
+
}
|
|
74979
75169
|
return ({
|
|
74980
75170
|
issuer: this.issuer,
|
|
74981
75171
|
serial: this.serial,
|
|
@@ -75459,14 +75649,16 @@ class VoteStaple extends VoteBlockBundle {
|
|
|
75459
75649
|
exports.VoteStaple = VoteStaple;
|
|
75460
75650
|
VoteStaple.isInstance = (0, helper_1.checkableGenerator)(VoteStaple);
|
|
75461
75651
|
class VoteBuilder {
|
|
75462
|
-
constructor(account, blocks = []) {
|
|
75652
|
+
constructor(account, blocks = [], options) {
|
|
75463
75653
|
_VoteBuilder_account.set(this, void 0);
|
|
75464
75654
|
_VoteBuilder_blocks.set(this, void 0);
|
|
75655
|
+
_VoteBuilder_fee.set(this, undefined);
|
|
75465
75656
|
if (!account_1.default.isInstance(account)) {
|
|
75466
75657
|
throw (new vote_1.default('VOTE_BUILDER_INVALID_CONSTRUCTION', 'internal error: account must be an Account'));
|
|
75467
75658
|
}
|
|
75468
75659
|
__classPrivateFieldSet(this, _VoteBuilder_account, account, "f");
|
|
75469
75660
|
__classPrivateFieldSet(this, _VoteBuilder_blocks, [], "f");
|
|
75661
|
+
__classPrivateFieldSet(this, _VoteBuilder_fee, options?.fee, "f");
|
|
75470
75662
|
this.addBlocks(blocks);
|
|
75471
75663
|
}
|
|
75472
75664
|
addBlocks(blocks) {
|
|
@@ -75488,6 +75680,26 @@ class VoteBuilder {
|
|
|
75488
75680
|
addBlock(block) {
|
|
75489
75681
|
this.addBlocks([block]);
|
|
75490
75682
|
}
|
|
75683
|
+
addFee(feeInput) {
|
|
75684
|
+
const fee = { amount: BigInt(feeInput.amount) };
|
|
75685
|
+
const payTo = account_1.default.toAccount(feeInput.payTo);
|
|
75686
|
+
if (payTo !== undefined) {
|
|
75687
|
+
if (payTo.isStorage()) {
|
|
75688
|
+
fee.payTo = payTo;
|
|
75689
|
+
}
|
|
75690
|
+
else {
|
|
75691
|
+
fee.payTo = payTo.assertAccount();
|
|
75692
|
+
}
|
|
75693
|
+
}
|
|
75694
|
+
const token = account_1.default.toAccount(fee.token);
|
|
75695
|
+
if (token !== undefined) {
|
|
75696
|
+
if (token.isToken()) {
|
|
75697
|
+
fee.token = token;
|
|
75698
|
+
}
|
|
75699
|
+
throw (new vote_1.default('VOTE_MALFORMED_FEES_TOKEN_NOT_TOKEN', 'Fee Token should be of type TOKEN'));
|
|
75700
|
+
}
|
|
75701
|
+
__classPrivateFieldSet(this, _VoteBuilder_fee, fee, "f");
|
|
75702
|
+
}
|
|
75491
75703
|
generateVoteData(serial, validTo, validFrom) {
|
|
75492
75704
|
/**
|
|
75493
75705
|
* Signature algorithm identifier
|
|
@@ -75525,6 +75737,31 @@ class VoteBuilder {
|
|
|
75525
75737
|
const signatureInfo = [
|
|
75526
75738
|
{ type: 'oid', oid: signatureInfoOID }
|
|
75527
75739
|
];
|
|
75740
|
+
let feeExtension = undefined;
|
|
75741
|
+
if (__classPrivateFieldGet(this, _VoteBuilder_fee, "f") !== undefined) {
|
|
75742
|
+
/** Amount for this vote */
|
|
75743
|
+
const feeData = [__classPrivateFieldGet(this, _VoteBuilder_fee, "f").amount];
|
|
75744
|
+
/** Account to pay the fee too */
|
|
75745
|
+
const payToPublicKey = __classPrivateFieldGet(this, _VoteBuilder_fee, "f").payTo?.publicKeyAndType;
|
|
75746
|
+
if (payToPublicKey !== undefined) {
|
|
75747
|
+
feeData.push({ type: 'context', value: 0, kind: 'implicit', contains: payToPublicKey });
|
|
75748
|
+
}
|
|
75749
|
+
/** Token in which to pay the fee */
|
|
75750
|
+
const tokenPublicKey = __classPrivateFieldGet(this, _VoteBuilder_fee, "f").token?.publicKeyAndType;
|
|
75751
|
+
if (tokenPublicKey !== undefined) {
|
|
75752
|
+
feeData.push({ type: 'context', value: 1, kind: 'implicit', contains: tokenPublicKey });
|
|
75753
|
+
}
|
|
75754
|
+
feeExtension = [
|
|
75755
|
+
{ type: 'oid', oid: '1.3.6.1.4.1.62675.0.1.0' }, // replace with 'fees' - 1.3.6.1.4.1.62675.0.1.0
|
|
75756
|
+
true,
|
|
75757
|
+
Buffer.from((0, asn1_1.JStoASN1)({
|
|
75758
|
+
type: 'context',
|
|
75759
|
+
value: 0,
|
|
75760
|
+
kind: 'explicit',
|
|
75761
|
+
contains: feeData
|
|
75762
|
+
}).toBER(false))
|
|
75763
|
+
];
|
|
75764
|
+
}
|
|
75528
75765
|
/*
|
|
75529
75766
|
* Certificate to be signed
|
|
75530
75767
|
*/
|
|
@@ -75602,7 +75839,8 @@ class VoteBuilder {
|
|
|
75602
75839
|
})
|
|
75603
75840
|
]
|
|
75604
75841
|
}).toBER(false))
|
|
75605
|
-
]
|
|
75842
|
+
],
|
|
75843
|
+
...(feeExtension ? [feeExtension] : [])
|
|
75606
75844
|
]
|
|
75607
75845
|
}
|
|
75608
75846
|
];
|
|
@@ -75652,6 +75890,9 @@ class VoteBuilder {
|
|
|
75652
75890
|
if (typeof serial !== 'bigint') {
|
|
75653
75891
|
throw (new vote_1.default('VOTE_BUILDER_INVALID_SERIAL', `internal error: serial must be a bigint, instead got ${serial}`));
|
|
75654
75892
|
}
|
|
75893
|
+
if (validTo === null && __classPrivateFieldGet(this, _VoteBuilder_fee, "f") !== undefined) {
|
|
75894
|
+
throw (new vote_1.default('VOTE_MALFORMED_FEES_IN_PERMANENT_VOTE', 'internal error: permanent votes should not have fees'));
|
|
75895
|
+
}
|
|
75655
75896
|
if (validTo === null) {
|
|
75656
75897
|
/**
|
|
75657
75898
|
* Issue a permanent vote
|
|
@@ -75673,13 +75914,13 @@ class VoteBuilder {
|
|
|
75673
75914
|
}
|
|
75674
75915
|
}
|
|
75675
75916
|
exports.VoteBuilder = VoteBuilder;
|
|
75676
|
-
_VoteBuilder_account = new WeakMap(), _VoteBuilder_blocks = new WeakMap();
|
|
75917
|
+
_VoteBuilder_account = new WeakMap(), _VoteBuilder_blocks = new WeakMap(), _VoteBuilder_fee = new WeakMap();
|
|
75677
75918
|
VoteBuilder.isInstance = (0, helper_1.checkableGenerator)(VoteBuilder);
|
|
75678
75919
|
PossiblyExpiredVote.Staple = VoteStaple;
|
|
75679
75920
|
PossiblyExpiredVote.Builder = VoteBuilder;
|
|
75680
75921
|
exports["default"] = Vote;
|
|
75681
75922
|
/** @internal */
|
|
75682
|
-
exports.Testing = { findRDN, blockHashesFromVote };
|
|
75923
|
+
exports.Testing = { findRDN, blockHashesFromVote, feeFromVote };
|
|
75683
75924
|
|
|
75684
75925
|
|
|
75685
75926
|
/***/ }),
|
|
@@ -75691,7 +75932,7 @@ exports.Testing = { findRDN, blockHashesFromVote };
|
|
|
75691
75932
|
|
|
75692
75933
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
75693
75934
|
exports.version = void 0;
|
|
75694
|
-
exports.version = '0.12.
|
|
75935
|
+
exports.version = '0.12.2+g77a8a16ada9dfab5604b605cbe69d373a414d204';
|
|
75695
75936
|
exports["default"] = exports.version;
|
|
75696
75937
|
|
|
75697
75938
|
|