@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.
Files changed (255) hide show
  1. package/api/index.d.ts +23 -7
  2. package/api/node.d.ts +27 -2
  3. package/api/vote.d.ts +4 -6
  4. package/client/builder.d.ts +17 -0
  5. package/client/client_common_tests.d.ts +1 -1
  6. package/client/index-browser.d.ts +112 -3
  7. package/client/index-browser.js +18234 -29816
  8. package/client/index.d.ts +112 -3
  9. package/client/index.js +4070 -6581
  10. package/config/index.d.ts +6 -1
  11. package/docs/assets/hierarchy.js +1 -1
  12. package/docs/assets/search.js +1 -1
  13. package/docs/classes/KeetaNetSDK.Client.html +31 -11
  14. package/docs/classes/KeetaNetSDK.Referenced.Account.html +31 -21
  15. package/docs/classes/KeetaNetSDK.Referenced.BaseSet.html +2 -2
  16. package/docs/classes/KeetaNetSDK.Referenced.Block.html +2 -4
  17. package/docs/classes/KeetaNetSDK.Referenced.BlockBuilder.html +1 -1
  18. package/docs/classes/KeetaNetSDK.Referenced.BlockHash.html +4 -5
  19. package/docs/classes/KeetaNetSDK.Referenced.BlockOperation.html +1 -1
  20. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationCREATE_IDENTIFIER.html +2 -2
  21. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationMANAGE_CERTIFICATE.html +12 -0
  22. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationMODIFY_PERMISSIONS.html +2 -2
  23. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationRECEIVE.html +2 -2
  24. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationSEND.html +2 -2
  25. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationSET_INFO.html +2 -2
  26. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationSET_REP.html +2 -2
  27. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationTOKEN_ADMIN_MODIFY_BALANCE.html +2 -2
  28. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationTOKEN_ADMIN_SUPPLY.html +2 -2
  29. package/docs/classes/{KeetaNetSDK.Referenced.src_lib_utils_certificate.Certificate.html → KeetaNetSDK.Referenced.Certificate.html} +31 -14
  30. package/docs/classes/KeetaNetSDK.Referenced.CertificateBundle.html +8 -0
  31. package/docs/classes/KeetaNetSDK.Referenced.CertificateHash.html +16 -0
  32. package/docs/classes/KeetaNetSDK.Referenced.ECDSAKeyPair.html +1 -1
  33. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256K1KeyPair.html +1 -1
  34. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256K1PrivateKey.html +1 -1
  35. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256K1PublicKey.html +1 -1
  36. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256K1Signature.html +1 -1
  37. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1KeyPair.html +1 -1
  38. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1PrivateKey.html +1 -1
  39. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1PublicKey.html +1 -1
  40. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1Signature.html +1 -1
  41. package/docs/classes/KeetaNetSDK.Referenced.ED25519KeyPair.html +1 -1
  42. package/docs/classes/KeetaNetSDK.Referenced.ED25519PrivateKey.html +1 -1
  43. package/docs/classes/KeetaNetSDK.Referenced.ED25519PublicKey.html +1 -1
  44. package/docs/classes/KeetaNetSDK.Referenced.ED25519Signature.html +1 -1
  45. package/docs/classes/KeetaNetSDK.Referenced.ExternalKeyPair.html +1 -1
  46. package/docs/classes/KeetaNetSDK.Referenced.ExternalSet.html +1 -1
  47. package/docs/classes/KeetaNetSDK.Referenced.IdentifierKey.html +1 -1
  48. package/docs/classes/KeetaNetSDK.Referenced.IdentifierKeyPair.html +4 -4
  49. package/docs/classes/KeetaNetSDK.Referenced.KeetaNetError.html +1 -1
  50. package/docs/classes/KeetaNetSDK.Referenced.KeyInterface.html +1 -1
  51. package/docs/classes/KeetaNetSDK.Referenced.KeyStorage.html +1 -1
  52. package/docs/classes/KeetaNetSDK.Referenced.Ledger.html +4 -2
  53. package/docs/classes/KeetaNetSDK.Referenced.LedgerAtomicInterface.html +3 -1
  54. package/docs/classes/KeetaNetSDK.Referenced.LedgerRequestCache.html +1 -1
  55. package/docs/classes/KeetaNetSDK.Referenced.Node.html +1 -1
  56. package/docs/classes/KeetaNetSDK.Referenced.P2PSwitch.html +3 -3
  57. package/docs/classes/KeetaNetSDK.Referenced.PendingAccount.html +3 -2
  58. package/docs/classes/KeetaNetSDK.Referenced.PermissionSetHolder.html +1 -1
  59. package/docs/classes/KeetaNetSDK.Referenced.Permissions.html +2 -3
  60. package/docs/classes/KeetaNetSDK.Referenced.PossiblyExpiredVote.html +5 -3
  61. package/docs/classes/KeetaNetSDK.Referenced.RequestTiming.html +16 -2
  62. package/docs/classes/KeetaNetSDK.Referenced.SignatureStorage.html +1 -1
  63. package/docs/classes/KeetaNetSDK.Referenced.Stats.html +3 -2
  64. package/docs/classes/KeetaNetSDK.Referenced.UserClientBuilder.html +3 -2
  65. package/docs/classes/KeetaNetSDK.Referenced.Vote.html +5 -5
  66. package/docs/classes/KeetaNetSDK.Referenced.VoteBlockBundle.html +35 -0
  67. package/docs/classes/KeetaNetSDK.Referenced.VoteBlockHash.html +1 -1
  68. package/docs/classes/KeetaNetSDK.Referenced.VoteBlockHashMap.html +9 -8
  69. package/docs/classes/KeetaNetSDK.Referenced.VoteBuilder.html +2 -1
  70. package/docs/classes/KeetaNetSDK.Referenced.VoteHash.html +1 -1
  71. package/docs/classes/KeetaNetSDK.Referenced.VoteStaple.html +23 -29
  72. package/docs/classes/KeetaNetSDK.Referenced.VoteStapleHash.html +1 -1
  73. package/docs/classes/KeetaNetSDK.Referenced.src_lib_utils_asn1.BufferStorageASN1.html +1 -1
  74. package/docs/classes/KeetaNetSDK.Referenced.src_lib_utils_buffer.BufferStorage.html +1 -1
  75. package/docs/classes/KeetaNetSDK.Referenced.src_lib_utils_certificate.CertificateBuilder.html +1 -1
  76. package/docs/classes/KeetaNetSDK.UserClient.html +57 -15
  77. package/docs/documents/GETTING-STARTED.html +5 -2
  78. package/docs/enums/KeetaNetSDK.Referenced.AccountKeyAlgorithm.html +2 -1
  79. package/docs/enums/KeetaNetSDK.Referenced.AdjustMethod.html +4 -4
  80. package/docs/enums/KeetaNetSDK.Referenced.BaseFlag.html +2 -1
  81. package/docs/enums/KeetaNetSDK.Referenced.OperationType.html +2 -1
  82. package/docs/functions/KeetaNetSDK.Referenced.src_config.getDefaultConfig.html +2 -2
  83. package/docs/functions/KeetaNetSDK.Referenced.src_config.getNetworkAlias.html +1 -1
  84. package/docs/functions/KeetaNetSDK.Referenced.src_config.getValidation.html +1 -1
  85. package/docs/functions/KeetaNetSDK.Referenced.src_config.isNetwork.html +1 -1
  86. package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_asn1.isASN1Object.html +1 -0
  87. package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_buffer.ZlibDeflateAsync.html +1 -0
  88. package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_buffer.ZlibInflateAsync.html +1 -0
  89. package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_conversion.objectToBuffer.html +1 -1
  90. package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_conversion.toJSONSerializable.html +1 -1
  91. package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_helper.booleanEnv.html +1 -0
  92. package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_helper.nonNullable.html +1 -0
  93. package/docs/hierarchy.html +1 -1
  94. package/docs/interfaces/KeetaNetSDK.Referenced.ACLEntry.html +1 -1
  95. package/docs/interfaces/KeetaNetSDK.Referenced.ACLUpdate.html +1 -1
  96. package/docs/interfaces/KeetaNetSDK.Referenced.ASN1ExplicitContextTag.html +1 -1
  97. package/docs/interfaces/KeetaNetSDK.Referenced.ASN1ImplicitContextTag.html +1 -1
  98. package/docs/interfaces/KeetaNetSDK.Referenced.ASN1Object.html +1 -1
  99. package/docs/interfaces/KeetaNetSDK.Referenced.BaseExternalKeyPairFunctions.html +1 -1
  100. package/docs/interfaces/KeetaNetSDK.Referenced.BaseGenerationConfig.html +1 -1
  101. package/docs/interfaces/KeetaNetSDK.Referenced.BlockCanonical.html +2 -2
  102. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSON.html +2 -2
  103. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperation.html +1 -1
  104. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationCREATE_IDENTIFIER.html +1 -1
  105. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationMANAGE_CERTIFICATE.html +6 -0
  106. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationMANAGE_CERTIFICATESerializable.html +5 -0
  107. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationMODIFY_PERMISSIONS.html +1 -1
  108. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationRECEIVE.html +1 -1
  109. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationSEND.html +1 -1
  110. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationSET_INFO.html +1 -1
  111. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationSET_REP.html +1 -1
  112. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationTOKEN_ADMIN_MODIFY_BALANCE.html +1 -1
  113. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationTOKEN_ADMIN_SUPPLY.html +2 -2
  114. package/docs/interfaces/KeetaNetSDK.Referenced.BlockUnsignedCanonical.html +2 -2
  115. package/docs/interfaces/KeetaNetSDK.Referenced.CertificateWithIntermediates.html +3 -0
  116. package/docs/interfaces/KeetaNetSDK.Referenced.CertificateWithIntermediatesResponse.html +3 -0
  117. package/docs/interfaces/KeetaNetSDK.Referenced.ComputedBlocksEffectFields.html +3 -2
  118. package/docs/interfaces/KeetaNetSDK.Referenced.Constructor.html +1 -1
  119. package/docs/interfaces/KeetaNetSDK.Referenced.DisposableTimingHandle.html +7 -0
  120. package/docs/interfaces/KeetaNetSDK.Referenced.ExternalKeyPairFunctionsNoEncryption.html +1 -1
  121. package/docs/interfaces/KeetaNetSDK.Referenced.ExternalKeyPairFunctionsSupportsEncryption.html +1 -1
  122. package/docs/interfaces/KeetaNetSDK.Referenced.FeeAmountAndToken.html +5 -0
  123. package/docs/interfaces/KeetaNetSDK.Referenced.FeeAmountAndTokenJSON.html +4 -0
  124. package/docs/interfaces/KeetaNetSDK.Referenced.IdentifierCreateRequest.html +2 -2
  125. package/docs/interfaces/KeetaNetSDK.Referenced.InitialConfigSupply.html +1 -1
  126. package/docs/interfaces/KeetaNetSDK.Referenced.InstanceSet.html +13 -0
  127. package/docs/interfaces/KeetaNetSDK.Referenced.KVGenericOptionsType.html +2 -0
  128. package/docs/interfaces/KeetaNetSDK.Referenced.KVSetOptionsType.html +3 -2
  129. package/docs/interfaces/KeetaNetSDK.Referenced.KVStorageProviderAPI.html +2 -2
  130. package/docs/interfaces/KeetaNetSDK.Referenced.LedgerConfig.html +4 -2
  131. package/docs/interfaces/KeetaNetSDK.Referenced.LedgerStatistics.html +3 -2
  132. package/docs/interfaces/KeetaNetSDK.Referenced.LedgerStorageAPI.html +15 -7
  133. package/docs/interfaces/KeetaNetSDK.Referenced.LedgerStorageTransactionBase.html +6 -0
  134. package/docs/interfaces/KeetaNetSDK.Referenced.ModifyTokenBalanceEntry.html +1 -1
  135. package/docs/interfaces/KeetaNetSDK.Referenced.NodeConfig.html +3 -3
  136. package/docs/interfaces/KeetaNetSDK.Referenced.NumericValidationRule.html +3 -0
  137. package/docs/interfaces/KeetaNetSDK.Referenced.NumericValueEntry.html +1 -1
  138. package/docs/interfaces/KeetaNetSDK.Referenced.P2PPeerBase.html +1 -1
  139. package/docs/interfaces/KeetaNetSDK.Referenced.P2PPeerListener.html +1 -1
  140. package/docs/interfaces/KeetaNetSDK.Referenced.P2PPeerRepBase.html +3 -3
  141. package/docs/interfaces/KeetaNetSDK.Referenced.PendingOperations.html +3 -2
  142. package/docs/interfaces/KeetaNetSDK.Referenced.PendingOperationsJSON.html +3 -2
  143. package/docs/interfaces/KeetaNetSDK.Referenced.PublicKeyStorage.html +1 -1
  144. package/docs/interfaces/KeetaNetSDK.Referenced.PublicKeyStringMapping.html +3 -2
  145. package/docs/interfaces/KeetaNetSDK.Referenced.RequestTokenReceiveEntry.html +1 -1
  146. package/docs/interfaces/KeetaNetSDK.Referenced.TokenNumericEntry.html +1 -1
  147. package/docs/interfaces/KeetaNetSDK.Referenced.UserClientConfig.html +2 -2
  148. package/docs/interfaces/KeetaNetSDK.Referenced.UserClientListenerOptions.html +2 -0
  149. package/docs/interfaces/KeetaNetSDK.Referenced.UserClientOptions.html +1 -1
  150. package/docs/interfaces/KeetaNetSDK.Referenced.VoteBundleConstructor.html +6 -0
  151. package/docs/interfaces/KeetaNetSDK.Referenced.VoteJSON.html +3 -2
  152. package/docs/interfaces/KeetaNetSDK.Referenced.VoteStapleJSON.html +2 -2
  153. package/docs/interfaces/KeetaNetSDK.Referenced.WithIsInstance.html +1 -1
  154. package/docs/interfaces/KeetaNetSDK.Referenced.src_config.ValidationConfig.html +2 -2
  155. package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1BitString.html +1 -1
  156. package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1Date.html +1 -1
  157. package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1OID.html +1 -1
  158. package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1Set.html +1 -1
  159. package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1String.html +1 -1
  160. package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_conversion.ToJSONSerializableOptions.html +3 -0
  161. package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_helper.InstanceSetConstructor.html +2 -2
  162. package/docs/modules/KeetaNetSDK.Referenced.html +1 -1
  163. package/docs/modules/KeetaNetSDK.Referenced.src_lib_utils_asn1.html +1 -1
  164. package/docs/modules/KeetaNetSDK.Referenced.src_lib_utils_buffer.html +1 -1
  165. package/docs/modules/KeetaNetSDK.Referenced.src_lib_utils_certificate.html +1 -1
  166. package/docs/modules/KeetaNetSDK.Referenced.src_lib_utils_conversion.html +1 -1
  167. package/docs/modules/KeetaNetSDK.Referenced.src_lib_utils_helper.html +1 -1
  168. package/docs/types/KeetaNetSDK.Referenced.AccountKeyAlgorithmHex.html +8 -0
  169. package/docs/types/KeetaNetSDK.Referenced.AccountKeyAlgorithmHexReverse.html +1 -0
  170. package/docs/types/KeetaNetSDK.Referenced.AccountKeyAlgorithmHexToType.html +1 -0
  171. package/docs/types/KeetaNetSDK.Referenced.AddBinaryIfIncluded.html +1 -0
  172. package/docs/types/KeetaNetSDK.Referenced.BlockHashString.html +1 -0
  173. package/docs/types/KeetaNetSDK.Referenced.CertificateErrorCode.html +1 -0
  174. package/docs/types/KeetaNetSDK.Referenced.CertificateExtensionData.html +1 -0
  175. package/docs/types/KeetaNetSDK.Referenced.CertificateExtensions.html +2 -2
  176. package/docs/types/KeetaNetSDK.Referenced.CertificateHashString.html +1 -0
  177. package/docs/types/KeetaNetSDK.Referenced.CertificateOptions.html +4 -4
  178. package/docs/types/KeetaNetSDK.Referenced.CertificateUpdate.html +2 -0
  179. package/docs/types/KeetaNetSDK.Referenced.ComputedEffectOfBlocks.html +3 -2
  180. package/docs/types/KeetaNetSDK.Referenced.DbStats.html +2 -0
  181. package/docs/types/KeetaNetSDK.Referenced.ErrorCode.html +1 -1
  182. package/docs/types/KeetaNetSDK.Referenced.ExportedJSONOperation.html +1 -0
  183. package/docs/types/KeetaNetSDK.Referenced.MultisigPublicKeyString.html +1 -0
  184. package/docs/types/KeetaNetSDK.Referenced.NodeLike-1.html +1 -0
  185. package/docs/types/KeetaNetSDK.Referenced.NodeLike.html +1 -1
  186. package/docs/types/KeetaNetSDK.Referenced.PublicKeyAndTypeStringHex.html +3 -0
  187. package/docs/types/{KeetaNetSDK.Referenced.VoteJSONOutput.html → KeetaNetSDK.Referenced.StorageAddress.html} +1 -1
  188. package/docs/types/KeetaNetSDK.Referenced.TimingData.html +2 -0
  189. package/docs/types/KeetaNetSDK.Referenced.TimingSectionHandle.html +6 -0
  190. package/docs/types/KeetaNetSDK.Referenced.VoteBuilderOptions.html +4 -0
  191. package/docs/types/KeetaNetSDK.Referenced.src_config.NetworkConfig.html +1 -1
  192. package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_asn1.ValidateASN1.Schema.html +1 -1
  193. package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_asn1.ValidateASN1.SchemaMap.html +1 -1
  194. package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_certificate.CertificateJSONOutput.html +1 -0
  195. package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_conversion.ToJSONSerializable.html +1 -1
  196. package/docs/variables/KeetaNetSDK.Referenced.BlockErrorCodes-1.html +1 -0
  197. package/docs/variables/KeetaNetSDK.Referenced.BlockErrorCodes.html +1 -1
  198. package/docs/{types/KeetaNetSDK.Referenced.JSONUnsupportedTypes.html → variables/KeetaNetSDK.Referenced.CertificateErrorType.html} +1 -1
  199. package/docs/variables/KeetaNetSDK.Referenced.ClientErrorCodes.html +1 -1
  200. package/docs/variables/KeetaNetSDK.Referenced.KVErrorCodes.html +1 -1
  201. package/docs/variables/KeetaNetSDK.Referenced.Operation.html +2 -2
  202. package/docs/variables/KeetaNetSDK.Referenced.VoteErrorCodes.html +1 -1
  203. package/docs/variables/KeetaNetSDK.Referenced.identifierKeyTypes.html +1 -1
  204. package/docs/variables/KeetaNetSDK.Referenced.src_config.networksArray.html +1 -1
  205. package/docs/variables/KeetaNetSDK.Referenced.src_lib_utils_helper.AsyncDisposableStack.html +2 -0
  206. package/docs/variables/KeetaNetSDK.Referenced.src_lib_utils_helper.crypto.html +1 -0
  207. package/lib/account.d.ts +68 -29
  208. package/lib/block/index.d.ts +53 -23
  209. package/lib/block/operations.d.ts +78 -33
  210. package/lib/error/block.d.ts +1 -1
  211. package/lib/error/certificate.d.ts +9 -0
  212. package/lib/error/client.d.ts +1 -1
  213. package/lib/error/index.d.ts +2 -1
  214. package/lib/error/kv.d.ts +1 -1
  215. package/lib/error/vote.d.ts +1 -1
  216. package/lib/kv/index.d.ts +15 -8
  217. package/lib/kv/kv_redis.d.ts +18 -8
  218. package/lib/ledger/common.d.ts +13 -5
  219. package/lib/ledger/db_dynamodb.d.ts +22 -16
  220. package/lib/ledger/db_postgres.d.ts +10 -10
  221. package/lib/ledger/db_spanner.d.ts +26 -14
  222. package/lib/ledger/db_spanner_helper.d.ts +94 -109
  223. package/lib/ledger/db_sqlite.d.ts +10 -10
  224. package/lib/ledger/effects.d.ts +19 -4
  225. package/lib/ledger/index.d.ts +57 -12
  226. package/lib/ledger/types.d.ts +7 -1
  227. package/lib/node/local.d.ts +10 -1
  228. package/lib/node/timing.d.ts +44 -5
  229. package/lib/p2p.d.ts +6 -3
  230. package/lib/permissions.d.ts +3 -3
  231. package/lib/pubsub/index.d.ts +1 -1
  232. package/lib/pubsub/providers.d.ts +2 -0
  233. package/lib/pubsub/ps_gcp.d.ts +14 -0
  234. package/lib/stats.d.ts +5 -0
  235. package/lib/utils/asn1.d.ts +4 -3
  236. package/lib/utils/buffer.d.ts +4 -0
  237. package/lib/utils/certificate.d.ts +107 -6
  238. package/lib/utils/conversion.d.ts +13 -35
  239. package/lib/utils/helper.d.ts +26 -8
  240. package/lib/utils/helper_testing.d.ts +1 -1
  241. package/lib/vote.d.ts +122 -63
  242. package/package.json +2 -3
  243. package/version.d.ts +1 -1
  244. package/docs/classes/KeetaNetSDK.Referenced.HTTPAgentManager.html +0 -4
  245. package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_conversion.RegisterSerializable.html +0 -2
  246. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOutput.html +0 -5
  247. package/docs/interfaces/KeetaNetSDK.Referenced.VoteJSONOutput.html +0 -4
  248. package/docs/interfaces/KeetaNetSDK.Referenced.WithConversionClass.html +0 -6
  249. package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_helper.InstanceSet.html +0 -10
  250. package/docs/types/KeetaNetSDK.Referenced.JSONSupportedObject.html +0 -1
  251. package/docs/types/KeetaNetSDK.Referenced.JSONSupportedValue.html +0 -1
  252. package/docs/types/KeetaNetSDK.Referenced.Vote.html +0 -1
  253. package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_conversion.JSONSupported.html +0 -1
  254. package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_conversion.ToJSONSerializableOptions.html +0 -3
  255. package/docs/variables/KeetaNetSDK.Referenced.default.html +0 -3
@@ -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: (identifier: string, readOnly?: boolean) => Promise<any>;
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<BlockHash[]>;
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
- blockHeight: string | null;
164
- } | null>;
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: any, storage: LedgerStorageAPI, config: LedgerConfig, ledger: Ledger);
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<BlockHash[]>;
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: any) => Promise<T>): Promise<T>;
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: any) => Promise<T>): Promise<T>;
356
+ _testingRunStorageFunction<T>(code: (storage: LedgerStorageAPI, transaction: LedgerStorageTransactionBase) => Promise<T>): Promise<T>;
312
357
  }
313
358
  export default Ledger;
@@ -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
+ }
@@ -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>;
@@ -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
- startTime(section: string): void;
4
- endTime(section: string, deduplicate?: boolean): void;
5
- runTimer<T>(section: string, code: () => Promise<T>, deduplicate?: boolean): Promise<T>;
6
- getTiming(section: string): number;
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]: number;
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
- * Endpoint to reach the representative
75
+ * Endpoints to reach the representative
76
76
  */
77
- endpoint: string;
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
  */
@@ -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
- static toJSONSerializablePrefix: string;
120
- static toJSONSerializable(value: Permissions): bigint[];
120
+ toJSON(): [bigint, bigint];
121
121
  }
@@ -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>;
@@ -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[] | Date | ASN1OID | ASN1Set | ASN1ExplicitContextTag | ASN1ImplicitContextTag | ASN1BitString | ASN1Date | ASN1String | readonly ASN1AnyJS[] | Readonly<Buffer> | Readonly<Date> | Readonly<ASN1OID> | Readonly<ASN1Set> | Readonly<ASN1ExplicitContextTag> | Readonly<ASN1ImplicitContextTag> | Readonly<ASN1BitString> | Readonly<ASN1Date> | Readonly<ASN1String> | null | undefined, ValidateASN1.Schema | undefined>;
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;
@@ -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 subjectDN: CertificateSchema[0][5];
284
+ protected subjectDNSet: CertificateSchema[0][5];
233
285
  /**
234
286
  * The complete IssuerDN
235
287
  */
236
- protected issuerDN: CertificateSchema[0][3];
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(): string;
399
+ hash(): CertificateHash;
335
400
  /**
336
401
  * Get a JSON representation of the certificate
337
402
  */
338
- toJSON(includeChain?: boolean): any;
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 {};