@xyo-network/sdk-protocol 7.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +165 -0
- package/README.md +85 -0
- package/dist/_pkg/account/neutral/Account.d.ts +38 -0
- package/dist/_pkg/account/neutral/Jwt/base64url.d.ts +5 -0
- package/dist/_pkg/account/neutral/Jwt/createJwt.d.ts +3 -0
- package/dist/_pkg/account/neutral/Jwt/decodeJwt.d.ts +3 -0
- package/dist/_pkg/account/neutral/Jwt/digest.d.ts +4 -0
- package/dist/_pkg/account/neutral/Jwt/index.d.ts +6 -0
- package/dist/_pkg/account/neutral/Jwt/verifyJwt.d.ts +3 -0
- package/dist/_pkg/account/neutral/Key/AddressValue.d.ts +11 -0
- package/dist/_pkg/account/neutral/Key/EllipticKey.d.ts +4 -0
- package/dist/_pkg/account/neutral/Key/PrivateKey.d.ts +14 -0
- package/dist/_pkg/account/neutral/Key/PublicKey.d.ts +14 -0
- package/dist/_pkg/account/neutral/Key/index.d.ts +5 -0
- package/dist/_pkg/account/neutral/index.d.ts +6 -0
- package/dist/_pkg/account/neutral/index.mjs +547 -0
- package/dist/_pkg/account/neutral/lib/index.d.ts +2 -0
- package/dist/_pkg/account/neutral/lib/walletPath/combineWalletPaths.d.ts +2 -0
- package/dist/_pkg/account/neutral/lib/walletPath/formatWalletPath.d.ts +2 -0
- package/dist/_pkg/account/neutral/lib/walletPath/index.d.ts +4 -0
- package/dist/_pkg/account/neutral/lib/walletPath/isValidWalletPath.d.ts +3 -0
- package/dist/_pkg/account/neutral/register.d.ts +2 -0
- package/dist/_pkg/account-model/neutral/Account.d.ts +46 -0
- package/dist/_pkg/account-model/neutral/Algorithm.d.ts +5 -0
- package/dist/_pkg/account-model/neutral/Jwt/constants.d.ts +14 -0
- package/dist/_pkg/account-model/neutral/Jwt/index.d.ts +3 -0
- package/dist/_pkg/account-model/neutral/Jwt/types.d.ts +56 -0
- package/dist/_pkg/account-model/neutral/VerifierRegistry.d.ts +6 -0
- package/dist/_pkg/account-model/neutral/addressTo20Bytes.d.ts +2 -0
- package/dist/_pkg/account-model/neutral/index.d.ts +6 -0
- package/dist/_pkg/account-model/neutral/index.mjs +100 -0
- package/dist/_pkg/address/neutral/XyoAddress.d.ts +38 -0
- package/dist/_pkg/address/neutral/XyoLegacyAddress.d.ts +37 -0
- package/dist/_pkg/address/neutral/XyoQuantAddress.d.ts +33 -0
- package/dist/_pkg/address/neutral/index.d.ts +4 -0
- package/dist/_pkg/address/neutral/index.mjs +75 -0
- package/dist/_pkg/api/neutral/Api/Api.d.ts +8 -0
- package/dist/_pkg/api/neutral/Api/index.d.ts +2 -0
- package/dist/_pkg/api/neutral/Base.d.ts +32 -0
- package/dist/_pkg/api/neutral/Simple.d.ts +22 -0
- package/dist/_pkg/api/neutral/WithArchive.d.ts +4 -0
- package/dist/_pkg/api/neutral/index.d.ts +6 -0
- package/dist/_pkg/api/neutral/index.mjs +187 -0
- package/dist/_pkg/api/neutral/models/ArchivePath.d.ts +4 -0
- package/dist/_pkg/api/neutral/models/index.d.ts +2 -0
- package/dist/_pkg/api/neutral/objToQuery.d.ts +2 -0
- package/dist/_pkg/api-models/neutral/Config.d.ts +25 -0
- package/dist/_pkg/api-models/neutral/Envelope.d.ts +15 -0
- package/dist/_pkg/api-models/neutral/Error.d.ts +5 -0
- package/dist/_pkg/api-models/neutral/Reportable.d.ts +8 -0
- package/dist/_pkg/api-models/neutral/Response.d.ts +8 -0
- package/dist/_pkg/api-models/neutral/Warning.d.ts +2 -0
- package/dist/_pkg/api-models/neutral/index.d.ts +7 -0
- package/dist/_pkg/api-models/neutral/index.mjs +1 -0
- package/dist/_pkg/boundwitness/neutral/builder.d.ts +2 -0
- package/dist/_pkg/boundwitness/neutral/builder.mjs +3 -0
- package/dist/_pkg/boundwitness/neutral/index.d.ts +5 -0
- package/dist/_pkg/boundwitness/neutral/index.mjs +6 -0
- package/dist/_pkg/boundwitness/neutral/model.d.ts +2 -0
- package/dist/_pkg/boundwitness/neutral/model.mjs +3 -0
- package/dist/_pkg/boundwitness/neutral/validator.d.ts +2 -0
- package/dist/_pkg/boundwitness/neutral/validator.mjs +3 -0
- package/dist/_pkg/boundwitness/neutral/wrapper.d.ts +2 -0
- package/dist/_pkg/boundwitness/neutral/wrapper.mjs +3 -0
- package/dist/_pkg/boundwitness-builder/neutral/BoundWitnessBuilder.d.ts +48 -0
- package/dist/_pkg/boundwitness-builder/neutral/GeneratedBoundWitnessFields.d.ts +3 -0
- package/dist/_pkg/boundwitness-builder/neutral/Query/QueryBoundWitnessBuilder.d.ts +9 -0
- package/dist/_pkg/boundwitness-builder/neutral/Query/index.d.ts +2 -0
- package/dist/_pkg/boundwitness-builder/neutral/combinationsByBoundwitness.d.ts +10 -0
- package/dist/_pkg/boundwitness-builder/neutral/index.d.ts +5 -0
- package/dist/_pkg/boundwitness-builder/neutral/index.mjs +311 -0
- package/dist/_pkg/boundwitness-builder/neutral/intraBoundwitnessSchemaCombinations.d.ts +11 -0
- package/dist/_pkg/boundwitness-builder/neutral/uniqueAccounts.d.ts +3 -0
- package/dist/_pkg/boundwitness-builder/neutral/uniqueAddresses.d.ts +3 -0
- package/dist/_pkg/boundwitness-model/neutral/BoundWitness/BoundWitness.d.ts +173 -0
- package/dist/_pkg/boundwitness-model/neutral/BoundWitness/BoundWitnessJsonSchema.d.ts +37 -0
- package/dist/_pkg/boundwitness-model/neutral/BoundWitness/BoundWitnessSchema.d.ts +5 -0
- package/dist/_pkg/boundwitness-model/neutral/BoundWitness/HydratedBoundWitness.d.ts +72 -0
- package/dist/_pkg/boundwitness-model/neutral/BoundWitness/Signatures.d.ts +14 -0
- package/dist/_pkg/boundwitness-model/neutral/BoundWitness/SignedBoundWitness.d.ts +44 -0
- package/dist/_pkg/boundwitness-model/neutral/BoundWitness/UnsignedBoundWitness.d.ts +44 -0
- package/dist/_pkg/boundwitness-model/neutral/BoundWitness/index.d.ts +8 -0
- package/dist/_pkg/boundwitness-model/neutral/QueryBoundWitness.d.ts +150 -0
- package/dist/_pkg/boundwitness-model/neutral/index.d.ts +3 -0
- package/dist/_pkg/boundwitness-model/neutral/index.mjs +131 -0
- package/dist/_pkg/boundwitness-validator/neutral/Validator.d.ts +17 -0
- package/dist/_pkg/boundwitness-validator/neutral/index.d.ts +3 -0
- package/dist/_pkg/boundwitness-validator/neutral/index.mjs +177 -0
- package/dist/_pkg/boundwitness-validator/neutral/lib/addresses/addressesContains.d.ts +10 -0
- package/dist/_pkg/boundwitness-validator/neutral/lib/addresses/addressesContainsAll.d.ts +10 -0
- package/dist/_pkg/boundwitness-validator/neutral/lib/addresses/addressesContainsAny.d.ts +12 -0
- package/dist/_pkg/boundwitness-validator/neutral/lib/addresses/index.d.ts +4 -0
- package/dist/_pkg/boundwitness-validator/neutral/lib/index.d.ts +4 -0
- package/dist/_pkg/boundwitness-validator/neutral/lib/payloadHashes/index.d.ts +4 -0
- package/dist/_pkg/boundwitness-validator/neutral/lib/payloadHashes/payloadHashesContains.d.ts +10 -0
- package/dist/_pkg/boundwitness-validator/neutral/lib/payloadHashes/payloadHashesContainsAll.d.ts +10 -0
- package/dist/_pkg/boundwitness-validator/neutral/lib/payloadHashes/payloadHashesContainsAny.d.ts +12 -0
- package/dist/_pkg/boundwitness-validator/neutral/lib/payloadSchemas/index.d.ts +4 -0
- package/dist/_pkg/boundwitness-validator/neutral/lib/payloadSchemas/payloadSchemasContains.d.ts +10 -0
- package/dist/_pkg/boundwitness-validator/neutral/lib/payloadSchemas/payloadSchemasContainsAll.d.ts +10 -0
- package/dist/_pkg/boundwitness-validator/neutral/lib/payloadSchemas/payloadSchemasContainsAny.d.ts +12 -0
- package/dist/_pkg/boundwitness-validator/neutral/lib/util/BoundWitnessArrayProperty.d.ts +10 -0
- package/dist/_pkg/boundwitness-validator/neutral/lib/util/boundWitnessArrayPropertyContains.d.ts +11 -0
- package/dist/_pkg/boundwitness-validator/neutral/lib/util/boundWitnessArrayPropertyContainsAll.d.ts +11 -0
- package/dist/_pkg/boundwitness-validator/neutral/lib/util/boundWitnessArrayPropertyContainsAny.d.ts +13 -0
- package/dist/_pkg/boundwitness-validator/neutral/lib/util/index.d.ts +4 -0
- package/dist/_pkg/boundwitness-wrapper/neutral/BoundWitnessWrapper.d.ts +60 -0
- package/dist/_pkg/boundwitness-wrapper/neutral/QueryBoundWitnessWrapper.d.ts +14 -0
- package/dist/_pkg/boundwitness-wrapper/neutral/SchemaType.d.ts +6 -0
- package/dist/_pkg/boundwitness-wrapper/neutral/index.d.ts +4 -0
- package/dist/_pkg/boundwitness-wrapper/neutral/index.mjs +281 -0
- package/dist/_pkg/config-payload-plugin/neutral/Payload.d.ts +44 -0
- package/dist/_pkg/config-payload-plugin/neutral/Plugin.d.ts +7 -0
- package/dist/_pkg/config-payload-plugin/neutral/Schema.d.ts +5 -0
- package/dist/_pkg/config-payload-plugin/neutral/Template.d.ts +3 -0
- package/dist/_pkg/config-payload-plugin/neutral/index.d.ts +5 -0
- package/dist/_pkg/config-payload-plugin/neutral/index.mjs +44 -0
- package/dist/_pkg/core/neutral/index.d.ts +6 -0
- package/dist/_pkg/core/neutral/index.mjs +7 -0
- package/dist/_pkg/core-payload-plugins/neutral/index.d.ts +11 -0
- package/dist/_pkg/core-payload-plugins/neutral/index.mjs +26 -0
- package/dist/_pkg/crypto/neutral/account-model.d.ts +2 -0
- package/dist/_pkg/crypto/neutral/account-model.mjs +3 -0
- package/dist/_pkg/crypto/neutral/account.d.ts +2 -0
- package/dist/_pkg/crypto/neutral/account.mjs +3 -0
- package/dist/_pkg/crypto/neutral/index.d.ts +10 -0
- package/dist/_pkg/crypto/neutral/index.mjs +11 -0
- package/dist/_pkg/crypto/neutral/key-model.d.ts +2 -0
- package/dist/_pkg/crypto/neutral/key-model.mjs +3 -0
- package/dist/_pkg/crypto/neutral/wallet-model.d.ts +2 -0
- package/dist/_pkg/crypto/neutral/wallet-model.mjs +3 -0
- package/dist/_pkg/crypto/neutral/wallet.d.ts +2 -0
- package/dist/_pkg/crypto/neutral/wallet.mjs +3 -0
- package/dist/_pkg/data/neutral/AbstractData.d.ts +16 -0
- package/dist/_pkg/data/neutral/Data.d.ts +13 -0
- package/dist/_pkg/data/neutral/index.d.ts +3 -0
- package/dist/_pkg/data/neutral/index.mjs +53 -0
- package/dist/_pkg/dns/neutral/DnsRecordType.d.ts +16 -0
- package/dist/_pkg/dns/neutral/DnsReturnCode.d.ts +14 -0
- package/dist/_pkg/dns/neutral/GoogleDnsResult.d.ts +17 -0
- package/dist/_pkg/dns/neutral/GoogleDnsResultAnswer.d.ts +8 -0
- package/dist/_pkg/dns/neutral/GoogleDnsResultQuestion.d.ts +11 -0
- package/dist/_pkg/dns/neutral/domainExists.d.ts +8 -0
- package/dist/_pkg/dns/neutral/domainResolve.d.ts +9 -0
- package/dist/_pkg/dns/neutral/googleDnsOverHttps.d.ts +5 -0
- package/dist/_pkg/dns/neutral/index.d.ts +9 -0
- package/dist/_pkg/dns/neutral/index.mjs +61 -0
- package/dist/_pkg/domain-payload-plugin/neutral/DomainConfigPayload.d.ts +219 -0
- package/dist/_pkg/domain-payload-plugin/neutral/DomainConfigPlugin.d.ts +33 -0
- package/dist/_pkg/domain-payload-plugin/neutral/DomainConfigSchema.d.ts +5 -0
- package/dist/_pkg/domain-payload-plugin/neutral/DomainConfigTemplate.d.ts +3 -0
- package/dist/_pkg/domain-payload-plugin/neutral/Payload.d.ts +282 -0
- package/dist/_pkg/domain-payload-plugin/neutral/Plugin.d.ts +33 -0
- package/dist/_pkg/domain-payload-plugin/neutral/Resolution/DomainSchemaResolver.d.ts +45 -0
- package/dist/_pkg/domain-payload-plugin/neutral/Resolution/SchemaResolution.d.ts +27 -0
- package/dist/_pkg/domain-payload-plugin/neutral/Resolution/XyoDnsRecords.d.ts +27 -0
- package/dist/_pkg/domain-payload-plugin/neutral/Resolution/index.d.ts +4 -0
- package/dist/_pkg/domain-payload-plugin/neutral/Schema.d.ts +5 -0
- package/dist/_pkg/domain-payload-plugin/neutral/Template.d.ts +3 -0
- package/dist/_pkg/domain-payload-plugin/neutral/Wrapper.d.ts +278 -0
- package/dist/_pkg/domain-payload-plugin/neutral/index.d.ts +11 -0
- package/dist/_pkg/domain-payload-plugin/neutral/index.mjs +485 -0
- package/dist/_pkg/elliptic/neutral/Elliptic.d.ts +15 -0
- package/dist/_pkg/elliptic/neutral/index.d.ts +2 -0
- package/dist/_pkg/elliptic/neutral/index.mjs +89 -0
- package/dist/_pkg/hash/browser/BrowserObjectHasher.d.ts +9 -0
- package/dist/_pkg/hash/browser/NodeObjectHasher.d.ts +6 -0
- package/dist/_pkg/hash/browser/ObjectHasher.d.ts +69 -0
- package/dist/_pkg/hash/browser/createBrowserWorker.d.ts +3 -0
- package/dist/_pkg/hash/browser/createNodeWorker.d.ts +3 -0
- package/dist/_pkg/hash/browser/hasEmptyFields.d.ts +3 -0
- package/dist/_pkg/hash/browser/index-browser.d.ts +4 -0
- package/dist/_pkg/hash/browser/index-browser.mjs +289 -0
- package/dist/_pkg/hash/browser/index.d.ts +5 -0
- package/dist/_pkg/hash/browser/removeEmptyFields.d.ts +3 -0
- package/dist/_pkg/hash/browser/sortFields.d.ts +3 -0
- package/dist/_pkg/hash/browser/worker/index.d.ts +3 -0
- package/dist/_pkg/hash/browser/worker/subtleHash-bundle.mjs +257 -0
- package/dist/_pkg/hash/browser/worker/subtleHash.d.ts +2 -0
- package/dist/_pkg/hash/browser/worker/subtleHashNode.d.ts +2 -0
- package/dist/_pkg/hash/browser/worker/wasmHash-bundle.mjs +1678 -0
- package/dist/_pkg/hash/browser/worker/wasmHash.d.ts +2 -0
- package/dist/_pkg/hash/browser/worker/wasmHashNode.d.ts +2 -0
- package/dist/_pkg/hash/neutral/BrowserObjectHasher.d.ts +9 -0
- package/dist/_pkg/hash/neutral/NodeObjectHasher.d.ts +6 -0
- package/dist/_pkg/hash/neutral/ObjectHasher.d.ts +69 -0
- package/dist/_pkg/hash/neutral/createBrowserWorker.d.ts +3 -0
- package/dist/_pkg/hash/neutral/createNodeWorker.d.ts +3 -0
- package/dist/_pkg/hash/neutral/hasEmptyFields.d.ts +3 -0
- package/dist/_pkg/hash/neutral/index-browser.d.ts +4 -0
- package/dist/_pkg/hash/neutral/index-browser.mjs +289 -0
- package/dist/_pkg/hash/neutral/index.d.ts +5 -0
- package/dist/_pkg/hash/neutral/removeEmptyFields.d.ts +3 -0
- package/dist/_pkg/hash/neutral/sortFields.d.ts +3 -0
- package/dist/_pkg/hash/neutral/worker/index.d.ts +3 -0
- package/dist/_pkg/hash/neutral/worker/subtleHash.d.ts +2 -0
- package/dist/_pkg/hash/neutral/worker/subtleHashNode.d.ts +2 -0
- package/dist/_pkg/hash/neutral/worker/wasmHash.d.ts +2 -0
- package/dist/_pkg/hash/neutral/worker/wasmHashNode.d.ts +2 -0
- package/dist/_pkg/hash/node/BrowserObjectHasher.d.ts +9 -0
- package/dist/_pkg/hash/node/NodeObjectHasher.d.ts +6 -0
- package/dist/_pkg/hash/node/ObjectHasher.d.ts +69 -0
- package/dist/_pkg/hash/node/createBrowserWorker.d.ts +3 -0
- package/dist/_pkg/hash/node/createNodeWorker.d.ts +3 -0
- package/dist/_pkg/hash/node/hasEmptyFields.d.ts +3 -0
- package/dist/_pkg/hash/node/index-browser.d.ts +4 -0
- package/dist/_pkg/hash/node/index.d.ts +5 -0
- package/dist/_pkg/hash/node/index.mjs +279 -0
- package/dist/_pkg/hash/node/removeEmptyFields.d.ts +3 -0
- package/dist/_pkg/hash/node/sortFields.d.ts +3 -0
- package/dist/_pkg/hash/node/worker/index.d.ts +3 -0
- package/dist/_pkg/hash/node/worker/subtleHash.d.ts +2 -0
- package/dist/_pkg/hash/node/worker/subtleHashNode.d.ts +2 -0
- package/dist/_pkg/hash/node/worker/wasmHash.d.ts +2 -0
- package/dist/_pkg/hash/node/worker/wasmHashNode.d.ts +2 -0
- package/dist/_pkg/huri/neutral/Huri.d.ts +33 -0
- package/dist/_pkg/huri/neutral/index.d.ts +2 -0
- package/dist/_pkg/huri/neutral/index.mjs +118 -0
- package/dist/_pkg/id-payload-plugin/neutral/Payload.d.ts +86 -0
- package/dist/_pkg/id-payload-plugin/neutral/Plugin.d.ts +7 -0
- package/dist/_pkg/id-payload-plugin/neutral/Schema.d.ts +5 -0
- package/dist/_pkg/id-payload-plugin/neutral/Template.d.ts +3 -0
- package/dist/_pkg/id-payload-plugin/neutral/index.d.ts +5 -0
- package/dist/_pkg/id-payload-plugin/neutral/index.mjs +48 -0
- package/dist/_pkg/key-model/neutral/Key/AddressValue.d.ts +10 -0
- package/dist/_pkg/key-model/neutral/Key/EllipticKey.d.ts +4 -0
- package/dist/_pkg/key-model/neutral/Key/PrivateKey.d.ts +15 -0
- package/dist/_pkg/key-model/neutral/Key/PublicKey.d.ts +11 -0
- package/dist/_pkg/key-model/neutral/Key/index.d.ts +4 -0
- package/dist/_pkg/key-model/neutral/index.d.ts +2 -0
- package/dist/_pkg/key-model/neutral/index.mjs +1 -0
- package/dist/_pkg/manifest/neutral/index.d.ts +2 -0
- package/dist/_pkg/manifest/neutral/index.mjs +3 -0
- package/dist/_pkg/manifest-model/neutral/Manifest.d.ts +4 -0
- package/dist/_pkg/manifest-model/neutral/Manifest.zod.d.ts +2619 -0
- package/dist/_pkg/manifest-model/neutral/Payload.d.ts +2 -0
- package/dist/_pkg/manifest-model/neutral/Payload.zod.d.ts +1591 -0
- package/dist/_pkg/manifest-model/neutral/index.d.ts +3 -0
- package/dist/_pkg/manifest-model/neutral/index.mjs +193 -0
- package/dist/_pkg/metamask-connector/browser/MetaMaskConnector.d.ts +38 -0
- package/dist/_pkg/metamask-connector/browser/index.d.ts +2 -0
- package/dist/_pkg/metamask-connector/browser/index.mjs +114 -0
- package/dist/_pkg/network/neutral/NetworkNodePayload.d.ts +79 -0
- package/dist/_pkg/network/neutral/NetworkNodePayloadWrapper.d.ts +17 -0
- package/dist/_pkg/network/neutral/NetworkPayload.d.ts +119 -0
- package/dist/_pkg/network/neutral/NetworkPayloadWrapper.d.ts +63 -0
- package/dist/_pkg/network/neutral/index.d.ts +8 -0
- package/dist/_pkg/network/neutral/index.mjs +211 -0
- package/dist/_pkg/network/neutral/knownArchivists.d.ts +3 -0
- package/dist/_pkg/network/neutral/knownDiviners.d.ts +3 -0
- package/dist/_pkg/network/neutral/knownNetworks.d.ts +3 -0
- package/dist/_pkg/payload/neutral/builder.d.ts +2 -0
- package/dist/_pkg/payload/neutral/builder.mjs +3 -0
- package/dist/_pkg/payload/neutral/index.d.ts +6 -0
- package/dist/_pkg/payload/neutral/index.mjs +7 -0
- package/dist/_pkg/payload/neutral/model.d.ts +2 -0
- package/dist/_pkg/payload/neutral/model.mjs +3 -0
- package/dist/_pkg/payload/neutral/validator.d.ts +2 -0
- package/dist/_pkg/payload/neutral/validator.mjs +3 -0
- package/dist/_pkg/payload/neutral/wrapper.d.ts +2 -0
- package/dist/_pkg/payload/neutral/wrapper.mjs +3 -0
- package/dist/_pkg/payload-builder/neutral/Builder.d.ts +70 -0
- package/dist/_pkg/payload-builder/neutral/Options.d.ts +7 -0
- package/dist/_pkg/payload-builder/neutral/index.d.ts +3 -0
- package/dist/_pkg/payload-builder/neutral/index.mjs +218 -0
- package/dist/_pkg/payload-model/neutral/Error.d.ts +65 -0
- package/dist/_pkg/payload-model/neutral/Payload.d.ts +35 -0
- package/dist/_pkg/payload-model/neutral/PayloadBundle.d.ts +72 -0
- package/dist/_pkg/payload-model/neutral/PayloadFindFilter.d.ts +6 -0
- package/dist/_pkg/payload-model/neutral/PayloadHashMap.d.ts +7 -0
- package/dist/_pkg/payload-model/neutral/PayloadSet/PayloadSetPayload.d.ts +54 -0
- package/dist/_pkg/payload-model/neutral/PayloadSet/PayloadSetSchema.d.ts +5 -0
- package/dist/_pkg/payload-model/neutral/PayloadSet/index.d.ts +3 -0
- package/dist/_pkg/payload-model/neutral/PayloadValidationFunction.d.ts +14 -0
- package/dist/_pkg/payload-model/neutral/PayloadValueExpression.d.ts +38 -0
- package/dist/_pkg/payload-model/neutral/PayloadZod.d.ts +173 -0
- package/dist/_pkg/payload-model/neutral/Query.d.ts +21 -0
- package/dist/_pkg/payload-model/neutral/Schema.d.ts +38 -0
- package/dist/_pkg/payload-model/neutral/StorageMeta/DataHash.d.ts +24 -0
- package/dist/_pkg/payload-model/neutral/StorageMeta/Hash.d.ts +25 -0
- package/dist/_pkg/payload-model/neutral/StorageMeta/Sequence.d.ts +11 -0
- package/dist/_pkg/payload-model/neutral/StorageMeta/index.d.ts +3 -0
- package/dist/_pkg/payload-model/neutral/StorageMeta/sequence/Comparer.d.ts +7 -0
- package/dist/_pkg/payload-model/neutral/StorageMeta/sequence/Parser.d.ts +31 -0
- package/dist/_pkg/payload-model/neutral/StorageMeta/sequence/Sequence.d.ts +80 -0
- package/dist/_pkg/payload-model/neutral/StorageMeta/sequence/SequenceZod.d.ts +9 -0
- package/dist/_pkg/payload-model/neutral/StorageMeta/sequence/index.d.ts +5 -0
- package/dist/_pkg/payload-model/neutral/Timestamp.d.ts +8 -0
- package/dist/_pkg/payload-model/neutral/index.d.ts +16 -0
- package/dist/_pkg/payload-model/neutral/index.mjs +452 -0
- package/dist/_pkg/payload-model/neutral/isPayloadOfSchemaType.d.ts +5 -0
- package/dist/_pkg/payload-model/neutral/isPayloadOfZodType.d.ts +12 -0
- package/dist/_pkg/payload-plugin/neutral/Plugin.d.ts +19 -0
- package/dist/_pkg/payload-plugin/neutral/Resolver.d.ts +26 -0
- package/dist/_pkg/payload-plugin/neutral/createPlugin.d.ts +5 -0
- package/dist/_pkg/payload-plugin/neutral/index.d.ts +4 -0
- package/dist/_pkg/payload-plugin/neutral/index.mjs +67 -0
- package/dist/_pkg/payload-validator/neutral/Validator.d.ts +18 -0
- package/dist/_pkg/payload-validator/neutral/index.d.ts +2 -0
- package/dist/_pkg/payload-validator/neutral/index.mjs +40 -0
- package/dist/_pkg/payload-wrapper/neutral/PayloadDataWrapper.d.ts +18 -0
- package/dist/_pkg/payload-wrapper/neutral/PayloadWrapper.d.ts +6 -0
- package/dist/_pkg/payload-wrapper/neutral/PayloadWrapperBase.d.ts +23 -0
- package/dist/_pkg/payload-wrapper/neutral/SchemaType.d.ts +6 -0
- package/dist/_pkg/payload-wrapper/neutral/index.d.ts +4 -0
- package/dist/_pkg/payload-wrapper/neutral/index.mjs +157 -0
- package/dist/_pkg/pqc/neutral/MlDsa.d.ts +20 -0
- package/dist/_pkg/pqc/neutral/index.d.ts +2 -0
- package/dist/_pkg/pqc/neutral/index.mjs +47 -0
- package/dist/_pkg/previous-hash-store/neutral/index.d.ts +4 -0
- package/dist/_pkg/previous-hash-store/neutral/index.mjs +5 -0
- package/dist/_pkg/previous-hash-store-indexeddb/neutral/IndexedDbPreviousHashStore.d.ts +27 -0
- package/dist/_pkg/previous-hash-store-indexeddb/neutral/index.d.ts +2 -0
- package/dist/_pkg/previous-hash-store-indexeddb/neutral/index.mjs +42 -0
- package/dist/_pkg/previous-hash-store-model/neutral/PreviousHashStore.d.ts +8 -0
- package/dist/_pkg/previous-hash-store-model/neutral/index.d.ts +2 -0
- package/dist/_pkg/previous-hash-store-model/neutral/index.mjs +1 -0
- package/dist/_pkg/previous-hash-store-storage/neutral/NamespacedStorage.d.ts +10 -0
- package/dist/_pkg/previous-hash-store-storage/neutral/StoragePreviousHashStore.d.ts +24 -0
- package/dist/_pkg/previous-hash-store-storage/neutral/index.d.ts +3 -0
- package/dist/_pkg/previous-hash-store-storage/neutral/index.mjs +104 -0
- package/dist/_pkg/protocol/neutral/index.d.ts +5 -0
- package/dist/_pkg/protocol/neutral/index.mjs +6 -0
- package/dist/_pkg/quadkey/neutral/Quadkey.d.ts +65 -0
- package/dist/_pkg/quadkey/neutral/RelativeDirectionConstantLookup.d.ts +2 -0
- package/dist/_pkg/quadkey/neutral/index.d.ts +2 -0
- package/dist/_pkg/quadkey/neutral/index.mjs +281 -0
- package/dist/_pkg/quant-account/neutral/QuantAccount.d.ts +34 -0
- package/dist/_pkg/quant-account/neutral/index.d.ts +3 -0
- package/dist/_pkg/quant-account/neutral/index.mjs +173 -0
- package/dist/_pkg/quant-account/neutral/register.d.ts +2 -0
- package/dist/_pkg/query-payload-plugin/neutral/Payload.d.ts +43 -0
- package/dist/_pkg/query-payload-plugin/neutral/Plugin.d.ts +7 -0
- package/dist/_pkg/query-payload-plugin/neutral/Schema.d.ts +5 -0
- package/dist/_pkg/query-payload-plugin/neutral/Template.d.ts +3 -0
- package/dist/_pkg/query-payload-plugin/neutral/index.d.ts +5 -0
- package/dist/_pkg/query-payload-plugin/neutral/index.mjs +44 -0
- package/dist/_pkg/schema-cache/neutral/Debounce.d.ts +5 -0
- package/dist/_pkg/schema-cache/neutral/SchemaCache.d.ts +43 -0
- package/dist/_pkg/schema-cache/neutral/SchemaNameToValidatorMap.d.ts +12 -0
- package/dist/_pkg/schema-cache/neutral/TtlLruCache.d.ts +13 -0
- package/dist/_pkg/schema-cache/neutral/index.d.ts +5 -0
- package/dist/_pkg/schema-cache/neutral/index.mjs +178 -0
- package/dist/_pkg/schema-name-validator/neutral/SchemaNameValidator.d.ts +43 -0
- package/dist/_pkg/schema-name-validator/neutral/index.d.ts +2 -0
- package/dist/_pkg/schema-name-validator/neutral/index.mjs +69 -0
- package/dist/_pkg/schema-payload-plugin/neutral/Payload.d.ts +96 -0
- package/dist/_pkg/schema-payload-plugin/neutral/Plugin.d.ts +13 -0
- package/dist/_pkg/schema-payload-plugin/neutral/Schema.d.ts +5 -0
- package/dist/_pkg/schema-payload-plugin/neutral/Template.d.ts +3 -0
- package/dist/_pkg/schema-payload-plugin/neutral/index.d.ts +5 -0
- package/dist/_pkg/schema-payload-plugin/neutral/index.mjs +60 -0
- package/dist/_pkg/sdk-utils/neutral/api.d.ts +5 -0
- package/dist/_pkg/sdk-utils/neutral/api.mjs +6 -0
- package/dist/_pkg/sdk-utils/neutral/index.d.ts +9 -0
- package/dist/_pkg/sdk-utils/neutral/index.mjs +10 -0
- package/dist/_pkg/sdk-utils/neutral/integrations.d.ts +3 -0
- package/dist/_pkg/sdk-utils/neutral/integrations.mjs +4 -0
- package/dist/_pkg/sdk-utils/neutral/plugins.d.ts +2 -0
- package/dist/_pkg/sdk-utils/neutral/plugins.mjs +3 -0
- package/dist/_pkg/sdk-utils/neutral/validation.d.ts +2 -0
- package/dist/_pkg/sdk-utils/neutral/validation.mjs +3 -0
- package/dist/_pkg/value-payload-plugin/neutral/Payload.d.ts +46 -0
- package/dist/_pkg/value-payload-plugin/neutral/Plugin.d.ts +3 -0
- package/dist/_pkg/value-payload-plugin/neutral/Schema.d.ts +5 -0
- package/dist/_pkg/value-payload-plugin/neutral/Template.d.ts +3 -0
- package/dist/_pkg/value-payload-plugin/neutral/index.d.ts +5 -0
- package/dist/_pkg/value-payload-plugin/neutral/index.mjs +44 -0
- package/dist/_pkg/wallet/neutral/HDWallet.d.ts +38 -0
- package/dist/_pkg/wallet/neutral/index.d.ts +2 -0
- package/dist/_pkg/wallet/neutral/index.mjs +157 -0
- package/dist/_pkg/wallet-model/neutral/Mnemonic.d.ts +27 -0
- package/dist/_pkg/wallet-model/neutral/Wallet.d.ts +26 -0
- package/dist/_pkg/wallet-model/neutral/Wordlist.d.ts +24 -0
- package/dist/_pkg/wallet-model/neutral/index.d.ts +2 -0
- package/dist/_pkg/wallet-model/neutral/index.mjs +1 -0
- package/dist/_pkg/wasm/neutral/WasmSupport.d.ts +110 -0
- package/dist/_pkg/wasm/neutral/index.d.ts +2 -0
- package/dist/_pkg/wasm/neutral/index.mjs +178 -0
- package/dist/_pkg/wasm/neutral/wasmFeatureDetect.d.ts +16 -0
- package/dist/neutral/core-payload-plugins.d.ts +1 -0
- package/dist/neutral/core-payload-plugins.mjs +1 -0
- package/dist/neutral/index.d.ts +4 -0
- package/dist/neutral/index.mjs +4 -0
- package/dist/neutral/manifest.d.ts +1 -0
- package/dist/neutral/manifest.mjs +1 -0
- package/dist/neutral/protocol.d.ts +1 -0
- package/dist/neutral/protocol.mjs +1 -0
- package/dist/neutral/sdk-utils.d.ts +1 -0
- package/dist/neutral/sdk-utils.mjs +1 -0
- package/package.json +113 -0
|
@@ -0,0 +1,485 @@
|
|
|
1
|
+
// src/DomainConfigPayload.ts
|
|
2
|
+
import {
|
|
3
|
+
zodAsFactory as zodAsFactory2,
|
|
4
|
+
zodIsFactory as zodIsFactory2,
|
|
5
|
+
zodToFactory as zodToFactory2
|
|
6
|
+
} from "@xylabs/sdk";
|
|
7
|
+
import { PayloadZodOfSchema as PayloadZodOfSchema2 } from "../../payload-model/neutral/index.mjs";
|
|
8
|
+
import * as z2 from "zod/mini";
|
|
9
|
+
|
|
10
|
+
// src/DomainConfigSchema.ts
|
|
11
|
+
import { asSchema } from "../../payload-model/neutral/index.mjs";
|
|
12
|
+
var DomainConfigSchema = asSchema("network.xyo.domain.config", true);
|
|
13
|
+
|
|
14
|
+
// src/Payload.ts
|
|
15
|
+
import {
|
|
16
|
+
zodAsFactory,
|
|
17
|
+
zodIsFactory,
|
|
18
|
+
zodToFactory
|
|
19
|
+
} from "@xylabs/sdk";
|
|
20
|
+
import { PayloadZodOfSchema } from "../../payload-model/neutral/index.mjs";
|
|
21
|
+
import * as z from "zod/mini";
|
|
22
|
+
|
|
23
|
+
// src/Schema.ts
|
|
24
|
+
import { asSchema as asSchema2 } from "../../payload-model/neutral/index.mjs";
|
|
25
|
+
var DomainSchema = asSchema2("network.xyo.domain", true);
|
|
26
|
+
|
|
27
|
+
// src/Payload.ts
|
|
28
|
+
var AliasZod = z.object({
|
|
29
|
+
/** huri to the aliased payload */
|
|
30
|
+
huri: z.string(),
|
|
31
|
+
/** canonical name (ex. network.xyo.example) */
|
|
32
|
+
name: z.optional(z.string())
|
|
33
|
+
});
|
|
34
|
+
var SchemaDefinitionZod = z.looseObject({ $id: z.optional(z.string()) });
|
|
35
|
+
var SchemaMapEntryZod = z.union([z.string(), SchemaDefinitionZod]);
|
|
36
|
+
var stringZod = z.string();
|
|
37
|
+
var optionalStringArrayZod = z.optional(z.array(stringZod));
|
|
38
|
+
var optionalAliasRecordZod = z.optional(z.record(stringZod, AliasZod));
|
|
39
|
+
var networkPayloadZod = z.custom();
|
|
40
|
+
var optionalNetworkPayloadArrayZod = z.optional(z.array(networkPayloadZod));
|
|
41
|
+
var optionalSchemaMapEntryRecordZod = z.optional(z.record(stringZod, SchemaMapEntryZod));
|
|
42
|
+
var DomainConfigFieldsZod = z.object({
|
|
43
|
+
/** Additional config files [huri] [out] */
|
|
44
|
+
additional: optionalStringArrayZod,
|
|
45
|
+
/** Values associated with this domain [out] */
|
|
46
|
+
aliases: optionalAliasRecordZod,
|
|
47
|
+
/** Known networks [out] */
|
|
48
|
+
networks: optionalNetworkPayloadArrayZod,
|
|
49
|
+
/** Official schemas published by this domain, keyed by schema name [out] */
|
|
50
|
+
schemas: optionalSchemaMapEntryRecordZod
|
|
51
|
+
});
|
|
52
|
+
var DomainPayloadZod = z.extend(PayloadZodOfSchema(DomainSchema), DomainConfigFieldsZod.shape);
|
|
53
|
+
var isDomainPayload = zodIsFactory(DomainPayloadZod);
|
|
54
|
+
var asDomainPayload = zodAsFactory(DomainPayloadZod, "asDomainPayload");
|
|
55
|
+
var toDomainPayload = zodToFactory(DomainPayloadZod, "toDomainPayload");
|
|
56
|
+
|
|
57
|
+
// src/DomainConfigPayload.ts
|
|
58
|
+
var DomainConfigPayloadZod = z2.extend(PayloadZodOfSchema2(DomainConfigSchema), DomainConfigFieldsZod.shape);
|
|
59
|
+
var isDomainConfigPayload = zodIsFactory2(DomainConfigPayloadZod);
|
|
60
|
+
var asDomainConfigPayload = zodAsFactory2(DomainConfigPayloadZod, "asDomainConfigPayload");
|
|
61
|
+
var toDomainConfigPayload = zodToFactory2(DomainConfigPayloadZod, "toDomainConfigPayload");
|
|
62
|
+
|
|
63
|
+
// src/DomainConfigPlugin.ts
|
|
64
|
+
import { createPayloadPlugin } from "../../payload-plugin/neutral/index.mjs";
|
|
65
|
+
|
|
66
|
+
// src/DomainConfigTemplate.ts
|
|
67
|
+
var domainConfigPayloadTemplate = () => ({
|
|
68
|
+
schema: DomainConfigSchema,
|
|
69
|
+
schemas: {
|
|
70
|
+
"com.example.inline": {
|
|
71
|
+
properties: { value: { type: "string" } },
|
|
72
|
+
type: "object"
|
|
73
|
+
},
|
|
74
|
+
"com.example.referenced": ""
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
// src/DomainConfigPlugin.ts
|
|
79
|
+
var DomainConfigPayloadPlugin = () => createPayloadPlugin({
|
|
80
|
+
schema: DomainConfigSchema,
|
|
81
|
+
template: domainConfigPayloadTemplate,
|
|
82
|
+
zod: DomainConfigPayloadZod
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
// src/Plugin.ts
|
|
86
|
+
import { createPayloadPlugin as createPayloadPlugin2 } from "../../payload-plugin/neutral/index.mjs";
|
|
87
|
+
|
|
88
|
+
// src/Template.ts
|
|
89
|
+
import { asSchema as asSchema3 } from "../../payload-model/neutral/index.mjs";
|
|
90
|
+
var domainConfigTemplate = () => ({
|
|
91
|
+
aliases: { "com.example.id": { huri: "" } },
|
|
92
|
+
networks: [
|
|
93
|
+
{
|
|
94
|
+
name: "",
|
|
95
|
+
nodes: [
|
|
96
|
+
{
|
|
97
|
+
name: "",
|
|
98
|
+
schema: asSchema3("network.xyo.network.node", true),
|
|
99
|
+
slug: "",
|
|
100
|
+
type: "archivist",
|
|
101
|
+
uri: ""
|
|
102
|
+
}
|
|
103
|
+
],
|
|
104
|
+
schema: asSchema3("network.xyo.network", true),
|
|
105
|
+
slug: ""
|
|
106
|
+
}
|
|
107
|
+
],
|
|
108
|
+
schema: DomainSchema
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
// src/Wrapper.ts
|
|
112
|
+
import {
|
|
113
|
+
Base,
|
|
114
|
+
FetchClientError,
|
|
115
|
+
fetchJson,
|
|
116
|
+
isBrowser,
|
|
117
|
+
isString
|
|
118
|
+
} from "@xylabs/sdk";
|
|
119
|
+
import { isHash as isHash2 } from "@xylabs/sdk";
|
|
120
|
+
import { DnsRecordType, domainResolve } from "../../dns/neutral/index.mjs";
|
|
121
|
+
import { Huri } from "../../huri/neutral/index.mjs";
|
|
122
|
+
import { PayloadBuilder } from "../../payload-builder/neutral/index.mjs";
|
|
123
|
+
import { PayloadWrapper } from "../../payload-wrapper/neutral/index.mjs";
|
|
124
|
+
|
|
125
|
+
// src/Resolution/XyoDnsRecords.ts
|
|
126
|
+
import { isHash } from "@xylabs/sdk";
|
|
127
|
+
var SCHEMA_KEY_PREFIX = "schema.";
|
|
128
|
+
function normalizeTxtData(data) {
|
|
129
|
+
const trimmed = data.trim();
|
|
130
|
+
if (trimmed.includes('"')) {
|
|
131
|
+
const quotedParts = Array.from(trimmed.matchAll(/"([^"]*)"/g), (match) => match[1]);
|
|
132
|
+
return quotedParts.join("") || trimmed;
|
|
133
|
+
}
|
|
134
|
+
return trimmed;
|
|
135
|
+
}
|
|
136
|
+
function parseXyoTxtRecords(answers) {
|
|
137
|
+
const entries = (answers ?? []).map((answer) => answer.data).filter((data) => typeof data === "string").map(normalizeTxtData).toSorted((left, right) => left.localeCompare(right));
|
|
138
|
+
const records = { legacyHashes: [], schemas: {} };
|
|
139
|
+
for (const entry of entries) {
|
|
140
|
+
if (isHash(entry)) {
|
|
141
|
+
records.legacyHashes.push(entry);
|
|
142
|
+
} else if (entry.startsWith(SCHEMA_KEY_PREFIX)) {
|
|
143
|
+
const separatorIndex = entry.indexOf("=");
|
|
144
|
+
if (separatorIndex > SCHEMA_KEY_PREFIX.length) {
|
|
145
|
+
const name = entry.slice(SCHEMA_KEY_PREFIX.length, separatorIndex);
|
|
146
|
+
const value = entry.slice(separatorIndex + 1);
|
|
147
|
+
if (name.length > 0 && value.length > 0) {
|
|
148
|
+
records.schemas[name] ??= value;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
} else if (entry.startsWith("domain=")) {
|
|
152
|
+
const value = entry.slice("domain=".length);
|
|
153
|
+
if (value.length > 0) {
|
|
154
|
+
records.domain ??= value;
|
|
155
|
+
}
|
|
156
|
+
} else if (entry.startsWith("config=")) {
|
|
157
|
+
const value = entry.slice("config=".length);
|
|
158
|
+
if (value.length > 0) {
|
|
159
|
+
records.config ??= value;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return records;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// src/Wrapper.ts
|
|
167
|
+
var DomainPayloadWrapper = class _DomainPayloadWrapper extends PayloadWrapper {
|
|
168
|
+
aliases;
|
|
169
|
+
static async discover(reverseDomainName, proxy) {
|
|
170
|
+
const parts = reverseDomainName.split(".");
|
|
171
|
+
for (let i = 2; i <= parts.length; i++) {
|
|
172
|
+
const domainToCheck = parts.filter((_, index) => index < i).toReversed().join(".");
|
|
173
|
+
const result = await this.discoverDNSEntry(domainToCheck) ?? await this.discoverRootFile(domainToCheck, proxy);
|
|
174
|
+
if (result) {
|
|
175
|
+
return result;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
static async discoverDNSEntry(domain) {
|
|
180
|
+
try {
|
|
181
|
+
const { Answer } = await domainResolve(`_xyo.${domain}`, DnsRecordType.TXT) ?? {};
|
|
182
|
+
const records = parseXyoTxtRecords(Answer);
|
|
183
|
+
const candidates = [records.config, ...records.legacyHashes].filter((element) => isString(element));
|
|
184
|
+
for (const candidate of candidates) {
|
|
185
|
+
const huri = new Huri(candidate);
|
|
186
|
+
const payload = await huri.fetch();
|
|
187
|
+
if (isDomainPayload(payload) || isDomainConfigPayload(payload)) {
|
|
188
|
+
return new _DomainPayloadWrapper(payload);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
} catch {
|
|
192
|
+
Base.defaultLogger?.log(`DomainConfig dns reading error entry not found [${domain}]`);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
static async discoverRootFile(domain, proxy) {
|
|
196
|
+
return await this.discoverRootFileDirect(domain) ?? (isBrowser() || isString(proxy) ? await this.discoverRootFileWithProxy(domain, proxy) : void 0);
|
|
197
|
+
}
|
|
198
|
+
static async discoverRootFileDirect(domain) {
|
|
199
|
+
const urls = [`https://${domain}/xyo.json`, `https://xyo.${domain}/`, `https://${domain}/xyo-config.json`];
|
|
200
|
+
for (const url of urls) {
|
|
201
|
+
try {
|
|
202
|
+
const response = await fetchJson(url);
|
|
203
|
+
if (response.data) {
|
|
204
|
+
return new _DomainPayloadWrapper(response.data);
|
|
205
|
+
}
|
|
206
|
+
} catch {
|
|
207
|
+
console.log(`DomainConfig root file not found [${url}]`);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
static async discoverRootFileWithProxy(domain, proxy = "https://api.archivist.xyo.network/domain") {
|
|
212
|
+
try {
|
|
213
|
+
const requestUrl = `${proxy}/${domain.split(".").toReversed().join(".")}`;
|
|
214
|
+
const response = await fetchJson(requestUrl);
|
|
215
|
+
if (response.data?.data) {
|
|
216
|
+
return new _DomainPayloadWrapper(response.data.data);
|
|
217
|
+
}
|
|
218
|
+
} catch (ex) {
|
|
219
|
+
const status = ex instanceof FetchClientError ? ex.response.status : "unknown";
|
|
220
|
+
console.log(`DomainConfig root file not found using proxy [${domain}] [${status}]`);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
async fetchAlias(alias, huriOptions) {
|
|
224
|
+
const huri = new Huri(alias.huri, huriOptions);
|
|
225
|
+
const payload = await huri.fetch();
|
|
226
|
+
return payload ? {
|
|
227
|
+
alias,
|
|
228
|
+
huri,
|
|
229
|
+
payload
|
|
230
|
+
} : null;
|
|
231
|
+
}
|
|
232
|
+
async findArchivistUri(hash) {
|
|
233
|
+
const network = await this.getNetwork(hash);
|
|
234
|
+
return network?.nodes?.find((payload) => payload.type === "archivist" ? payload : void 0)?.uri;
|
|
235
|
+
}
|
|
236
|
+
async getNetwork(hash) {
|
|
237
|
+
return isHash2(hash) ? await PayloadBuilder.findByDataHash(this.payload.networks, hash) : this.payload.networks?.[0];
|
|
238
|
+
}
|
|
239
|
+
async fetch(networkSlug) {
|
|
240
|
+
await this.fetchAliases(networkSlug);
|
|
241
|
+
}
|
|
242
|
+
async fetchAliases(networkSlug) {
|
|
243
|
+
this.aliases = null;
|
|
244
|
+
const archivistUri = await this.findArchivistUri(networkSlug);
|
|
245
|
+
if (this.payload.aliases) {
|
|
246
|
+
const fetchedAliases = await Promise.all(
|
|
247
|
+
Object.values(this.payload.aliases ?? {}).map((alias) => {
|
|
248
|
+
return this.fetchAlias(alias, { archivistUri });
|
|
249
|
+
})
|
|
250
|
+
);
|
|
251
|
+
this.aliases = fetchedAliases.filter(Boolean);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
// src/Plugin.ts
|
|
257
|
+
var DomainPayloadPlugin = () => createPayloadPlugin2({
|
|
258
|
+
schema: DomainSchema,
|
|
259
|
+
template: domainConfigTemplate,
|
|
260
|
+
wrap: (payload) => DomainPayloadWrapper.wrap(payload)
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
// src/Resolution/DomainSchemaResolver.ts
|
|
264
|
+
import {
|
|
265
|
+
fetchJson as fetchJson2,
|
|
266
|
+
isBrowser as isBrowser2,
|
|
267
|
+
isString as isString2
|
|
268
|
+
} from "@xylabs/sdk";
|
|
269
|
+
import { DnsRecordType as DnsRecordType2, domainResolve as domainResolve2 } from "../../dns/neutral/index.mjs";
|
|
270
|
+
import { Huri as Huri2 } from "../../huri/neutral/index.mjs";
|
|
271
|
+
import { PayloadBuilder as PayloadBuilder2 } from "../../payload-builder/neutral/index.mjs";
|
|
272
|
+
import { isSchemaPayload, SchemaSchema } from "../../schema-payload-plugin/neutral/index.mjs";
|
|
273
|
+
var DEFAULT_MAX_INDIRECTION_DEPTH = 3;
|
|
274
|
+
var DEFAULT_PROXY = "https://api.archivist.xyo.network/domain";
|
|
275
|
+
function candidateDomains(schemaName) {
|
|
276
|
+
const parts = schemaName.split(".");
|
|
277
|
+
const domains = [];
|
|
278
|
+
for (let i = 2; i <= parts.length; i++) {
|
|
279
|
+
domains.push(parts.slice(0, i).toReversed().join("."));
|
|
280
|
+
}
|
|
281
|
+
return domains;
|
|
282
|
+
}
|
|
283
|
+
function isSchemaInDomainNamespace(schemaName, domain) {
|
|
284
|
+
return candidateDomains(schemaName).some((candidate) => candidate === domain || domain.endsWith(`.${candidate}`));
|
|
285
|
+
}
|
|
286
|
+
function isValidSchemaName(schemaName) {
|
|
287
|
+
return schemaName.length > 0 && schemaName === schemaName.toLowerCase() && schemaName.split(".").length >= 3;
|
|
288
|
+
}
|
|
289
|
+
var DomainSchemaResolver = class {
|
|
290
|
+
async resolve(schemaName, options = {}) {
|
|
291
|
+
if (!isValidSchemaName(schemaName)) {
|
|
292
|
+
return { status: "not-published" };
|
|
293
|
+
}
|
|
294
|
+
const context = {
|
|
295
|
+
anyCleanAnswer: false,
|
|
296
|
+
archivistUri: options.archivistUri,
|
|
297
|
+
proxy: options.proxy,
|
|
298
|
+
visited: /* @__PURE__ */ new Set()
|
|
299
|
+
};
|
|
300
|
+
const depth = options.maxIndirectionDepth ?? DEFAULT_MAX_INDIRECTION_DEPTH;
|
|
301
|
+
for (const domain of candidateDomains(schemaName)) {
|
|
302
|
+
const resolved = await this.resolveAtDomain(domain, schemaName, depth, context);
|
|
303
|
+
if (resolved) {
|
|
304
|
+
return {
|
|
305
|
+
payload: resolved.payload,
|
|
306
|
+
source: resolved.source,
|
|
307
|
+
status: "resolved"
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
return { status: context.anyCleanAnswer ? "not-published" : "unreachable" };
|
|
312
|
+
}
|
|
313
|
+
/** Fetch a payload by hash (or HURI href) and verify it against the referenced hash */
|
|
314
|
+
async fetchPayload(hashOrHref, context, configFields) {
|
|
315
|
+
try {
|
|
316
|
+
const archivistUri = context.archivistUri ?? findArchivistUri(configFields);
|
|
317
|
+
const huri = new Huri2(hashOrHref, { archivistUri });
|
|
318
|
+
const payload = await huri.fetch();
|
|
319
|
+
if (!payload) {
|
|
320
|
+
context.anyCleanAnswer = true;
|
|
321
|
+
return void 0;
|
|
322
|
+
}
|
|
323
|
+
if (await PayloadBuilder2.dataHash(payload) !== huri.hash && await PayloadBuilder2.hash(payload) !== huri.hash) {
|
|
324
|
+
console.warn(`DomainSchemaResolver: hash mismatch for [${huri.hash}]`);
|
|
325
|
+
context.anyCleanAnswer = true;
|
|
326
|
+
return void 0;
|
|
327
|
+
}
|
|
328
|
+
return payload;
|
|
329
|
+
} catch {
|
|
330
|
+
return void 0;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
async fetchSchemaPayloadByHash(hashOrHref, schemaName, context, configFields) {
|
|
334
|
+
const payload = await this.fetchPayload(hashOrHref, context, configFields);
|
|
335
|
+
if (isSchemaPayload(payload) && payload.definition.$id === schemaName) {
|
|
336
|
+
return payload;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
lookupHash(fields, schemaName) {
|
|
340
|
+
const entry = fields.schemas?.[schemaName];
|
|
341
|
+
if (isString2(entry)) return entry;
|
|
342
|
+
const alias = fields.aliases?.[schemaName];
|
|
343
|
+
if (isString2(alias?.huri) && alias.huri.length > 0) return alias.huri;
|
|
344
|
+
}
|
|
345
|
+
/** Find the schema in a domain config document (schemas map first, then legacy aliases) */
|
|
346
|
+
async lookupInConfig(fields, schemaName, domain, mechanism, context, url) {
|
|
347
|
+
if (!fields) return void 0;
|
|
348
|
+
context.anyCleanAnswer = true;
|
|
349
|
+
const entry = fields.schemas?.[schemaName];
|
|
350
|
+
if (entry !== void 0 && !isString2(entry)) {
|
|
351
|
+
const payload = { definition: { ...entry, $id: schemaName }, schema: SchemaSchema };
|
|
352
|
+
return {
|
|
353
|
+
payload,
|
|
354
|
+
source: {
|
|
355
|
+
domain,
|
|
356
|
+
mechanism,
|
|
357
|
+
url
|
|
358
|
+
}
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
const hash = this.lookupHash(fields, schemaName);
|
|
362
|
+
if (isString2(hash)) {
|
|
363
|
+
const payload = await this.fetchSchemaPayloadByHash(hash, schemaName, context, fields);
|
|
364
|
+
if (payload) {
|
|
365
|
+
const huri = new Huri2(hash);
|
|
366
|
+
return {
|
|
367
|
+
payload,
|
|
368
|
+
source: {
|
|
369
|
+
domain,
|
|
370
|
+
hash: huri.hash,
|
|
371
|
+
mechanism,
|
|
372
|
+
url
|
|
373
|
+
}
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
async resolveAtDomain(domain, schemaName, depth, context) {
|
|
379
|
+
if (context.visited.has(domain)) return void 0;
|
|
380
|
+
context.visited.add(domain);
|
|
381
|
+
const dnsResolved = await this.resolveViaDns(domain, schemaName, depth, context);
|
|
382
|
+
if (dnsResolved) return dnsResolved;
|
|
383
|
+
const fileCandidates = [
|
|
384
|
+
[`https://${domain}/xyo.json`, "file-root"],
|
|
385
|
+
[`https://xyo.${domain}/`, "file-subdomain"],
|
|
386
|
+
[`https://${domain}/xyo-config.json`, "file-legacy"]
|
|
387
|
+
];
|
|
388
|
+
let anyDirectTransportFailure = false;
|
|
389
|
+
for (const [url, mechanism] of fileCandidates) {
|
|
390
|
+
try {
|
|
391
|
+
const response = await fetchJson2(url);
|
|
392
|
+
context.anyCleanAnswer = true;
|
|
393
|
+
const resolved = await this.lookupInConfig(response.data ?? void 0, schemaName, domain, mechanism, context, url);
|
|
394
|
+
if (resolved) return resolved;
|
|
395
|
+
} catch {
|
|
396
|
+
anyDirectTransportFailure = true;
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
if (isString2(context.proxy) || isBrowser2() && anyDirectTransportFailure) {
|
|
400
|
+
const url = `${context.proxy ?? DEFAULT_PROXY}/${domain.split(".").toReversed().join(".")}`;
|
|
401
|
+
try {
|
|
402
|
+
const response = await fetchJson2(url);
|
|
403
|
+
context.anyCleanAnswer = true;
|
|
404
|
+
const resolved = await this.lookupInConfig(response.data?.data, schemaName, domain, "file-proxy", context, url);
|
|
405
|
+
if (resolved) return resolved;
|
|
406
|
+
} catch {
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
async resolveViaDns(domain, schemaName, depth, context) {
|
|
411
|
+
try {
|
|
412
|
+
const result = await domainResolve2(`_xyo.${domain}`, DnsRecordType2.TXT);
|
|
413
|
+
if (!result) return void 0;
|
|
414
|
+
context.anyCleanAnswer = true;
|
|
415
|
+
const records = parseXyoTxtRecords(result.Answer);
|
|
416
|
+
const schemaHash = records.schemas[schemaName];
|
|
417
|
+
if (isString2(schemaHash)) {
|
|
418
|
+
const payload = await this.fetchSchemaPayloadByHash(schemaHash, schemaName, context);
|
|
419
|
+
if (payload) {
|
|
420
|
+
const huri = new Huri2(schemaHash);
|
|
421
|
+
return {
|
|
422
|
+
payload,
|
|
423
|
+
source: {
|
|
424
|
+
domain,
|
|
425
|
+
hash: huri.hash,
|
|
426
|
+
mechanism: "dns-schema"
|
|
427
|
+
}
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
if (isString2(records.config)) {
|
|
432
|
+
const configPayload = await this.fetchPayload(records.config, context);
|
|
433
|
+
if (isDomainConfigPayload(configPayload) || isDomainPayload(configPayload)) {
|
|
434
|
+
const resolved = await this.lookupInConfig(configPayload, schemaName, domain, "dns-config", context);
|
|
435
|
+
if (resolved) return resolved;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
if (isString2(records.domain) && depth > 0 && !context.visited.has(records.domain)) {
|
|
439
|
+
const resolved = await this.resolveAtDomain(records.domain, schemaName, depth - 1, context);
|
|
440
|
+
if (resolved) {
|
|
441
|
+
return { payload: resolved.payload, source: { ...resolved.source, mechanism: "dns-domain" } };
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
for (const legacyHash of records.legacyHashes) {
|
|
445
|
+
const legacyPayload = await this.fetchPayload(legacyHash, context);
|
|
446
|
+
if (isDomainPayload(legacyPayload) || isDomainConfigPayload(legacyPayload)) {
|
|
447
|
+
const resolved = await this.lookupInConfig(legacyPayload, schemaName, domain, "dns-legacy", context);
|
|
448
|
+
if (resolved) return resolved;
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
} catch {
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
};
|
|
455
|
+
function findArchivistUri(fields) {
|
|
456
|
+
return fields?.networks?.[0]?.nodes?.find((node) => node.type === "archivist")?.uri;
|
|
457
|
+
}
|
|
458
|
+
export {
|
|
459
|
+
AliasZod,
|
|
460
|
+
DomainConfigFieldsZod,
|
|
461
|
+
DomainConfigPayloadPlugin,
|
|
462
|
+
DomainConfigPayloadZod,
|
|
463
|
+
DomainConfigSchema,
|
|
464
|
+
DomainPayloadPlugin,
|
|
465
|
+
DomainPayloadWrapper,
|
|
466
|
+
DomainPayloadZod,
|
|
467
|
+
DomainSchema,
|
|
468
|
+
DomainSchemaResolver,
|
|
469
|
+
SchemaDefinitionZod,
|
|
470
|
+
SchemaMapEntryZod,
|
|
471
|
+
asDomainConfigPayload,
|
|
472
|
+
asDomainPayload,
|
|
473
|
+
candidateDomains,
|
|
474
|
+
DomainPayloadPlugin as default,
|
|
475
|
+
domainConfigPayloadTemplate,
|
|
476
|
+
domainConfigTemplate,
|
|
477
|
+
isDomainConfigPayload,
|
|
478
|
+
isDomainPayload,
|
|
479
|
+
isSchemaInDomainNamespace,
|
|
480
|
+
normalizeTxtData,
|
|
481
|
+
parseXyoTxtRecords,
|
|
482
|
+
toDomainConfigPayload,
|
|
483
|
+
toDomainPayload
|
|
484
|
+
};
|
|
485
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Secp256k1 } from '@bitauth/libauth';
|
|
2
|
+
import { WasmSupport } from '../../wasm/neutral/index.ts';
|
|
3
|
+
export declare class Elliptic {
|
|
4
|
+
static readonly wasmSupport: WasmSupport;
|
|
5
|
+
protected static _secp256k1: Secp256k1 | undefined;
|
|
6
|
+
private static _secp256k1Mutex;
|
|
7
|
+
static addressFromPublicKey(key: ArrayBufferLike): ArrayBufferLike;
|
|
8
|
+
static initialize(): Promise<Secp256k1>;
|
|
9
|
+
static publicKeyFromPrivateKey(privateKey: ArrayBufferLike, prefix?: boolean): Promise<ArrayBufferLike>;
|
|
10
|
+
static ready(): boolean;
|
|
11
|
+
static secp256k1(): Promise<Secp256k1>;
|
|
12
|
+
static sign(hash: ArrayBufferLike, key: ArrayBufferLike): Promise<ArrayBufferLike>;
|
|
13
|
+
static verify(msg: ArrayBufferLike, signature: ArrayBufferLike, address: ArrayBufferLike): Promise<boolean>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=Elliptic.d.ts.map
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// src/Elliptic.ts
|
|
2
|
+
import { instantiateSecp256k1 } from "@bitauth/libauth";
|
|
3
|
+
import {
|
|
4
|
+
assertEx,
|
|
5
|
+
toHex,
|
|
6
|
+
toUint8Array
|
|
7
|
+
} from "@xylabs/sdk";
|
|
8
|
+
import { Data } from "../../data/neutral/index.mjs";
|
|
9
|
+
import { WasmSupport } from "../../wasm/neutral/index.mjs";
|
|
10
|
+
import { Mutex } from "async-mutex";
|
|
11
|
+
var wasmSupportStatic = new WasmSupport(["bigInt", "mutableGlobals", "referenceTypes", "saturatedFloatToInt", "signExtensions", "simd"]);
|
|
12
|
+
var recoveryIds = [0, 1, 2, 3];
|
|
13
|
+
function compareArrayBuffers(b1, b2) {
|
|
14
|
+
if (b1.byteLength !== b2.byteLength) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
const a1 = new Uint8Array(b1);
|
|
18
|
+
const a2 = new Uint8Array(b2);
|
|
19
|
+
for (let i = 0; i < b1.byteLength; i++) {
|
|
20
|
+
if (a1[i] !== a2[i]) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
var Elliptic = class {
|
|
27
|
+
static wasmSupport = wasmSupportStatic;
|
|
28
|
+
static _secp256k1;
|
|
29
|
+
static _secp256k1Mutex = new Mutex();
|
|
30
|
+
static addressFromPublicKey(key) {
|
|
31
|
+
const data = new Data(64, key);
|
|
32
|
+
return data.keccak256.slice(12);
|
|
33
|
+
}
|
|
34
|
+
static initialize() {
|
|
35
|
+
return this.secp256k1();
|
|
36
|
+
}
|
|
37
|
+
static async publicKeyFromPrivateKey(privateKey, prefix = false) {
|
|
38
|
+
const { derivePublicKeyUncompressed } = await this.secp256k1();
|
|
39
|
+
if (BigInt(toHex(privateKey, { prefix: true })) === 0n) {
|
|
40
|
+
throw new Error(`Invalid private key [${toHex(privateKey)}]`);
|
|
41
|
+
}
|
|
42
|
+
const derivedPublicKey = derivePublicKeyUncompressed(new Uint8Array(privateKey));
|
|
43
|
+
const fullPublicKey = typeof derivedPublicKey === "string" ? toUint8Array(derivedPublicKey) : derivedPublicKey;
|
|
44
|
+
return (prefix ? fullPublicKey : fullPublicKey.slice(1)).buffer;
|
|
45
|
+
}
|
|
46
|
+
static ready() {
|
|
47
|
+
return !!this._secp256k1;
|
|
48
|
+
}
|
|
49
|
+
static async secp256k1() {
|
|
50
|
+
return await this._secp256k1Mutex.runExclusive(async () => {
|
|
51
|
+
if (this._secp256k1) return this._secp256k1;
|
|
52
|
+
await wasmSupportStatic.initialize();
|
|
53
|
+
const secp256k1 = assertEx(await instantiateSecp256k1(), () => "No Wasm Support");
|
|
54
|
+
this._secp256k1 = secp256k1;
|
|
55
|
+
return secp256k1;
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
static async sign(hash, key) {
|
|
59
|
+
const { signMessageHashCompact } = await this.secp256k1();
|
|
60
|
+
const signature = signMessageHashCompact(new Uint8Array(key), toUint8Array(hash));
|
|
61
|
+
return (typeof signature === "string" ? toUint8Array(signature) : signature).buffer;
|
|
62
|
+
}
|
|
63
|
+
static async verify(msg, signature, address) {
|
|
64
|
+
const verifier = await this.secp256k1();
|
|
65
|
+
if (this.wasmSupport.canUseWasm) {
|
|
66
|
+
for (const recoveryId of recoveryIds) {
|
|
67
|
+
try {
|
|
68
|
+
const rawRecoveredPublicKey = verifier.recoverPublicKeyUncompressed(toUint8Array(signature), recoveryId, toUint8Array(msg));
|
|
69
|
+
const recoveredPublicKey = (typeof rawRecoveredPublicKey === "string" ? toUint8Array(rawRecoveredPublicKey) : rawRecoveredPublicKey).slice(1).buffer;
|
|
70
|
+
const recoveredAddress = this.addressFromPublicKey(recoveredPublicKey);
|
|
71
|
+
if (compareArrayBuffers(address, recoveredAddress)) {
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
} catch (ex) {
|
|
75
|
+
const error = ex;
|
|
76
|
+
console.log(error.message);
|
|
77
|
+
console.log(error.stack);
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
throw new Error("No wasm support");
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
export {
|
|
87
|
+
Elliptic
|
|
88
|
+
};
|
|
89
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { EmptyObject } from '@xylabs/sdk';
|
|
2
|
+
import { ObjectHasher } from './ObjectHasher.ts';
|
|
3
|
+
export declare class BrowserObjectHasher<T extends EmptyObject = EmptyObject> extends ObjectHasher<T> {
|
|
4
|
+
static readonly createBrowserWorker: (url?: URL) => import("@xylabs/threads/master").Worker;
|
|
5
|
+
static readonly createNodeWorker: (func?: () => unknown) => import("@xylabs/threads/master").Worker;
|
|
6
|
+
static readonly subtleHashWorkerUrl: URL | undefined;
|
|
7
|
+
static readonly wasmHashWorkerUrl: URL | undefined;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=BrowserObjectHasher.d.ts.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { EmptyObject } from '@xylabs/sdk';
|
|
2
|
+
import { ObjectHasher } from './ObjectHasher.ts';
|
|
3
|
+
export declare class NodeObjectHasher<T extends EmptyObject = EmptyObject> extends ObjectHasher<T> {
|
|
4
|
+
static readonly createNodeWorker: (func?: () => unknown) => import("@xylabs/threads/master").Worker;
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=NodeObjectHasher.d.ts.map
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { EmptyObject, Hash } from '@xylabs/sdk';
|
|
2
|
+
import { ObjectWrapper } from '@xylabs/sdk';
|
|
3
|
+
import type { Worker } from '@xylabs/threads/master';
|
|
4
|
+
import { WasmSupport } from '../../wasm/neutral/index.ts';
|
|
5
|
+
export type WorkerFunction = ((...args: unknown[]) => unknown) | (() => unknown);
|
|
6
|
+
export type WorkerModule<Keys extends string> = Record<Keys, WorkerFunction>;
|
|
7
|
+
export declare class ObjectHasher<T extends EmptyObject = EmptyObject> extends ObjectWrapper<T> {
|
|
8
|
+
static allowHashPooling: boolean;
|
|
9
|
+
static allowSubtle: boolean;
|
|
10
|
+
static createBrowserWorker?: (url?: URL) => Worker | undefined;
|
|
11
|
+
static createNodeWorker?: (func?: () => unknown) => Worker | undefined;
|
|
12
|
+
static readonly subtleHashWorkerUrl?: URL;
|
|
13
|
+
static warnIfUsingJsHash: boolean;
|
|
14
|
+
static readonly wasmHashWorkerUrl?: URL;
|
|
15
|
+
static readonly wasmInitialized: Promise<void>;
|
|
16
|
+
static readonly wasmSupport: WasmSupport;
|
|
17
|
+
private static _subtleHashPool?;
|
|
18
|
+
private static _wasmHashPool?;
|
|
19
|
+
private static get subtleHashPool();
|
|
20
|
+
private static get wasmHashPool();
|
|
21
|
+
static createWorker(url?: URL, func?: () => unknown): Worker;
|
|
22
|
+
static filterExcludeByHash<T extends EmptyObject>(objs: T[] | undefined, hash: Hash[] | Hash): Promise<T[]>;
|
|
23
|
+
static filterIncludeByHash<T extends EmptyObject>(objs: T[] | undefined, hash: Hash[] | Hash): Promise<T[]>;
|
|
24
|
+
static findByHash<T extends EmptyObject>(objs: T[] | undefined, hash: Hash): Promise<T | undefined>;
|
|
25
|
+
/**
|
|
26
|
+
* Asynchronously hashes a payload
|
|
27
|
+
* @param obj A payload
|
|
28
|
+
* @returns The payload hash
|
|
29
|
+
*/
|
|
30
|
+
static hash<T extends EmptyObject>(obj: T): Promise<Hash>;
|
|
31
|
+
static hashBytes(bytes: ArrayBuffer | Uint8Array): Promise<Hash>;
|
|
32
|
+
static hashFields<T extends EmptyObject>(obj: T): T;
|
|
33
|
+
/**
|
|
34
|
+
* Creates an array of payload/hash tuples based on the payloads passed in
|
|
35
|
+
* @param objs Any array of payloads
|
|
36
|
+
* @returns An array of payload/hash tuples
|
|
37
|
+
*/
|
|
38
|
+
static hashPairs<T extends EmptyObject>(objs: T[]): Promise<[T, Hash][]>;
|
|
39
|
+
/**
|
|
40
|
+
* Creates an array of payload hashes based on the payloads passed in
|
|
41
|
+
* @param objs Any array of payloads
|
|
42
|
+
* @returns An array of payload hashes
|
|
43
|
+
*/
|
|
44
|
+
static hashes<T extends EmptyObject>(objs?: T[]): Promise<Hash[] | undefined>;
|
|
45
|
+
/**
|
|
46
|
+
* Returns a clone of the payload that is JSON safe
|
|
47
|
+
* @param obj A payload
|
|
48
|
+
* @param meta Keeps underscore (meta) fields if set to true
|
|
49
|
+
* @returns Returns a clone of the payload that is JSON safe
|
|
50
|
+
*/
|
|
51
|
+
static json<T extends EmptyObject>(payload: T, meta?: boolean): T;
|
|
52
|
+
/** @deprecated us JSON instead */
|
|
53
|
+
static jsonPayload<T extends EmptyObject>(payload: T, meta?: boolean): T;
|
|
54
|
+
static stringifyHashFields<T extends EmptyObject>(obj: T): string;
|
|
55
|
+
static subtleHash(data: Uint8Array<ArrayBuffer>): Promise<ArrayBuffer>;
|
|
56
|
+
static wasmHash(data: Uint8Array): Promise<Hash>;
|
|
57
|
+
private static createWorkerPool;
|
|
58
|
+
hash(): Promise<Hash>;
|
|
59
|
+
/**
|
|
60
|
+
* Returns a clone of the payload that is JSON safe
|
|
61
|
+
* @param meta Keeps underscore (meta) fields if set to true
|
|
62
|
+
* @returns Returns a clone of the payload that is JSON safe
|
|
63
|
+
*/
|
|
64
|
+
json(meta?: boolean): T;
|
|
65
|
+
}
|
|
66
|
+
/** @deprecated use PayloadBuilder or ObjectHasher instead */
|
|
67
|
+
export declare class PayloadHasher<T extends object> extends ObjectHasher<T> {
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=ObjectHasher.d.ts.map
|