@keetanetwork/keetanet-client 0.16.0 → 0.16.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 (210) hide show
  1. package/client/builder.d.ts +3 -3
  2. package/client/client_common_tests.d.ts +23 -4
  3. package/client/index-browser.d.ts +15 -13
  4. package/client/index-browser.js +878 -351
  5. package/client/index.d.ts +15 -13
  6. package/client/index.js +737 -253
  7. package/docs/assets/hierarchy.js +1 -1
  8. package/docs/assets/search.js +1 -1
  9. package/docs/classes/KeetaNetSDK.Client.html +10 -10
  10. package/docs/classes/KeetaNetSDK.Referenced.Account.html +34 -31
  11. package/docs/classes/KeetaNetSDK.Referenced.BaseSet.html +1 -1
  12. package/docs/classes/KeetaNetSDK.Referenced.BaseVoteBuilder.html +2 -2
  13. package/docs/classes/KeetaNetSDK.Referenced.Block.html +3 -3
  14. package/docs/classes/KeetaNetSDK.Referenced.BlockBuilder.html +1 -1
  15. package/docs/classes/KeetaNetSDK.Referenced.BlockHash.html +1 -1
  16. package/docs/classes/KeetaNetSDK.Referenced.BlockOperation.html +1 -1
  17. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationCREATE_IDENTIFIER.html +2 -2
  18. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationMANAGE_CERTIFICATE.html +2 -2
  19. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationMODIFY_PERMISSIONS.html +2 -2
  20. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationRECEIVE.html +2 -2
  21. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationSEND.html +2 -2
  22. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationSET_INFO.html +2 -2
  23. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationSET_REP.html +2 -2
  24. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationTOKEN_ADMIN_MODIFY_BALANCE.html +2 -2
  25. package/docs/classes/KeetaNetSDK.Referenced.BlockOperationTOKEN_ADMIN_SUPPLY.html +2 -2
  26. package/docs/classes/KeetaNetSDK.Referenced.Certificate.html +7 -7
  27. package/docs/classes/KeetaNetSDK.Referenced.CertificateBundle.html +1 -1
  28. package/docs/classes/KeetaNetSDK.Referenced.CertificateHash.html +1 -1
  29. package/docs/classes/KeetaNetSDK.Referenced.ECDSAKeyPair.html +1 -1
  30. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256K1KeyPair.html +1 -1
  31. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256K1PrivateKey.html +1 -1
  32. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256K1PublicKey.html +1 -1
  33. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256K1Signature.html +1 -1
  34. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1KeyPair.html +1 -1
  35. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1PrivateKey.html +1 -1
  36. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1PublicKey.html +1 -1
  37. package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1Signature.html +1 -1
  38. package/docs/classes/KeetaNetSDK.Referenced.ED25519KeyPair.html +1 -1
  39. package/docs/classes/KeetaNetSDK.Referenced.ED25519PrivateKey.html +1 -1
  40. package/docs/classes/KeetaNetSDK.Referenced.ED25519PublicKey.html +1 -1
  41. package/docs/classes/KeetaNetSDK.Referenced.ED25519Signature.html +1 -1
  42. package/docs/classes/KeetaNetSDK.Referenced.ExternalKeyPair.html +1 -1
  43. package/docs/classes/KeetaNetSDK.Referenced.ExternalSet.html +1 -1
  44. package/docs/classes/KeetaNetSDK.Referenced.IdempotentKey.html +1 -1
  45. package/docs/classes/KeetaNetSDK.Referenced.IdentifierKey.html +1 -1
  46. package/docs/classes/KeetaNetSDK.Referenced.IdentifierKeyPair.html +4 -4
  47. package/docs/classes/KeetaNetSDK.Referenced.KeetaNetError.html +2 -2
  48. package/docs/classes/KeetaNetSDK.Referenced.KeetaNetErrorBase.html +1 -1
  49. package/docs/classes/KeetaNetSDK.Referenced.KeetaNetLedgerError.html +1 -1
  50. package/docs/classes/KeetaNetSDK.Referenced.KeetaNetLedgerIdempotentKeyError.html +1 -1
  51. package/docs/classes/KeetaNetSDK.Referenced.KeetaNetLedgerVoteError.html +1 -1
  52. package/docs/classes/KeetaNetSDK.Referenced.KeyInterface.html +1 -1
  53. package/docs/classes/KeetaNetSDK.Referenced.KeyStorage.html +1 -1
  54. package/docs/classes/KeetaNetSDK.Referenced.Ledger.html +2 -2
  55. package/docs/classes/KeetaNetSDK.Referenced.LedgerAtomicInterface.html +1 -1
  56. package/docs/classes/KeetaNetSDK.Referenced.P2PSwitch.html +2 -2
  57. package/docs/classes/KeetaNetSDK.Referenced.PermissionSetHolder.html +1 -1
  58. package/docs/classes/KeetaNetSDK.Referenced.PossiblyExpiredVote.html +2 -2
  59. package/docs/classes/KeetaNetSDK.Referenced.PossiblyUnsignedBlock.html +3 -3
  60. package/docs/classes/KeetaNetSDK.Referenced.SignatureStorage.html +1 -1
  61. package/docs/classes/KeetaNetSDK.Referenced.Stats.html +1 -1
  62. package/docs/classes/KeetaNetSDK.Referenced.StatsPending.html +1 -1
  63. package/docs/classes/KeetaNetSDK.Referenced.UnsignedBlock.html +3 -3
  64. package/docs/classes/KeetaNetSDK.Referenced.UserClientBuilder.html +11 -11
  65. package/docs/classes/KeetaNetSDK.Referenced.Vote.html +2 -2
  66. package/docs/classes/KeetaNetSDK.Referenced.VoteBlockBundle.html +4 -4
  67. package/docs/classes/KeetaNetSDK.Referenced.VoteBlockHash.html +1 -1
  68. package/docs/classes/KeetaNetSDK.Referenced.VoteBuilder.html +2 -2
  69. package/docs/classes/KeetaNetSDK.Referenced.VoteHash.html +1 -1
  70. package/docs/classes/KeetaNetSDK.Referenced.VoteLikeBase.html +2 -2
  71. package/docs/classes/KeetaNetSDK.Referenced.VoteQuote.html +2 -2
  72. package/docs/classes/KeetaNetSDK.Referenced.VoteQuoteBuilder.html +2 -2
  73. package/docs/classes/KeetaNetSDK.Referenced.VoteStaple.html +4 -4
  74. package/docs/classes/KeetaNetSDK.Referenced.VoteStapleHash.html +1 -1
  75. package/docs/classes/KeetaNetSDK.Referenced.src_lib_utils_buffer.BufferStorage.html +1 -1
  76. package/docs/classes/KeetaNetSDK.UserClient.html +20 -20
  77. package/docs/documents/GETTING-STARTED.html +1 -1
  78. package/docs/enums/KeetaNetSDK.Referenced.AccountKeyAlgorithm.html +8 -8
  79. package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_domain-separation.applyNamespace.html +5 -0
  80. package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_helper.getTypedObjectEntries.html +1 -0
  81. package/docs/hierarchy.html +1 -1
  82. package/docs/interfaces/KeetaNetSDK.Referenced.ACLEntry.html +1 -1
  83. package/docs/interfaces/KeetaNetSDK.Referenced.ACLUpdate.html +1 -1
  84. package/docs/interfaces/KeetaNetSDK.Referenced.ASN1ExplicitContextTag.html +1 -1
  85. package/docs/interfaces/KeetaNetSDK.Referenced.ASN1ImplicitContextTag.html +1 -1
  86. package/docs/interfaces/KeetaNetSDK.Referenced.ASN1Object.html +1 -1
  87. package/docs/interfaces/KeetaNetSDK.Referenced.BaseAccountInfo.html +10 -0
  88. package/docs/interfaces/KeetaNetSDK.Referenced.BaseExternalKeyPairFunctions.html +1 -1
  89. package/docs/interfaces/KeetaNetSDK.Referenced.BaseGenerationConfig.html +2 -2
  90. package/docs/interfaces/KeetaNetSDK.Referenced.BaseIdentifierAccountInfo.html +12 -0
  91. package/docs/interfaces/KeetaNetSDK.Referenced.BaseIdentifierCreateArguments.html +1 -1
  92. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperation.html +1 -1
  93. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationCREATE_IDENTIFIER.html +2 -2
  94. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationMANAGE_CERTIFICATE.html +2 -2
  95. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationMODIFY_PERMISSIONS.html +1 -1
  96. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationRECEIVE.html +1 -1
  97. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationSEND.html +1 -1
  98. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationSET_INFO.html +1 -1
  99. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationSET_REP.html +1 -1
  100. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationTOKEN_ADMIN_MODIFY_BALANCE.html +1 -1
  101. package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationTOKEN_ADMIN_SUPPLY.html +1 -1
  102. package/docs/interfaces/KeetaNetSDK.Referenced.BlockV1Canonical.html +1 -1
  103. package/docs/interfaces/KeetaNetSDK.Referenced.BlockV1JSON.html +2 -2
  104. package/docs/interfaces/KeetaNetSDK.Referenced.BlockV2Canonical.html +1 -1
  105. package/docs/interfaces/KeetaNetSDK.Referenced.BuilderBlockOptions.html +2 -2
  106. package/docs/interfaces/KeetaNetSDK.Referenced.Constructor.html +1 -1
  107. package/docs/interfaces/KeetaNetSDK.Referenced.DisposableTimingHandle.html +1 -1
  108. package/docs/interfaces/KeetaNetSDK.Referenced.ECDSA_SECP256K1AccountInfo.html +10 -0
  109. package/docs/interfaces/KeetaNetSDK.Referenced.ECDSA_SECP256R1AccountInfo.html +10 -0
  110. package/docs/interfaces/KeetaNetSDK.Referenced.ED25519AccountInfo.html +10 -0
  111. package/docs/interfaces/KeetaNetSDK.Referenced.ExternalKeyPairFunctionsNoEncryption.html +1 -1
  112. package/docs/interfaces/KeetaNetSDK.Referenced.ExternalKeyPairFunctionsSupportsEncryption.html +1 -1
  113. package/docs/interfaces/KeetaNetSDK.Referenced.FeeAmountAndToken.html +2 -2
  114. package/docs/interfaces/KeetaNetSDK.Referenced.FeeAmountAndTokenJSON.html +2 -2
  115. package/docs/interfaces/KeetaNetSDK.Referenced.IdentifierCreateRequest.html +2 -2
  116. package/docs/interfaces/KeetaNetSDK.Referenced.InitialConfigSupply.html +2 -2
  117. package/docs/interfaces/KeetaNetSDK.Referenced.InstanceSet.html +1 -1
  118. package/docs/interfaces/KeetaNetSDK.Referenced.KVGenericOptionsType.html +1 -1
  119. package/docs/interfaces/KeetaNetSDK.Referenced.KVSetOptionsType.html +1 -1
  120. package/docs/interfaces/KeetaNetSDK.Referenced.LedgerConfig.html +4 -4
  121. package/docs/interfaces/KeetaNetSDK.Referenced.LedgerStorageAPI.html +5 -5
  122. package/docs/interfaces/KeetaNetSDK.Referenced.ModifyTokenBalanceEntry.html +1 -1
  123. package/docs/interfaces/KeetaNetSDK.Referenced.MultiSigIdentifierCreateArguments.html +2 -2
  124. package/docs/interfaces/KeetaNetSDK.Referenced.MultisigAccountInfo.html +14 -0
  125. package/docs/interfaces/KeetaNetSDK.Referenced.MultisigConfig.html +2 -2
  126. package/docs/interfaces/KeetaNetSDK.Referenced.NetworkAccountInfo.html +12 -0
  127. package/docs/interfaces/KeetaNetSDK.Referenced.NodeConfig.html +4 -4
  128. package/docs/interfaces/KeetaNetSDK.Referenced.NumericValueEntry.html +1 -1
  129. package/docs/interfaces/KeetaNetSDK.Referenced.P2PPeerBase.html +1 -1
  130. package/docs/interfaces/KeetaNetSDK.Referenced.P2PPeerListener.html +1 -1
  131. package/docs/interfaces/KeetaNetSDK.Referenced.P2PPeerRepBase.html +1 -1
  132. package/docs/interfaces/KeetaNetSDK.Referenced.PendingOperations.html +2 -2
  133. package/docs/interfaces/KeetaNetSDK.Referenced.PendingOperationsJSON.html +2 -2
  134. package/docs/interfaces/KeetaNetSDK.Referenced.PrincipalACLWithInfoParsed.html +3 -10
  135. package/docs/interfaces/KeetaNetSDK.Referenced.PublicKeyStorage.html +1 -1
  136. package/docs/interfaces/KeetaNetSDK.Referenced.PublishOptions.html +1 -1
  137. package/docs/interfaces/KeetaNetSDK.Referenced.RequestTokenReceiveEntry.html +1 -1
  138. package/docs/interfaces/KeetaNetSDK.Referenced.StorageAccountInfo.html +12 -0
  139. package/docs/interfaces/KeetaNetSDK.Referenced.TokenAccountInfo.html +14 -0
  140. package/docs/interfaces/KeetaNetSDK.Referenced.TokenNumericEntry.html +1 -1
  141. package/docs/interfaces/KeetaNetSDK.Referenced.UserClientConfig.html +2 -2
  142. package/docs/interfaces/KeetaNetSDK.Referenced.UserClientOptions.html +1 -1
  143. package/docs/interfaces/KeetaNetSDK.Referenced.VoteJSON.html +2 -2
  144. package/docs/interfaces/KeetaNetSDK.Referenced.VoteStapleJSON.html +2 -2
  145. package/docs/interfaces/KeetaNetSDK.Referenced.WithIsInstance.html +1 -1
  146. package/docs/interfaces/KeetaNetSDK.Referenced.signOptionsType.html +16 -3
  147. package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1BitString.html +1 -1
  148. package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1Date.html +1 -1
  149. package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1OID.html +1 -1
  150. package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1Set.html +1 -1
  151. package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1String.html +1 -1
  152. package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1Struct.html +1 -1
  153. package/docs/modules/KeetaNetSDK.Referenced.html +1 -1
  154. package/docs/modules/KeetaNetSDK.Referenced.src_lib_utils_domain-separation.html +1 -0
  155. package/docs/modules/KeetaNetSDK.Referenced.src_lib_utils_helper.html +1 -1
  156. package/docs/types/KeetaNetSDK.Referenced.AccountInfo.html +1 -0
  157. package/docs/types/KeetaNetSDK.Referenced.AccountInfoForType.html +1 -0
  158. package/docs/types/KeetaNetSDK.Referenced.AccountInfoResponse.html +2 -2
  159. package/docs/types/KeetaNetSDK.Referenced.AccountInfoWithoutAccount.html +1 -0
  160. package/docs/types/{KeetaNetSDK.Referenced.src_lib_utils_helper.DistributiveOmit.html → KeetaNetSDK.Referenced.DistributiveOmit.html} +1 -1
  161. package/docs/types/KeetaNetSDK.Referenced.GetAccountStateAPIResponseFormatted.html +5 -12
  162. package/docs/types/KeetaNetSDK.Referenced.KeyPairAccountInfo.html +1 -0
  163. package/docs/types/KeetaNetSDK.Referenced.KeyPairKeyAlgorithm.html +1 -0
  164. package/docs/types/KeetaNetSDK.Referenced.NetworkAddress.html +1 -1
  165. package/docs/types/KeetaNetSDK.Referenced.StorageAddress.html +1 -1
  166. package/docs/types/KeetaNetSDK.Referenced.TokenAddress.html +1 -1
  167. package/docs/types/KeetaNetSDK.Referenced.TokenOrPending.html +1 -1
  168. package/docs/types/KeetaNetSDK.Referenced.UserEditableAccountInfo.html +1 -1
  169. package/docs/types/KeetaNetSDK.Referenced.VoteBuilderOptions.html +2 -2
  170. package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_conversion.ToJSONSerializable.html +1 -1
  171. package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_initial.BaseNetworkInfo.html +1 -1
  172. package/docs/variables/KeetaNetSDK.Referenced.allFullErrorCodes.html +1 -1
  173. package/docs/variables/KeetaNetSDK.Referenced.identifierKeyTypes.html +1 -1
  174. package/docs/variables/KeetaNetSDK.Referenced.src_lib_utils_domain-separation.KeetaNamespaceVersion.html +3 -0
  175. package/docs/variables/KeetaNetSDK.Referenced.src_lib_utils_domain-separation.MaxNamespaceLength.html +3 -0
  176. package/docs/variables/KeetaNetSDK.Referenced.src_lib_utils_domain-separation.namespacePrefixSchema.html +9 -0
  177. package/docs/variables/KeetaNetSDK.lib.html +2 -2
  178. package/lib/account.d.ts +39 -1
  179. package/lib/block/index.d.ts +126 -108
  180. package/lib/block/operations.d.ts +11 -0
  181. package/lib/error/account.d.ts +2 -2
  182. package/lib/error/index.d.ts +1 -1
  183. package/lib/error/vote.d.ts +2 -2
  184. package/lib/index.d.ts +4 -2
  185. package/lib/ledger/common.d.ts +15 -3
  186. package/lib/ledger/db_dynamodb.d.ts +6 -6
  187. package/lib/ledger/db_postgres.d.ts +3 -3
  188. package/lib/ledger/db_spanner.d.ts +4 -4
  189. package/lib/ledger/db_spanner_helper.d.ts +2 -2
  190. package/lib/ledger/db_sqlite.d.ts +3 -3
  191. package/lib/ledger/effects.d.ts +3 -1
  192. package/lib/ledger/index.d.ts +9 -9
  193. package/lib/ledger/types.d.ts +43 -9
  194. package/lib/log/target_gcp.js +3 -0
  195. package/lib/log/target_https.js +7 -0
  196. package/lib/utils/certificate.d.ts +13 -12
  197. package/lib/utils/conversion.d.ts +12 -3
  198. package/lib/utils/domain-separation.d.ts +31 -0
  199. package/lib/utils/external-keys/gcp-kms.d.ts +53 -0
  200. package/lib/utils/external-keys/gcp-kms.js +328 -0
  201. package/lib/utils/external-keys/passkey-prf.d.ts +1 -3
  202. package/lib/utils/external-keys/passkey-prf.js +6 -0
  203. package/lib/utils/helper.d.ts +1 -0
  204. package/lib/utils/initial.d.ts +3 -2
  205. package/lib/utils/never.d.ts +4 -0
  206. package/lib/vote.d.ts +96 -89
  207. package/npm-shrinkwrap.json +30 -12
  208. package/package.json +2 -2
  209. package/version.d.ts +1 -1
  210. package/docs/interfaces/KeetaNetSDK.Referenced.AccountInfo.html +0 -14
@@ -1,6 +1,6 @@
1
1
  import { KeetaNetErrorBase } from './base';
2
- export declare const VoteErrorCodes: readonly ["SERIAL_MISMATCH", "INVALID_VERSION", "INVALID_CONSTRUCTION", "INVALID_CONSTRUCTION_JSON", "SIGNATURE_INVALID", "EXPIRED", "INVALID_VALIDITY", "MOMENT_BEFORE_VALIDITY_FROM", "STAPLE_INVALID_CONSTRUCTION", "STAPLE_ALL_VOTES_MUST_HAVE_SAME_BLOCKS_COUNT", "STAPLE_ALL_VOTES_MUST_HAVE_SAME_BLOCKS_MISSING", "STAPLE_ALL_VOTES_MUST_HAVE_SAME_BLOCKS_ORDER", "STAPLE_DUPLICATE_VOTE_ISSUER", "STAPLE_PERMANENCE_MISMATCH", "BUILDER_INVALID_CONSTRUCTION", "BUILDER_INVALID_BLOCK_TYPE", "BUILDER_INVALID_SERIAL", "BUILDER_INVALID_VALID_TO_FROM", "MALFORMED_WRAPPER", "MALFORMED_VOTE_WRAPPER", "MALFORMED_VOTE_CONTENT", "MALFORMED_VOTE_CONTENT_EXTRA_DATA", "MALFORMED_VOTE_VERSION", "MALFORMED_VOTE_SERIAL", "MALFORMED_VOTE_SIGNATURE_INFORMATION", "MALFORMED_VOTE_ISSUER_INFORMATION", "MALFORMED_VOTE_SUBJECT_INFORMATION", "MALFORMED_VOTE_VALIDITY_INFORMATION", "MALFORMED_VOTE_SERIAL", "MALFORMED_VOTE_EXTENSIONS", "MALFORMED_VOTE_EXTENSIONS_DATA", "MALFORMED_VOTE_EXTENSIONS_VALUE", "MALFORMED_VOTE_EXTENSIONS_VALUE_OID", "MALFORMED_VOTE_EXTENSIONS_VALUE_CRITICAL", "MALFORMED_VOTE_EXTENSIONS_VALUE_CRITICAL_TYPE", "MALFORMED_VOTE_SIGNATURE_SCHEME_DOES_NOT_MATCH_ISSUER", "MALFORMED_VOTE_SIGNATURE_SCHEME_DOES_NOT_MATCH_WRAPPER", "MALFORMED_VOTE_SIGNATURE_SCHEME_ECDSA_INVALID_CURVE", "MALFORMED_VOTE_SIGNATURE_UNSUPPORTED_SCHEME", "MALFORMED_VOTE_SUBJECT_PUBLIC_KEY_INFORMATION", "MALFORMED_VOTE_SIGNATURE_VALUE", "MALFORMED_VOTE_NO_BLOCKS_FOUND", "MALFORMED_STAPLE", "MALFORMED_STAPLE_BLOCKS", "MALFORMED_STAPLE_BLOCKS_AT_LEAST_ONE", "MALFORMED_STAPLE_VOTES", "MALFORMED_STAPLE_VOTES_AT_LEAST_ONE", "MALFORMED_FIND_RDN_INVALID_TYPE", "MALFORMED_FIND_RDN_MUST_HAVE_ONE", "MALFORMED_FIND_RDN_PART_WELL_FORMED", "MALFORMED_FIND_RDN_MUST_BE_SET", "MALFORMED_FIND_RDN_TYPE_MUST_BE_OID", "MALFORMED_HASHES_FROM_VOTE_INVALID_INPUT", "MALFORMED_HASHES_FROM_VOTE_INVALID_TYPE", "MALFORMED_HASHES_FROM_VOTE_INVALID_CONTEXT_SPECIFIC", "MALFORMED_HASHES_FROM_VOTE_DATA_NEEDS_OID", "MALFORMED_HASHES_FROM_VOTE_DATA_HASH_DATA_MUST_BE_SEQUENCE", "MALFORMED_HASHES_FROM_VOTE_DATA_NOT_TWO_ITEMS", "MALFORMED_HASHES_FROM_VOTE_DATA_UNSUPPORTED_HASH_FUNC", "MALFORMED_HASHES_FROM_VOTE_DATA_UNSUPPORTED_HASH_TYPE", "MALFORMED_HASHES_FROM_VOTE_DATA_SECOND_MUST_BE_SEQUENCE", "MALFORMED_FEES_AMOUNT", "MALFORMED_FEES_FROM_VOTE_INVALID_INPUT", "MALFORMED_FEES_IN_PERMANENT_VOTE", "MALFORMED_FEES_PAY_TO_INVALID", "MALFORMED_FEES_TOKEN_NOT_TOKEN", "FEE_IS_QUOTE", "FEE_QUOTE_MISSING_FEES", "FEE_NOT_QUOTE", "MALFORMED_FEES_KIND_MISSING", "MALFORMED_FEES_QUOTE_INVALID"];
3
- export declare const FullVoteErrorCodes: ("VOTE_INVALID_VERSION" | "VOTE_SERIAL_MISMATCH" | "VOTE_INVALID_CONSTRUCTION" | "VOTE_INVALID_CONSTRUCTION_JSON" | "VOTE_SIGNATURE_INVALID" | "VOTE_EXPIRED" | "VOTE_INVALID_VALIDITY" | "VOTE_MOMENT_BEFORE_VALIDITY_FROM" | "VOTE_STAPLE_INVALID_CONSTRUCTION" | "VOTE_STAPLE_ALL_VOTES_MUST_HAVE_SAME_BLOCKS_COUNT" | "VOTE_STAPLE_ALL_VOTES_MUST_HAVE_SAME_BLOCKS_MISSING" | "VOTE_STAPLE_ALL_VOTES_MUST_HAVE_SAME_BLOCKS_ORDER" | "VOTE_STAPLE_DUPLICATE_VOTE_ISSUER" | "VOTE_STAPLE_PERMANENCE_MISMATCH" | "VOTE_BUILDER_INVALID_CONSTRUCTION" | "VOTE_BUILDER_INVALID_BLOCK_TYPE" | "VOTE_BUILDER_INVALID_SERIAL" | "VOTE_BUILDER_INVALID_VALID_TO_FROM" | "VOTE_MALFORMED_WRAPPER" | "VOTE_MALFORMED_VOTE_WRAPPER" | "VOTE_MALFORMED_VOTE_CONTENT" | "VOTE_MALFORMED_VOTE_CONTENT_EXTRA_DATA" | "VOTE_MALFORMED_VOTE_VERSION" | "VOTE_MALFORMED_VOTE_SERIAL" | "VOTE_MALFORMED_VOTE_SIGNATURE_INFORMATION" | "VOTE_MALFORMED_VOTE_ISSUER_INFORMATION" | "VOTE_MALFORMED_VOTE_SUBJECT_INFORMATION" | "VOTE_MALFORMED_VOTE_VALIDITY_INFORMATION" | "VOTE_MALFORMED_VOTE_EXTENSIONS" | "VOTE_MALFORMED_VOTE_EXTENSIONS_DATA" | "VOTE_MALFORMED_VOTE_EXTENSIONS_VALUE" | "VOTE_MALFORMED_VOTE_EXTENSIONS_VALUE_OID" | "VOTE_MALFORMED_VOTE_EXTENSIONS_VALUE_CRITICAL" | "VOTE_MALFORMED_VOTE_EXTENSIONS_VALUE_CRITICAL_TYPE" | "VOTE_MALFORMED_VOTE_SIGNATURE_SCHEME_DOES_NOT_MATCH_ISSUER" | "VOTE_MALFORMED_VOTE_SIGNATURE_SCHEME_DOES_NOT_MATCH_WRAPPER" | "VOTE_MALFORMED_VOTE_SIGNATURE_SCHEME_ECDSA_INVALID_CURVE" | "VOTE_MALFORMED_VOTE_SIGNATURE_UNSUPPORTED_SCHEME" | "VOTE_MALFORMED_VOTE_SUBJECT_PUBLIC_KEY_INFORMATION" | "VOTE_MALFORMED_VOTE_SIGNATURE_VALUE" | "VOTE_MALFORMED_VOTE_NO_BLOCKS_FOUND" | "VOTE_MALFORMED_STAPLE" | "VOTE_MALFORMED_STAPLE_BLOCKS" | "VOTE_MALFORMED_STAPLE_BLOCKS_AT_LEAST_ONE" | "VOTE_MALFORMED_STAPLE_VOTES" | "VOTE_MALFORMED_STAPLE_VOTES_AT_LEAST_ONE" | "VOTE_MALFORMED_FIND_RDN_INVALID_TYPE" | "VOTE_MALFORMED_FIND_RDN_MUST_HAVE_ONE" | "VOTE_MALFORMED_FIND_RDN_PART_WELL_FORMED" | "VOTE_MALFORMED_FIND_RDN_MUST_BE_SET" | "VOTE_MALFORMED_FIND_RDN_TYPE_MUST_BE_OID" | "VOTE_MALFORMED_HASHES_FROM_VOTE_INVALID_INPUT" | "VOTE_MALFORMED_HASHES_FROM_VOTE_INVALID_TYPE" | "VOTE_MALFORMED_HASHES_FROM_VOTE_INVALID_CONTEXT_SPECIFIC" | "VOTE_MALFORMED_HASHES_FROM_VOTE_DATA_NEEDS_OID" | "VOTE_MALFORMED_HASHES_FROM_VOTE_DATA_HASH_DATA_MUST_BE_SEQUENCE" | "VOTE_MALFORMED_HASHES_FROM_VOTE_DATA_NOT_TWO_ITEMS" | "VOTE_MALFORMED_HASHES_FROM_VOTE_DATA_UNSUPPORTED_HASH_FUNC" | "VOTE_MALFORMED_HASHES_FROM_VOTE_DATA_UNSUPPORTED_HASH_TYPE" | "VOTE_MALFORMED_HASHES_FROM_VOTE_DATA_SECOND_MUST_BE_SEQUENCE" | "VOTE_MALFORMED_FEES_AMOUNT" | "VOTE_MALFORMED_FEES_FROM_VOTE_INVALID_INPUT" | "VOTE_MALFORMED_FEES_IN_PERMANENT_VOTE" | "VOTE_MALFORMED_FEES_PAY_TO_INVALID" | "VOTE_MALFORMED_FEES_TOKEN_NOT_TOKEN" | "VOTE_FEE_IS_QUOTE" | "VOTE_FEE_QUOTE_MISSING_FEES" | "VOTE_FEE_NOT_QUOTE" | "VOTE_MALFORMED_FEES_KIND_MISSING" | "VOTE_MALFORMED_FEES_QUOTE_INVALID")[];
2
+ export declare const VoteErrorCodes: readonly ["SERIAL_MISMATCH", "INVALID_VERSION", "INVALID_CONSTRUCTION", "INVALID_CONSTRUCTION_JSON", "SIGNATURE_INVALID", "EXPIRED", "INVALID_VALIDITY", "MOMENT_BEFORE_VALIDITY_FROM", "STAPLE_INVALID_CONSTRUCTION", "STAPLE_ALL_VOTES_MUST_HAVE_SAME_BLOCKS_COUNT", "STAPLE_ALL_VOTES_MUST_HAVE_SAME_BLOCKS_MISSING", "STAPLE_ALL_VOTES_MUST_HAVE_SAME_BLOCKS_ORDER", "STAPLE_DUPLICATE_VOTE_ISSUER", "STAPLE_PERMANENCE_MISMATCH", "BUILDER_INVALID_CONSTRUCTION", "BUILDER_INVALID_BLOCK_TYPE", "BUILDER_INVALID_SERIAL", "BUILDER_INVALID_VALID_TO_FROM", "BUILDER_INVALID_FEE", "MALFORMED_WRAPPER", "MALFORMED_VOTE_WRAPPER", "MALFORMED_VOTE_CONTENT", "MALFORMED_VOTE_CONTENT_EXTRA_DATA", "MALFORMED_VOTE_VERSION", "MALFORMED_VOTE_SERIAL", "MALFORMED_VOTE_SIGNATURE_INFORMATION", "MALFORMED_VOTE_ISSUER_INFORMATION", "MALFORMED_VOTE_SUBJECT_INFORMATION", "MALFORMED_VOTE_VALIDITY_INFORMATION", "MALFORMED_VOTE_SERIAL", "MALFORMED_VOTE_EXTENSIONS", "MALFORMED_VOTE_EXTENSIONS_DATA", "MALFORMED_VOTE_EXTENSIONS_VALUE", "MALFORMED_VOTE_EXTENSIONS_VALUE_OID", "MALFORMED_VOTE_EXTENSIONS_VALUE_CRITICAL", "MALFORMED_VOTE_EXTENSIONS_VALUE_CRITICAL_TYPE", "MALFORMED_VOTE_SIGNATURE_SCHEME_DOES_NOT_MATCH_ISSUER", "MALFORMED_VOTE_SIGNATURE_SCHEME_DOES_NOT_MATCH_WRAPPER", "MALFORMED_VOTE_SIGNATURE_SCHEME_ECDSA_INVALID_CURVE", "MALFORMED_VOTE_SIGNATURE_UNSUPPORTED_SCHEME", "MALFORMED_VOTE_SUBJECT_PUBLIC_KEY_INFORMATION", "MALFORMED_VOTE_SIGNATURE_VALUE", "MALFORMED_VOTE_NO_BLOCKS_FOUND", "MALFORMED_STAPLE", "MALFORMED_STAPLE_BLOCKS", "MALFORMED_STAPLE_BLOCKS_AT_LEAST_ONE", "MALFORMED_STAPLE_VOTES", "MALFORMED_STAPLE_VOTES_AT_LEAST_ONE", "MALFORMED_FIND_RDN_INVALID_TYPE", "MALFORMED_FIND_RDN_MUST_HAVE_ONE", "MALFORMED_FIND_RDN_PART_WELL_FORMED", "MALFORMED_FIND_RDN_MUST_BE_SET", "MALFORMED_FIND_RDN_TYPE_MUST_BE_OID", "MALFORMED_HASHES_FROM_VOTE_INVALID_INPUT", "MALFORMED_HASHES_FROM_VOTE_INVALID_TYPE", "MALFORMED_HASHES_FROM_VOTE_INVALID_CONTEXT_SPECIFIC", "MALFORMED_HASHES_FROM_VOTE_DATA_NEEDS_OID", "MALFORMED_HASHES_FROM_VOTE_DATA_HASH_DATA_MUST_BE_SEQUENCE", "MALFORMED_HASHES_FROM_VOTE_DATA_NOT_TWO_ITEMS", "MALFORMED_HASHES_FROM_VOTE_DATA_UNSUPPORTED_HASH_FUNC", "MALFORMED_HASHES_FROM_VOTE_DATA_UNSUPPORTED_HASH_TYPE", "MALFORMED_HASHES_FROM_VOTE_DATA_SECOND_MUST_BE_SEQUENCE", "MALFORMED_FEES_AMOUNT", "MALFORMED_FEES_FROM_VOTE_INVALID_INPUT", "MALFORMED_FEES_IN_PERMANENT_VOTE", "MALFORMED_FEES_INVALID_QUOTE_VALUE", "MALFORMED_FEES_MULTIPLE_FEE_EMPTY", "MALFORMED_FEES_PAY_TO_INVALID", "MALFORMED_FEES_TOKEN_NOT_TOKEN", "FEE_IS_QUOTE", "FEE_QUOTE_MISSING_FEES", "FEE_NOT_QUOTE", "MALFORMED_FEES_KIND_MISSING", "MALFORMED_FEES_QUOTE_INVALID"];
3
+ export declare const FullVoteErrorCodes: ("VOTE_INVALID_CONSTRUCTION" | "VOTE_INVALID_VERSION" | "VOTE_SERIAL_MISMATCH" | "VOTE_INVALID_CONSTRUCTION_JSON" | "VOTE_SIGNATURE_INVALID" | "VOTE_EXPIRED" | "VOTE_INVALID_VALIDITY" | "VOTE_MOMENT_BEFORE_VALIDITY_FROM" | "VOTE_STAPLE_INVALID_CONSTRUCTION" | "VOTE_STAPLE_ALL_VOTES_MUST_HAVE_SAME_BLOCKS_COUNT" | "VOTE_STAPLE_ALL_VOTES_MUST_HAVE_SAME_BLOCKS_MISSING" | "VOTE_STAPLE_ALL_VOTES_MUST_HAVE_SAME_BLOCKS_ORDER" | "VOTE_STAPLE_DUPLICATE_VOTE_ISSUER" | "VOTE_STAPLE_PERMANENCE_MISMATCH" | "VOTE_BUILDER_INVALID_CONSTRUCTION" | "VOTE_BUILDER_INVALID_BLOCK_TYPE" | "VOTE_BUILDER_INVALID_SERIAL" | "VOTE_BUILDER_INVALID_VALID_TO_FROM" | "VOTE_BUILDER_INVALID_FEE" | "VOTE_MALFORMED_WRAPPER" | "VOTE_MALFORMED_VOTE_WRAPPER" | "VOTE_MALFORMED_VOTE_CONTENT" | "VOTE_MALFORMED_VOTE_CONTENT_EXTRA_DATA" | "VOTE_MALFORMED_VOTE_VERSION" | "VOTE_MALFORMED_VOTE_SERIAL" | "VOTE_MALFORMED_VOTE_SIGNATURE_INFORMATION" | "VOTE_MALFORMED_VOTE_ISSUER_INFORMATION" | "VOTE_MALFORMED_VOTE_SUBJECT_INFORMATION" | "VOTE_MALFORMED_VOTE_VALIDITY_INFORMATION" | "VOTE_MALFORMED_VOTE_EXTENSIONS" | "VOTE_MALFORMED_VOTE_EXTENSIONS_DATA" | "VOTE_MALFORMED_VOTE_EXTENSIONS_VALUE" | "VOTE_MALFORMED_VOTE_EXTENSIONS_VALUE_OID" | "VOTE_MALFORMED_VOTE_EXTENSIONS_VALUE_CRITICAL" | "VOTE_MALFORMED_VOTE_EXTENSIONS_VALUE_CRITICAL_TYPE" | "VOTE_MALFORMED_VOTE_SIGNATURE_SCHEME_DOES_NOT_MATCH_ISSUER" | "VOTE_MALFORMED_VOTE_SIGNATURE_SCHEME_DOES_NOT_MATCH_WRAPPER" | "VOTE_MALFORMED_VOTE_SIGNATURE_SCHEME_ECDSA_INVALID_CURVE" | "VOTE_MALFORMED_VOTE_SIGNATURE_UNSUPPORTED_SCHEME" | "VOTE_MALFORMED_VOTE_SUBJECT_PUBLIC_KEY_INFORMATION" | "VOTE_MALFORMED_VOTE_SIGNATURE_VALUE" | "VOTE_MALFORMED_VOTE_NO_BLOCKS_FOUND" | "VOTE_MALFORMED_STAPLE" | "VOTE_MALFORMED_STAPLE_BLOCKS" | "VOTE_MALFORMED_STAPLE_BLOCKS_AT_LEAST_ONE" | "VOTE_MALFORMED_STAPLE_VOTES" | "VOTE_MALFORMED_STAPLE_VOTES_AT_LEAST_ONE" | "VOTE_MALFORMED_FIND_RDN_INVALID_TYPE" | "VOTE_MALFORMED_FIND_RDN_MUST_HAVE_ONE" | "VOTE_MALFORMED_FIND_RDN_PART_WELL_FORMED" | "VOTE_MALFORMED_FIND_RDN_MUST_BE_SET" | "VOTE_MALFORMED_FIND_RDN_TYPE_MUST_BE_OID" | "VOTE_MALFORMED_HASHES_FROM_VOTE_INVALID_INPUT" | "VOTE_MALFORMED_HASHES_FROM_VOTE_INVALID_TYPE" | "VOTE_MALFORMED_HASHES_FROM_VOTE_INVALID_CONTEXT_SPECIFIC" | "VOTE_MALFORMED_HASHES_FROM_VOTE_DATA_NEEDS_OID" | "VOTE_MALFORMED_HASHES_FROM_VOTE_DATA_HASH_DATA_MUST_BE_SEQUENCE" | "VOTE_MALFORMED_HASHES_FROM_VOTE_DATA_NOT_TWO_ITEMS" | "VOTE_MALFORMED_HASHES_FROM_VOTE_DATA_UNSUPPORTED_HASH_FUNC" | "VOTE_MALFORMED_HASHES_FROM_VOTE_DATA_UNSUPPORTED_HASH_TYPE" | "VOTE_MALFORMED_HASHES_FROM_VOTE_DATA_SECOND_MUST_BE_SEQUENCE" | "VOTE_MALFORMED_FEES_AMOUNT" | "VOTE_MALFORMED_FEES_FROM_VOTE_INVALID_INPUT" | "VOTE_MALFORMED_FEES_IN_PERMANENT_VOTE" | "VOTE_MALFORMED_FEES_INVALID_QUOTE_VALUE" | "VOTE_MALFORMED_FEES_MULTIPLE_FEE_EMPTY" | "VOTE_MALFORMED_FEES_PAY_TO_INVALID" | "VOTE_MALFORMED_FEES_TOKEN_NOT_TOKEN" | "VOTE_FEE_IS_QUOTE" | "VOTE_FEE_QUOTE_MISSING_FEES" | "VOTE_FEE_NOT_QUOTE" | "VOTE_MALFORMED_FEES_KIND_MISSING" | "VOTE_MALFORMED_FEES_QUOTE_INVALID")[];
4
4
  export type VoteErrorCode = typeof FullVoteErrorCodes[number];
5
5
  export default class KeetaNetVoteError extends KeetaNetErrorBase<VoteErrorCode> {
6
6
  static readonly isInstance: (obj: any, strict?: boolean) => obj is KeetaNetVoteError;
package/lib/index.d.ts CHANGED
@@ -11,6 +11,7 @@ import { KeetaNetError as Error } from './error';
11
11
  import * as ASN1 from './utils/asn1';
12
12
  import * as Bloom from './utils/bloom';
13
13
  import * as Buffer from './utils/buffer';
14
+ import * as DomainSeparation from './utils/domain-separation';
14
15
  import * as Hash from './utils/hash';
15
16
  import * as Helper from './utils/helper';
16
17
  import * as Initial from './utils/initial';
@@ -35,11 +36,12 @@ declare const _default: {
35
36
  ASN1: typeof ASN1;
36
37
  Bloom: typeof Bloom;
37
38
  Buffer: typeof Buffer;
39
+ Certificate: typeof Certificate;
40
+ Conversion: typeof Conversion;
41
+ DomainSeparation: typeof DomainSeparation;
38
42
  Hash: typeof Hash;
39
43
  Helper: typeof Helper;
40
44
  Initial: typeof Initial;
41
- Conversion: typeof Conversion;
42
- Certificate: typeof Certificate;
43
45
  };
44
46
  };
45
47
  export default _default;
@@ -1,10 +1,10 @@
1
1
  import type { VoteStaple } from '../vote';
2
2
  import type Vote from '../vote';
3
3
  import type { GenericAccount, TokenAddress } from '../account';
4
- import Account from '../account';
4
+ import Account, { AccountKeyAlgorithm } from '../account';
5
5
  import { Block, BlockHash } from '../block';
6
6
  import type { LedgerConfig, LedgerSelector, LedgerStorage, LedgerStorageAPI } from '.';
7
- import type { AccountInfo, ACLRow, ACLEntry, ACLUpdate } from './types';
7
+ import type { AccountInfo, ACLRow, ACLEntry, ACLUpdate, AccountInfoForType } from './types';
8
8
  import type Node from '../node';
9
9
  import type Stats from '../stats';
10
10
  import type { BaseSet, ExternalSet } from '../permissions';
@@ -62,6 +62,18 @@ export declare function validateNumericValue(value: bigint, block: Pick<Block, '
62
62
  }): void;
63
63
  export declare function validateBlockSignerCount(amount: bigint, network: bigint): void;
64
64
  export declare function validateBlockSignerDepth(depth: bigint, network: bigint): void;
65
+ /**
66
+ * Determines if an account type can delegate voting weight via SET_REP.
67
+ *
68
+ * Regular accounts (ECDSA_SECP256K1, ED25519, ECDSA_SECP256R1) can always delegate.
69
+ * Among identifier accounts, only STORAGE accounts can delegate.
70
+ * TOKEN, NETWORK, and MULTISIG identifier accounts cannot delegate.
71
+ *
72
+ * @param keyType - The account key algorithm type to check
73
+ * @returns true if the account type can use SET_REP to delegate, false otherwise
74
+ *
75
+ */
76
+ export declare function canDelegate(keyType: AccountKeyAlgorithm): boolean;
65
77
  /**
66
78
  * Compute effects on the ledger from block effects
67
79
  */
@@ -129,7 +141,7 @@ export declare abstract class LedgerStorageBase {
129
141
  preAdjust(input: VoteStaple, mayDefer?: boolean, transaction?: any): Promise<{
130
142
  [hash: string]: bigint;
131
143
  }>;
132
- _formatAccountInfoFromRow(account: GenericAccount, row?: AccountInfoUnparsedRow | undefined): AccountInfo;
144
+ _formatAccountInfoFromRow<T extends AccountKeyAlgorithm = AccountKeyAlgorithm>(account: Account<T>, row: AccountInfoUnparsedRow | undefined): AccountInfoForType<T>;
133
145
  _validateAccountInfoKeys(account: GenericAccount, info: Partial<AccountInfo>): void;
134
146
  /**
135
147
  * @param moment - The date to use as the base for the timestamp.
@@ -2,10 +2,10 @@ import { VoteStaple, Vote } from '../vote';
2
2
  import { Block, BlockHash } from '../block';
3
3
  import type { VoteBlockHash, VoteBlockHashMap } from '../vote';
4
4
  import type { GenericAccount, IdentifierAddress, TokenAddress } from '../account';
5
- import Account from '../account';
5
+ import Account, { AccountKeyAlgorithm } from '../account';
6
6
  import type { Ledger, LedgerConfig, LedgerStorageAPI, LedgerSelector, PaginatedVotes, GetVotesAfterOptions, LedgerStorageTransactionBaseOptions, IdempotentKey } from '../ledger';
7
7
  import { LedgerStorageTransactionBase } from '../ledger';
8
- import type { AccountInfo, ACLRow, GetAllBalancesResponse, LedgerStatistics, CertificateWithIntermediates } from './types';
8
+ import type { ACLRow, GetAllBalancesResponse, LedgerStatistics, CertificateWithIntermediates, AccountInfoForType } from './types';
9
9
  import { LedgerStorageBase } from './common';
10
10
  import type { ComputedEffectOfBlocks } from './effects';
11
11
  import type { CertificateHash } from '../utils/certificate';
@@ -50,8 +50,8 @@ declare class DynamoDBTransaction extends LedgerStorageTransactionBase {
50
50
  getHeadBlocks(accounts: GenericAccount[], from: LedgerSelector): Promise<{
51
51
  [publicKey: string]: Block | null;
52
52
  }>;
53
- getAccountRep(userAccount: Account | string): Promise<Account | null>;
54
- getAccountInfo(account: GenericAccount | string): Promise<AccountInfo>;
53
+ getAccountRep(userAccount: GenericAccount | string): Promise<Account | null>;
54
+ getAccountInfo<T extends AccountKeyAlgorithm = AccountKeyAlgorithm>(account: Account<T> | string): Promise<AccountInfoForType<T>>;
55
55
  listOwners(identifier: IdentifierAddress): Promise<Account[]>;
56
56
  listACLsByEntity(entity: GenericAccount): Promise<ACLRow[]>;
57
57
  listACLsByPrincipal(principal: GenericAccount, entityList?: GenericAccount[]): Promise<ACLRow[]>;
@@ -90,8 +90,8 @@ export declare class DBDynamoDB extends LedgerStorageBase implements LedgerStora
90
90
  getHeadBlocks(transaction: DynamoDBTransaction, accounts: GenericAccount[], from: LedgerSelector): Promise<{
91
91
  [publicKey: string]: Block | null;
92
92
  }>;
93
- getAccountRep(transaction: DynamoDBTransaction, account: Account | string): Promise<Account | null>;
94
- getAccountInfo(transaction: DynamoDBTransaction, account: GenericAccount | string): Promise<AccountInfo>;
93
+ getAccountRep(transaction: DynamoDBTransaction, account: GenericAccount | string): Promise<Account | null>;
94
+ getAccountInfo<T extends AccountKeyAlgorithm = AccountKeyAlgorithm>(transaction: DynamoDBTransaction, account: Account<T> | string): Promise<AccountInfoForType<T>>;
95
95
  listOwners(transaction: DynamoDBTransaction, identifier: IdentifierAddress): Promise<Account[]>;
96
96
  listACLsByPrincipal(transaction: DynamoDBTransaction, principal: GenericAccount, entityList?: GenericAccount[]): Promise<ACLRow[]>;
97
97
  listACLsByEntity(transaction: DynamoDBTransaction, entity: GenericAccount): Promise<ACLRow[]>;
@@ -5,7 +5,7 @@ import type { GenericAccount, IdentifierAddress, TokenAddress } from '../account
5
5
  import Account, { AccountKeyAlgorithm } from '../account';
6
6
  import type { Ledger, LedgerConfig, LedgerStorageAPI, LedgerSelector, PaginatedVotes, GetVotesAfterOptions, LedgerStorageTransactionBaseOptions } from '../ledger';
7
7
  import { IdempotentKey, LedgerStorageTransactionBase } from '../ledger';
8
- import type { AccountInfo, ACLRow, GetAllBalancesResponse, LedgerStatistics, CertificateWithIntermediates } from './types';
8
+ import type { ACLRow, GetAllBalancesResponse, LedgerStatistics, CertificateWithIntermediates, AccountInfoForType } from './types';
9
9
  import { LedgerStorageBase } from './common';
10
10
  import type { PoolClient as PostgresPoolClient } from 'pg';
11
11
  import { Pool as PostgresPool } from 'pg';
@@ -35,7 +35,7 @@ export declare class DBPostgres extends LedgerStorageBase implements LedgerStora
35
35
  getBalance(transaction: PostgresTransaction, account: GenericAccount, token: TokenAddress, options?: PostgresSelectOptions): Promise<bigint>;
36
36
  getAllBalances(transaction: PostgresTransaction, account: GenericAccount): Promise<GetAllBalancesResponse>;
37
37
  addPendingVote(transaction: PostgresTransaction, votesAndBlocks: VoteStaple): Promise<void>;
38
- getAccountRep(transaction: PostgresTransaction, userAccount: Account | string): Promise<Account | null>;
38
+ getAccountRep(transaction: PostgresTransaction, userAccount: GenericAccount | string): Promise<Account | null>;
39
39
  /**
40
40
  * If an adjustment cannot be made right now, defer it for follow-up
41
41
  */
@@ -43,7 +43,7 @@ export declare class DBPostgres extends LedgerStorageBase implements LedgerStora
43
43
  listOwners(transaction: PostgresTransaction, entity: IdentifierAddress): Promise<Account<AccountKeyAlgorithm.TOKEN>[]>;
44
44
  listACLsByEntity(transaction: PostgresTransaction, entity: GenericAccount): Promise<ACLRow[]>;
45
45
  listACLsByPrincipal(transaction: PostgresTransaction, principal: GenericAccount, entityList?: GenericAccount[]): Promise<ACLRow[]>;
46
- getAccountInfo(transaction: PostgresTransaction, account: GenericAccount | string): Promise<AccountInfo>;
46
+ getAccountInfo<T extends AccountKeyAlgorithm = AccountKeyAlgorithm>(transaction: PostgresTransaction, account: Account<T> | string): Promise<AccountInfoForType<T>>;
47
47
  adjust(transaction: PostgresTransaction, input: VoteStaple, changes: ComputedEffectOfBlocks, mayDefer?: boolean, completedStaples?: Set<string>): Promise<VoteStaple[]>;
48
48
  getBlock(transaction: PostgresTransaction, block: BlockHash, from: LedgerSelector): Promise<Block | null>;
49
49
  getBlockHeight(transaction: PostgresTransaction, blockHash: BlockHash, account: GenericAccount): Promise<bigint | null>;
@@ -3,10 +3,10 @@ import type { Block } from '../block';
3
3
  import { BlockHash } from '../block';
4
4
  import type { VoteBlockHash, VoteBlockHashMap } from '../vote';
5
5
  import type { GenericAccount, IdentifierAddress, TokenAddress } from '../account';
6
- import Account from '../account';
6
+ import Account, { AccountKeyAlgorithm } from '../account';
7
7
  import type { Ledger, LedgerConfig, LedgerStorageAPI, LedgerSelector, PaginatedVotes, GetVotesAfterOptions, LedgerStorageTransactionBaseOptions } from '../ledger';
8
8
  import { IdempotentKey, LedgerStorageTransactionBase } from '../ledger';
9
- import type { AccountInfo, ACLRow, GetAllBalancesResponse, LedgerStatistics, CertificateWithIntermediates } from './types';
9
+ import type { ACLRow, GetAllBalancesResponse, LedgerStatistics, CertificateWithIntermediates, AccountInfoForType } from './types';
10
10
  import type { KVStorageProviderAPI } from '../kv';
11
11
  import { LedgerStorageBase } from './common';
12
12
  import type { Database as GoogleSpannerDatabase } from '@google-cloud/spanner';
@@ -70,7 +70,7 @@ export declare class DBSpanner extends LedgerStorageBase implements LedgerStorag
70
70
  getBalance(transaction: SpannerTransaction, account: GenericAccount | string, token: TokenAddress | string): Promise<bigint>;
71
71
  getAllBalances(transaction: SpannerTransaction, account: GenericAccount): Promise<GetAllBalancesResponse>;
72
72
  addPendingVote(transaction: SpannerTransaction, votesAndBlocks: VoteStaple): Promise<void>;
73
- getAccountRep(transaction: SpannerTransaction, userAccount: Account | string): Promise<Account | null>;
73
+ getAccountRep(transaction: SpannerTransaction, userAccount: GenericAccount | string): Promise<Account | null>;
74
74
  /**
75
75
  * If an adjustment cannot be made right now, defer it for follow-up
76
76
  */
@@ -97,7 +97,7 @@ export declare class DBSpanner extends LedgerStorageBase implements LedgerStorag
97
97
  getHeadBlocks(transaction: SpannerTransaction, accounts: GenericAccount[], from: LedgerSelector): Promise<{
98
98
  [publicKey: string]: Block | null;
99
99
  }>;
100
- getAccountInfo(transaction: SpannerTransaction, account: GenericAccount | string): Promise<AccountInfo>;
100
+ getAccountInfo<T extends AccountKeyAlgorithm = AccountKeyAlgorithm>(transaction: SpannerTransaction, account: Account<T> | string): Promise<AccountInfoForType<T>>;
101
101
  listOwners(transaction: SpannerTransaction, entity: IdentifierAddress): Promise<GenericAccount[]>;
102
102
  listACLsByEntity(transaction: SpannerTransaction, entity: GenericAccount): Promise<ACLRow[]>;
103
103
  listACLsByPrincipal(transaction: SpannerTransaction, principal: GenericAccount, entityList?: GenericAccount[]): Promise<ACLRow[]>;
@@ -15,7 +15,7 @@ declare const ColumnTypes: {
15
15
  readonly toComparable: (name: string) => string;
16
16
  };
17
17
  readonly ACCOUNT: {
18
- readonly fromSpanner: (pubKey: string) => Account<AccountKeyAlgorithm.ECDSA_SECP256K1 | AccountKeyAlgorithm.ED25519 | AccountKeyAlgorithm.ECDSA_SECP256R1>;
18
+ readonly fromSpanner: (pubKey: string) => Account<import("../account").KeyPairKeyAlgorithm>;
19
19
  readonly toSpanner: (account: Account) => import("../account").Secp256K1PublicKeyString | import("../account").Secp256R1PublicKeyString | import("../account").ED25519PublicKeyString;
20
20
  readonly dbType: string;
21
21
  readonly dbSize: number;
@@ -304,7 +304,7 @@ declare const schema: {
304
304
  readonly delegation: {
305
305
  readonly type: "TABLE";
306
306
  readonly columns: {
307
- readonly account: ColumnInterface<"ACCOUNT", false>;
307
+ readonly account: ColumnInterface<"GENERIC_ACCOUNT", false>;
308
308
  readonly delegatedToRep: ColumnInterface<"ACCOUNT", false>;
309
309
  };
310
310
  readonly key: readonly [Key];
@@ -6,7 +6,7 @@ import type { GenericAccount, IdentifierAddress, TokenAddress } from '../account
6
6
  import Account, { AccountKeyAlgorithm } from '../account';
7
7
  import type { Ledger, LedgerConfig, LedgerStorageAPI, LedgerSelector, PaginatedVotes, GetVotesAfterOptions, LedgerStorageTransactionBaseOptions } from '../ledger';
8
8
  import { IdempotentKey, LedgerStorageTransactionBase } from '../ledger';
9
- import type { AccountInfo, ACLRow, GetAllBalancesResponse, LedgerStatistics, CertificateWithIntermediates } from './types';
9
+ import type { ACLRow, GetAllBalancesResponse, LedgerStatistics, CertificateWithIntermediates, AccountInfoForType } from './types';
10
10
  import { LedgerStorageBase } from './common';
11
11
  import * as sqlite from 'sqlite';
12
12
  import type { ComputedEffectOfBlocks } from './effects';
@@ -34,7 +34,7 @@ export declare class DBSqlite extends LedgerStorageBase implements LedgerStorage
34
34
  getBalance(transaction: DBSqliteTransaction, account: GenericAccount, token: TokenAddress): Promise<bigint>;
35
35
  getAllBalances(transaction: DBSqliteTransaction, account: GenericAccount): Promise<GetAllBalancesResponse>;
36
36
  addPendingVote(transaction: DBSqliteTransaction, votesAndBlocks: VoteStaple): Promise<void>;
37
- getAccountRep(transaction: DBSqliteTransaction, userAccount: Account | string): Promise<Account | null>;
37
+ getAccountRep(transaction: DBSqliteTransaction, userAccount: GenericAccount | string): Promise<Account | null>;
38
38
  /**
39
39
  * If an adjustment cannot be made right now, defer it for follow-up
40
40
  */
@@ -42,7 +42,7 @@ export declare class DBSqlite extends LedgerStorageBase implements LedgerStorage
42
42
  listOwners(transaction: DBSqliteTransaction, entity: IdentifierAddress): Promise<Account<AccountKeyAlgorithm.TOKEN>[]>;
43
43
  listACLsByEntity(transaction: DBSqliteTransaction, entity: GenericAccount): Promise<ACLRow[]>;
44
44
  listACLsByPrincipal(transaction: DBSqliteTransaction, principal: GenericAccount, entityList?: GenericAccount[]): Promise<ACLRow[]>;
45
- getAccountInfo(transaction: DBSqliteTransaction, account: GenericAccount | string): Promise<AccountInfo>;
45
+ getAccountInfo<T extends AccountKeyAlgorithm = AccountKeyAlgorithm>(transaction: DBSqliteTransaction, account: Account<T> | string): Promise<AccountInfoForType<T>>;
46
46
  adjust(transaction: DBSqliteTransaction, input: VoteStaple, changes: ComputedEffectOfBlocks, mayDefer?: boolean, completedStaples?: Set<string>): Promise<VoteStaple[]>;
47
47
  getBlock(transaction: DBSqliteTransaction, block: BlockHash, from: LedgerSelector): Promise<Block | null>;
48
48
  getBlockHeight(transaction: DBSqliteTransaction, blockHash: BlockHash, account: GenericAccount): Promise<bigint | null>;
@@ -3,9 +3,10 @@ import Account from '../account';
3
3
  import type { AdjustMethod } from '../block';
4
4
  import { Block } from '../block';
5
5
  import type * as Operations from '../block/operations';
6
- import type { UserEditableAccountInfo, ACLEntry, ACLUpdate } from '../ledger/types';
6
+ import type { ACLEntry, ACLUpdate, AccountInfo } from '../ledger/types';
7
7
  import type { Certificate, CertificateBundle } from '../utils/certificate';
8
8
  import { CertificateHash } from '../utils/certificate';
9
+ import type { DistributiveOmit } from '../utils/helper';
9
10
  interface NumericValueEntry {
10
11
  value: bigint;
11
12
  }
@@ -49,6 +50,7 @@ interface CreateIdentifierRequest {
49
50
  type DelegationUpdate = {
50
51
  delegateTo: Account;
51
52
  };
53
+ type UserEditableAccountInfo = DistributiveOmit<AccountInfo, 'supply' | 'account'>;
52
54
  interface ComputedBlocksEffectFields {
53
55
  balance?: ComputedBlocksEffectTokenChangesField;
54
56
  supply?: NumericValueEntry[];
@@ -1,12 +1,12 @@
1
1
  import { VoteStaple, Vote, VoteBlockHashMap } from '../vote';
2
2
  import { Block, BlockHash } from '../block';
3
3
  import type { FeeAmountAndToken, VoteBlockHash, VoteQuote } from '../vote';
4
- import type { GenericAccount, IdentifierAddress, NetworkAddress, StorageAddress, TokenAddress } from '../account';
4
+ import type { AccountKeyAlgorithm, GenericAccount, IdentifierAddress, NetworkAddress, StorageAddress, TokenAddress } from '../account';
5
5
  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, CertificateWithIntermediates } from './types';
9
+ import type { ACLRow, GetAllBalancesResponse, LedgerStatistics, CertificateWithIntermediates, AccountInfoForType } from './types';
10
10
  import LedgerRequestCache from './cache';
11
11
  import type { Logger } from '../log';
12
12
  import type { CertificateHash } from '../utils/certificate';
@@ -37,7 +37,7 @@ export interface LedgerConfig {
37
37
  /**
38
38
  * Provided function to compute fees for a given set of Blocks and computed effects
39
39
  */
40
- computeFeeFromBlocks: (ledger: Ledger, blocks: Block[], effects: ComputedEffectOfBlocks) => FeeAmountAndToken | null;
40
+ computeFeeFromBlocks: (ledger: Ledger, blocks: Block[], effects: ComputedEffectOfBlocks) => FeeAmountAndToken | FeeAmountAndToken[] | null;
41
41
  /**
42
42
  * Storage mechanism
43
43
  */
@@ -189,7 +189,7 @@ export interface LedgerStorageAPI {
189
189
  * If token account, return supply
190
190
  * If non user account, returns default permissions
191
191
  */
192
- getAccountInfo: (transaction: any, account: GenericAccount | string) => Promise<AccountInfo>;
192
+ getAccountInfo: <T extends AccountKeyAlgorithm = AccountKeyAlgorithm>(transaction: any, account: Account<T> | string) => Promise<AccountInfoForType<T>>;
193
193
  /**
194
194
  * List all owners of an account
195
195
  */
@@ -285,7 +285,7 @@ export interface LedgerStorageAPI {
285
285
  /**
286
286
  * Get the Account Representative
287
287
  */
288
- getAccountRep: (transaction: any, account: Account | string) => Promise<Account | null>;
288
+ getAccountRep: (transaction: any, account: GenericAccount | string) => Promise<Account | null>;
289
289
  /**
290
290
  * Get Votes after a specific moment
291
291
  */
@@ -350,8 +350,8 @@ declare class LedgerAtomicInterface {
350
350
  [account: string]: Block | null;
351
351
  }>;
352
352
  getHeadBlock(account: GenericAccount, from: LedgerSelector): Promise<Block | null>;
353
- getAccountRep(account: Account | string): Promise<Account | null>;
354
- getAccountInfo(account: GenericAccount | string): Promise<AccountInfo>;
353
+ getAccountRep(account: GenericAccount | string): Promise<Account | null>;
354
+ getAccountInfo<T extends AccountKeyAlgorithm = AccountKeyAlgorithm>(account: Account<T> | string): Promise<AccountInfoForType<T>>;
355
355
  getBlock(blockhash: BlockHash, from?: LedgerSelector): Promise<Block | null>;
356
356
  getAccountsBlockHeightInfo(toFetch: {
357
357
  account: GenericAccount;
@@ -368,7 +368,7 @@ declare class LedgerAtomicInterface {
368
368
  getStaplesFromBlockHashes(hashes: BlockHash[]): Promise<VoteStaple[]>;
369
369
  getVoteStaplesAfter(moment: Date, limit?: number, options?: GetVotesAfterOptions): Promise<VoteStaple[]>;
370
370
  gc(timeLimitMS?: number): Promise<boolean>;
371
- getFee(blocks: Block[], effectsInput?: ComputedEffectOfBlocks): Promise<FeeAmountAndToken | null>;
371
+ getFee(blocks: Block[], effectsInput?: ComputedEffectOfBlocks): Promise<FeeAmountAndToken | FeeAmountAndToken[] | null>;
372
372
  getIdempotentBlockHash(account: GenericAccount, idempotent: string | Buffer, from?: LedgerSelector, excludeBlockHash?: BlockHash): Promise<BlockHash | null>;
373
373
  getBlockFromIdempotent(account: GenericAccount, idempotent: string | Buffer, from?: LedgerSelector, excludeBlockHash?: BlockHash): Promise<Block | null>;
374
374
  _testingRunStorageFunction<T>(code: (storage: LedgerStorageAPI, transaction: LedgerStorageTransactionBase) => Promise<T>): Promise<T>;
@@ -414,7 +414,7 @@ export declare class Ledger implements Omit<LedgerAtomicInterface, 'commit' | 'a
414
414
  getHeadBlocks(...args: Parameters<LedgerAtomicInterface['getHeadBlocks']>): ReturnType<LedgerAtomicInterface['getHeadBlocks']>;
415
415
  getHeadBlock(...args: Parameters<LedgerAtomicInterface['getHeadBlock']>): ReturnType<LedgerAtomicInterface['getHeadBlock']>;
416
416
  getAccountRep(...args: Parameters<LedgerAtomicInterface['getAccountRep']>): ReturnType<LedgerAtomicInterface['getAccountRep']>;
417
- getAccountInfo(...args: Parameters<LedgerAtomicInterface['getAccountInfo']>): ReturnType<LedgerAtomicInterface['getAccountInfo']>;
417
+ getAccountInfo<T extends AccountKeyAlgorithm = AccountKeyAlgorithm>(account: Account<T> | string): Promise<AccountInfoForType<T>>;
418
418
  getBlock(...args: Parameters<LedgerAtomicInterface['getBlock']>): ReturnType<LedgerAtomicInterface['getBlock']>;
419
419
  getAccountsBlockHeightInfo(...args: Parameters<LedgerAtomicInterface['getAccountsBlockHeightInfo']>): ReturnType<LedgerAtomicInterface['getAccountsBlockHeightInfo']>;
420
420
  getVoteStaple(...args: Parameters<LedgerAtomicInterface['getVoteStaple']>): ReturnType<LedgerAtomicInterface['getVoteStaple']>;
@@ -1,8 +1,9 @@
1
- import type { Account, GenericAccount, MultisigAddress, TokenAddress } from '../account';
1
+ import type { Account, AccountKeyAlgorithm, GenericAccount, IdentifierKeyAlgorithm, MultisigAddress, TokenAddress } from '../account';
2
2
  import type { AdjustMethod } from '../block';
3
3
  import type { Permissions } from '../permissions';
4
4
  import type { DbStats, TimeStats } from '../stats';
5
5
  import type { Certificate, CertificateBundle } from '../utils/certificate';
6
+ import type { DistributiveOmit } from '../utils/helper';
6
7
  export interface MultisigConfig {
7
8
  signers: (Account | MultisigAddress)[];
8
9
  quorum: bigint;
@@ -10,7 +11,11 @@ export interface MultisigConfig {
10
11
  /**
11
12
  * Account info entry
12
13
  */
13
- export interface AccountInfo {
14
+ interface BaseAccountInfo<KeyType extends AccountKeyAlgorithm> {
15
+ /**
16
+ * The account that this info is for
17
+ */
18
+ account: Account<KeyType>;
14
19
  /**
15
20
  * A name for the account
16
21
  */
@@ -23,20 +28,48 @@ export interface AccountInfo {
23
28
  * Arbitrary metadata for the account
24
29
  */
25
30
  metadata: string;
26
- /**
27
- * If the account is a token, the supply of the token
28
- */
29
- supply?: bigint;
31
+ }
32
+ interface BaseIdentifierAccountInfo<KeyType extends IdentifierKeyAlgorithm> extends BaseAccountInfo<KeyType> {
30
33
  /**
31
34
  * The default permissions for the account
32
35
  */
33
36
  defaultPermission?: Permissions;
37
+ }
38
+ interface ECDSA_SECP256K1AccountInfo extends BaseAccountInfo<AccountKeyAlgorithm.ECDSA_SECP256K1> {
39
+ }
40
+ interface ECDSA_SECP256R1AccountInfo extends BaseAccountInfo<AccountKeyAlgorithm.ECDSA_SECP256R1> {
41
+ }
42
+ interface ED25519AccountInfo extends BaseAccountInfo<AccountKeyAlgorithm.ED25519> {
43
+ }
44
+ type KeyPairAccountInfo = ECDSA_SECP256K1AccountInfo | ECDSA_SECP256R1AccountInfo | ED25519AccountInfo;
45
+ interface TokenAccountInfo extends BaseIdentifierAccountInfo<AccountKeyAlgorithm.TOKEN> {
34
46
  /**
35
- * If this is a multisig account, the number of signers required
47
+ * The current supply of the token
36
48
  */
37
- multisigQuorum?: bigint;
49
+ supply: bigint;
50
+ }
51
+ interface MultisigAccountInfo extends BaseIdentifierAccountInfo<AccountKeyAlgorithm.MULTISIG> {
52
+ /**
53
+ * The number of signers required for this multisig
54
+ */
55
+ multisigQuorum: bigint | null;
56
+ }
57
+ interface NetworkAccountInfo extends BaseIdentifierAccountInfo<AccountKeyAlgorithm.NETWORK> {
58
+ }
59
+ interface StorageAccountInfo extends BaseIdentifierAccountInfo<AccountKeyAlgorithm.STORAGE> {
38
60
  }
39
- export type UserEditableAccountInfo = Omit<AccountInfo, 'supply'>;
61
+ export type AccountInfo = KeyPairAccountInfo | TokenAccountInfo | MultisigAccountInfo | StorageAccountInfo | NetworkAccountInfo;
62
+ export type AccountInfoWithoutAccount = DistributiveOmit<AccountInfo, 'account'>;
63
+ export type AccountInfoForType<T extends AccountKeyAlgorithm> = Extract<AccountInfo, {
64
+ account: Account<T>;
65
+ }>;
66
+ export declare function isIdentifierAccountInfo(info: AccountInfo): info is Extract<AccountInfo, {
67
+ account: Account<IdentifierKeyAlgorithm>;
68
+ }>;
69
+ export declare function isKeyPairAccountInfo(info: AccountInfo): info is KeyPairAccountInfo;
70
+ export declare function isAccountInfoOfType<T extends AccountKeyAlgorithm>(info: AccountInfo, type: T): info is Extract<AccountInfo, {
71
+ account: Account<T>;
72
+ }>;
40
73
  /**
41
74
  * Permissions types
42
75
  */
@@ -114,3 +147,4 @@ export interface CertificateWithIntermediates {
114
147
  certificate: Certificate;
115
148
  intermediates: CertificateBundle | null;
116
149
  }
150
+ export {};
@@ -586,6 +586,9 @@ function convertSingleValue(value, opts = {}) {
586
586
  return (checkPrefix(out, prefix, opts));
587
587
  }
588
588
  function toJSONSerializable(data, opts) {
589
+ if (data === undefined) {
590
+ throw (new Error('undefined is not JSON serializable'));
591
+ }
589
592
  return (JSON.parse(JSON.stringify(convertSingleValue(data, opts))));
590
593
  }
591
594
  function objectToBuffer(data, opts = {}) {
@@ -5659,6 +5659,10 @@ function assertNever(value) {
5659
5659
  // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
5660
5660
  throw new Error(`Unexpected value: ${value}`);
5661
5661
  }
5662
+
5663
+ /**
5664
+ * Asserts that the provided type is never.
5665
+ */
5662
5666
  ;// ./src/lib/log/target_console.ts
5663
5667
  function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
5664
5668
  function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
@@ -5786,6 +5790,9 @@ function convertSingleValue(value) {
5786
5790
  return checkPrefix(out, prefix, opts);
5787
5791
  }
5788
5792
  function toJSONSerializable(data, opts) {
5793
+ if (data === undefined) {
5794
+ throw new Error('undefined is not JSON serializable');
5795
+ }
5789
5796
  return JSON.parse(JSON.stringify(convertSingleValue(data, opts)));
5790
5797
  }
5791
5798
  function objectToBuffer(data) {
@@ -462,24 +462,12 @@ export declare class Certificate {
462
462
  * Get a JSON representation of the certificate
463
463
  */
464
464
  toJSON(options?: ToJSONSerializableOptions, includeChain?: boolean): {
465
- $binary?: string | undefined;
466
- $chain?: undefined;
467
465
  serial: string;
468
466
  notBefore: string;
469
467
  notAfter: string;
470
468
  subject: string;
471
469
  issuer: string;
472
470
  subjectPublicKey: import("../account").Secp256K1PublicKeyString | import("../account").Secp256R1PublicKeyString | import("../account").ED25519PublicKeyString;
473
- baseExtensions: {
474
- basicConstraints?: [ca: boolean, pathLenConstraint?: string | undefined] | undefined;
475
- keyUsage?: KeyUsage | undefined;
476
- subjectKeyIdentifier?: string | undefined;
477
- authorityKeyIdentifier?: {
478
- type: "context";
479
- value: 0;
480
- contains: string;
481
- } | undefined;
482
- } | undefined;
483
471
  subjectDN: {
484
472
  name: string;
485
473
  value: string;
@@ -489,6 +477,19 @@ export declare class Certificate {
489
477
  value: string;
490
478
  }[];
491
479
  $hash: CertificateHashString;
480
+ } & {
481
+ $binary?: string | undefined;
482
+ $chain?: undefined;
483
+ baseExtensions?: ({} & {
484
+ basicConstraints?: [ca: boolean, pathLenConstraint?: string | null | undefined] | undefined;
485
+ keyUsage?: KeyUsage | undefined;
486
+ subjectKeyIdentifier?: string | undefined;
487
+ authorityKeyIdentifier?: ({
488
+ type: "context";
489
+ value: 0;
490
+ contains: string;
491
+ } & {}) | undefined;
492
+ }) | undefined;
492
493
  };
493
494
  }
494
495
  export {};
@@ -15,13 +15,22 @@ type AddBinaryIfIncluded<I> = I extends {
15
15
  } : I;
16
16
  type IsTuple<T> = T extends readonly any[] ? number extends T['length'] ? false : true : false;
17
17
  type JSONDepthLimit = [never, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
18
- export type ToJSONSerializable<T, Options extends ToJSONSerializableOptions = ToJSONSerializableOptions, Depth extends number = 10> = T extends never ? never : Depth extends never ? never : T extends JSONSerializable ? T : T extends undefined ? undefined : T extends bigint ? string : T extends Date ? string : T extends Buffer | ArrayBuffer ? string : T extends {
18
+ export type ToJSONSerializable<T, Options extends ToJSONSerializableOptions = ToJSONSerializableOptions, Depth extends number = 10> = T extends never ? never : Depth extends never ? never : symbol extends keyof T ? {
19
+ [key: symbol]: never;
20
+ } : T extends JSONSerializable ? T : T extends undefined ? never : T extends bigint ? string : T extends Date ? string : T extends Buffer | ArrayBuffer ? string : T extends {
19
21
  toJSON(): infer U;
20
22
  } ? Options['addBinary'] extends true ? ToJSONSerializable<AddBinaryIfIncluded<U>, Options, JSONDepthLimit[Depth]> : ToJSONSerializable<U, Options, JSONDepthLimit[Depth]> : IsTuple<T> extends true ? {
23
+ [K in keyof T]: undefined extends T[K] ? ToJSONSerializable<Exclude<T[K], undefined>, Options, JSONDepthLimit[Depth]> | null : ToJSONSerializable<T[K], Options, JSONDepthLimit[Depth]>;
24
+ } : T extends readonly (infer U)[] ? Array<undefined extends U ? ToJSONSerializable<Exclude<U, undefined>, Options, JSONDepthLimit[Depth]> | null : ToJSONSerializable<U, Options, JSONDepthLimit[Depth]>> : T extends object ? (string extends keyof T ? {
21
25
  [K in keyof T]: ToJSONSerializable<T[K], Options, JSONDepthLimit[Depth]>;
22
- } : T extends readonly (infer U)[] ? ToJSONSerializable<U, Options, JSONDepthLimit[Depth]>[] : T extends object ? {
26
+ } : number extends keyof T ? {
23
27
  [K in keyof T]: ToJSONSerializable<T[K], Options, JSONDepthLimit[Depth]>;
24
- } : never;
28
+ } : // number index signature type
29
+ {
30
+ [K in keyof T as ({} extends Pick<T, K> ? never : undefined extends T[K] ? never : K)]: ToJSONSerializable<T[K], Options, JSONDepthLimit[Depth]>;
31
+ } & {
32
+ [K in keyof T as ({} extends Pick<T, K> ? K : undefined extends T[K] ? K : never)]?: ToJSONSerializable<Exclude<T[K], undefined>, Options, JSONDepthLimit[Depth]>;
33
+ }) : never;
25
34
  export declare function toJSONSerializable<Value = never, Options extends ToJSONSerializableOptions = ToJSONSerializableOptions>(data: Value, opts?: Options): ToJSONSerializable<Value, Options>;
26
35
  export declare function objectToBuffer(data: any, opts?: ToJSONSerializableOptions): Buffer;
27
36
  export declare function parseHexBigIntString(input: string): bigint;
@@ -0,0 +1,31 @@
1
+ import { ValidateASN1 } from './asn1';
2
+ /**
3
+ * Version for Keeta's domain separation namespace schema, encoded as the
4
+ * `INTEGER` field of `namespacePrefixSchema`.
5
+ */
6
+ export declare const KeetaNamespaceVersion = 0;
7
+ /**
8
+ * Maximum domain separation namespace length in bytes (for strings,
9
+ * this is the UTF-8 byte length, not the character count).
10
+ */
11
+ export declare const MaxNamespaceLength = 255;
12
+ /**
13
+ * Schema for the namespace prefix:
14
+ *
15
+ * ```asn1
16
+ * NamespacePrefix ::= SEQUENCE {
17
+ * version INTEGER,
18
+ * namespace OCTET STRING,
19
+ * data OCTET STRING
20
+ * }
21
+ * ```
22
+ */
23
+ export declare const namespacePrefixSchema: readonly [typeof ValidateASN1.IsInteger, typeof ValidateASN1.IsOctetString, typeof ValidateASN1.IsOctetString];
24
+ /**
25
+ * Apply the `NamespacePrefix` domain separator to `data`.
26
+ *
27
+ * String namespaces are UTF-8 encoded; ArrayBuffer namespaces are used
28
+ * verbatim. Namespace length MUST be 1-`MaxNamespaceLength` bytes after
29
+ * encoding.
30
+ */
31
+ export declare function applyNamespace(namespace: string | ArrayBuffer, data: ArrayBuffer): ArrayBuffer;
@@ -0,0 +1,53 @@
1
+ /**
2
+ * ExternalKeyPair for the Keeta Network which uses Google Cloud KMS
3
+ * for signing operations. This implementation supports ECDSA keys on
4
+ * both SECP256K1 and SECP256R1 curves, with potential for ED25519
5
+ * support in the future.
6
+ */
7
+ import type { KeyManagementServiceClient } from '@google-cloud/kms';
8
+ import type * as KeetaNet from '../../../client';
9
+ import type { AccountKeyAlgorithm } from '../../../lib/account';
10
+ import type * as crypto from 'node:crypto';
11
+ type KeetaGCPKMSKeyPairPackages = {
12
+ KeyManagementServiceClient: typeof KeyManagementServiceClient;
13
+ KeetaNet: {
14
+ lib: {
15
+ Account: typeof KeetaNet.lib.Account;
16
+ Utils: {
17
+ Helper: typeof KeetaNet.lib.Utils.Helper;
18
+ Buffer: typeof KeetaNet.lib.Utils.Buffer;
19
+ ASN1: typeof KeetaNet.lib.Utils.ASN1;
20
+ };
21
+ };
22
+ };
23
+ crypto: Pick<typeof crypto, 'createPublicKey'>;
24
+ };
25
+ type KeetaGCPKMSKeyPairOptions = {
26
+ /**
27
+ * The GCP KMS key resource name or config object.
28
+ * Format: projects/<project>/locations/<location>/keyRings/<keyRing>/cryptoKeys/<key>
29
+ */
30
+ key: string | {
31
+ projectId: string;
32
+ locationId: string;
33
+ keyRingId: string;
34
+ keyId: string;
35
+ versionId?: string;
36
+ };
37
+ /**
38
+ * Key type for the KMS key. Optional - will be auto-detected from KMS
39
+ * if not provided, but can be explicitly specified for validation.
40
+ */
41
+ keyType?: AccountKeyAlgorithm;
42
+ };
43
+ interface KeetaGCPKMSKeyPair extends InstanceType<typeof KeetaNet.lib.Account.ExternalKeyPair> {
44
+ /**
45
+ * The full GCP KMS key resource name used for this key pair.
46
+ */
47
+ readonly keyName: string;
48
+ }
49
+ interface KeetaGCPKMSKeyPairClass {
50
+ lookup: (options: KeetaGCPKMSKeyPairOptions) => Promise<KeetaGCPKMSKeyPair>;
51
+ }
52
+ export declare function KeetaGCPKMSKeyPairFactory(packages: KeetaGCPKMSKeyPairPackages): Omit<KeetaGCPKMSKeyPairClass, '_Testing'>;
53
+ export {};