@keetanetwork/keetanet-client 0.10.5 → 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/api/index.d.ts +23 -7
- package/api/node.d.ts +27 -2
- package/api/vote.d.ts +4 -6
- package/client/builder.d.ts +17 -0
- package/client/client_common_tests.d.ts +1 -1
- package/client/index-browser.d.ts +112 -3
- package/client/index-browser.js +18234 -29816
- package/client/index.d.ts +112 -3
- package/client/index.js +4070 -6581
- package/config/index.d.ts +6 -1
- package/docs/assets/hierarchy.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/KeetaNetSDK.Client.html +31 -11
- package/docs/classes/KeetaNetSDK.Referenced.Account.html +31 -21
- package/docs/classes/KeetaNetSDK.Referenced.BaseSet.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.Block.html +2 -4
- package/docs/classes/KeetaNetSDK.Referenced.BlockBuilder.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.BlockHash.html +4 -5
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperation.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationCREATE_IDENTIFIER.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationMANAGE_CERTIFICATE.html +12 -0
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationMODIFY_PERMISSIONS.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationRECEIVE.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationSEND.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationSET_INFO.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationSET_REP.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationTOKEN_ADMIN_MODIFY_BALANCE.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationTOKEN_ADMIN_SUPPLY.html +2 -2
- package/docs/classes/{KeetaNetSDK.Referenced.src_lib_utils_certificate.Certificate.html → KeetaNetSDK.Referenced.Certificate.html} +31 -14
- package/docs/classes/KeetaNetSDK.Referenced.CertificateBundle.html +8 -0
- package/docs/classes/KeetaNetSDK.Referenced.CertificateHash.html +16 -0
- 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 +4 -4
- 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.Ledger.html +4 -2
- package/docs/classes/KeetaNetSDK.Referenced.LedgerAtomicInterface.html +3 -1
- package/docs/classes/KeetaNetSDK.Referenced.LedgerRequestCache.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.Node.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.P2PSwitch.html +3 -3
- package/docs/classes/KeetaNetSDK.Referenced.PendingAccount.html +3 -2
- package/docs/classes/KeetaNetSDK.Referenced.PermissionSetHolder.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.Permissions.html +2 -3
- package/docs/classes/KeetaNetSDK.Referenced.PossiblyExpiredVote.html +5 -3
- package/docs/classes/KeetaNetSDK.Referenced.RequestTiming.html +16 -2
- package/docs/classes/KeetaNetSDK.Referenced.SignatureStorage.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.Stats.html +3 -2
- package/docs/classes/KeetaNetSDK.Referenced.UserClientBuilder.html +3 -2
- package/docs/classes/KeetaNetSDK.Referenced.Vote.html +5 -5
- package/docs/classes/KeetaNetSDK.Referenced.VoteBlockBundle.html +35 -0
- package/docs/classes/KeetaNetSDK.Referenced.VoteBlockHash.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.VoteBlockHashMap.html +9 -8
- 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 +23 -29
- package/docs/classes/KeetaNetSDK.Referenced.VoteStapleHash.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.src_lib_utils_asn1.BufferStorageASN1.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.src_lib_utils_buffer.BufferStorage.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.src_lib_utils_certificate.CertificateBuilder.html +1 -1
- package/docs/classes/KeetaNetSDK.UserClient.html +57 -15
- package/docs/documents/GETTING-STARTED.html +5 -2
- package/docs/enums/KeetaNetSDK.Referenced.AccountKeyAlgorithm.html +2 -1
- package/docs/enums/KeetaNetSDK.Referenced.AdjustMethod.html +4 -4
- package/docs/enums/KeetaNetSDK.Referenced.BaseFlag.html +2 -1
- package/docs/enums/KeetaNetSDK.Referenced.OperationType.html +2 -1
- package/docs/functions/KeetaNetSDK.Referenced.src_config.getDefaultConfig.html +2 -2
- package/docs/functions/KeetaNetSDK.Referenced.src_config.getNetworkAlias.html +1 -1
- package/docs/functions/KeetaNetSDK.Referenced.src_config.getValidation.html +1 -1
- package/docs/functions/KeetaNetSDK.Referenced.src_config.isNetwork.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/functions/KeetaNetSDK.Referenced.src_lib_utils_conversion.objectToBuffer.html +1 -1
- package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_conversion.toJSONSerializable.html +1 -1
- package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_helper.booleanEnv.html +1 -0
- package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_helper.nonNullable.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 +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSON.html +2 -2
- 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 +6 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationMANAGE_CERTIFICATESerializable.html +5 -0
- 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 +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockUnsignedCanonical.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.CertificateWithIntermediates.html +3 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.CertificateWithIntermediatesResponse.html +3 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.ComputedBlocksEffectFields.html +3 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.Constructor.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.DisposableTimingHandle.html +7 -0
- 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.IdentifierCreateRequest.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.InitialConfigSupply.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.InstanceSet.html +13 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.KVGenericOptionsType.html +2 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.KVSetOptionsType.html +3 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.KVStorageProviderAPI.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.LedgerConfig.html +4 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.LedgerStatistics.html +3 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.LedgerStorageAPI.html +15 -7
- package/docs/interfaces/KeetaNetSDK.Referenced.LedgerStorageTransactionBase.html +6 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.ModifyTokenBalanceEntry.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.NodeConfig.html +3 -3
- package/docs/interfaces/KeetaNetSDK.Referenced.NumericValidationRule.html +3 -0
- 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 +3 -3
- package/docs/interfaces/KeetaNetSDK.Referenced.PendingOperations.html +3 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.PendingOperationsJSON.html +3 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.PublicKeyStorage.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.PublicKeyStringMapping.html +3 -2
- 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 +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.UserClientListenerOptions.html +2 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.UserClientOptions.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.VoteBundleConstructor.html +6 -0
- 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_config.ValidationConfig.html +2 -2
- 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/interfaces/KeetaNetSDK.Referenced.src_lib_utils_conversion.ToJSONSerializableOptions.html +3 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_helper.InstanceSetConstructor.html +2 -2
- 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_certificate.html +1 -1
- package/docs/modules/KeetaNetSDK.Referenced.src_lib_utils_conversion.html +1 -1
- package/docs/modules/KeetaNetSDK.Referenced.src_lib_utils_helper.html +1 -1
- package/docs/types/KeetaNetSDK.Referenced.AccountKeyAlgorithmHex.html +8 -0
- package/docs/types/KeetaNetSDK.Referenced.AccountKeyAlgorithmHexReverse.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.AccountKeyAlgorithmHexToType.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.AddBinaryIfIncluded.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.BlockHashString.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.CertificateErrorCode.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.CertificateExtensionData.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.CertificateExtensions.html +2 -2
- package/docs/types/KeetaNetSDK.Referenced.CertificateHashString.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.CertificateOptions.html +4 -4
- package/docs/types/KeetaNetSDK.Referenced.CertificateUpdate.html +2 -0
- package/docs/types/KeetaNetSDK.Referenced.ComputedEffectOfBlocks.html +3 -2
- package/docs/types/KeetaNetSDK.Referenced.DbStats.html +2 -0
- package/docs/types/KeetaNetSDK.Referenced.ErrorCode.html +1 -1
- package/docs/types/KeetaNetSDK.Referenced.ExportedJSONOperation.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.MultisigPublicKeyString.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.NodeLike-1.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.NodeLike.html +1 -1
- package/docs/types/KeetaNetSDK.Referenced.PublicKeyAndTypeStringHex.html +3 -0
- package/docs/types/{KeetaNetSDK.Referenced.VoteJSONOutput.html → KeetaNetSDK.Referenced.StorageAddress.html} +1 -1
- package/docs/types/KeetaNetSDK.Referenced.TimingData.html +2 -0
- package/docs/types/KeetaNetSDK.Referenced.TimingSectionHandle.html +6 -0
- package/docs/types/KeetaNetSDK.Referenced.VoteBuilderOptions.html +4 -0
- package/docs/types/KeetaNetSDK.Referenced.src_config.NetworkConfig.html +1 -1
- package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_asn1.ValidateASN1.Schema.html +1 -1
- package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_asn1.ValidateASN1.SchemaMap.html +1 -1
- package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_certificate.CertificateJSONOutput.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_conversion.ToJSONSerializable.html +1 -1
- package/docs/variables/KeetaNetSDK.Referenced.BlockErrorCodes-1.html +1 -0
- package/docs/variables/KeetaNetSDK.Referenced.BlockErrorCodes.html +1 -1
- package/docs/{types/KeetaNetSDK.Referenced.JSONUnsupportedTypes.html → variables/KeetaNetSDK.Referenced.CertificateErrorType.html} +1 -1
- package/docs/variables/KeetaNetSDK.Referenced.ClientErrorCodes.html +1 -1
- package/docs/variables/KeetaNetSDK.Referenced.KVErrorCodes.html +1 -1
- package/docs/variables/KeetaNetSDK.Referenced.Operation.html +2 -2
- package/docs/variables/KeetaNetSDK.Referenced.VoteErrorCodes.html +1 -1
- package/docs/variables/KeetaNetSDK.Referenced.identifierKeyTypes.html +1 -1
- package/docs/variables/KeetaNetSDK.Referenced.src_config.networksArray.html +1 -1
- package/docs/variables/KeetaNetSDK.Referenced.src_lib_utils_helper.AsyncDisposableStack.html +2 -0
- package/docs/variables/KeetaNetSDK.Referenced.src_lib_utils_helper.crypto.html +1 -0
- package/lib/account.d.ts +68 -29
- package/lib/block/index.d.ts +53 -23
- package/lib/block/operations.d.ts +78 -33
- package/lib/error/block.d.ts +1 -1
- package/lib/error/certificate.d.ts +9 -0
- package/lib/error/client.d.ts +1 -1
- package/lib/error/index.d.ts +2 -1
- package/lib/error/kv.d.ts +1 -1
- package/lib/error/vote.d.ts +1 -1
- package/lib/kv/index.d.ts +15 -8
- package/lib/kv/kv_redis.d.ts +18 -8
- package/lib/ledger/common.d.ts +13 -5
- package/lib/ledger/db_dynamodb.d.ts +22 -16
- package/lib/ledger/db_postgres.d.ts +10 -10
- package/lib/ledger/db_spanner.d.ts +26 -14
- package/lib/ledger/db_spanner_helper.d.ts +94 -109
- package/lib/ledger/db_sqlite.d.ts +10 -10
- package/lib/ledger/effects.d.ts +19 -4
- package/lib/ledger/index.d.ts +57 -12
- package/lib/ledger/types.d.ts +7 -1
- package/lib/node/local.d.ts +10 -1
- package/lib/node/timing.d.ts +44 -5
- package/lib/p2p.d.ts +6 -3
- package/lib/permissions.d.ts +3 -3
- package/lib/pubsub/index.d.ts +1 -1
- package/lib/pubsub/providers.d.ts +2 -0
- package/lib/pubsub/ps_gcp.d.ts +14 -0
- package/lib/stats.d.ts +5 -0
- package/lib/utils/asn1.d.ts +4 -3
- package/lib/utils/buffer.d.ts +4 -0
- package/lib/utils/certificate.d.ts +107 -6
- package/lib/utils/conversion.d.ts +13 -35
- package/lib/utils/helper.d.ts +26 -8
- package/lib/utils/helper_testing.d.ts +1 -1
- package/lib/vote.d.ts +122 -63
- package/package.json +2 -3
- package/version.d.ts +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.HTTPAgentManager.html +0 -4
- package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_conversion.RegisterSerializable.html +0 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOutput.html +0 -5
- package/docs/interfaces/KeetaNetSDK.Referenced.VoteJSONOutput.html +0 -4
- package/docs/interfaces/KeetaNetSDK.Referenced.WithConversionClass.html +0 -6
- package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_helper.InstanceSet.html +0 -10
- package/docs/types/KeetaNetSDK.Referenced.JSONSupportedObject.html +0 -1
- package/docs/types/KeetaNetSDK.Referenced.JSONSupportedValue.html +0 -1
- package/docs/types/KeetaNetSDK.Referenced.Vote.html +0 -1
- package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_conversion.JSONSupported.html +0 -1
- package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_conversion.ToJSONSerializableOptions.html +0 -3
- package/docs/variables/KeetaNetSDK.Referenced.default.html +0 -3
package/lib/ledger/index.d.ts
CHANGED
|
@@ -6,8 +6,9 @@ import Account from '../account';
|
|
|
6
6
|
import type Node from '../node';
|
|
7
7
|
import type { BloomFilter } from '../utils/bloom';
|
|
8
8
|
import type { ComputedEffectOfBlocks } from './effects';
|
|
9
|
-
import type { ACLRow, AccountInfo, GetAllBalancesResponse, LedgerStatistics } from './types';
|
|
9
|
+
import type { ACLRow, AccountInfo, GetAllBalancesResponse, LedgerStatistics, CertificateWithIntermediates } from './types';
|
|
10
10
|
import LedgerRequestCache from './cache';
|
|
11
|
+
import type { CertificateHash } from '../utils/certificate';
|
|
11
12
|
/**
|
|
12
13
|
* Kind of ledger
|
|
13
14
|
*/
|
|
@@ -47,6 +48,16 @@ export interface LedgerConfig {
|
|
|
47
48
|
* no-voting: Normal mode (read-write enabled), but no voting
|
|
48
49
|
*/
|
|
49
50
|
ledgerWriteMode?: 'bootstrap-only' | 'read-only' | 'read-write' | 'no-voting';
|
|
51
|
+
/**
|
|
52
|
+
* Timeout for storage operations
|
|
53
|
+
*/
|
|
54
|
+
transactionRetries?: ({
|
|
55
|
+
timeout?: number;
|
|
56
|
+
maxRetries?: never;
|
|
57
|
+
} | {
|
|
58
|
+
timeout?: never;
|
|
59
|
+
maxRetries?: number;
|
|
60
|
+
});
|
|
50
61
|
/**
|
|
51
62
|
* Logging method
|
|
52
63
|
*/
|
|
@@ -84,6 +95,15 @@ export type GetVotesAfterOptions = {
|
|
|
84
95
|
*/
|
|
85
96
|
timeout?: number;
|
|
86
97
|
};
|
|
98
|
+
/**
|
|
99
|
+
* Each transaction can contain the node object making the request to access things like timing information
|
|
100
|
+
*/
|
|
101
|
+
export interface LedgerStorageTransactionBase {
|
|
102
|
+
node?: Node;
|
|
103
|
+
moment: Date;
|
|
104
|
+
identifier: string;
|
|
105
|
+
readOnly: boolean;
|
|
106
|
+
}
|
|
87
107
|
/**
|
|
88
108
|
* Each Ledger Storage backend must implement this interface
|
|
89
109
|
*/
|
|
@@ -99,7 +119,7 @@ export interface LedgerStorageAPI {
|
|
|
99
119
|
/**
|
|
100
120
|
* Begin a transaction
|
|
101
121
|
*/
|
|
102
|
-
beginTransaction: (
|
|
122
|
+
beginTransaction: (transactionBase: LedgerStorageTransactionBase) => Promise<LedgerStorageTransactionBase>;
|
|
103
123
|
/**
|
|
104
124
|
* Commit an active transaction
|
|
105
125
|
*/
|
|
@@ -115,9 +135,9 @@ export interface LedgerStorageAPI {
|
|
|
115
135
|
evaluateError: (error: any) => Promise<any>;
|
|
116
136
|
/**
|
|
117
137
|
* Get the amount of delegated weight for an account,
|
|
118
|
-
* if "rep" is not supplied get the total delegated weight
|
|
138
|
+
* if "rep" is not supplied get the total delegated weight, if "rep" is of type Account.Set, return the sum of the weights for the provided account(s)
|
|
119
139
|
*/
|
|
120
|
-
delegatedWeight: (transaction: any, rep?: Account) => Promise<bigint>;
|
|
140
|
+
delegatedWeight: (transaction: any, rep?: Account | InstanceType<typeof Account.Set>) => Promise<bigint>;
|
|
121
141
|
/**
|
|
122
142
|
* Get the balance of an account or token
|
|
123
143
|
*/
|
|
@@ -147,7 +167,7 @@ export interface LedgerStorageAPI {
|
|
|
147
167
|
/**
|
|
148
168
|
* Adjust the ledger by performing a set of changes based on some blocks and votes
|
|
149
169
|
*/
|
|
150
|
-
adjust: (transaction: any, input: VoteStaple, changes: ComputedEffectOfBlocks) => Promise<
|
|
170
|
+
adjust: (transaction: any, input: VoteStaple, changes: ComputedEffectOfBlocks) => Promise<VoteStaple[]>;
|
|
151
171
|
/**
|
|
152
172
|
* Add a transitional vote (to the side-ledger)
|
|
153
173
|
*/
|
|
@@ -159,9 +179,16 @@ export interface LedgerStorageAPI {
|
|
|
159
179
|
/**
|
|
160
180
|
* Get the block height from a given block hash
|
|
161
181
|
*/
|
|
162
|
-
getBlockHeight: (transaction: any, blockHash: BlockHash, account: GenericAccount) => Promise<
|
|
163
|
-
|
|
164
|
-
|
|
182
|
+
getBlockHeight: (transaction: any, blockHash: BlockHash, account: GenericAccount) => Promise<bigint | null>;
|
|
183
|
+
/**
|
|
184
|
+
* Get multiple block heights for a given set of block hashes and chains.
|
|
185
|
+
*/
|
|
186
|
+
getBlockHeights: (transaction: any, toFetch: {
|
|
187
|
+
blockHash: BlockHash;
|
|
188
|
+
account: GenericAccount;
|
|
189
|
+
}[]) => Promise<{
|
|
190
|
+
[blockHash: string]: bigint | null;
|
|
191
|
+
}>;
|
|
165
192
|
/**
|
|
166
193
|
* Get the votes for a given block
|
|
167
194
|
*/
|
|
@@ -190,6 +217,12 @@ export interface LedgerStorageAPI {
|
|
|
190
217
|
getHeadBlocks: (transaction: any, accounts: GenericAccount[], from: LedgerSelector) => Promise<{
|
|
191
218
|
[account: string]: Block | null;
|
|
192
219
|
}>;
|
|
220
|
+
/**
|
|
221
|
+
* Get multiple head block hashes at the same time for a set of accounts
|
|
222
|
+
*/
|
|
223
|
+
getHeadBlockHashes: (transaction: any, accounts: InstanceType<typeof Account.Set>) => Promise<{
|
|
224
|
+
[account: string]: BlockHash | null;
|
|
225
|
+
}>;
|
|
193
226
|
/**
|
|
194
227
|
* Get the HEAD block for an account (implemented by LedgerStorageBase using getHeadBlocks())
|
|
195
228
|
*/
|
|
@@ -222,6 +255,14 @@ export interface LedgerStorageAPI {
|
|
|
222
255
|
* Get the next serial number for a representative
|
|
223
256
|
*/
|
|
224
257
|
getNextSerialNumber: (transaction?: any) => Promise<bigint>;
|
|
258
|
+
/**
|
|
259
|
+
* Get the X.509 Certificates associated with an account
|
|
260
|
+
*/
|
|
261
|
+
getAccountCertificates: (transaction: any, account: GenericAccount) => Promise<CertificateWithIntermediates[]>;
|
|
262
|
+
/**
|
|
263
|
+
* Get the X.509 Certificate associated with an account using the certificate hash
|
|
264
|
+
*/
|
|
265
|
+
getAccountCertificateByHash: (transaction: any, account: GenericAccount, hash: CertificateHash) => Promise<CertificateWithIntermediates | null>;
|
|
225
266
|
/**
|
|
226
267
|
* Get ledger statistics
|
|
227
268
|
*/
|
|
@@ -232,13 +273,15 @@ export interface LedgerStorageAPI {
|
|
|
232
273
|
*/
|
|
233
274
|
declare class LedgerAtomicInterface {
|
|
234
275
|
#private;
|
|
235
|
-
constructor(transaction:
|
|
276
|
+
constructor(transaction: LedgerStorageTransactionBase, storage: LedgerStorageAPI, config: LedgerConfig, ledger: Ledger);
|
|
236
277
|
commit(): Promise<void>;
|
|
237
278
|
abort(): Promise<void>;
|
|
238
279
|
vote(blocks: Block[], otherVotes?: Vote[]): Promise<Vote>;
|
|
239
|
-
add(votesAndBlocks: VoteStaple, from?: 'bootstrap' | string): Promise<
|
|
280
|
+
add(votesAndBlocks: VoteStaple, from?: 'bootstrap' | string): Promise<VoteStaple[]>;
|
|
240
281
|
getBalance(account: GenericAccount, token: TokenAddress): Promise<bigint>;
|
|
241
282
|
getAllBalances(account: GenericAccount): Promise<GetAllBalancesResponse>;
|
|
283
|
+
getAccountCertificates(account: GenericAccount): Promise<CertificateWithIntermediates[]>;
|
|
284
|
+
getAccountCertificateByHash(account: GenericAccount, hash: CertificateHash): Promise<CertificateWithIntermediates | null>;
|
|
242
285
|
listACLsByPrincipal(principal: GenericAccount, entityList?: GenericAccount[]): Promise<ACLRow[]>;
|
|
243
286
|
listACLsByEntity(entity: GenericAccount): Promise<ACLRow[]>;
|
|
244
287
|
votingPower(rep?: Account): Promise<bigint>;
|
|
@@ -260,7 +303,7 @@ declare class LedgerAtomicInterface {
|
|
|
260
303
|
getStaplesFromBlockHashes(hashes: BlockHash[]): Promise<VoteStaple[]>;
|
|
261
304
|
getVoteStaplesAfter(moment: Date, limit?: number, options?: GetVotesAfterOptions): Promise<VoteStaple[]>;
|
|
262
305
|
gc(): Promise<boolean>;
|
|
263
|
-
_testingRunStorageFunction<T>(code: (storage: LedgerStorageAPI, transaction:
|
|
306
|
+
_testingRunStorageFunction<T>(code: (storage: LedgerStorageAPI, transaction: LedgerStorageTransactionBase) => Promise<T>): Promise<T>;
|
|
264
307
|
}
|
|
265
308
|
/**
|
|
266
309
|
* The core Ledger components
|
|
@@ -292,6 +335,8 @@ export declare class Ledger implements Omit<LedgerAtomicInterface, 'commit' | 'a
|
|
|
292
335
|
listACLsByEntity(...args: Parameters<LedgerAtomicInterface['listACLsByEntity']>): ReturnType<LedgerAtomicInterface['listACLsByEntity']>;
|
|
293
336
|
getBalance(...args: Parameters<LedgerAtomicInterface['getBalance']>): ReturnType<LedgerAtomicInterface['getBalance']>;
|
|
294
337
|
getAllBalances(...args: Parameters<LedgerAtomicInterface['getAllBalances']>): ReturnType<LedgerAtomicInterface['getAllBalances']>;
|
|
338
|
+
getAccountCertificates(...args: Parameters<LedgerAtomicInterface['getAccountCertificates']>): ReturnType<LedgerAtomicInterface['getAccountCertificates']>;
|
|
339
|
+
getAccountCertificateByHash(...args: Parameters<LedgerAtomicInterface['getAccountCertificateByHash']>): ReturnType<LedgerAtomicInterface['getAccountCertificateByHash']>;
|
|
295
340
|
votingPower(...args: Parameters<LedgerAtomicInterface['votingPower']>): ReturnType<LedgerAtomicInterface['votingPower']>;
|
|
296
341
|
getVotes(...args: Parameters<LedgerAtomicInterface['getVotes']>): ReturnType<LedgerAtomicInterface['getVotes']>;
|
|
297
342
|
getVotesFromMultiplePrevious(...args: Parameters<LedgerAtomicInterface['getVotesFromMultiplePrevious']>): ReturnType<LedgerAtomicInterface['getVotesFromMultiplePrevious']>;
|
|
@@ -308,6 +353,6 @@ export declare class Ledger implements Omit<LedgerAtomicInterface, 'commit' | 'a
|
|
|
308
353
|
getVoteStaplesAfter(...args: Parameters<LedgerAtomicInterface['getVoteStaplesAfter']>): ReturnType<LedgerAtomicInterface['getVoteStaplesAfter']>;
|
|
309
354
|
gc(...args: Parameters<LedgerAtomicInterface['gc']>): ReturnType<LedgerAtomicInterface['gc']>;
|
|
310
355
|
stats(): Promise<LedgerStatistics>;
|
|
311
|
-
_testingRunStorageFunction<T>(code: (storage: LedgerStorageAPI, transaction:
|
|
356
|
+
_testingRunStorageFunction<T>(code: (storage: LedgerStorageAPI, transaction: LedgerStorageTransactionBase) => Promise<T>): Promise<T>;
|
|
312
357
|
}
|
|
313
358
|
export default Ledger;
|
package/lib/ledger/types.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { GenericAccount, TokenAddress } from '../account';
|
|
2
2
|
import type { AdjustMethod } from '../block';
|
|
3
3
|
import type { Permissions } from '../permissions';
|
|
4
|
-
import type { TimeStats } from '../stats';
|
|
4
|
+
import type { DbStats, TimeStats } from '../stats';
|
|
5
|
+
import type { Certificate, CertificateBundle } from '../utils/certificate';
|
|
5
6
|
/**
|
|
6
7
|
* Account info entry
|
|
7
8
|
*/
|
|
@@ -97,5 +98,10 @@ export interface LedgerStatistics {
|
|
|
97
98
|
blockCount: number;
|
|
98
99
|
transactionCount: number;
|
|
99
100
|
representativeCount: number;
|
|
101
|
+
db: DbStats;
|
|
100
102
|
settlementTimes: TimeStats;
|
|
101
103
|
}
|
|
104
|
+
export interface CertificateWithIntermediates {
|
|
105
|
+
certificate: Certificate;
|
|
106
|
+
intermediates: CertificateBundle | null;
|
|
107
|
+
}
|
package/lib/node/local.d.ts
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
|
+
import type { Response as ExpressResponse } from 'express';
|
|
1
2
|
import type { NodeConfig } from './';
|
|
2
3
|
import { Node } from './';
|
|
3
4
|
import type { BootstrapConfig } from '../bootstrap';
|
|
4
5
|
import { BootstrapClient } from '../bootstrap';
|
|
5
6
|
import type { ErrorCode } from '../error';
|
|
6
|
-
export type LocalNodeConfig = NodeConfig & {
|
|
7
|
+
export type LocalNodeConfig = Omit<NodeConfig, 'nodeOptions'> & {
|
|
7
8
|
bootstrap?: BootstrapConfig;
|
|
8
9
|
invokeSecret?: string;
|
|
10
|
+
nodeOptions?: {
|
|
11
|
+
listenIP?: string;
|
|
12
|
+
listenPort?: number;
|
|
13
|
+
timingSampleRate?: number;
|
|
14
|
+
noSyncAfterEachRoute?: boolean;
|
|
15
|
+
};
|
|
9
16
|
};
|
|
10
17
|
export type ApiErrorResponse = {
|
|
11
18
|
error: boolean;
|
|
@@ -19,7 +26,9 @@ type LocalNodeRunOptions = {
|
|
|
19
26
|
export declare class LocalNode extends Node {
|
|
20
27
|
#private;
|
|
21
28
|
static isInstance: (obj: any, strict?: boolean) => obj is LocalNode;
|
|
29
|
+
config: LocalNodeConfig;
|
|
22
30
|
constructor(config: LocalNodeConfig);
|
|
31
|
+
setCorsHeaders(response: ExpressResponse): void;
|
|
23
32
|
addRoutes(prefix?: string): void;
|
|
24
33
|
get _app(): import("express-serve-static-core").Express;
|
|
25
34
|
run(options?: LocalNodeRunOptions): Promise<void>;
|
package/lib/node/timing.d.ts
CHANGED
|
@@ -1,11 +1,50 @@
|
|
|
1
|
+
interface DisposableTimingHandle extends Disposable {
|
|
2
|
+
/**
|
|
3
|
+
* Unique identifier for the timing section
|
|
4
|
+
*/
|
|
5
|
+
id: symbol;
|
|
6
|
+
/**
|
|
7
|
+
* End the timing section
|
|
8
|
+
*/
|
|
9
|
+
end: () => void;
|
|
10
|
+
/**
|
|
11
|
+
* Dispose of the timing section, ending it
|
|
12
|
+
*/
|
|
13
|
+
[Symbol.dispose]: () => void;
|
|
14
|
+
}
|
|
1
15
|
export declare class RequestTiming {
|
|
2
16
|
#private;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
17
|
+
static defaultLogger: Console;
|
|
18
|
+
log: Console;
|
|
19
|
+
/**
|
|
20
|
+
* Start timing a section of code
|
|
21
|
+
* @param section Name of the section to time -- should be unique within the code base so that it can be identified later
|
|
22
|
+
* @returns A handle which can be used to end the timing section
|
|
23
|
+
*/
|
|
24
|
+
startTime(section: string): DisposableTimingHandle;
|
|
25
|
+
endTime(section: symbol | undefined | ReturnType<RequestTiming['startTime']>): void;
|
|
26
|
+
/** @deprecated Use `endTime(section: symbol)` instead */
|
|
27
|
+
endTime(section: string | undefined, deduplicate?: boolean): void;
|
|
28
|
+
/**
|
|
29
|
+
* Run a piece of code and time it, returning the result of the code
|
|
30
|
+
*
|
|
31
|
+
* This takes an optional "timing" parameter which is a timing object
|
|
32
|
+
* if one exists, to update -- if this parameter is undefined no timing
|
|
33
|
+
* will be done.
|
|
34
|
+
*
|
|
35
|
+
* @param section Name of the section to time -- should be unique within the code base so that it can be identified later
|
|
36
|
+
* @param timing Timing object to update, if available
|
|
37
|
+
* @param code The code to run
|
|
38
|
+
* @returns The result of the code
|
|
39
|
+
*/
|
|
40
|
+
static runTimer<T>(section: string, timing: RequestTiming | undefined, code: () => Promise<T>): Promise<T>;
|
|
41
|
+
runTimer<T>(section: string, code: () => Promise<T>): Promise<T>;
|
|
42
|
+
private getTiming;
|
|
7
43
|
getAllTiming(): {
|
|
8
|
-
[section: string]:
|
|
44
|
+
[section: string]: {
|
|
45
|
+
name: string;
|
|
46
|
+
duration: number;
|
|
47
|
+
};
|
|
9
48
|
};
|
|
10
49
|
counter(): number;
|
|
11
50
|
}
|
package/lib/p2p.d.ts
CHANGED
|
@@ -72,9 +72,12 @@ interface P2PPeerBase {
|
|
|
72
72
|
interface P2PPeerRepBase extends P2PPeerBase {
|
|
73
73
|
kind: NodeKind.REPRESENTATIVE;
|
|
74
74
|
/**
|
|
75
|
-
*
|
|
75
|
+
* Endpoints to reach the representative
|
|
76
76
|
*/
|
|
77
|
-
|
|
77
|
+
endpoints: {
|
|
78
|
+
p2p: string;
|
|
79
|
+
api: string;
|
|
80
|
+
};
|
|
78
81
|
/**
|
|
79
82
|
* Public key of the representative (used as the ID)
|
|
80
83
|
*/
|
|
@@ -224,7 +227,7 @@ export declare class P2PWebSocket implements P2PConnection {
|
|
|
224
227
|
/**
|
|
225
228
|
* The interfaces from the Node that the P2P switch uses
|
|
226
229
|
*/
|
|
227
|
-
type NodeLike = Pick<Node, 'recvMessageFromPeer' | 'config' | 'stats' | 'log'>;
|
|
230
|
+
type NodeLike = Pick<Node, 'recvMessageFromPeer' | 'sendMessage' | 'config' | 'stats' | 'log'>;
|
|
228
231
|
/**
|
|
229
232
|
* Deserializer DB
|
|
230
233
|
*/
|
package/lib/permissions.d.ts
CHANGED
|
@@ -17,7 +17,8 @@ declare enum BaseFlag {
|
|
|
17
17
|
TOKEN_ADMIN_SUPPLY = 6,/* 0x0040 */
|
|
18
18
|
TOKEN_ADMIN_MODIFY_BALANCE = 7,/* 0x0080 */
|
|
19
19
|
PERMISSION_DELEGATE_ADD = 11,/* 0x0800 */
|
|
20
|
-
PERMISSION_DELEGATE_REMOVE = 12
|
|
20
|
+
PERMISSION_DELEGATE_REMOVE = 12,/* 0x1000 */
|
|
21
|
+
MANAGE_CERTIFICATE = 13
|
|
21
22
|
}
|
|
22
23
|
type ExternalFlagName = `${typeof externalFlagPrefix}${string}`;
|
|
23
24
|
export type BaseFlagName = keyof typeof BaseFlag;
|
|
@@ -116,6 +117,5 @@ export declare class Permissions {
|
|
|
116
117
|
get canUseDelegation(): boolean;
|
|
117
118
|
get base(): BaseSet;
|
|
118
119
|
get external(): ExternalSet;
|
|
119
|
-
|
|
120
|
-
static toJSONSerializable(value: Permissions): bigint[];
|
|
120
|
+
toJSON(): [bigint, bigint];
|
|
121
121
|
}
|
package/lib/pubsub/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { JSONSerializable } from '../utils/conversion';
|
|
2
2
|
export type SubscriptionCallback = (message: JSONSerializable) => void;
|
|
3
3
|
export interface PubSubProviderAPI {
|
|
4
|
-
subscribe: (channel: string, callback: SubscriptionCallback) => Promise<void>;
|
|
5
4
|
publish: (channel: string, message: JSONSerializable) => Promise<void>;
|
|
5
|
+
subscribe: (channel: string, callback: SubscriptionCallback) => Promise<void>;
|
|
6
6
|
destroy: () => Promise<void>;
|
|
7
7
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import PubSubProviderMemory from './ps_memory';
|
|
2
2
|
import PubSubProviderRedis from './ps_redis';
|
|
3
|
+
import PubSubProviderGCP from './ps_gcp';
|
|
3
4
|
export declare const PS: {
|
|
4
5
|
Memory: typeof PubSubProviderMemory;
|
|
5
6
|
Redis: typeof PubSubProviderRedis;
|
|
7
|
+
GCP: typeof PubSubProviderGCP;
|
|
6
8
|
};
|
|
7
9
|
export default PS;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { JSONSerializable } from '../utils/conversion';
|
|
2
|
+
import type { PubSubProviderAPI, SubscriptionCallback } from '.';
|
|
3
|
+
import { PubSub } from '@google-cloud/pubsub';
|
|
4
|
+
import type { Topic } from '@google-cloud/pubsub';
|
|
5
|
+
export declare class PubSubProviderGCP implements PubSubProviderAPI {
|
|
6
|
+
#private;
|
|
7
|
+
constructor(projectId: string, apiEndpoint?: string);
|
|
8
|
+
get _testing_pubsub(): PubSub;
|
|
9
|
+
publish(channel: string, message: JSONSerializable): Promise<void>;
|
|
10
|
+
subscribe(channel: string, callback: SubscriptionCallback): Promise<void>;
|
|
11
|
+
destroy(): Promise<void>;
|
|
12
|
+
assertTopicExists(topic: Topic, channel: string): Promise<true | undefined>;
|
|
13
|
+
}
|
|
14
|
+
export default PubSubProviderGCP;
|
package/lib/stats.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { KVStorageProvider } from './kv';
|
|
2
2
|
import { BufferStorage } from './utils/buffer';
|
|
3
3
|
import type { BlockHash } from './block';
|
|
4
|
+
import type { RequestTiming } from './node/timing';
|
|
4
5
|
export interface StatsConfig {
|
|
5
6
|
kv: KVStorageProvider | null;
|
|
6
7
|
}
|
|
@@ -33,6 +34,9 @@ type TimeStat = {
|
|
|
33
34
|
export type TimeStats = {
|
|
34
35
|
[duration in DurationBreakdowns]: TimeStat;
|
|
35
36
|
};
|
|
37
|
+
export type DbStats = {
|
|
38
|
+
retries: number;
|
|
39
|
+
};
|
|
36
40
|
export declare class Stats {
|
|
37
41
|
#private;
|
|
38
42
|
constructor(config: StatsConfig);
|
|
@@ -44,6 +48,7 @@ export declare class Stats {
|
|
|
44
48
|
xor(key: string, change: BlockHash | BufferStorage): void;
|
|
45
49
|
getXor(key: string): Promise<BufferStorage>;
|
|
46
50
|
addTimingPoint(arena: string, category: string, duration: number, returnOnly?: boolean): Parameters<Stats['incr']>;
|
|
51
|
+
addRequestTiming(arena: string, timing: RequestTiming, returnOnly?: boolean): Parameters<Stats['incr']>[];
|
|
47
52
|
get(arena: string, key: string): Promise<number>;
|
|
48
53
|
getTimingData(arena: string, category: string): Promise<TimeStats>;
|
|
49
54
|
sync(): Promise<void>;
|
package/lib/utils/asn1.d.ts
CHANGED
|
@@ -44,6 +44,7 @@ export interface ASN1String extends ASN1Object {
|
|
|
44
44
|
kind: 'printable' | 'ia5' | 'utf8';
|
|
45
45
|
value: string;
|
|
46
46
|
}
|
|
47
|
+
export declare function isASN1Object(input: unknown): input is ASN1Object;
|
|
47
48
|
/**
|
|
48
49
|
* Validation function for {@link isValidSequenceSchema}
|
|
49
50
|
*/
|
|
@@ -63,7 +64,7 @@ export declare namespace ValidateASN1 {
|
|
|
63
64
|
sequenceOf: Schema;
|
|
64
65
|
} | {
|
|
65
66
|
optional: Schema;
|
|
66
|
-
} | {
|
|
67
|
+
} | bigint | {
|
|
67
68
|
type: 'context';
|
|
68
69
|
kind: 'implicit' | 'explicit';
|
|
69
70
|
contains: Schema;
|
|
@@ -110,7 +111,7 @@ export declare namespace ValidateASN1 {
|
|
|
110
111
|
sequenceOf: Schema;
|
|
111
112
|
} ? SchemaMap<T['sequenceOf']>[] : T extends {
|
|
112
113
|
optional: Schema;
|
|
113
|
-
} ? SchemaMap<T['optional']> | undefined : T extends {
|
|
114
|
+
} ? SchemaMap<T['optional']> | undefined : T extends bigint ? T : T extends {
|
|
114
115
|
type: 'context';
|
|
115
116
|
kind: infer U extends 'implicit' | 'explicit';
|
|
116
117
|
value: number;
|
|
@@ -182,7 +183,7 @@ type Mutable<T> = T extends Buffer | ArrayBuffer | Date ? T : T extends object ?
|
|
|
182
183
|
export declare class BufferStorageASN1<T extends ASN1AnyJS | Readonly<ASN1AnyJS> = Readonly<ASN1AnyJS>, S extends ValidateASN1.Schema | undefined = undefined> {
|
|
183
184
|
#private;
|
|
184
185
|
static readonly Validate: typeof ValidateASN1;
|
|
185
|
-
static readonly isInstance: (obj: any, strict?: boolean) => obj is BufferStorageASN1<string | number | bigint | boolean | Buffer | ASN1AnyJS[] |
|
|
186
|
+
static readonly isInstance: (obj: any, strict?: boolean) => obj is BufferStorageASN1<string | number | bigint | boolean | Date | Buffer | ASN1AnyJS[] | ASN1OID | ASN1Set | ASN1ExplicitContextTag | ASN1ImplicitContextTag | ASN1BitString | ASN1Date | ASN1String | readonly ASN1AnyJS[] | Readonly<Date> | Readonly<Buffer> | Readonly<ASN1OID> | Readonly<ASN1Set> | Readonly<ASN1ExplicitContextTag> | Readonly<ASN1ImplicitContextTag> | Readonly<ASN1BitString> | Readonly<ASN1Date> | Readonly<ASN1String> | null | undefined, ValidateASN1.Schema | undefined>;
|
|
186
187
|
constructor(input: T | ArrayBuffer, schema?: S);
|
|
187
188
|
getDER(): ArrayBuffer;
|
|
188
189
|
getDERBuffer(): Buffer;
|
package/lib/utils/buffer.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Buffer } from 'buffer';
|
|
1
2
|
import zlib from 'zlib';
|
|
2
3
|
/**
|
|
3
4
|
* RFC 4648 Base32 Decoder
|
|
@@ -11,6 +12,8 @@ export declare function DecodeBase64(data: string): ArrayBuffer;
|
|
|
11
12
|
export declare function EncodeBase64(data: ArrayBuffer): string;
|
|
12
13
|
export declare function ZlibInflate(data: ArrayBuffer, options?: zlib.ZlibOptions): ArrayBuffer;
|
|
13
14
|
export declare function ZlibDeflate(data: ArrayBuffer, options?: zlib.ZlibOptions): ArrayBuffer;
|
|
15
|
+
export declare function ZlibInflateAsync(data: ArrayBuffer, options?: zlib.ZlibOptions): Promise<ArrayBuffer>;
|
|
16
|
+
export declare function ZlibDeflateAsync(data: ArrayBuffer, options?: zlib.ZlibOptions): Promise<ArrayBuffer>;
|
|
14
17
|
export declare class BufferStorage {
|
|
15
18
|
#private;
|
|
16
19
|
readonly storageKind: string;
|
|
@@ -24,3 +27,4 @@ export declare class BufferStorage {
|
|
|
24
27
|
compare(compareWith: typeof this | undefined | null): boolean;
|
|
25
28
|
compareHexString(compareWith: BufferStorage | string | undefined | null): boolean;
|
|
26
29
|
}
|
|
30
|
+
export { Buffer };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as ASN1 from './asn1';
|
|
2
|
-
import Account from '../account';
|
|
2
|
+
import Account, { AccountKeyAlgorithm } from '../account';
|
|
3
3
|
import * as HashLib from './hash';
|
|
4
|
+
import { BufferStorage } from './buffer';
|
|
5
|
+
import type { ToJSONSerializableOptions, ToJSONSerializable } from './conversion';
|
|
4
6
|
/**
|
|
5
7
|
* De-normalized mapped Certificate Schema, for use in type annotations since
|
|
6
8
|
* we do not want to expose such a complex type
|
|
@@ -132,7 +134,7 @@ export declare class CertificateBuilder {
|
|
|
132
134
|
* Create a certificate
|
|
133
135
|
*/
|
|
134
136
|
buildDER(params?: Partial<CertificateBuilderParams>): Promise<ArrayBuffer>;
|
|
135
|
-
build(params?: Partial<CertificateBuilderParams>): Promise<Certificate>;
|
|
137
|
+
build(params?: Partial<CertificateBuilderParams>, options?: ConstructorParameters<typeof Certificate>[1]): Promise<Certificate>;
|
|
136
138
|
}
|
|
137
139
|
type CertificateOptions = {
|
|
138
140
|
/**
|
|
@@ -163,12 +165,48 @@ type CertificateOptions = {
|
|
|
163
165
|
*/
|
|
164
166
|
isTrustedRoot?: boolean;
|
|
165
167
|
};
|
|
168
|
+
type CertificateHashString = string & {
|
|
169
|
+
readonly __certificateHash: never;
|
|
170
|
+
};
|
|
171
|
+
/**
|
|
172
|
+
* Certificate hash
|
|
173
|
+
*/
|
|
174
|
+
export declare class CertificateHash extends BufferStorage {
|
|
175
|
+
static isInstance: (obj: any, strict?: boolean) => obj is CertificateHash;
|
|
176
|
+
static Set: import("./helper").InstanceSetConstructor<CertificateHash, CertificateHashString>;
|
|
177
|
+
get hashFunctionName(): string;
|
|
178
|
+
constructor(certificateHash: ConstructorParameters<typeof BufferStorage>[0]);
|
|
179
|
+
static fromData(data: Buffer): CertificateHash;
|
|
180
|
+
toJSON(): CertificateHashString;
|
|
181
|
+
toString(): CertificateHashString;
|
|
182
|
+
}
|
|
183
|
+
export declare class CertificateBundle {
|
|
184
|
+
#private;
|
|
185
|
+
static isInstance: (obj: any, strict?: boolean) => obj is CertificateBundle;
|
|
186
|
+
constructor(input: CertificateBundle | Certificate[] | ArrayBuffer | Buffer | string | (ConstructorParameters<typeof Certificate>[0])[] | Set<Certificate>);
|
|
187
|
+
get bundleSize(): number;
|
|
188
|
+
getDER(): ArrayBuffer;
|
|
189
|
+
getDERBuffer(): Buffer;
|
|
190
|
+
getCertificates(): Certificate[];
|
|
191
|
+
toJSON(): {
|
|
192
|
+
certificates: string[];
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
export type CertificateJSONOutput = ToJSONSerializable<ReturnType<Certificate['toJSON']>>;
|
|
166
196
|
export declare class Certificate {
|
|
167
197
|
#private;
|
|
168
198
|
/**
|
|
169
199
|
* The Certificate Builder
|
|
170
200
|
*/
|
|
171
201
|
static readonly Builder: typeof CertificateBuilder;
|
|
202
|
+
/**
|
|
203
|
+
* The certificate bundle
|
|
204
|
+
*/
|
|
205
|
+
static readonly Bundle: typeof CertificateBundle;
|
|
206
|
+
/**
|
|
207
|
+
* The certificate hash information
|
|
208
|
+
*/
|
|
209
|
+
static readonly Hash: typeof CertificateHash;
|
|
172
210
|
/**
|
|
173
211
|
* The serial number of the certificate
|
|
174
212
|
*/
|
|
@@ -185,10 +223,24 @@ export declare class Certificate {
|
|
|
185
223
|
* The Subject DN of the certificate as a string --- for informational purposes only
|
|
186
224
|
*/
|
|
187
225
|
readonly subject: string;
|
|
226
|
+
/**
|
|
227
|
+
* The Subject DN of the certificate --- for informational purposes only
|
|
228
|
+
*/
|
|
229
|
+
readonly subjectDN: ({
|
|
230
|
+
name: string;
|
|
231
|
+
value: string;
|
|
232
|
+
})[];
|
|
188
233
|
/**
|
|
189
234
|
* The Issuer DN of the certificate as a string --- for informational purposes only
|
|
190
235
|
*/
|
|
191
236
|
readonly issuer: string;
|
|
237
|
+
/**
|
|
238
|
+
* The Issuer DN of the certificate --- for informational purposes only
|
|
239
|
+
*/
|
|
240
|
+
readonly issuerDN: ({
|
|
241
|
+
name: string;
|
|
242
|
+
value: string;
|
|
243
|
+
})[];
|
|
192
244
|
/**
|
|
193
245
|
* The Subject of the certificate as a KeetaNet Account, derived from the
|
|
194
246
|
* public key in the certificate
|
|
@@ -229,11 +281,11 @@ export declare class Certificate {
|
|
|
229
281
|
/**
|
|
230
282
|
* The complete SubjectDN
|
|
231
283
|
*/
|
|
232
|
-
protected
|
|
284
|
+
protected subjectDNSet: CertificateSchema[0][5];
|
|
233
285
|
/**
|
|
234
286
|
* The complete IssuerDN
|
|
235
287
|
*/
|
|
236
|
-
protected
|
|
288
|
+
protected issuerDNSet: CertificateSchema[0][3];
|
|
237
289
|
/**
|
|
238
290
|
* Object type ID for {@link Certificate.isCertificate}
|
|
239
291
|
*/
|
|
@@ -269,6 +321,11 @@ export declare class Certificate {
|
|
|
269
321
|
* Verifies that the certificate is was signed by the given account or certificate
|
|
270
322
|
*/
|
|
271
323
|
verify(account: Account | Certificate): boolean;
|
|
324
|
+
/**
|
|
325
|
+
* Asserts provided certificates can construct a valid graph with no loops or orphans, and that all provided certificates can reach the root, or current certificate
|
|
326
|
+
* @param certificates Additional intermediate certificates to verify
|
|
327
|
+
*/
|
|
328
|
+
assertCanConstructValidGraph(certificates: Set<Certificate>): true | undefined;
|
|
272
329
|
/**
|
|
273
330
|
* Verify against a given certificate store
|
|
274
331
|
*/
|
|
@@ -328,13 +385,57 @@ export declare class Certificate {
|
|
|
328
385
|
* Get the certificate as a PEM encoded string
|
|
329
386
|
*/
|
|
330
387
|
toPEM(): string;
|
|
388
|
+
/**
|
|
389
|
+
* The string representation of the certificate
|
|
390
|
+
* is a PEM encoded certificate -- this misses
|
|
391
|
+
* some of the internal details like chain
|
|
392
|
+
* and verified, but is usually what someone
|
|
393
|
+
* wants to see when they call toString()
|
|
394
|
+
*/
|
|
395
|
+
toString(): string;
|
|
331
396
|
/**
|
|
332
397
|
* Compute a hash of the certificate
|
|
333
398
|
*/
|
|
334
|
-
hash():
|
|
399
|
+
hash(): CertificateHash;
|
|
335
400
|
/**
|
|
336
401
|
* Get a JSON representation of the certificate
|
|
337
402
|
*/
|
|
338
|
-
toJSON(includeChain?: boolean):
|
|
403
|
+
toJSON(options?: ToJSONSerializableOptions, includeChain?: boolean): {
|
|
404
|
+
$binary?: string;
|
|
405
|
+
$chain?: unknown;
|
|
406
|
+
serial: bigint;
|
|
407
|
+
notBefore: Date;
|
|
408
|
+
notAfter: Date;
|
|
409
|
+
subject: string;
|
|
410
|
+
issuer: string;
|
|
411
|
+
subjectPublicKey: Account<AccountKeyAlgorithm.ECDSA_SECP256K1 | AccountKeyAlgorithm.ED25519 | AccountKeyAlgorithm.ECDSA_SECP256R1>;
|
|
412
|
+
baseExtensions: {
|
|
413
|
+
/**
|
|
414
|
+
* Basic Constraints
|
|
415
|
+
*/
|
|
416
|
+
basicConstraints?: [ca: boolean, pathLenConstraint?: bigint];
|
|
417
|
+
/**
|
|
418
|
+
* Subject Key Identifier
|
|
419
|
+
*/
|
|
420
|
+
subjectKeyIdentifier?: Buffer;
|
|
421
|
+
/**
|
|
422
|
+
* Authority Key Identifier
|
|
423
|
+
*/
|
|
424
|
+
authorityKeyIdentifier?: {
|
|
425
|
+
type: "context";
|
|
426
|
+
value: 0;
|
|
427
|
+
contains: Buffer;
|
|
428
|
+
};
|
|
429
|
+
} | undefined;
|
|
430
|
+
subjectDN: {
|
|
431
|
+
name: string;
|
|
432
|
+
value: string;
|
|
433
|
+
}[];
|
|
434
|
+
issuerDN: {
|
|
435
|
+
name: string;
|
|
436
|
+
value: string;
|
|
437
|
+
}[];
|
|
438
|
+
$hash: CertificateHash;
|
|
439
|
+
};
|
|
339
440
|
}
|
|
340
441
|
export {};
|