@enbox/dwn-sdk-js 0.0.1
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 +201 -0
- package/README.md +352 -0
- package/dist/bundles/dwn.js +153 -0
- package/dist/cjs/index.js +36749 -0
- package/dist/cjs/package.json +1 -0
- package/dist/esm/generated/precompiled-validators.js +11973 -0
- package/dist/esm/generated/precompiled-validators.js.map +1 -0
- package/dist/esm/json-schemas/definitions.json +23 -0
- package/dist/esm/src/core/abstract-message.js +47 -0
- package/dist/esm/src/core/abstract-message.js.map +1 -0
- package/dist/esm/src/core/auth.js +39 -0
- package/dist/esm/src/core/auth.js.map +1 -0
- package/dist/esm/src/core/dwn-constant.js +10 -0
- package/dist/esm/src/core/dwn-constant.js.map +1 -0
- package/dist/esm/src/core/dwn-error.js +169 -0
- package/dist/esm/src/core/dwn-error.js.map +1 -0
- package/dist/esm/src/core/grant-authorization.js +97 -0
- package/dist/esm/src/core/grant-authorization.js.map +1 -0
- package/dist/esm/src/core/message-reply.js +5 -0
- package/dist/esm/src/core/message-reply.js.map +1 -0
- package/dist/esm/src/core/message.js +233 -0
- package/dist/esm/src/core/message.js.map +1 -0
- package/dist/esm/src/core/messages-grant-authorization.js +101 -0
- package/dist/esm/src/core/messages-grant-authorization.js.map +1 -0
- package/dist/esm/src/core/protocol-authorization.js +608 -0
- package/dist/esm/src/core/protocol-authorization.js.map +1 -0
- package/dist/esm/src/core/protocols-grant-authorization.js +66 -0
- package/dist/esm/src/core/protocols-grant-authorization.js.map +1 -0
- package/dist/esm/src/core/records-grant-authorization.js +132 -0
- package/dist/esm/src/core/records-grant-authorization.js.map +1 -0
- package/dist/esm/src/core/resumable-task-manager.js +109 -0
- package/dist/esm/src/core/resumable-task-manager.js.map +1 -0
- package/dist/esm/src/core/tenant-gate.js +20 -0
- package/dist/esm/src/core/tenant-gate.js.map +1 -0
- package/dist/esm/src/dwn.js +164 -0
- package/dist/esm/src/dwn.js.map +1 -0
- package/dist/esm/src/enums/dwn-interface-method.js +16 -0
- package/dist/esm/src/enums/dwn-interface-method.js.map +1 -0
- package/dist/esm/src/event-log/event-emitter-stream.js +60 -0
- package/dist/esm/src/event-log/event-emitter-stream.js.map +1 -0
- package/dist/esm/src/event-log/event-log-level.js +63 -0
- package/dist/esm/src/event-log/event-log-level.js.map +1 -0
- package/dist/esm/src/handlers/messages-query.js +71 -0
- package/dist/esm/src/handlers/messages-query.js.map +1 -0
- package/dist/esm/src/handlers/messages-read.js +102 -0
- package/dist/esm/src/handlers/messages-read.js.map +1 -0
- package/dist/esm/src/handlers/messages-subscribe.js +81 -0
- package/dist/esm/src/handlers/messages-subscribe.js.map +1 -0
- package/dist/esm/src/handlers/protocols-configure.js +133 -0
- package/dist/esm/src/handlers/protocols-configure.js.map +1 -0
- package/dist/esm/src/handlers/protocols-query.js +73 -0
- package/dist/esm/src/handlers/protocols-query.js.map +1 -0
- package/dist/esm/src/handlers/records-delete.js +107 -0
- package/dist/esm/src/handlers/records-delete.js.map +1 -0
- package/dist/esm/src/handlers/records-query.js +210 -0
- package/dist/esm/src/handlers/records-query.js.map +1 -0
- package/dist/esm/src/handlers/records-read.js +169 -0
- package/dist/esm/src/handlers/records-read.js.map +1 -0
- package/dist/esm/src/handlers/records-subscribe.js +172 -0
- package/dist/esm/src/handlers/records-subscribe.js.map +1 -0
- package/dist/esm/src/handlers/records-write.js +344 -0
- package/dist/esm/src/handlers/records-write.js.map +1 -0
- package/dist/esm/src/index.js +49 -0
- package/dist/esm/src/index.js.map +1 -0
- package/dist/esm/src/interfaces/messages-query.js +53 -0
- package/dist/esm/src/interfaces/messages-query.js.map +1 -0
- package/dist/esm/src/interfaces/messages-read.js +61 -0
- package/dist/esm/src/interfaces/messages-read.js.map +1 -0
- package/dist/esm/src/interfaces/messages-subscribe.js +58 -0
- package/dist/esm/src/interfaces/messages-subscribe.js.map +1 -0
- package/dist/esm/src/interfaces/protocols-configure.js +271 -0
- package/dist/esm/src/interfaces/protocols-configure.js.map +1 -0
- package/dist/esm/src/interfaces/protocols-query.js +84 -0
- package/dist/esm/src/interfaces/protocols-query.js.map +1 -0
- package/dist/esm/src/interfaces/records-delete.js +89 -0
- package/dist/esm/src/interfaces/records-delete.js.map +1 -0
- package/dist/esm/src/interfaces/records-query.js +104 -0
- package/dist/esm/src/interfaces/records-query.js.map +1 -0
- package/dist/esm/src/interfaces/records-read.js +84 -0
- package/dist/esm/src/interfaces/records-read.js.map +1 -0
- package/dist/esm/src/interfaces/records-subscribe.js +91 -0
- package/dist/esm/src/interfaces/records-subscribe.js.map +1 -0
- package/dist/esm/src/interfaces/records-write.js +795 -0
- package/dist/esm/src/interfaces/records-write.js.map +1 -0
- package/dist/esm/src/jose/algorithms/signing/ed25519.js +51 -0
- package/dist/esm/src/jose/algorithms/signing/ed25519.js.map +1 -0
- package/dist/esm/src/jose/algorithms/signing/signature-algorithms.js +20 -0
- package/dist/esm/src/jose/algorithms/signing/signature-algorithms.js.map +1 -0
- package/dist/esm/src/jose/jws/general/builder.js +47 -0
- package/dist/esm/src/jose/jws/general/builder.js.map +1 -0
- package/dist/esm/src/jose/jws/general/verifier.js +97 -0
- package/dist/esm/src/jose/jws/general/verifier.js.map +1 -0
- package/dist/esm/src/protocols/permission-grant.js +39 -0
- package/dist/esm/src/protocols/permission-grant.js.map +1 -0
- package/dist/esm/src/protocols/permission-request.js +35 -0
- package/dist/esm/src/protocols/permission-request.js.map +1 -0
- package/dist/esm/src/protocols/permissions.js +357 -0
- package/dist/esm/src/protocols/permissions.js.map +1 -0
- package/dist/esm/src/schema-validator.js +37 -0
- package/dist/esm/src/schema-validator.js.map +1 -0
- package/dist/esm/src/store/blockstore-level.js +187 -0
- package/dist/esm/src/store/blockstore-level.js.map +1 -0
- package/dist/esm/src/store/blockstore-mock.js +168 -0
- package/dist/esm/src/store/blockstore-mock.js.map +1 -0
- package/dist/esm/src/store/data-store-level.js +136 -0
- package/dist/esm/src/store/data-store-level.js.map +1 -0
- package/dist/esm/src/store/index-level.js +660 -0
- package/dist/esm/src/store/index-level.js.map +1 -0
- package/dist/esm/src/store/level-wrapper.js +305 -0
- package/dist/esm/src/store/level-wrapper.js.map +1 -0
- package/dist/esm/src/store/message-store-level.js +159 -0
- package/dist/esm/src/store/message-store-level.js.map +1 -0
- package/dist/esm/src/store/resumable-task-store-level.js +131 -0
- package/dist/esm/src/store/resumable-task-store-level.js.map +1 -0
- package/dist/esm/src/store/storage-controller.js +184 -0
- package/dist/esm/src/store/storage-controller.js.map +1 -0
- package/dist/esm/src/types/cache.js +2 -0
- package/dist/esm/src/types/cache.js.map +1 -0
- package/dist/esm/src/types/data-store.js +2 -0
- package/dist/esm/src/types/data-store.js.map +1 -0
- package/dist/esm/src/types/event-log.js +2 -0
- package/dist/esm/src/types/event-log.js.map +1 -0
- package/dist/esm/src/types/jose-types.js +2 -0
- package/dist/esm/src/types/jose-types.js.map +1 -0
- package/dist/esm/src/types/jws-types.js +2 -0
- package/dist/esm/src/types/jws-types.js.map +1 -0
- package/dist/esm/src/types/message-interface.js +2 -0
- package/dist/esm/src/types/message-interface.js.map +1 -0
- package/dist/esm/src/types/message-store.js +2 -0
- package/dist/esm/src/types/message-store.js.map +1 -0
- package/dist/esm/src/types/message-types.js +3 -0
- package/dist/esm/src/types/message-types.js.map +1 -0
- package/dist/esm/src/types/messages-types.js +2 -0
- package/dist/esm/src/types/messages-types.js.map +1 -0
- package/dist/esm/src/types/method-handler.js +2 -0
- package/dist/esm/src/types/method-handler.js.map +1 -0
- package/dist/esm/src/types/permission-types.js +6 -0
- package/dist/esm/src/types/permission-types.js.map +1 -0
- package/dist/esm/src/types/protocols-types.js +20 -0
- package/dist/esm/src/types/protocols-types.js.map +1 -0
- package/dist/esm/src/types/query-types.js +6 -0
- package/dist/esm/src/types/query-types.js.map +1 -0
- package/dist/esm/src/types/records-types.js +8 -0
- package/dist/esm/src/types/records-types.js.map +1 -0
- package/dist/esm/src/types/resumable-task-store.js +2 -0
- package/dist/esm/src/types/resumable-task-store.js.map +1 -0
- package/dist/esm/src/types/signer.js +2 -0
- package/dist/esm/src/types/signer.js.map +1 -0
- package/dist/esm/src/types/subscriptions.js +2 -0
- package/dist/esm/src/types/subscriptions.js.map +1 -0
- package/dist/esm/src/utils/abort.js +40 -0
- package/dist/esm/src/utils/abort.js.map +1 -0
- package/dist/esm/src/utils/array.js +72 -0
- package/dist/esm/src/utils/array.js.map +1 -0
- package/dist/esm/src/utils/cid.js +130 -0
- package/dist/esm/src/utils/cid.js.map +1 -0
- package/dist/esm/src/utils/data-stream.js +100 -0
- package/dist/esm/src/utils/data-stream.js.map +1 -0
- package/dist/esm/src/utils/encoder.js +45 -0
- package/dist/esm/src/utils/encoder.js.map +1 -0
- package/dist/esm/src/utils/encryption.js +128 -0
- package/dist/esm/src/utils/encryption.js.map +1 -0
- package/dist/esm/src/utils/filter.js +229 -0
- package/dist/esm/src/utils/filter.js.map +1 -0
- package/dist/esm/src/utils/hd-key.js +114 -0
- package/dist/esm/src/utils/hd-key.js.map +1 -0
- package/dist/esm/src/utils/jws.js +89 -0
- package/dist/esm/src/utils/jws.js.map +1 -0
- package/dist/esm/src/utils/memory-cache.js +41 -0
- package/dist/esm/src/utils/memory-cache.js.map +1 -0
- package/dist/esm/src/utils/messages.js +84 -0
- package/dist/esm/src/utils/messages.js.map +1 -0
- package/dist/esm/src/utils/object.js +40 -0
- package/dist/esm/src/utils/object.js.map +1 -0
- package/dist/esm/src/utils/private-key-signer.js +43 -0
- package/dist/esm/src/utils/private-key-signer.js.map +1 -0
- package/dist/esm/src/utils/protocols.js +51 -0
- package/dist/esm/src/utils/protocols.js.map +1 -0
- package/dist/esm/src/utils/records.js +454 -0
- package/dist/esm/src/utils/records.js.map +1 -0
- package/dist/esm/src/utils/secp256k1.js +166 -0
- package/dist/esm/src/utils/secp256k1.js.map +1 -0
- package/dist/esm/src/utils/secp256r1.js +120 -0
- package/dist/esm/src/utils/secp256r1.js.map +1 -0
- package/dist/esm/src/utils/string.js +16 -0
- package/dist/esm/src/utils/string.js.map +1 -0
- package/dist/esm/src/utils/time.js +85 -0
- package/dist/esm/src/utils/time.js.map +1 -0
- package/dist/esm/src/utils/url.js +62 -0
- package/dist/esm/src/utils/url.js.map +1 -0
- package/dist/esm/tests/core/auth.spec.js +22 -0
- package/dist/esm/tests/core/auth.spec.js.map +1 -0
- package/dist/esm/tests/core/message-reply.spec.js +16 -0
- package/dist/esm/tests/core/message-reply.spec.js.map +1 -0
- package/dist/esm/tests/core/message.spec.js +146 -0
- package/dist/esm/tests/core/message.spec.js.map +1 -0
- package/dist/esm/tests/core/protocol-authorization.spec.js +48 -0
- package/dist/esm/tests/core/protocol-authorization.spec.js.map +1 -0
- package/dist/esm/tests/dwn.spec.js +166 -0
- package/dist/esm/tests/dwn.spec.js.map +1 -0
- package/dist/esm/tests/event-log/event-emitter-stream.spec.js +78 -0
- package/dist/esm/tests/event-log/event-emitter-stream.spec.js.map +1 -0
- package/dist/esm/tests/event-log/event-log-level.spec.js +44 -0
- package/dist/esm/tests/event-log/event-log-level.spec.js.map +1 -0
- package/dist/esm/tests/event-log/event-log.spec.js +236 -0
- package/dist/esm/tests/event-log/event-log.spec.js.map +1 -0
- package/dist/esm/tests/event-log/event-stream.spec.js +125 -0
- package/dist/esm/tests/event-log/event-stream.spec.js.map +1 -0
- package/dist/esm/tests/features/author-delegated-grant.spec.js +1273 -0
- package/dist/esm/tests/features/author-delegated-grant.spec.js.map +1 -0
- package/dist/esm/tests/features/owner-delegated-grant.spec.js +584 -0
- package/dist/esm/tests/features/owner-delegated-grant.spec.js.map +1 -0
- package/dist/esm/tests/features/owner-signature.spec.js +192 -0
- package/dist/esm/tests/features/owner-signature.spec.js.map +1 -0
- package/dist/esm/tests/features/permissions.spec.js +815 -0
- package/dist/esm/tests/features/permissions.spec.js.map +1 -0
- package/dist/esm/tests/features/protocol-create-action.spec.js +248 -0
- package/dist/esm/tests/features/protocol-create-action.spec.js.map +1 -0
- package/dist/esm/tests/features/protocol-delete-action.spec.js +492 -0
- package/dist/esm/tests/features/protocol-delete-action.spec.js.map +1 -0
- package/dist/esm/tests/features/protocol-update-action.spec.js +572 -0
- package/dist/esm/tests/features/protocol-update-action.spec.js.map +1 -0
- package/dist/esm/tests/features/records-prune.spec.js +812 -0
- package/dist/esm/tests/features/records-prune.spec.js.map +1 -0
- package/dist/esm/tests/features/records-tags.spec.js +2516 -0
- package/dist/esm/tests/features/records-tags.spec.js.map +1 -0
- package/dist/esm/tests/features/resumable-tasks.spec.js +349 -0
- package/dist/esm/tests/features/resumable-tasks.spec.js.map +1 -0
- package/dist/esm/tests/handlers/messages-query.spec.js +349 -0
- package/dist/esm/tests/handlers/messages-query.spec.js.map +1 -0
- package/dist/esm/tests/handlers/messages-read.spec.js +647 -0
- package/dist/esm/tests/handlers/messages-read.spec.js.map +1 -0
- package/dist/esm/tests/handlers/messages-subscribe.spec.js +432 -0
- package/dist/esm/tests/handlers/messages-subscribe.spec.js.map +1 -0
- package/dist/esm/tests/handlers/protocols-configure.spec.js +608 -0
- package/dist/esm/tests/handlers/protocols-configure.spec.js.map +1 -0
- package/dist/esm/tests/handlers/protocols-query.spec.js +454 -0
- package/dist/esm/tests/handlers/protocols-query.spec.js.map +1 -0
- package/dist/esm/tests/handlers/records-delete.spec.js +662 -0
- package/dist/esm/tests/handlers/records-delete.spec.js.map +1 -0
- package/dist/esm/tests/handlers/records-query.spec.js +2695 -0
- package/dist/esm/tests/handlers/records-query.spec.js.map +1 -0
- package/dist/esm/tests/handlers/records-read.spec.js +1724 -0
- package/dist/esm/tests/handlers/records-read.spec.js.map +1 -0
- package/dist/esm/tests/handlers/records-subscribe.spec.js +684 -0
- package/dist/esm/tests/handlers/records-subscribe.spec.js.map +1 -0
- package/dist/esm/tests/handlers/records-write.spec.js +3637 -0
- package/dist/esm/tests/handlers/records-write.spec.js.map +1 -0
- package/dist/esm/tests/interfaces/messages-get.spec.js +78 -0
- package/dist/esm/tests/interfaces/messages-get.spec.js.map +1 -0
- package/dist/esm/tests/interfaces/messages-subscribe.spec.js +30 -0
- package/dist/esm/tests/interfaces/messages-subscribe.spec.js.map +1 -0
- package/dist/esm/tests/interfaces/messagess-query.spec.js +127 -0
- package/dist/esm/tests/interfaces/messagess-query.spec.js.map +1 -0
- package/dist/esm/tests/interfaces/protocols-configure.spec.js +489 -0
- package/dist/esm/tests/interfaces/protocols-configure.spec.js.map +1 -0
- package/dist/esm/tests/interfaces/protocols-query.spec.js +46 -0
- package/dist/esm/tests/interfaces/protocols-query.spec.js.map +1 -0
- package/dist/esm/tests/interfaces/records-delete.spec.js +39 -0
- package/dist/esm/tests/interfaces/records-delete.spec.js.map +1 -0
- package/dist/esm/tests/interfaces/records-query.spec.js +85 -0
- package/dist/esm/tests/interfaces/records-query.spec.js.map +1 -0
- package/dist/esm/tests/interfaces/records-read.spec.js +62 -0
- package/dist/esm/tests/interfaces/records-read.spec.js.map +1 -0
- package/dist/esm/tests/interfaces/records-subscribe.spec.js +72 -0
- package/dist/esm/tests/interfaces/records-subscribe.spec.js.map +1 -0
- package/dist/esm/tests/interfaces/records-write.spec.js +423 -0
- package/dist/esm/tests/interfaces/records-write.spec.js.map +1 -0
- package/dist/esm/tests/jose/jws/general.spec.js +243 -0
- package/dist/esm/tests/jose/jws/general.spec.js.map +1 -0
- package/dist/esm/tests/protocols/permission-request.spec.js +40 -0
- package/dist/esm/tests/protocols/permission-request.spec.js.map +1 -0
- package/dist/esm/tests/protocols/permissions.spec.js +123 -0
- package/dist/esm/tests/protocols/permissions.spec.js.map +1 -0
- package/dist/esm/tests/scenarios/aggregator.spec.js +670 -0
- package/dist/esm/tests/scenarios/aggregator.spec.js.map +1 -0
- package/dist/esm/tests/scenarios/deleted-record.spec.js +102 -0
- package/dist/esm/tests/scenarios/deleted-record.spec.js.map +1 -0
- package/dist/esm/tests/scenarios/end-to-end-tests.spec.js +220 -0
- package/dist/esm/tests/scenarios/end-to-end-tests.spec.js.map +1 -0
- package/dist/esm/tests/scenarios/messages-query.spec.js +395 -0
- package/dist/esm/tests/scenarios/messages-query.spec.js.map +1 -0
- package/dist/esm/tests/scenarios/nested-roles.spec.js +300 -0
- package/dist/esm/tests/scenarios/nested-roles.spec.js.map +1 -0
- package/dist/esm/tests/scenarios/subscriptions.spec.js +886 -0
- package/dist/esm/tests/scenarios/subscriptions.spec.js.map +1 -0
- package/dist/esm/tests/store/blockstore-mock.spec.js +192 -0
- package/dist/esm/tests/store/blockstore-mock.spec.js.map +1 -0
- package/dist/esm/tests/store/data-store-level.spec.js +146 -0
- package/dist/esm/tests/store/data-store-level.spec.js.map +1 -0
- package/dist/esm/tests/store/index-level.spec.js +1208 -0
- package/dist/esm/tests/store/index-level.spec.js.map +1 -0
- package/dist/esm/tests/store/message-store-level.spec.js +48 -0
- package/dist/esm/tests/store/message-store-level.spec.js.map +1 -0
- package/dist/esm/tests/store/message-store.spec.js +404 -0
- package/dist/esm/tests/store/message-store.spec.js.map +1 -0
- package/dist/esm/tests/store-dependent-tests.spec.js +5 -0
- package/dist/esm/tests/store-dependent-tests.spec.js.map +1 -0
- package/dist/esm/tests/test-event-stream.js +25 -0
- package/dist/esm/tests/test-event-stream.js.map +1 -0
- package/dist/esm/tests/test-stores.js +45 -0
- package/dist/esm/tests/test-stores.js.map +1 -0
- package/dist/esm/tests/test-suite.js +88 -0
- package/dist/esm/tests/test-suite.js.map +1 -0
- package/dist/esm/tests/utils/cid.spec.js +80 -0
- package/dist/esm/tests/utils/cid.spec.js.map +1 -0
- package/dist/esm/tests/utils/data-stream.spec.js +27 -0
- package/dist/esm/tests/utils/data-stream.spec.js.map +1 -0
- package/dist/esm/tests/utils/encryption.spec.js +148 -0
- package/dist/esm/tests/utils/encryption.spec.js.map +1 -0
- package/dist/esm/tests/utils/filters.spec.js +295 -0
- package/dist/esm/tests/utils/filters.spec.js.map +1 -0
- package/dist/esm/tests/utils/hd-key.spec.js +35 -0
- package/dist/esm/tests/utils/hd-key.spec.js.map +1 -0
- package/dist/esm/tests/utils/jws.spec.js +8 -0
- package/dist/esm/tests/utils/jws.spec.js.map +1 -0
- package/dist/esm/tests/utils/memory-cache.spec.js +35 -0
- package/dist/esm/tests/utils/memory-cache.spec.js.map +1 -0
- package/dist/esm/tests/utils/messages.spec.js +101 -0
- package/dist/esm/tests/utils/messages.spec.js.map +1 -0
- package/dist/esm/tests/utils/object.spec.js +36 -0
- package/dist/esm/tests/utils/object.spec.js.map +1 -0
- package/dist/esm/tests/utils/poller.js +49 -0
- package/dist/esm/tests/utils/poller.js.map +1 -0
- package/dist/esm/tests/utils/private-key-signer.spec.js +44 -0
- package/dist/esm/tests/utils/private-key-signer.spec.js.map +1 -0
- package/dist/esm/tests/utils/records.spec.js +53 -0
- package/dist/esm/tests/utils/records.spec.js.map +1 -0
- package/dist/esm/tests/utils/secp256k1.spec.js +50 -0
- package/dist/esm/tests/utils/secp256k1.spec.js.map +1 -0
- package/dist/esm/tests/utils/secp256r1.spec.js +56 -0
- package/dist/esm/tests/utils/secp256r1.spec.js.map +1 -0
- package/dist/esm/tests/utils/test-data-generator.js +643 -0
- package/dist/esm/tests/utils/test-data-generator.js.map +1 -0
- package/dist/esm/tests/utils/test-stub-generator.js +39 -0
- package/dist/esm/tests/utils/test-stub-generator.js.map +1 -0
- package/dist/esm/tests/utils/time.spec.js +64 -0
- package/dist/esm/tests/utils/time.spec.js.map +1 -0
- package/dist/esm/tests/utils/url.spec.js +43 -0
- package/dist/esm/tests/utils/url.spec.js.map +1 -0
- package/dist/esm/tests/validation/json-schemas/definitions.spec.js +33 -0
- package/dist/esm/tests/validation/json-schemas/definitions.spec.js.map +1 -0
- package/dist/esm/tests/validation/json-schemas/jwk/general-jwk.spec.js +50 -0
- package/dist/esm/tests/validation/json-schemas/jwk/general-jwk.spec.js.map +1 -0
- package/dist/esm/tests/validation/json-schemas/jwk/public-jwk.spec.js +36 -0
- package/dist/esm/tests/validation/json-schemas/jwk/public-jwk.spec.js.map +1 -0
- package/dist/esm/tests/validation/json-schemas/jwk-verification-method.spec.js +82 -0
- package/dist/esm/tests/validation/json-schemas/jwk-verification-method.spec.js.map +1 -0
- package/dist/esm/tests/validation/json-schemas/protocols/protocols-configure.spec.js +75 -0
- package/dist/esm/tests/validation/json-schemas/protocols/protocols-configure.spec.js.map +1 -0
- package/dist/esm/tests/validation/json-schemas/records/records-query.spec.js +148 -0
- package/dist/esm/tests/validation/json-schemas/records/records-query.spec.js.map +1 -0
- package/dist/esm/tests/validation/json-schemas/records/records-write.spec.js +421 -0
- package/dist/esm/tests/validation/json-schemas/records/records-write.spec.js.map +1 -0
- package/dist/esm/tests/vectors/protocol-definitions/anyone-collaborate.json +21 -0
- package/dist/esm/tests/vectors/protocol-definitions/author-can.json +33 -0
- package/dist/esm/tests/vectors/protocol-definitions/chat.json +70 -0
- package/dist/esm/tests/vectors/protocol-definitions/credential-issuance.json +41 -0
- package/dist/esm/tests/vectors/protocol-definitions/dex.json +58 -0
- package/dist/esm/tests/vectors/protocol-definitions/email.json +62 -0
- package/dist/esm/tests/vectors/protocol-definitions/free-for-all.json +45 -0
- package/dist/esm/tests/vectors/protocol-definitions/friend-role.json +48 -0
- package/dist/esm/tests/vectors/protocol-definitions/message.json +37 -0
- package/dist/esm/tests/vectors/protocol-definitions/minimal.json +10 -0
- package/dist/esm/tests/vectors/protocol-definitions/nested.json +31 -0
- package/dist/esm/tests/vectors/protocol-definitions/private-protocol.json +15 -0
- package/dist/esm/tests/vectors/protocol-definitions/recipient-can.json +33 -0
- package/dist/esm/tests/vectors/protocol-definitions/slack.json +242 -0
- package/dist/esm/tests/vectors/protocol-definitions/social-media.json +106 -0
- package/dist/esm/tests/vectors/protocol-definitions/thread-role.json +70 -0
- package/dist/types/generated/precompiled-validators.d.ts +597 -0
- package/dist/types/generated/precompiled-validators.d.ts.map +1 -0
- package/dist/types/src/core/abstract-message.d.ts +25 -0
- package/dist/types/src/core/abstract-message.d.ts.map +1 -0
- package/dist/types/src/core/auth.d.ts +9 -0
- package/dist/types/src/core/auth.d.ts.map +1 -0
- package/dist/types/src/core/dwn-constant.d.ts +10 -0
- package/dist/types/src/core/dwn-constant.d.ts.map +1 -0
- package/dist/types/src/core/dwn-error.d.ts +164 -0
- package/dist/types/src/core/dwn-error.d.ts.map +1 -0
- package/dist/types/src/core/grant-authorization.d.ts +43 -0
- package/dist/types/src/core/grant-authorization.d.ts.map +1 -0
- package/dist/types/src/core/message-reply.d.ts +32 -0
- package/dist/types/src/core/message-reply.d.ts.map +1 -0
- package/dist/types/src/core/message.d.ts +94 -0
- package/dist/types/src/core/message.d.ts.map +1 -0
- package/dist/types/src/core/messages-grant-authorization.d.ts +34 -0
- package/dist/types/src/core/messages-grant-authorization.d.ts.map +1 -0
- package/dist/types/src/core/protocol-authorization.d.ts +103 -0
- package/dist/types/src/core/protocol-authorization.d.ts.map +1 -0
- package/dist/types/src/core/protocols-grant-authorization.d.ts +31 -0
- package/dist/types/src/core/protocols-grant-authorization.d.ts.map +1 -0
- package/dist/types/src/core/records-grant-authorization.d.ts +60 -0
- package/dist/types/src/core/records-grant-authorization.d.ts.map +1 -0
- package/dist/types/src/core/resumable-task-manager.d.ts +43 -0
- package/dist/types/src/core/resumable-task-manager.d.ts.map +1 -0
- package/dist/types/src/core/tenant-gate.d.ts +29 -0
- package/dist/types/src/core/tenant-gate.d.ts.map +1 -0
- package/dist/types/src/dwn.d.ts +85 -0
- package/dist/types/src/dwn.d.ts.map +1 -0
- package/dist/types/src/enums/dwn-interface-method.d.ts +14 -0
- package/dist/types/src/enums/dwn-interface-method.d.ts.map +1 -0
- package/dist/types/src/event-log/event-emitter-stream.d.ts +23 -0
- package/dist/types/src/event-log/event-emitter-stream.d.ts.map +1 -0
- package/dist/types/src/event-log/event-log-level.d.ts +35 -0
- package/dist/types/src/event-log/event-log-level.d.ts.map +1 -0
- package/dist/types/src/handlers/messages-query.d.ts +17 -0
- package/dist/types/src/handlers/messages-query.d.ts.map +1 -0
- package/dist/types/src/handlers/messages-read.d.ts +22 -0
- package/dist/types/src/handlers/messages-read.d.ts.map +1 -0
- package/dist/types/src/handlers/messages-subscribe.d.ts +18 -0
- package/dist/types/src/handlers/messages-subscribe.d.ts.map +1 -0
- package/dist/types/src/handlers/protocols-configure.d.ts +24 -0
- package/dist/types/src/handlers/protocols-configure.d.ts.map +1 -0
- package/dist/types/src/handlers/protocols-query.d.ts +20 -0
- package/dist/types/src/handlers/protocols-query.d.ts.map +1 -0
- package/dist/types/src/handlers/records-delete.d.ts +23 -0
- package/dist/types/src/handlers/records-delete.d.ts.map +1 -0
- package/dist/types/src/handlers/records-query.d.ts +70 -0
- package/dist/types/src/handlers/records-query.d.ts.map +1 -0
- package/dist/types/src/handlers/records-read.d.ts +20 -0
- package/dist/types/src/handlers/records-read.d.ts.map +1 -0
- package/dist/types/src/handlers/records-subscribe.d.ts +62 -0
- package/dist/types/src/handlers/records-subscribe.d.ts.map +1 -0
- package/dist/types/src/handlers/records-write.d.ts +51 -0
- package/dist/types/src/handlers/records-write.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +63 -0
- package/dist/types/src/index.d.ts.map +1 -0
- package/dist/types/src/interfaces/messages-query.d.ts +16 -0
- package/dist/types/src/interfaces/messages-query.d.ts.map +1 -0
- package/dist/types/src/interfaces/messages-read.d.ts +20 -0
- package/dist/types/src/interfaces/messages-read.d.ts.map +1 -0
- package/dist/types/src/interfaces/messages-subscribe.d.ts +20 -0
- package/dist/types/src/interfaces/messages-subscribe.d.ts.map +1 -0
- package/dist/types/src/interfaces/protocols-configure.d.ts +40 -0
- package/dist/types/src/interfaces/protocols-configure.d.ts.map +1 -0
- package/dist/types/src/interfaces/protocols-query.d.ts +17 -0
- package/dist/types/src/interfaces/protocols-query.d.ts.map +1 -0
- package/dist/types/src/interfaces/records-delete.d.ts +34 -0
- package/dist/types/src/interfaces/records-delete.d.ts.map +1 -0
- package/dist/types/src/interfaces/records-query.d.ts +31 -0
- package/dist/types/src/interfaces/records-query.d.ts.map +1 -0
- package/dist/types/src/interfaces/records-read.d.ts +36 -0
- package/dist/types/src/interfaces/records-read.d.ts.map +1 -0
- package/dist/types/src/interfaces/records-subscribe.d.ts +27 -0
- package/dist/types/src/interfaces/records-subscribe.d.ts.map +1 -0
- package/dist/types/src/interfaces/records-write.d.ts +309 -0
- package/dist/types/src/interfaces/records-write.d.ts.map +1 -0
- package/dist/types/src/jose/algorithms/signing/ed25519.d.ts +3 -0
- package/dist/types/src/jose/algorithms/signing/ed25519.d.ts.map +1 -0
- package/dist/types/src/jose/algorithms/signing/signature-algorithms.d.ts +3 -0
- package/dist/types/src/jose/algorithms/signing/signature-algorithms.d.ts.map +1 -0
- package/dist/types/src/jose/jws/general/builder.d.ts +10 -0
- package/dist/types/src/jose/jws/general/builder.d.ts.map +1 -0
- package/dist/types/src/jose/jws/general/verifier.d.ts +32 -0
- package/dist/types/src/jose/jws/general/verifier.d.ts.map +1 -0
- package/dist/types/src/protocols/permission-grant.d.ts +50 -0
- package/dist/types/src/protocols/permission-grant.d.ts.map +1 -0
- package/dist/types/src/protocols/permission-request.d.ts +35 -0
- package/dist/types/src/protocols/permission-request.d.ts.map +1 -0
- package/dist/types/src/protocols/permissions.d.ts +150 -0
- package/dist/types/src/protocols/permissions.d.ts.map +1 -0
- package/dist/types/src/schema-validator.d.ts +8 -0
- package/dist/types/src/schema-validator.d.ts.map +1 -0
- package/dist/types/src/store/blockstore-level.d.ts +34 -0
- package/dist/types/src/store/blockstore-level.d.ts.map +1 -0
- package/dist/types/src/store/blockstore-mock.d.ts +27 -0
- package/dist/types/src/store/blockstore-mock.d.ts.map +1 -0
- package/dist/types/src/store/data-store-level.d.ts +34 -0
- package/dist/types/src/store/data-store-level.d.ts.map +1 -0
- package/dist/types/src/store/index-level.d.ts +171 -0
- package/dist/types/src/store/index-level.d.ts.map +1 -0
- package/dist/types/src/store/level-wrapper.d.ts +48 -0
- package/dist/types/src/store/level-wrapper.d.ts.map +1 -0
- package/dist/types/src/store/message-store-level.d.ts +46 -0
- package/dist/types/src/store/message-store-level.d.ts.map +1 -0
- package/dist/types/src/store/resumable-task-store-level.d.ts +28 -0
- package/dist/types/src/store/resumable-task-store-level.d.ts.map +1 -0
- package/dist/types/src/store/storage-controller.d.ts +46 -0
- package/dist/types/src/store/storage-controller.d.ts.map +1 -0
- package/dist/types/src/types/cache.d.ts +16 -0
- package/dist/types/src/types/cache.d.ts.map +1 -0
- package/dist/types/src/types/data-store.d.ts +57 -0
- package/dist/types/src/types/data-store.d.ts.map +1 -0
- package/dist/types/src/types/event-log.d.ts +52 -0
- package/dist/types/src/types/event-log.d.ts.map +1 -0
- package/dist/types/src/types/jose-types.d.ts +75 -0
- package/dist/types/src/types/jose-types.d.ts.map +1 -0
- package/dist/types/src/types/jws-types.d.ts +27 -0
- package/dist/types/src/types/jws-types.d.ts.map +1 -0
- package/dist/types/src/types/message-interface.d.ts +27 -0
- package/dist/types/src/types/message-interface.d.ts.map +1 -0
- package/dist/types/src/types/message-store.d.ts +42 -0
- package/dist/types/src/types/message-store.d.ts.map +1 -0
- package/dist/types/src/types/message-types.d.ts +116 -0
- package/dist/types/src/types/message-types.d.ts.map +1 -0
- package/dist/types/src/types/messages-types.d.ts +65 -0
- package/dist/types/src/types/messages-types.d.ts.map +1 -0
- package/dist/types/src/types/method-handler.d.ts +19 -0
- package/dist/types/src/types/method-handler.d.ts.map +1 -0
- package/dist/types/src/types/permission-types.d.ts +93 -0
- package/dist/types/src/types/permission-types.d.ts.map +1 -0
- package/dist/types/src/types/protocols-types.d.ts +154 -0
- package/dist/types/src/types/protocols-types.d.ts.map +1 -0
- package/dist/types/src/types/query-types.d.ts +66 -0
- package/dist/types/src/types/query-types.d.ts.map +1 -0
- package/dist/types/src/types/records-types.d.ts +230 -0
- package/dist/types/src/types/records-types.d.ts.map +1 -0
- package/dist/types/src/types/resumable-task-store.d.ts +89 -0
- package/dist/types/src/types/resumable-task-store.d.ts.map +1 -0
- package/dist/types/src/types/signer.d.ts +26 -0
- package/dist/types/src/types/signer.d.ts.map +1 -0
- package/dist/types/src/types/subscriptions.d.ts +30 -0
- package/dist/types/src/types/subscriptions.d.ts.map +1 -0
- package/dist/types/src/utils/abort.d.ts +5 -0
- package/dist/types/src/utils/abort.d.ts.map +1 -0
- package/dist/types/src/utils/array.d.ts +18 -0
- package/dist/types/src/utils/array.d.ts.map +1 -0
- package/dist/types/src/utils/cid.d.ts +30 -0
- package/dist/types/src/utils/cid.d.ts.map +1 -0
- package/dist/types/src/utils/data-stream.d.ts +31 -0
- package/dist/types/src/utils/data-stream.d.ts.map +1 -0
- package/dist/types/src/utils/encoder.d.ts +14 -0
- package/dist/types/src/utils/encoder.d.ts.map +1 -0
- package/dist/types/src/utils/encryption.d.ts +44 -0
- package/dist/types/src/utils/encryption.d.ts.map +1 -0
- package/dist/types/src/utils/filter.d.ts +60 -0
- package/dist/types/src/utils/filter.d.ts.map +1 -0
- package/dist/types/src/utils/hd-key.d.ts +54 -0
- package/dist/types/src/utils/hd-key.d.ts.map +1 -0
- package/dist/types/src/utils/jws.d.ts +39 -0
- package/dist/types/src/utils/jws.d.ts.map +1 -0
- package/dist/types/src/utils/memory-cache.d.ts +15 -0
- package/dist/types/src/utils/memory-cache.d.ts.map +1 -0
- package/dist/types/src/utils/messages.d.ts +27 -0
- package/dist/types/src/utils/messages.d.ts.map +1 -0
- package/dist/types/src/utils/object.d.ts +13 -0
- package/dist/types/src/utils/object.d.ts.map +1 -0
- package/dist/types/src/utils/private-key-signer.d.ts +34 -0
- package/dist/types/src/utils/private-key-signer.d.ts.map +1 -0
- package/dist/types/src/utils/protocols.d.ts +14 -0
- package/dist/types/src/utils/protocols.d.ts.map +1 -0
- package/dist/types/src/utils/records.d.ts +122 -0
- package/dist/types/src/utils/records.d.ts.map +1 -0
- package/dist/types/src/utils/secp256k1.d.ts +59 -0
- package/dist/types/src/utils/secp256k1.d.ts.map +1 -0
- package/dist/types/src/utils/secp256r1.d.ts +39 -0
- package/dist/types/src/utils/secp256r1.d.ts.map +1 -0
- package/dist/types/src/utils/string.d.ts +6 -0
- package/dist/types/src/utils/string.d.ts.map +1 -0
- package/dist/types/src/utils/time.d.ts +50 -0
- package/dist/types/src/utils/time.d.ts.map +1 -0
- package/dist/types/src/utils/url.d.ts +5 -0
- package/dist/types/src/utils/url.d.ts.map +1 -0
- package/dist/types/tests/core/auth.spec.d.ts +2 -0
- package/dist/types/tests/core/auth.spec.d.ts.map +1 -0
- package/dist/types/tests/core/message-reply.spec.d.ts +2 -0
- package/dist/types/tests/core/message-reply.spec.d.ts.map +1 -0
- package/dist/types/tests/core/message.spec.d.ts +2 -0
- package/dist/types/tests/core/message.spec.d.ts.map +1 -0
- package/dist/types/tests/core/protocol-authorization.spec.d.ts +2 -0
- package/dist/types/tests/core/protocol-authorization.spec.d.ts.map +1 -0
- package/dist/types/tests/dwn.spec.d.ts +2 -0
- package/dist/types/tests/dwn.spec.d.ts.map +1 -0
- package/dist/types/tests/event-log/event-emitter-stream.spec.d.ts +2 -0
- package/dist/types/tests/event-log/event-emitter-stream.spec.d.ts.map +1 -0
- package/dist/types/tests/event-log/event-log-level.spec.d.ts +2 -0
- package/dist/types/tests/event-log/event-log-level.spec.d.ts.map +1 -0
- package/dist/types/tests/event-log/event-log.spec.d.ts +2 -0
- package/dist/types/tests/event-log/event-log.spec.d.ts.map +1 -0
- package/dist/types/tests/event-log/event-stream.spec.d.ts +2 -0
- package/dist/types/tests/event-log/event-stream.spec.d.ts.map +1 -0
- package/dist/types/tests/features/author-delegated-grant.spec.d.ts +2 -0
- package/dist/types/tests/features/author-delegated-grant.spec.d.ts.map +1 -0
- package/dist/types/tests/features/owner-delegated-grant.spec.d.ts +2 -0
- package/dist/types/tests/features/owner-delegated-grant.spec.d.ts.map +1 -0
- package/dist/types/tests/features/owner-signature.spec.d.ts +2 -0
- package/dist/types/tests/features/owner-signature.spec.d.ts.map +1 -0
- package/dist/types/tests/features/permissions.spec.d.ts +2 -0
- package/dist/types/tests/features/permissions.spec.d.ts.map +1 -0
- package/dist/types/tests/features/protocol-create-action.spec.d.ts +2 -0
- package/dist/types/tests/features/protocol-create-action.spec.d.ts.map +1 -0
- package/dist/types/tests/features/protocol-delete-action.spec.d.ts +2 -0
- package/dist/types/tests/features/protocol-delete-action.spec.d.ts.map +1 -0
- package/dist/types/tests/features/protocol-update-action.spec.d.ts +2 -0
- package/dist/types/tests/features/protocol-update-action.spec.d.ts.map +1 -0
- package/dist/types/tests/features/records-prune.spec.d.ts +2 -0
- package/dist/types/tests/features/records-prune.spec.d.ts.map +1 -0
- package/dist/types/tests/features/records-tags.spec.d.ts +2 -0
- package/dist/types/tests/features/records-tags.spec.d.ts.map +1 -0
- package/dist/types/tests/features/resumable-tasks.spec.d.ts +2 -0
- package/dist/types/tests/features/resumable-tasks.spec.d.ts.map +1 -0
- package/dist/types/tests/handlers/messages-query.spec.d.ts +2 -0
- package/dist/types/tests/handlers/messages-query.spec.d.ts.map +1 -0
- package/dist/types/tests/handlers/messages-read.spec.d.ts +2 -0
- package/dist/types/tests/handlers/messages-read.spec.d.ts.map +1 -0
- package/dist/types/tests/handlers/messages-subscribe.spec.d.ts +2 -0
- package/dist/types/tests/handlers/messages-subscribe.spec.d.ts.map +1 -0
- package/dist/types/tests/handlers/protocols-configure.spec.d.ts +2 -0
- package/dist/types/tests/handlers/protocols-configure.spec.d.ts.map +1 -0
- package/dist/types/tests/handlers/protocols-query.spec.d.ts +2 -0
- package/dist/types/tests/handlers/protocols-query.spec.d.ts.map +1 -0
- package/dist/types/tests/handlers/records-delete.spec.d.ts +2 -0
- package/dist/types/tests/handlers/records-delete.spec.d.ts.map +1 -0
- package/dist/types/tests/handlers/records-query.spec.d.ts +2 -0
- package/dist/types/tests/handlers/records-query.spec.d.ts.map +1 -0
- package/dist/types/tests/handlers/records-read.spec.d.ts +2 -0
- package/dist/types/tests/handlers/records-read.spec.d.ts.map +1 -0
- package/dist/types/tests/handlers/records-subscribe.spec.d.ts +2 -0
- package/dist/types/tests/handlers/records-subscribe.spec.d.ts.map +1 -0
- package/dist/types/tests/handlers/records-write.spec.d.ts +2 -0
- package/dist/types/tests/handlers/records-write.spec.d.ts.map +1 -0
- package/dist/types/tests/interfaces/messages-get.spec.d.ts +2 -0
- package/dist/types/tests/interfaces/messages-get.spec.d.ts.map +1 -0
- package/dist/types/tests/interfaces/messages-subscribe.spec.d.ts +2 -0
- package/dist/types/tests/interfaces/messages-subscribe.spec.d.ts.map +1 -0
- package/dist/types/tests/interfaces/messagess-query.spec.d.ts +2 -0
- package/dist/types/tests/interfaces/messagess-query.spec.d.ts.map +1 -0
- package/dist/types/tests/interfaces/protocols-configure.spec.d.ts +2 -0
- package/dist/types/tests/interfaces/protocols-configure.spec.d.ts.map +1 -0
- package/dist/types/tests/interfaces/protocols-query.spec.d.ts +2 -0
- package/dist/types/tests/interfaces/protocols-query.spec.d.ts.map +1 -0
- package/dist/types/tests/interfaces/records-delete.spec.d.ts +2 -0
- package/dist/types/tests/interfaces/records-delete.spec.d.ts.map +1 -0
- package/dist/types/tests/interfaces/records-query.spec.d.ts +2 -0
- package/dist/types/tests/interfaces/records-query.spec.d.ts.map +1 -0
- package/dist/types/tests/interfaces/records-read.spec.d.ts +2 -0
- package/dist/types/tests/interfaces/records-read.spec.d.ts.map +1 -0
- package/dist/types/tests/interfaces/records-subscribe.spec.d.ts +2 -0
- package/dist/types/tests/interfaces/records-subscribe.spec.d.ts.map +1 -0
- package/dist/types/tests/interfaces/records-write.spec.d.ts +2 -0
- package/dist/types/tests/interfaces/records-write.spec.d.ts.map +1 -0
- package/dist/types/tests/jose/jws/general.spec.d.ts +2 -0
- package/dist/types/tests/jose/jws/general.spec.d.ts.map +1 -0
- package/dist/types/tests/protocols/permission-request.spec.d.ts +2 -0
- package/dist/types/tests/protocols/permission-request.spec.d.ts.map +1 -0
- package/dist/types/tests/protocols/permissions.spec.d.ts +2 -0
- package/dist/types/tests/protocols/permissions.spec.d.ts.map +1 -0
- package/dist/types/tests/scenarios/aggregator.spec.d.ts +2 -0
- package/dist/types/tests/scenarios/aggregator.spec.d.ts.map +1 -0
- package/dist/types/tests/scenarios/deleted-record.spec.d.ts +2 -0
- package/dist/types/tests/scenarios/deleted-record.spec.d.ts.map +1 -0
- package/dist/types/tests/scenarios/end-to-end-tests.spec.d.ts +2 -0
- package/dist/types/tests/scenarios/end-to-end-tests.spec.d.ts.map +1 -0
- package/dist/types/tests/scenarios/messages-query.spec.d.ts +2 -0
- package/dist/types/tests/scenarios/messages-query.spec.d.ts.map +1 -0
- package/dist/types/tests/scenarios/nested-roles.spec.d.ts +2 -0
- package/dist/types/tests/scenarios/nested-roles.spec.d.ts.map +1 -0
- package/dist/types/tests/scenarios/subscriptions.spec.d.ts +2 -0
- package/dist/types/tests/scenarios/subscriptions.spec.d.ts.map +1 -0
- package/dist/types/tests/store/blockstore-mock.spec.d.ts +2 -0
- package/dist/types/tests/store/blockstore-mock.spec.d.ts.map +1 -0
- package/dist/types/tests/store/data-store-level.spec.d.ts +2 -0
- package/dist/types/tests/store/data-store-level.spec.d.ts.map +1 -0
- package/dist/types/tests/store/index-level.spec.d.ts +2 -0
- package/dist/types/tests/store/index-level.spec.d.ts.map +1 -0
- package/dist/types/tests/store/message-store-level.spec.d.ts +2 -0
- package/dist/types/tests/store/message-store-level.spec.d.ts.map +1 -0
- package/dist/types/tests/store/message-store.spec.d.ts +2 -0
- package/dist/types/tests/store/message-store.spec.d.ts.map +1 -0
- package/dist/types/tests/store-dependent-tests.spec.d.ts +2 -0
- package/dist/types/tests/store-dependent-tests.spec.d.ts.map +1 -0
- package/dist/types/tests/test-event-stream.d.ts +22 -0
- package/dist/types/tests/test-event-stream.d.ts.map +1 -0
- package/dist/types/tests/test-stores.d.ts +33 -0
- package/dist/types/tests/test-stores.d.ts.map +1 -0
- package/dist/types/tests/test-suite.d.ts +18 -0
- package/dist/types/tests/test-suite.d.ts.map +1 -0
- package/dist/types/tests/utils/cid.spec.d.ts +2 -0
- package/dist/types/tests/utils/cid.spec.d.ts.map +1 -0
- package/dist/types/tests/utils/data-stream.spec.d.ts +2 -0
- package/dist/types/tests/utils/data-stream.spec.d.ts.map +1 -0
- package/dist/types/tests/utils/encryption.spec.d.ts +2 -0
- package/dist/types/tests/utils/encryption.spec.d.ts.map +1 -0
- package/dist/types/tests/utils/filters.spec.d.ts +2 -0
- package/dist/types/tests/utils/filters.spec.d.ts.map +1 -0
- package/dist/types/tests/utils/hd-key.spec.d.ts +2 -0
- package/dist/types/tests/utils/hd-key.spec.d.ts.map +1 -0
- package/dist/types/tests/utils/jws.spec.d.ts +2 -0
- package/dist/types/tests/utils/jws.spec.d.ts.map +1 -0
- package/dist/types/tests/utils/memory-cache.spec.d.ts +2 -0
- package/dist/types/tests/utils/memory-cache.spec.d.ts.map +1 -0
- package/dist/types/tests/utils/messages.spec.d.ts +2 -0
- package/dist/types/tests/utils/messages.spec.d.ts.map +1 -0
- package/dist/types/tests/utils/object.spec.d.ts +2 -0
- package/dist/types/tests/utils/object.spec.d.ts.map +1 -0
- package/dist/types/tests/utils/poller.d.ts +21 -0
- package/dist/types/tests/utils/poller.d.ts.map +1 -0
- package/dist/types/tests/utils/private-key-signer.spec.d.ts +2 -0
- package/dist/types/tests/utils/private-key-signer.spec.d.ts.map +1 -0
- package/dist/types/tests/utils/records.spec.d.ts +2 -0
- package/dist/types/tests/utils/records.spec.d.ts.map +1 -0
- package/dist/types/tests/utils/secp256k1.spec.d.ts +2 -0
- package/dist/types/tests/utils/secp256k1.spec.d.ts.map +1 -0
- package/dist/types/tests/utils/secp256r1.spec.d.ts +2 -0
- package/dist/types/tests/utils/secp256r1.spec.d.ts.map +1 -0
- package/dist/types/tests/utils/test-data-generator.d.ts +342 -0
- package/dist/types/tests/utils/test-data-generator.d.ts.map +1 -0
- package/dist/types/tests/utils/test-stub-generator.d.ts +16 -0
- package/dist/types/tests/utils/test-stub-generator.d.ts.map +1 -0
- package/dist/types/tests/utils/time.spec.d.ts +2 -0
- package/dist/types/tests/utils/time.spec.d.ts.map +1 -0
- package/dist/types/tests/utils/url.spec.d.ts +2 -0
- package/dist/types/tests/utils/url.spec.d.ts.map +1 -0
- package/dist/types/tests/validation/json-schemas/definitions.spec.d.ts +2 -0
- package/dist/types/tests/validation/json-schemas/definitions.spec.d.ts.map +1 -0
- package/dist/types/tests/validation/json-schemas/jwk/general-jwk.spec.d.ts +2 -0
- package/dist/types/tests/validation/json-schemas/jwk/general-jwk.spec.d.ts.map +1 -0
- package/dist/types/tests/validation/json-schemas/jwk/public-jwk.spec.d.ts +2 -0
- package/dist/types/tests/validation/json-schemas/jwk/public-jwk.spec.d.ts.map +1 -0
- package/dist/types/tests/validation/json-schemas/jwk-verification-method.spec.d.ts +2 -0
- package/dist/types/tests/validation/json-schemas/jwk-verification-method.spec.d.ts.map +1 -0
- package/dist/types/tests/validation/json-schemas/protocols/protocols-configure.spec.d.ts +2 -0
- package/dist/types/tests/validation/json-schemas/protocols/protocols-configure.spec.d.ts.map +1 -0
- package/dist/types/tests/validation/json-schemas/records/records-query.spec.d.ts +2 -0
- package/dist/types/tests/validation/json-schemas/records/records-query.spec.d.ts.map +1 -0
- package/dist/types/tests/validation/json-schemas/records/records-write.spec.d.ts +2 -0
- package/dist/types/tests/validation/json-schemas/records/records-write.spec.d.ts.map +1 -0
- package/package.json +167 -0
- package/src/core/abstract-message.ts +62 -0
- package/src/core/auth.ts +36 -0
- package/src/core/dwn-constant.ts +9 -0
- package/src/core/dwn-error.ts +167 -0
- package/src/core/grant-authorization.ts +148 -0
- package/src/core/message-reply.ts +41 -0
- package/src/core/message.ts +259 -0
- package/src/core/messages-grant-authorization.ts +134 -0
- package/src/core/protocol-authorization.ts +903 -0
- package/src/core/protocols-grant-authorization.ts +88 -0
- package/src/core/records-grant-authorization.ts +197 -0
- package/src/core/resumable-task-manager.ts +114 -0
- package/src/core/tenant-gate.ts +33 -0
- package/src/dwn.ts +264 -0
- package/src/enums/dwn-interface-method.ts +14 -0
- package/src/event-log/event-emitter-stream.ts +69 -0
- package/src/event-log/event-log-level.ts +72 -0
- package/src/handlers/messages-query.ts +67 -0
- package/src/handlers/messages-read.ts +103 -0
- package/src/handlers/messages-subscribe.ts +89 -0
- package/src/handlers/protocols-configure.ts +137 -0
- package/src/handlers/protocols-query.ts +82 -0
- package/src/handlers/records-delete.ts +124 -0
- package/src/handlers/records-query.ts +262 -0
- package/src/handlers/records-read.ts +187 -0
- package/src/handlers/records-subscribe.ts +218 -0
- package/src/handlers/records-write.ts +404 -0
- package/src/index.ts +67 -0
- package/src/interfaces/messages-query.ts +60 -0
- package/src/interfaces/messages-read.ts +63 -0
- package/src/interfaces/messages-subscribe.ts +64 -0
- package/src/interfaces/protocols-configure.ts +340 -0
- package/src/interfaces/protocols-query.ts +96 -0
- package/src/interfaces/records-delete.ts +117 -0
- package/src/interfaces/records-query.ts +131 -0
- package/src/interfaces/records-read.ts +100 -0
- package/src/interfaces/records-subscribe.ts +104 -0
- package/src/interfaces/records-write.ts +1072 -0
- package/src/jose/algorithms/signing/ed25519.ts +58 -0
- package/src/jose/algorithms/signing/signature-algorithms.ts +22 -0
- package/src/jose/jws/general/builder.ts +48 -0
- package/src/jose/jws/general/verifier.ts +112 -0
- package/src/protocols/permission-grant.ts +86 -0
- package/src/protocols/permission-request.ts +63 -0
- package/src/protocols/permissions.ts +508 -0
- package/src/schema-validator.ts +46 -0
- package/src/store/blockstore-level.ts +113 -0
- package/src/store/blockstore-mock.ts +80 -0
- package/src/store/data-store-level.ts +120 -0
- package/src/store/index-level.ts +691 -0
- package/src/store/level-wrapper.ts +272 -0
- package/src/store/message-store-level.ts +195 -0
- package/src/store/resumable-task-store-level.ts +120 -0
- package/src/store/storage-controller.ts +240 -0
- package/src/types/cache.ts +16 -0
- package/src/types/data-store.ts +64 -0
- package/src/types/event-log.ts +52 -0
- package/src/types/jose-types.ts +76 -0
- package/src/types/jws-types.ts +28 -0
- package/src/types/message-interface.ts +30 -0
- package/src/types/message-store.ts +57 -0
- package/src/types/message-types.ts +132 -0
- package/src/types/messages-types.ts +77 -0
- package/src/types/method-handler.ts +19 -0
- package/src/types/permission-types.ts +110 -0
- package/src/types/protocols-types.ts +177 -0
- package/src/types/query-types.ts +61 -0
- package/src/types/records-types.ts +263 -0
- package/src/types/resumable-task-store.ts +96 -0
- package/src/types/signer.ts +27 -0
- package/src/types/subscriptions.ts +34 -0
- package/src/utils/abort.ts +31 -0
- package/src/utils/array.ts +39 -0
- package/src/utils/cid.ts +101 -0
- package/src/utils/data-stream.ts +99 -0
- package/src/utils/encoder.ts +54 -0
- package/src/utils/encryption.ts +145 -0
- package/src/utils/filter.ts +245 -0
- package/src/utils/hd-key.ts +126 -0
- package/src/utils/jws.ts +95 -0
- package/src/utils/memory-cache.ts +31 -0
- package/src/utils/messages.ts +109 -0
- package/src/utils/object.ts +43 -0
- package/src/utils/private-key-signer.ts +72 -0
- package/src/utils/protocols.ts +50 -0
- package/src/utils/records.ts +559 -0
- package/src/utils/secp256k1.ts +157 -0
- package/src/utils/secp256r1.ts +142 -0
- package/src/utils/string.ts +13 -0
- package/src/utils/time.ts +78 -0
- package/src/utils/url.ts +65 -0
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A class that represents a DWN error.
|
|
3
|
+
*/
|
|
4
|
+
export declare class DwnError extends Error {
|
|
5
|
+
code: string;
|
|
6
|
+
constructor(code: string, message: string);
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* DWN SDK error codes.
|
|
10
|
+
*/
|
|
11
|
+
export declare enum DwnErrorCode {
|
|
12
|
+
AuthenticateJwsMissing = "AuthenticateJwsMissing",
|
|
13
|
+
AuthenticateDescriptorCidMismatch = "AuthenticateDescriptorCidMismatch",
|
|
14
|
+
AuthenticationMoreThanOneSignatureNotSupported = "AuthenticationMoreThanOneSignatureNotSupported",
|
|
15
|
+
AuthorizationNotGrantedToAuthor = "AuthorizationNotGrantedToAuthor",
|
|
16
|
+
ComputeCidCodecNotSupported = "ComputeCidCodecNotSupported",
|
|
17
|
+
ComputeCidMultihashNotSupported = "ComputeCidMultihashNotSupported",
|
|
18
|
+
Ed25519InvalidJwk = "Ed25519InvalidJwk",
|
|
19
|
+
EventEmitterStreamNotOpenError = "EventEmitterStreamNotOpenError",
|
|
20
|
+
MessagesGrantAuthorizationMismatchedProtocol = "EventsGrantAuthorizationMismatchedProtocol",
|
|
21
|
+
MessagesSubscribeAuthorizationFailed = "MessagesSubscribeAuthorizationFailed",
|
|
22
|
+
MessagesSubscribeEventStreamUnimplemented = "MessagesSubscribeEventStreamUnimplemented",
|
|
23
|
+
GeneralJwsVerifierGetPublicKeyNotFound = "GeneralJwsVerifierGetPublicKeyNotFound",
|
|
24
|
+
GeneralJwsVerifierInvalidSignature = "GeneralJwsVerifierInvalidSignature",
|
|
25
|
+
GrantAuthorizationGrantExpired = "GrantAuthorizationGrantExpired",
|
|
26
|
+
GrantAuthorizationGrantMissing = "GrantAuthorizationGrantMissing",
|
|
27
|
+
GrantAuthorizationGrantRevoked = "GrantAuthorizationGrantRevoked",
|
|
28
|
+
GrantAuthorizationInterfaceMismatch = "GrantAuthorizationInterfaceMismatch",
|
|
29
|
+
GrantAuthorizationMethodMismatch = "GrantAuthorizationMethodMismatch",
|
|
30
|
+
GrantAuthorizationNotGrantedForTenant = "GrantAuthorizationNotGrantedForTenant",
|
|
31
|
+
GrantAuthorizationNotGrantedToAuthor = "GrantAuthorizationNotGrantedToAuthor",
|
|
32
|
+
GrantAuthorizationGrantNotYetActive = "GrantAuthorizationGrantNotYetActive",
|
|
33
|
+
HdKeyDerivationPathInvalid = "HdKeyDerivationPathInvalid",
|
|
34
|
+
JwsVerifySignatureUnsupportedCrv = "JwsVerifySignatureUnsupportedCrv",
|
|
35
|
+
IndexInvalidCursorValueType = "IndexInvalidCursorValueType",
|
|
36
|
+
IndexInvalidCursorSortProperty = "IndexInvalidCursorSortProperty",
|
|
37
|
+
IndexInvalidSortPropertyInMemory = "IndexInvalidSortPropertyInMemory",
|
|
38
|
+
IndexMissingIndexableProperty = "IndexMissingIndexableProperty",
|
|
39
|
+
JwsDecodePlainObjectPayloadInvalid = "JwsDecodePlainObjectPayloadInvalid",
|
|
40
|
+
MessagesReadInvalidCid = "MessagesReadInvalidCid",
|
|
41
|
+
MessagesReadAuthorizationFailed = "MessagesReadAuthorizationFailed",
|
|
42
|
+
MessageGetInvalidCid = "MessageGetInvalidCid",
|
|
43
|
+
MessagesQueryAuthorizationFailed = "MessagesQueryAuthorizationFailed",
|
|
44
|
+
MessagesReadVerifyScopeFailed = "MessagesReadVerifyScopeFailed",
|
|
45
|
+
ParseCidCodecNotSupported = "ParseCidCodecNotSupported",
|
|
46
|
+
ParseCidMultihashNotSupported = "ParseCidMultihashNotSupported",
|
|
47
|
+
PermissionsProtocolCreateGrantRecordsScopeMissingProtocol = "PermissionsProtocolCreateGrantRecordsScopeMissingProtocol",
|
|
48
|
+
PermissionsProtocolCreateRequestRecordsScopeMissingProtocol = "PermissionsProtocolCreateRequestRecordsScopeMissingProtocol",
|
|
49
|
+
PermissionsProtocolGetScopeInvalidProtocol = "PermissionsProtocolGetScopeInvalidProtocol",
|
|
50
|
+
PermissionsProtocolValidateSchemaUnexpectedRecord = "PermissionsProtocolValidateSchemaUnexpectedRecord",
|
|
51
|
+
PermissionsProtocolValidateScopeContextIdProhibitedProperties = "PermissionsProtocolValidateScopeContextIdProhibitedProperties",
|
|
52
|
+
PermissionsProtocolValidateScopeProtocolMismatch = "PermissionsProtocolValidateScopeProtocolMismatch",
|
|
53
|
+
PermissionsProtocolValidateScopeMissingProtocolTag = "PermissionsProtocolValidateScopeMissingProtocolTag",
|
|
54
|
+
PermissionsProtocolValidateRevocationProtocolTagMismatch = "PermissionsProtocolValidateRevocationProtocolTagMismatch",
|
|
55
|
+
PrivateKeySignerUnableToDeduceAlgorithm = "PrivateKeySignerUnableToDeduceAlgorithm",
|
|
56
|
+
PrivateKeySignerUnableToDeduceKeyId = "PrivateKeySignerUnableToDeduceKeyId",
|
|
57
|
+
PrivateKeySignerUnsupportedCurve = "PrivateKeySignerUnsupportedCurve",
|
|
58
|
+
ProtocolAuthorizationActionNotAllowed = "ProtocolAuthorizationActionNotAllowed",
|
|
59
|
+
ProtocolAuthorizationActionRulesNotFound = "ProtocolAuthorizationActionRulesNotFound",
|
|
60
|
+
ProtocolAuthorizationIncorrectDataFormat = "ProtocolAuthorizationIncorrectDataFormat",
|
|
61
|
+
ProtocolAuthorizationIncorrectContextId = "ProtocolAuthorizationIncorrectContextId",
|
|
62
|
+
ProtocolAuthorizationIncorrectProtocolPath = "ProtocolAuthorizationIncorrectProtocolPath",
|
|
63
|
+
ProtocolAuthorizationDuplicateRoleRecipient = "ProtocolAuthorizationDuplicateRoleRecipient",
|
|
64
|
+
ProtocolAuthorizationInvalidSchema = "ProtocolAuthorizationInvalidSchema",
|
|
65
|
+
ProtocolAuthorizationInvalidType = "ProtocolAuthorizationInvalidType",
|
|
66
|
+
ProtocolAuthorizationMatchingRoleRecordNotFound = "ProtocolAuthorizationMatchingRoleRecordNotFound",
|
|
67
|
+
ProtocolAuthorizationMaxSizeInvalid = "ProtocolAuthorizationMaxSizeInvalid",
|
|
68
|
+
ProtocolAuthorizationMinSizeInvalid = "ProtocolAuthorizationMinSizeInvalid",
|
|
69
|
+
ProtocolAuthorizationMissingContextId = "ProtocolAuthorizationMissingContextId",
|
|
70
|
+
ProtocolAuthorizationMissingRuleSet = "ProtocolAuthorizationMissingRuleSet",
|
|
71
|
+
ProtocolAuthorizationParentlessIncorrectProtocolPath = "ProtocolAuthorizationParentlessIncorrectProtocolPath",
|
|
72
|
+
ProtocolAuthorizationNotARole = "ProtocolAuthorizationNotARole",
|
|
73
|
+
ProtocolAuthorizationParentNotFoundConstructingRecordChain = "ProtocolAuthorizationParentNotFoundConstructingRecordChain",
|
|
74
|
+
ProtocolAuthorizationProtocolNotFound = "ProtocolAuthorizationProtocolNotFound",
|
|
75
|
+
ProtocolAuthorizationRoleMissingRecipient = "ProtocolAuthorizationRoleMissingRecipient",
|
|
76
|
+
ProtocolAuthorizationTagsInvalidSchema = "ProtocolAuthorizationTagsInvalidSchema",
|
|
77
|
+
ProtocolsConfigureAuthorizationFailed = "ProtocolsConfigureAuthorizationFailed",
|
|
78
|
+
ProtocolsConfigureDuplicateActorInRuleSet = "ProtocolsConfigureDuplicateActorInRuleSet",
|
|
79
|
+
ProtocolsConfigureDuplicateRoleInRuleSet = "ProtocolsConfigureDuplicateRoleInRuleSet",
|
|
80
|
+
ProtocolsConfigureInvalidSize = "ProtocolsConfigureInvalidSize",
|
|
81
|
+
ProtocolsConfigureInvalidActionMissingOf = "ProtocolsConfigureInvalidActionMissingOf",
|
|
82
|
+
ProtocolsConfigureInvalidActionOfNotAllowed = "ProtocolsConfigureInvalidActionOfNotAllowed",
|
|
83
|
+
ProtocolsConfigureInvalidActionDeleteWithoutCreate = "ProtocolsConfigureInvalidActionDeleteWithoutCreate",
|
|
84
|
+
ProtocolsConfigureInvalidActionUpdateWithoutCreate = "ProtocolsConfigureInvalidActionUpdateWithoutCreate",
|
|
85
|
+
ProtocolsConfigureInvalidRecipientOfAction = "ProtocolsConfigureInvalidRecipientOfAction",
|
|
86
|
+
ProtocolsConfigureInvalidRuleSetRecordType = "ProtocolsConfigureInvalidRuleSetRecordType",
|
|
87
|
+
ProtocolsConfigureInvalidTagSchema = "ProtocolsConfigureInvalidTagSchema",
|
|
88
|
+
ProtocolsConfigureRecordNestingDepthExceeded = "ProtocolsConfigureRecordNestingDepthExceeded",
|
|
89
|
+
ProtocolsConfigureRoleDoesNotExistAtGivenPath = "ProtocolsConfigureRoleDoesNotExistAtGivenPath",
|
|
90
|
+
ProtocolsConfigureRoleReadActionMissing = "ProtocolsConfigureRoleReadActionMissing",
|
|
91
|
+
ProtocolsGrantAuthorizationQueryProtocolScopeMismatch = "ProtocolsGrantAuthorizationQueryProtocolScopeMismatch",
|
|
92
|
+
ProtocolsGrantAuthorizationScopeProtocolMismatch = "ProtocolsGrantAuthorizationScopeProtocolMismatch",
|
|
93
|
+
ProtocolsQueryUnauthorized = "ProtocolsQueryUnauthorized",
|
|
94
|
+
RecordsAuthorDelegatedGrantAndIdExistenceMismatch = "RecordsAuthorDelegatedGrantAndIdExistenceMismatch",
|
|
95
|
+
RecordsAuthorDelegatedGrantCidMismatch = "RecordsAuthorDelegatedGrantCidMismatch",
|
|
96
|
+
RecordsAuthorDelegatedGrantGrantedToAndOwnerSignatureMismatch = "RecordsAuthorDelegatedGrantGrantedToAndOwnerSignatureMismatch",
|
|
97
|
+
RecordsAuthorDelegatedGrantNotADelegatedGrant = "RecordsAuthorDelegatedGrantNotADelegatedGrant",
|
|
98
|
+
RecordsDecryptNoMatchingKeyEncryptedFound = "RecordsDecryptNoMatchingKeyEncryptedFound",
|
|
99
|
+
RecordsDeleteAuthorizationFailed = "RecordsDeleteAuthorizationFailed",
|
|
100
|
+
RecordsQueryCreateFilterPublishedSortInvalid = "RecordsQueryCreateFilterPublishedSortInvalid",
|
|
101
|
+
RecordsQueryParseFilterPublishedSortInvalid = "RecordsQueryParseFilterPublishedSortInvalid",
|
|
102
|
+
RecordsGrantAuthorizationConditionPublicationProhibited = "RecordsGrantAuthorizationConditionPublicationProhibited",
|
|
103
|
+
RecordsGrantAuthorizationConditionPublicationRequired = "RecordsGrantAuthorizationConditionPublicationRequired",
|
|
104
|
+
RecordsGrantAuthorizationDeleteProtocolScopeMismatch = "RecordsGrantAuthorizationDeleteProtocolScopeMismatch",
|
|
105
|
+
RecordsGrantAuthorizationQueryOrSubscribeProtocolScopeMismatch = "RecordsGrantAuthorizationQueryOrSubscribeProtocolScopeMismatch",
|
|
106
|
+
RecordsGrantAuthorizationScopeContextIdMismatch = "RecordsGrantAuthorizationScopeContextIdMismatch",
|
|
107
|
+
RecordsGrantAuthorizationScopeProtocolMismatch = "RecordsGrantAuthorizationScopeProtocolMismatch",
|
|
108
|
+
RecordsGrantAuthorizationScopeProtocolPathMismatch = "RecordsGrantAuthorizationScopeProtocolPathMismatch",
|
|
109
|
+
RecordsDerivePrivateKeyUnSupportedCurve = "RecordsDerivePrivateKeyUnSupportedCurve",
|
|
110
|
+
RecordsInvalidAncestorKeyDerivationSegment = "RecordsInvalidAncestorKeyDerivationSegment",
|
|
111
|
+
RecordsOwnerDelegatedGrantAndIdExistenceMismatch = "RecordsOwnerDelegatedGrantAndIdExistenceMismatch",
|
|
112
|
+
RecordsOwnerDelegatedGrantCidMismatch = "RecordsOwnerDelegatedGrantCidMismatch",
|
|
113
|
+
RecordsOwnerDelegatedGrantGrantedToAndOwnerSignatureMismatch = "RecordsOwnerDelegatedGrantGrantedToAndOwnerSignatureMismatch",
|
|
114
|
+
RecordsOwnerDelegatedGrantNotADelegatedGrant = "RecordsOwnerDelegatedGrantNotADelegatedGrant",
|
|
115
|
+
RecordsProtocolContextDerivationSchemeMissingContextId = "RecordsProtocolContextDerivationSchemeMissingContextId",
|
|
116
|
+
RecordsProtocolPathDerivationSchemeMissingProtocol = "RecordsProtocolPathDerivationSchemeMissingProtocol",
|
|
117
|
+
RecordsQueryFilterMissingRequiredProperties = "RecordsQueryFilterMissingRequiredProperties",
|
|
118
|
+
RecordsReadReturnedMultiple = "RecordsReadReturnedMultiple",
|
|
119
|
+
RecordsReadAuthorizationFailed = "RecordsReadAuthorizationFailed",
|
|
120
|
+
RecordsSubscribeEventStreamUnimplemented = "RecordsSubscribeEventStreamUnimplemented",
|
|
121
|
+
RecordsSubscribeFilterMissingRequiredProperties = "RecordsSubscribeFilterMissingRequiredProperties",
|
|
122
|
+
RecordsSchemasDerivationSchemeMissingSchema = "RecordsSchemasDerivationSchemeMissingSchema",
|
|
123
|
+
RecordsWriteAttestationIntegrityMoreThanOneSignature = "RecordsWriteAttestationIntegrityMoreThanOneSignature",
|
|
124
|
+
RecordsWriteAttestationIntegrityDescriptorCidMismatch = "RecordsWriteAttestationIntegrityDescriptorCidMismatch",
|
|
125
|
+
RecordsWriteAttestationIntegrityInvalidPayloadProperty = "RecordsWriteAttestationIntegrityInvalidPayloadProperty",
|
|
126
|
+
RecordsWriteAuthorizationFailed = "RecordsWriteAuthorizationFailed",
|
|
127
|
+
RecordsWriteCreateMissingSigner = "RecordsWriteCreateMissingSigner",
|
|
128
|
+
RecordsWriteCreateDataAndDataCidMutuallyExclusive = "RecordsWriteCreateDataAndDataCidMutuallyExclusive",
|
|
129
|
+
RecordsWriteCreateDataCidAndDataSizeMutuallyInclusive = "RecordsWriteCreateDataCidAndDataSizeMutuallyInclusive",
|
|
130
|
+
RecordsWriteCreateProtocolAndProtocolPathMutuallyInclusive = "RecordsWriteCreateProtocolAndProtocolPathMutuallyInclusive",
|
|
131
|
+
RecordsWriteDataCidMismatch = "RecordsWriteDataCidMismatch",
|
|
132
|
+
RecordsWriteDataSizeMismatch = "RecordsWriteDataSizeMismatch",
|
|
133
|
+
RecordsWriteGetEntryIdUndefinedAuthor = "RecordsWriteGetEntryIdUndefinedAuthor",
|
|
134
|
+
RecordsWriteGetNewestWriteRecordNotFound = "RecordsWriteGetNewestWriteRecordNotFound",
|
|
135
|
+
RecordsWriteGetInitialWriteNotFound = "RecordsWriteGetInitialWriteNotFound",
|
|
136
|
+
RecordsWriteImmutablePropertyChanged = "RecordsWriteImmutablePropertyChanged",
|
|
137
|
+
RecordsWriteMissingSigner = "RecordsWriteMissingSigner",
|
|
138
|
+
RecordsWriteMissingDataInPrevious = "RecordsWriteMissingDataInPrevious",
|
|
139
|
+
RecordsWriteMissingEncodedDataInPrevious = "RecordsWriteMissingEncodedDataInPrevious",
|
|
140
|
+
RecordsWriteMissingProtocol = "RecordsWriteMissingProtocol",
|
|
141
|
+
RecordsWriteMissingSchema = "RecordsWriteMissingSchema",
|
|
142
|
+
RecordsWriteNotAllowedAfterDelete = "RecordsWriteNotAllowedAfterDelete",
|
|
143
|
+
RecordsWriteOwnerAndTenantMismatch = "RecordsWriteOwnerAndTenantMismatch",
|
|
144
|
+
RecordsWriteSignAsOwnerDelegateUnknownAuthor = "RecordsWriteSignAsOwnerDelegateUnknownAuthor",
|
|
145
|
+
RecordsWriteSignAsOwnerUnknownAuthor = "RecordsWriteSignAsOwnerUnknownAuthor",
|
|
146
|
+
RecordsWriteValidateIntegrityAttestationMismatch = "RecordsWriteValidateIntegrityAttestationMismatch",
|
|
147
|
+
RecordsWriteValidateIntegrityContextIdMismatch = "RecordsWriteValidateIntegrityContextIdMismatch",
|
|
148
|
+
RecordsWriteValidateIntegrityContextIdNotInSignerSignaturePayload = "RecordsWriteValidateIntegrityContextIdNotInSignerSignaturePayload",
|
|
149
|
+
RecordsWriteValidateIntegrityDateCreatedMismatch = "RecordsWriteValidateIntegrityDateCreatedMismatch",
|
|
150
|
+
RecordsWriteValidateIntegrityEncryptionCidMismatch = "RecordsWriteValidateIntegrityEncryptionCidMismatch",
|
|
151
|
+
RecordsWriteValidateIntegrityRecordIdUnauthorized = "RecordsWriteValidateIntegrityRecordIdUnauthorized",
|
|
152
|
+
SchemaValidatorAdditionalPropertyNotAllowed = "SchemaValidatorAdditionalPropertyNotAllowed",
|
|
153
|
+
SchemaValidatorFailure = "SchemaValidatorFailure",
|
|
154
|
+
SchemaValidatorSchemaNotFound = "SchemaValidatorSchemaNotFound",
|
|
155
|
+
SchemaValidatorUnevaluatedPropertyNotAllowed = "SchemaValidatorUnevaluatedPropertyNotAllowed",
|
|
156
|
+
Secp256k1KeyNotValid = "Secp256k1KeyNotValid",
|
|
157
|
+
Secp256r1KeyNotValid = "Secp256r1KeyNotValid",
|
|
158
|
+
TimestampInvalid = "TimestampInvalid",
|
|
159
|
+
UrlProtocolNotNormalized = "UrlProtocolNotNormalized",
|
|
160
|
+
UrlProtocolNotNormalizable = "UrlProtocolNotNormalizable",
|
|
161
|
+
UrlSchemaNotNormalized = "UrlSchemaNotNormalized",
|
|
162
|
+
RecordsReadInitialWriteNotFound = "RecordsReadInitialWriteNotFound"
|
|
163
|
+
}
|
|
164
|
+
//# sourceMappingURL=dwn-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dwn-error.d.ts","sourceRoot":"","sources":["../../../../src/core/dwn-error.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,QAAS,SAAQ,KAAK;IACb,IAAI,EAAE,MAAM;gBAAZ,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAKlD;AAED;;GAEG;AACH,oBAAY,YAAY;IACtB,sBAAsB,2BAA2B;IACjD,iCAAiC,sCAAsC;IACvE,8CAA8C,mDAAmD;IACjG,+BAA+B,oCAAoC;IACnE,2BAA2B,gCAAgC;IAC3D,+BAA+B,oCAAoC;IACnE,iBAAiB,sBAAsB;IACvC,8BAA8B,mCAAmC;IACjE,4CAA4C,+CAA+C;IAC3F,oCAAoC,yCAAyC;IAC7E,yCAAyC,8CAA8C;IACvF,sCAAsC,2CAA2C;IACjF,kCAAkC,uCAAuC;IACzE,8BAA8B,mCAAmC;IACjE,8BAA8B,mCAAmC;IACjE,8BAA8B,mCAAmC;IACjE,mCAAmC,wCAAwC;IAC3E,gCAAgC,qCAAqC;IACrE,qCAAqC,0CAA0C;IAC/E,oCAAoC,yCAAyC;IAC7E,mCAAmC,wCAAwC;IAC3E,0BAA0B,+BAA+B;IACzD,gCAAgC,qCAAqC;IACrE,2BAA2B,gCAAgC;IAC3D,8BAA8B,mCAAmC;IACjE,gCAAgC,qCAAqC;IACrE,6BAA6B,kCAAkC;IAC/D,kCAAkC,uCAAuC;IACzE,sBAAsB,2BAA2B;IACjD,+BAA+B,oCAAoC;IACnE,oBAAoB,yBAAyB;IAC7C,gCAAgC,qCAAqC;IACrE,6BAA6B,kCAAkC;IAC/D,yBAAyB,8BAA8B;IACvD,6BAA6B,kCAAkC;IAC/D,yDAAyD,8DAA8D;IACvH,2DAA2D,gEAAgE;IAC3H,0CAA0C,+CAA+C;IACzF,iDAAiD,sDAAsD;IACvG,6DAA6D,kEAAkE;IAC/H,gDAAgD,qDAAqD;IACrG,kDAAkD,uDAAuD;IACzG,wDAAwD,6DAA6D;IACrH,uCAAuC,4CAA4C;IACnF,mCAAmC,wCAAwC;IAC3E,gCAAgC,qCAAqC;IACrE,qCAAqC,0CAA0C;IAC/E,wCAAwC,6CAA6C;IACrF,wCAAwC,6CAA6C;IACrF,uCAAuC,4CAA4C;IACnF,0CAA0C,+CAA+C;IACzF,2CAA2C,gDAAgD;IAC3F,kCAAkC,uCAAuC;IACzE,gCAAgC,qCAAqC;IACrE,+CAA+C,oDAAoD;IACnG,mCAAmC,wCAAwC;IAC3E,mCAAmC,wCAAwC;IAC3E,qCAAqC,0CAA0C;IAC/E,mCAAmC,wCAAwC;IAC3E,oDAAoD,yDAAyD;IAC7G,6BAA6B,kCAAkC;IAC/D,0DAA0D,+DAA+D;IACzH,qCAAqC,0CAA0C;IAC/E,yCAAyC,8CAA8C;IACvF,sCAAsC,2CAA2C;IACjF,qCAAqC,0CAA0C;IAC/E,yCAAyC,8CAA8C;IACvF,wCAAwC,6CAA6C;IACrF,6BAA6B,kCAAkC;IAC/D,wCAAwC,6CAA6C;IACrF,2CAA2C,gDAAgD;IAC3F,kDAAkD,uDAAuD;IACzG,kDAAkD,uDAAuD;IACzG,0CAA0C,+CAA+C;IACzF,0CAA0C,+CAA+C;IACzF,kCAAkC,uCAAuC;IACzE,4CAA4C,iDAAiD;IAC7F,6CAA6C,kDAAkD;IAC/F,uCAAuC,4CAA4C;IACnF,qDAAqD,0DAA0D;IAC/G,gDAAgD,qDAAqD;IACrG,0BAA0B,+BAA+B;IACzD,iDAAiD,sDAAsD;IACvG,sCAAsC,2CAA2C;IACjF,6DAA6D,kEAAkE;IAC/H,6CAA6C,kDAAkD;IAC/F,yCAAyC,8CAA8C;IACvF,gCAAgC,qCAAqC;IACrE,4CAA4C,iDAAiD;IAC7F,2CAA2C,gDAAgD;IAC3F,uDAAuD,4DAA4D;IACnH,qDAAqD,0DAA0D;IAC/G,oDAAoD,yDAAyD;IAC7G,8DAA8D,mEAAmE;IACjI,+CAA+C,oDAAoD;IACnG,8CAA8C,mDAAmD;IACjG,kDAAkD,uDAAuD;IACzG,uCAAuC,4CAA4C;IACnF,0CAA0C,+CAA+C;IACzF,gDAAgD,qDAAqD;IACrG,qCAAqC,0CAA0C;IAC/E,4DAA4D,iEAAiE;IAC7H,4CAA4C,iDAAiD;IAC7F,sDAAsD,2DAA2D;IACjH,kDAAkD,uDAAuD;IACzG,2CAA2C,gDAAgD;IAC3F,2BAA2B,gCAAgC;IAC3D,8BAA8B,mCAAmC;IACjE,wCAAwC,6CAA6C;IACrF,+CAA+C,oDAAoD;IACnG,2CAA2C,gDAAgD;IAC3F,oDAAoD,yDAAyD;IAC7G,qDAAqD,0DAA0D;IAC/G,sDAAsD,2DAA2D;IACjH,+BAA+B,oCAAoC;IACnE,+BAA+B,oCAAoC;IACnE,iDAAiD,sDAAsD;IACvG,qDAAqD,0DAA0D;IAC/G,0DAA0D,+DAA+D;IACzH,2BAA2B,gCAAgC;IAC3D,4BAA4B,iCAAiC;IAC7D,qCAAqC,0CAA0C;IAC/E,wCAAwC,6CAA6C;IACrF,mCAAmC,wCAAwC;IAC3E,oCAAoC,yCAAyC;IAC7E,yBAAyB,8BAA8B;IACvD,iCAAiC,sCAAsC;IACvE,wCAAwC,6CAA6C;IACrF,2BAA2B,gCAAgC;IAC3D,yBAAyB,8BAA8B;IACvD,iCAAiC,sCAAsC;IACvE,kCAAkC,uCAAuC;IACzE,4CAA4C,iDAAiD;IAC7F,oCAAoC,yCAAyC;IAC7E,gDAAgD,qDAAqD;IACrG,8CAA8C,mDAAmD;IACjG,iEAAiE,sEAAsE;IACvI,gDAAgD,qDAAqD;IACrG,kDAAkD,uDAAuD;IACzG,iDAAiD,sDAAsD;IACvG,2CAA2C,gDAAgD;IAC3F,sBAAsB,2BAA2B;IACjD,6BAA6B,kCAAkC;IAC/D,4CAA4C,iDAAiD;IAC7F,oBAAoB,yBAAyB;IAC7C,oBAAoB,yBAAyB;IAC7C,gBAAgB,qBAAqB;IACrC,wBAAwB,6BAA6B;IACrD,0BAA0B,+BAA+B;IACzD,sBAAsB,2BAA2B;IACjD,+BAA+B,oCAAoC;CACpE"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { GenericMessage } from '../types/message-types.js';
|
|
2
|
+
import type { MessageStore } from '../types/message-store.js';
|
|
3
|
+
import type { PermissionGrant } from '../protocols/permission-grant.js';
|
|
4
|
+
export declare class GrantAuthorization {
|
|
5
|
+
/**
|
|
6
|
+
* Performs base permissions-grant-based authorization against the given message:
|
|
7
|
+
* 1. Validates the `expectedGrantor` and `expectedGrantee` values against the actual values in given permission grant.
|
|
8
|
+
* 2. Verifies that the incoming message is within the allowed time frame of the grant, and the grant has not been revoked.
|
|
9
|
+
* 3. Verifies that the `interface` and `method` grant scopes match the incoming message.
|
|
10
|
+
*
|
|
11
|
+
* NOTE: Does not validate grant `conditions` or `scope` beyond `interface` and `method`
|
|
12
|
+
*
|
|
13
|
+
* @param messageStore Used to check if the grant has been revoked.
|
|
14
|
+
* @throws {DwnError} if validation fails
|
|
15
|
+
*/
|
|
16
|
+
static performBaseValidation(input: {
|
|
17
|
+
incomingMessage: GenericMessage;
|
|
18
|
+
expectedGrantor: string;
|
|
19
|
+
expectedGrantee: string;
|
|
20
|
+
permissionGrant: PermissionGrant;
|
|
21
|
+
messageStore: MessageStore;
|
|
22
|
+
}): Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* Verifies the given `expectedGrantor` and `expectedGrantee` values against
|
|
25
|
+
* the actual signer and recipient in given permission grant.
|
|
26
|
+
* @throws {DwnError} if `expectedGrantor` or `expectedGrantee` do not match the actual values in the grant.
|
|
27
|
+
*/
|
|
28
|
+
private static verifyExpectedGrantorAndGrantee;
|
|
29
|
+
/**
|
|
30
|
+
* Verify that the incoming message is within the allowed time frame of the grant,
|
|
31
|
+
* and the grant has not been revoked.
|
|
32
|
+
* @param messageStore Used to check if the grant has been revoked.
|
|
33
|
+
* @throws {DwnError} if incomingMessage has timestamp for a time in which the grant is not active.
|
|
34
|
+
*/
|
|
35
|
+
private static verifyGrantActive;
|
|
36
|
+
/**
|
|
37
|
+
* Verify that the `interface` and `method` grant scopes match the incoming message
|
|
38
|
+
* @param permissionGrantId Purely being passed for logging purposes.
|
|
39
|
+
* @throws {DwnError} if the `interface` and `method` of the incoming message do not match the scope of the permission grant.
|
|
40
|
+
*/
|
|
41
|
+
private static verifyGrantScopeInterfaceAndMethod;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=grant-authorization.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grant-authorization.d.ts","sourceRoot":"","sources":["../../../../src/core/grant-authorization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAKxE,qBAAa,kBAAkB;IAE7B;;;;;;;;;;OAUG;WACiB,qBAAqB,CAAC,KAAK,EAAE;QAC/C,eAAe,EAAE,cAAc,CAAC;QAChC,eAAe,EAAE,MAAM,CAAC;QACxB,eAAe,EAAE,MAAM,CAAC;QACxB,eAAe,EAAE,eAAe,CAAC;QACjC,YAAY,EAAE,YAAY,CAAC;KAC1B,GAAG,OAAO,CAAC,IAAI,CAAC;IAwBnB;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,+BAA+B;IAuB9C;;;;;OAKG;mBACkB,iBAAiB;IAwCtC;;;;OAIG;mBACkB,kCAAkC;CAkBxD"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { MessagesReadReplyEntry } from '../types/messages-types.js';
|
|
2
|
+
import type { PaginationCursor } from '../types/query-types.js';
|
|
3
|
+
import type { ProtocolsConfigureMessage } from '../types/protocols-types.js';
|
|
4
|
+
import type { RecordsReadReplyEntry } from '../types/records-types.js';
|
|
5
|
+
import type { GenericMessageReply, MessageSubscription, QueryResultEntry } from '../types/message-types.js';
|
|
6
|
+
export declare function messageReplyFromError(e: unknown, code: number): GenericMessageReply;
|
|
7
|
+
/**
|
|
8
|
+
* Catch-all message reply type. It is recommended to use GenericMessageReply or a message-specific reply type wherever possible.
|
|
9
|
+
*/
|
|
10
|
+
export type UnionMessageReply = GenericMessageReply & {
|
|
11
|
+
/**
|
|
12
|
+
* A container for the data returned from a `RecordsRead` or `MessagesRead`.
|
|
13
|
+
* Mutually exclusive with (`entries` + `cursor`) and `subscription`.
|
|
14
|
+
*/
|
|
15
|
+
entry?: MessagesReadReplyEntry & RecordsReadReplyEntry;
|
|
16
|
+
/**
|
|
17
|
+
* Resulting message entries or events returned from the invocation of the corresponding message.
|
|
18
|
+
* e.g. the resulting messages from a RecordsQuery, or array of messageCid strings for MessagesQuery
|
|
19
|
+
* Mutually exclusive with `record`.
|
|
20
|
+
*/
|
|
21
|
+
entries?: QueryResultEntry[] | ProtocolsConfigureMessage[] | string[];
|
|
22
|
+
/**
|
|
23
|
+
* A cursor for pagination if applicable (e.g. RecordsQuery).
|
|
24
|
+
* Mutually exclusive with `record`.
|
|
25
|
+
*/
|
|
26
|
+
cursor?: PaginationCursor;
|
|
27
|
+
/**
|
|
28
|
+
* A subscription object if a subscription was requested.
|
|
29
|
+
*/
|
|
30
|
+
subscription?: MessageSubscription;
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=message-reply.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message-reply.d.ts","sourceRoot":"","sources":["../../../../src/core/message-reply.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAC7E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,KAAK,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE5G,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,mBAAmB,CAKnF;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,mBAAmB,GAAG;IACpD;;;OAGG;IACH,KAAK,CAAC,EAAE,sBAAsB,GAAG,qBAAqB,CAAC;IAEvD;;;;OAIG;IACH,OAAO,CAAC,EAAE,gBAAgB,EAAE,GAAG,yBAAyB,EAAE,GAAG,MAAM,EAAE,CAAC;IAEtE;;;OAGG;IACH,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAE1B;;OAEG;IACH,YAAY,CAAC,EAAE,mBAAmB,CAAC;CACpC,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { DataEncodedRecordsWriteMessage } from '../types/records-types.js';
|
|
2
|
+
import type { GeneralJws } from '../types/jws-types.js';
|
|
3
|
+
import type { Signer } from '../types/signer.js';
|
|
4
|
+
import type { AuthorizationModel, Descriptor, GenericMessage, GenericSignaturePayload } from '../types/message-types.js';
|
|
5
|
+
/**
|
|
6
|
+
* A class containing utility methods for working with DWN messages.
|
|
7
|
+
*/
|
|
8
|
+
export declare class Message {
|
|
9
|
+
/**
|
|
10
|
+
* Gets the DID of the author of the given message.
|
|
11
|
+
*/
|
|
12
|
+
static getAuthor(message: GenericMessage): string | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* Validates the given message against the corresponding JSON schema.
|
|
15
|
+
* @throws {Error} if fails validation.
|
|
16
|
+
*/
|
|
17
|
+
static validateJsonSchema(rawMessage: any): void;
|
|
18
|
+
/**
|
|
19
|
+
* Gets the DID of the signer of the given message, returns `undefined` if message is not signed.
|
|
20
|
+
*/
|
|
21
|
+
static getSigner(message: GenericMessage): string | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Gets the CID of the given message.
|
|
24
|
+
*/
|
|
25
|
+
static getCid(message: GenericMessage): Promise<string>;
|
|
26
|
+
/**
|
|
27
|
+
* Compares message CID in lexicographical order according to the spec.
|
|
28
|
+
* @returns 1 if `a` is larger than `b`; -1 if `a` is smaller/older than `b`; 0 otherwise (same message)
|
|
29
|
+
*/
|
|
30
|
+
static compareCid(a: GenericMessage, b: GenericMessage): Promise<number>;
|
|
31
|
+
/**
|
|
32
|
+
* Creates the `authorization` property to be included in a DWN message.
|
|
33
|
+
* @param signer Message signer.
|
|
34
|
+
* @returns {AuthorizationModel} used as an `authorization` property.
|
|
35
|
+
*/
|
|
36
|
+
static createAuthorization(input: {
|
|
37
|
+
descriptor: Descriptor;
|
|
38
|
+
signer: Signer;
|
|
39
|
+
delegatedGrant?: DataEncodedRecordsWriteMessage;
|
|
40
|
+
permissionGrantId?: string;
|
|
41
|
+
protocolRole?: string;
|
|
42
|
+
}): Promise<AuthorizationModel>;
|
|
43
|
+
/**
|
|
44
|
+
* Creates a generic signature from the given DWN message descriptor by including `descriptorCid` as the required property in the signature payload.
|
|
45
|
+
* NOTE: there is an opportunity to consolidate RecordsWrite.createSignerSignature() wth this method
|
|
46
|
+
*/
|
|
47
|
+
static createSignature(descriptor: Descriptor, signer: Signer, additionalPayloadProperties?: {
|
|
48
|
+
delegatedGrantId?: string;
|
|
49
|
+
permissionGrantId?: string;
|
|
50
|
+
protocolRole?: string;
|
|
51
|
+
}): Promise<GeneralJws>;
|
|
52
|
+
/**
|
|
53
|
+
* @returns newest message in the array. `undefined` if given array is empty.
|
|
54
|
+
*/
|
|
55
|
+
static getNewestMessage(messages: GenericMessage[]): Promise<GenericMessage | undefined>;
|
|
56
|
+
/**
|
|
57
|
+
* @returns oldest message in the array. `undefined` if given array is empty.
|
|
58
|
+
*/
|
|
59
|
+
static getOldestMessage(messages: GenericMessage[]): Promise<GenericMessage | undefined>;
|
|
60
|
+
/**
|
|
61
|
+
* Checks if first message is newer than second message.
|
|
62
|
+
* @returns `true` if `a` is newer than `b`; `false` otherwise
|
|
63
|
+
*/
|
|
64
|
+
static isNewer(a: GenericMessage, b: GenericMessage): Promise<boolean>;
|
|
65
|
+
/**
|
|
66
|
+
* Checks if first message is older than second message.
|
|
67
|
+
* @returns `true` if `a` is older than `b`; `false` otherwise
|
|
68
|
+
*/
|
|
69
|
+
static isOlder(a: GenericMessage, b: GenericMessage): Promise<boolean>;
|
|
70
|
+
/**
|
|
71
|
+
* See if the given message is signed by an author-delegate.
|
|
72
|
+
*/
|
|
73
|
+
static isSignedByAuthorDelegate(message: GenericMessage): boolean;
|
|
74
|
+
/**
|
|
75
|
+
* See if the given message is signed by an owner-delegate.
|
|
76
|
+
*/
|
|
77
|
+
static isSignedByOwnerDelegate(message: GenericMessage): boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Compares the `messageTimestamp` of the given messages with a fallback to message CID according to the spec.
|
|
80
|
+
* @returns 1 if `a` is larger/newer than `b`; -1 if `a` is smaller/older than `b`; 0 otherwise (same age)
|
|
81
|
+
*/
|
|
82
|
+
static compareMessageTimestamp(a: GenericMessage, b: GenericMessage): Promise<number>;
|
|
83
|
+
/**
|
|
84
|
+
* Validates the structural integrity of the message signature given:
|
|
85
|
+
* 1. The message signature must contain exactly 1 signature
|
|
86
|
+
* 2. Passes JSON schema validation
|
|
87
|
+
* 3. The `descriptorCid` property matches the CID of the message descriptor
|
|
88
|
+
* NOTE: signature is NOT verified.
|
|
89
|
+
* @param payloadJsonSchemaKey The key to look up the JSON schema referenced in `compile-validators.js` and perform payload schema validation on.
|
|
90
|
+
* @returns the parsed JSON payload object if validation succeeds.
|
|
91
|
+
*/
|
|
92
|
+
static validateSignatureStructure(messageSignature: GeneralJws, messageDescriptor: Descriptor, payloadJsonSchemaKey?: string): Promise<GenericSignaturePayload>;
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=message.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../../src/core/message.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,2BAA2B,CAAC;AAChF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAWzH;;GAEG;AACH,qBAAa,OAAO;IAElB;;OAEG;WACW,SAAS,CAAC,OAAO,EAAE,cAAc,GAAG,MAAM,GAAG,SAAS;IAepE;;;OAGG;WACW,kBAAkB,CAAC,UAAU,EAAE,GAAG,GAAG,IAAI;IASvD;;OAEG;WACW,SAAS,CAAC,OAAO,EAAE,cAAc,GAAG,MAAM,GAAG,SAAS;IASpE;;OAEG;WACiB,MAAM,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC;IAgBpE;;;OAGG;WACiB,UAAU,CAAC,CAAC,EAAE,cAAc,EAAE,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC;IAOrF;;;;OAIG;WACiB,mBAAmB,CAAC,KAAK,EAAE;QAC7C,UAAU,EAAE,UAAU,CAAC;QACvB,MAAM,EAAE,MAAM,CAAC;QACf,cAAc,CAAC,EAAE,8BAA8B,CAAC;QAChD,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,YAAY,CAAC,EAAE,MAAM,CAAA;KACtB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAqB/B;;;OAGG;WACiB,eAAe,CACjC,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,EACd,2BAA2B,CAAC,EAAE;QAAE,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,GAC7G,OAAO,CAAC,UAAU,CAAC;IActB;;OAEG;WACiB,gBAAgB,CAAC,QAAQ,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC;IAWrG;;OAEG;WACiB,gBAAgB,CAAC,QAAQ,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC;IAWrG;;;OAGG;WACiB,OAAO,CAAC,CAAC,EAAE,cAAc,EAAE,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC;IAKnF;;;OAGG;WACiB,OAAO,CAAC,CAAC,EAAE,cAAc,EAAE,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC;IAKnF;;OAEG;WACW,wBAAwB,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO;IAIxE;;OAEG;WACW,uBAAuB,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO;IAIvE;;;OAGG;WACiB,uBAAuB,CAAC,CAAC,EAAE,cAAc,EAAE,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC;IAYlG;;;;;;;;OAQG;WACiB,0BAA0B,CAC5C,gBAAgB,EAAE,UAAU,EAC5B,iBAAiB,EAAE,UAAU,EAC7B,oBAAoB,GAAE,MAAkC,GACvD,OAAO,CAAC,uBAAuB,CAAC;CAuBpC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { GenericMessage } from '../types/message-types.js';
|
|
2
|
+
import type { MessageStore } from '../types/message-store.js';
|
|
3
|
+
import type { PermissionGrant } from '../protocols/permission-grant.js';
|
|
4
|
+
import type { MessagesQueryMessage, MessagesReadMessage, MessagesSubscribeMessage } from '../types/messages-types.js';
|
|
5
|
+
export declare class MessagesGrantAuthorization {
|
|
6
|
+
/**
|
|
7
|
+
* Authorizes a MessagesReadMessage using the given permission grant.
|
|
8
|
+
* @param messageStore Used to check if the given grant has been revoked; and to fetch related RecordsWrites if needed.
|
|
9
|
+
*/
|
|
10
|
+
static authorizeMessagesRead(input: {
|
|
11
|
+
messagesReadMessage: MessagesReadMessage;
|
|
12
|
+
messageToRead: GenericMessage;
|
|
13
|
+
expectedGrantor: string;
|
|
14
|
+
expectedGrantee: string;
|
|
15
|
+
permissionGrant: PermissionGrant;
|
|
16
|
+
messageStore: MessageStore;
|
|
17
|
+
}): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* Authorizes the scope of a permission grant for MessagesQuery or MessagesSubscribe.
|
|
20
|
+
* @param messageStore Used to check if the grant has been revoked.
|
|
21
|
+
*/
|
|
22
|
+
static authorizeQueryOrSubscribe(input: {
|
|
23
|
+
incomingMessage: MessagesQueryMessage | MessagesSubscribeMessage;
|
|
24
|
+
expectedGrantor: string;
|
|
25
|
+
expectedGrantee: string;
|
|
26
|
+
permissionGrant: PermissionGrant;
|
|
27
|
+
messageStore: MessageStore;
|
|
28
|
+
}): Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Verifies the given record against the scope of the given grant.
|
|
31
|
+
*/
|
|
32
|
+
private static verifyScope;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=messages-grant-authorization.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages-grant-authorization.d.ts","sourceRoot":"","sources":["../../../../src/core/messages-grant-authorization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAEhE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAGxE,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAStH,qBAAa,0BAA0B;IAErC;;;OAGG;WACiB,qBAAqB,CAAC,KAAK,EAAE;QAC/C,mBAAmB,EAAE,mBAAmB,CAAC;QACzC,aAAa,EAAE,cAAc,CAAC;QAC9B,eAAe,EAAE,MAAM,CAAC;QACxB,eAAe,EAAE,MAAM,CAAC;QACxB,eAAe,EAAE,eAAe,CAAC;QACjC,YAAY,EAAE,YAAY,CAAC;KAC5B,GAAG,OAAO,CAAC,IAAI,CAAC;IAiBjB;;;OAGG;WACiB,yBAAyB,CAAC,KAAK,EAAE;QACnD,eAAe,EAAE,oBAAoB,GAAG,wBAAwB,CAAC;QACjE,eAAe,EAAE,MAAM,CAAC;QACxB,eAAe,EAAE,MAAM,CAAC;QACxB,eAAe,EAAE,eAAe,CAAC;QACjC,YAAY,EAAE,YAAY,CAAC;KAC5B,GAAG,OAAO,CAAC,IAAI,CAAC;IA2BjB;;OAEG;mBACkB,WAAW;CAgDjC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import type { MessageStore } from '../types/message-store.js';
|
|
2
|
+
import type { RecordsDelete } from '../interfaces/records-delete.js';
|
|
3
|
+
import type { RecordsQuery } from '../interfaces/records-query.js';
|
|
4
|
+
import type { RecordsRead } from '../interfaces/records-read.js';
|
|
5
|
+
import type { RecordsSubscribe } from '../interfaces/records-subscribe.js';
|
|
6
|
+
import { RecordsWrite } from '../interfaces/records-write.js';
|
|
7
|
+
export declare class ProtocolAuthorization {
|
|
8
|
+
/**
|
|
9
|
+
* Performs validation on the structure of RecordsWrite messages that use a protocol.
|
|
10
|
+
* @throws {Error} if validation fails.
|
|
11
|
+
*/
|
|
12
|
+
static validateReferentialIntegrity(tenant: string, incomingMessage: RecordsWrite, messageStore: MessageStore): Promise<void>;
|
|
13
|
+
/**
|
|
14
|
+
* Performs protocol-based authorization against the incoming RecordsWrite message.
|
|
15
|
+
* @throws {Error} if authorization fails.
|
|
16
|
+
*/
|
|
17
|
+
static authorizeWrite(tenant: string, incomingMessage: RecordsWrite, messageStore: MessageStore): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* Performs protocol-based authorization against the incoming `RecordsRead` message.
|
|
20
|
+
* @param newestRecordsWrite The latest RecordsWrite associated with the recordId being read.
|
|
21
|
+
* @throws {Error} if authorization fails.
|
|
22
|
+
*/
|
|
23
|
+
static authorizeRead(tenant: string, incomingMessage: RecordsRead, newestRecordsWrite: RecordsWrite, messageStore: MessageStore): Promise<void>;
|
|
24
|
+
static authorizeQueryOrSubscribe(tenant: string, incomingMessage: RecordsQuery | RecordsSubscribe, messageStore: MessageStore): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Performs protocol-based authorization against the incoming `RecordsDelete` message.
|
|
27
|
+
* @param recordsWrite A `RecordsWrite` of the record being deleted.
|
|
28
|
+
*/
|
|
29
|
+
static authorizeDelete(tenant: string, incomingMessage: RecordsDelete, recordsWrite: RecordsWrite, messageStore: MessageStore): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* Fetches the protocol definition based on the protocol specified in the given message.
|
|
32
|
+
*/
|
|
33
|
+
private static fetchProtocolDefinition;
|
|
34
|
+
/**
|
|
35
|
+
* Constructs the chain of EXISTING records in the datastore where the first record is the root initial `RecordsWrite` of the record chain
|
|
36
|
+
* and last record is the initial `RecordsWrite` of the descendant record specified.
|
|
37
|
+
* @param descendantRecordId The ID of the descendent record to start constructing the record chain from by repeatedly looking up the parent.
|
|
38
|
+
* @returns the record chain where each record is represented by its initial `RecordsWrite`;
|
|
39
|
+
* returns empty array if `descendantRecordId` is `undefined`.
|
|
40
|
+
* @throws {DwnError} if `descendantRecordId` is defined but any initial `RecordsWrite` is not found in the chain of records.
|
|
41
|
+
*/
|
|
42
|
+
private static constructRecordChain;
|
|
43
|
+
/**
|
|
44
|
+
* Fetches the initial RecordsWrite message associated with the given (tenant + recordId).
|
|
45
|
+
*/
|
|
46
|
+
private static fetchInitialWrite;
|
|
47
|
+
/**
|
|
48
|
+
* Gets the rule set corresponding to the given protocolPath.
|
|
49
|
+
*/
|
|
50
|
+
private static getRuleSet;
|
|
51
|
+
/**
|
|
52
|
+
* Verifies the `protocolPath` declared in the given message (if it is a RecordsWrite) matches the path of actual record chain.
|
|
53
|
+
* @throws {DwnError} if fails verification.
|
|
54
|
+
*/
|
|
55
|
+
private static verifyProtocolPathAndContextId;
|
|
56
|
+
/**
|
|
57
|
+
* Verifies the `dataFormat` and `schema` declared in the given message (if it is a RecordsWrite) matches dataFormat
|
|
58
|
+
* and schema of the type in the given protocol.
|
|
59
|
+
* @throws {DwnError} if fails verification.
|
|
60
|
+
*/
|
|
61
|
+
private static verifyType;
|
|
62
|
+
/**
|
|
63
|
+
* Check if the incoming message is invoking a role. If so, validate the invoked role.
|
|
64
|
+
*/
|
|
65
|
+
private static verifyInvokedRole;
|
|
66
|
+
/**
|
|
67
|
+
* Returns all the ProtocolActions that would authorized the incoming message
|
|
68
|
+
* (but we still need to later verify if there is a rule defined that matches one of the actions).
|
|
69
|
+
* NOTE: the reason why there could be multiple actions is because:
|
|
70
|
+
* - In case of an initial RecordsWrite, the RecordsWrite can be authorized by an allow `create` or `write` rule.
|
|
71
|
+
* - In case of a non-initial RecordsWrite by the original record author, the RecordsWrite can be authorized by a `write` or `co-update` rule.
|
|
72
|
+
*
|
|
73
|
+
* It is important to recognize that the `write` access that allowed the original record author to create the record maybe revoked
|
|
74
|
+
* (e.g. by role revocation) by the time a "non-initial" write by the same author is attempted.
|
|
75
|
+
*/
|
|
76
|
+
private static getActionsSeekingARuleMatch;
|
|
77
|
+
/**
|
|
78
|
+
* Verifies the given message is authorized by one of the action rules in the given protocol rule set.
|
|
79
|
+
* @throws {Error} if action not allowed.
|
|
80
|
+
*/
|
|
81
|
+
private static authorizeAgainstAllowedActions;
|
|
82
|
+
/**
|
|
83
|
+
* Verifies that writes adhere to the $size constraints if provided
|
|
84
|
+
* @throws {Error} if size is exceeded.
|
|
85
|
+
*/
|
|
86
|
+
private static verifySizeLimit;
|
|
87
|
+
private static verifyTagsIfNeeded;
|
|
88
|
+
/**
|
|
89
|
+
* If the given RecordsWrite is not a role record, this method does nothing and succeeds immediately.
|
|
90
|
+
*
|
|
91
|
+
* Else it verifies the validity of the given `RecordsWrite` as a role record, including:
|
|
92
|
+
* 1. The same role has not been assigned to the same entity/recipient.
|
|
93
|
+
*/
|
|
94
|
+
private static verifyAsRoleRecordIfNeeded;
|
|
95
|
+
private static getRuleSetAtProtocolPath;
|
|
96
|
+
/**
|
|
97
|
+
* Checks if the `who: 'author' | 'recipient'` action rule has a matching record in the record chain.
|
|
98
|
+
* @returns `true` if the action rule is satisfied; `false` otherwise.
|
|
99
|
+
*/
|
|
100
|
+
private static checkActor;
|
|
101
|
+
private static getTypeName;
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=protocol-authorization.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol-authorization.d.ts","sourceRoot":"","sources":["../../../../src/core/protocol-authorization.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAQ3E,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAK9D,qBAAa,qBAAqB;IAEhC;;;OAGG;WACiB,4BAA4B,CAC9C,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,YAAY,EAC7B,YAAY,EAAE,YAAY,GACzB,OAAO,CAAC,IAAI,CAAC;IA0ChB;;;OAGG;WACiB,cAAc,CAChC,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,YAAY,EAC7B,YAAY,EAAE,YAAY,GACzB,OAAO,CAAC,IAAI,CAAC;IA8ChB;;;;OAIG;WACiB,aAAa,CAC/B,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,WAAW,EAC5B,kBAAkB,EAAE,YAAY,EAChC,YAAY,EAAE,YAAY,GACzB,OAAO,CAAC,IAAI,CAAC;WAsCI,yBAAyB,CAC3C,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,YAAY,GAAG,gBAAgB,EAChD,YAAY,EAAE,YAAY,GACzB,OAAO,CAAC,IAAI,CAAC;IAoChB;;;OAGG;WACiB,eAAe,CACjC,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,aAAa,EAC9B,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,YAAY,GACzB,OAAO,CAAC,IAAI,CAAC;IAuChB;;OAEG;mBACkB,uBAAuB;IA0B5C;;;;;;;OAOG;mBACkB,oBAAoB;IAoCzC;;OAEG;mBACkB,iBAAiB;IAqBtC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,UAAU;IAYzB;;;OAGG;mBACkB,8BAA8B;IAwDnD;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,UAAU;IAuCzB;;OAEG;mBACkB,iBAAiB;IAgEtC;;;;;;;;;OASG;mBACkB,2BAA2B;IA+EhD;;;OAGG;mBACkB,8BAA8B;IA+FnD;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,eAAe;IAqB9B,OAAO,CAAC,MAAM,CAAC,kBAAkB;IAmCjC;;;;;OAKG;mBACkB,0BAA0B;IAoD/C,OAAO,CAAC,MAAM,CAAC,wBAAwB;IAmBvC;;;OAGG;mBACkB,UAAU;IA2B/B,OAAO,CAAC,MAAM,CAAC,WAAW;CAG3B"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { MessageStore } from '../types/message-store.js';
|
|
2
|
+
import type { PermissionGrant } from '../protocols/permission-grant.js';
|
|
3
|
+
import type { ProtocolsConfigureMessage, ProtocolsQueryMessage } from '../types/protocols-types.js';
|
|
4
|
+
export declare class ProtocolsGrantAuthorization {
|
|
5
|
+
/**
|
|
6
|
+
* Authorizes the given ProtocolsConfigure in the scope of the DID given.
|
|
7
|
+
*/
|
|
8
|
+
static authorizeConfigure(input: {
|
|
9
|
+
protocolsConfigureMessage: ProtocolsConfigureMessage;
|
|
10
|
+
expectedGrantor: string;
|
|
11
|
+
expectedGrantee: string;
|
|
12
|
+
permissionGrant: PermissionGrant;
|
|
13
|
+
messageStore: MessageStore;
|
|
14
|
+
}): Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* Authorizes the scope of a permission grant for a ProtocolsQuery message.
|
|
17
|
+
* @param messageStore Used to check if the grant has been revoked.
|
|
18
|
+
*/
|
|
19
|
+
static authorizeQuery(input: {
|
|
20
|
+
expectedGrantor: string;
|
|
21
|
+
expectedGrantee: string;
|
|
22
|
+
incomingMessage: ProtocolsQueryMessage;
|
|
23
|
+
permissionGrant: PermissionGrant;
|
|
24
|
+
messageStore: MessageStore;
|
|
25
|
+
}): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Verifies a ProtocolsConfigure against the scope of the given grant.
|
|
28
|
+
*/
|
|
29
|
+
private static verifyScope;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=protocols-grant-authorization.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocols-grant-authorization.d.ts","sourceRoot":"","sources":["../../../../src/core/protocols-grant-authorization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAExE,OAAO,KAAK,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAKpG,qBAAa,2BAA2B;IACtC;;OAEG;WACiB,kBAAkB,CAAC,KAAK,EAAE;QAC5C,yBAAyB,EAAE,yBAAyB,CAAC;QACrD,eAAe,EAAE,MAAM,CAAC;QACxB,eAAe,EAAE,MAAM,CAAC;QACxB,eAAe,EAAE,eAAe,CAAC;QACjC,YAAY,EAAE,YAAY,CAAC;KAC5B,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBjB;;;OAGG;WACiB,cAAc,CAAC,KAAK,EAAE;QACxC,eAAe,EAAE,MAAM,CAAC;QACxB,eAAe,EAAE,MAAM,CAAC;QACxB,eAAe,EAAE,qBAAqB,CAAC;QACvC,eAAe,EAAE,eAAe,CAAC;QACjC,YAAY,EAAE,YAAY,CAAC;KAC5B,GAAG,OAAO,CAAC,IAAI,CAAC;IAuBjB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,WAAW;CAiB3B"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { MessageStore } from '../types/message-store.js';
|
|
2
|
+
import type { PermissionGrant } from '../protocols/permission-grant.js';
|
|
3
|
+
import type { RecordsDeleteMessage, RecordsQueryMessage, RecordsReadMessage, RecordsSubscribeMessage, RecordsWriteMessage } from '../types/records-types.js';
|
|
4
|
+
export declare class RecordsGrantAuthorization {
|
|
5
|
+
/**
|
|
6
|
+
* Authorizes the given RecordsWrite in the scope of the DID given.
|
|
7
|
+
*/
|
|
8
|
+
static authorizeWrite(input: {
|
|
9
|
+
recordsWriteMessage: RecordsWriteMessage;
|
|
10
|
+
expectedGrantor: string;
|
|
11
|
+
expectedGrantee: string;
|
|
12
|
+
permissionGrant: PermissionGrant;
|
|
13
|
+
messageStore: MessageStore;
|
|
14
|
+
}): Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* Authorizes a RecordsReadMessage using the given permission grant.
|
|
17
|
+
* @param messageStore Used to check if the given grant has been revoked.
|
|
18
|
+
*/
|
|
19
|
+
static authorizeRead(input: {
|
|
20
|
+
recordsReadMessage: RecordsReadMessage;
|
|
21
|
+
recordsWriteMessageToBeRead: RecordsWriteMessage;
|
|
22
|
+
expectedGrantor: string;
|
|
23
|
+
expectedGrantee: string;
|
|
24
|
+
permissionGrant: PermissionGrant;
|
|
25
|
+
messageStore: MessageStore;
|
|
26
|
+
}): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Authorizes the scope of a permission grant for RecordsQuery or RecordsSubscribe.
|
|
29
|
+
* @param messageStore Used to check if the grant has been revoked.
|
|
30
|
+
*/
|
|
31
|
+
static authorizeQueryOrSubscribe(input: {
|
|
32
|
+
incomingMessage: RecordsQueryMessage | RecordsSubscribeMessage;
|
|
33
|
+
expectedGrantor: string;
|
|
34
|
+
expectedGrantee: string;
|
|
35
|
+
permissionGrant: PermissionGrant;
|
|
36
|
+
messageStore: MessageStore;
|
|
37
|
+
}): Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* Authorizes the scope of a permission grant for RecordsDelete.
|
|
40
|
+
* @param messageStore Used to check if the grant has been revoked.
|
|
41
|
+
*/
|
|
42
|
+
static authorizeDelete(input: {
|
|
43
|
+
recordsDeleteMessage: RecordsDeleteMessage;
|
|
44
|
+
recordsWriteToDelete: RecordsWriteMessage;
|
|
45
|
+
expectedGrantor: string;
|
|
46
|
+
expectedGrantee: string;
|
|
47
|
+
permissionGrant: PermissionGrant;
|
|
48
|
+
messageStore: MessageStore;
|
|
49
|
+
}): Promise<void>;
|
|
50
|
+
/**
|
|
51
|
+
* Verifies a record against the scope of the given grant.
|
|
52
|
+
*/
|
|
53
|
+
private static verifyScope;
|
|
54
|
+
/**
|
|
55
|
+
* Verifies grant `conditions`.
|
|
56
|
+
* Currently the only condition is `published` which only applies to RecordsWrites
|
|
57
|
+
*/
|
|
58
|
+
private static verifyConditions;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=records-grant-authorization.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"records-grant-authorization.d.ts","sourceRoot":"","sources":["../../../../src/core/records-grant-authorization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAExE,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAM7J,qBAAa,yBAAyB;IACpC;;OAEG;WACiB,cAAc,CAAC,KAAK,EAAE;QACxC,mBAAmB,EAAE,mBAAmB,CAAC;QACzC,eAAe,EAAE,MAAM,CAAC;QACxB,eAAe,EAAE,MAAM,CAAC;QACxB,eAAe,EAAE,eAAe,CAAC;QACjC,YAAY,EAAE,YAAY,CAAC;KAC5B,GAAG,OAAO,CAAC,IAAI,CAAC;IAmBjB;;;OAGG;WACiB,aAAa,CAAC,KAAK,EAAE;QACvC,kBAAkB,EAAE,kBAAkB,CAAC;QACvC,2BAA2B,EAAE,mBAAmB,CAAC;QACjD,eAAe,EAAE,MAAM,CAAC;QACxB,eAAe,EAAE,MAAM,CAAC;QACxB,eAAe,EAAE,eAAe,CAAC;QACjC,YAAY,EAAE,YAAY,CAAC;KAC5B,GAAG,OAAO,CAAC,IAAI,CAAC;IAiBjB;;;OAGG;WACiB,yBAAyB,CAAC,KAAK,EAAE;QACnD,eAAe,EAAE,mBAAmB,GAAG,uBAAuB,CAAC;QAC/D,eAAe,EAAE,MAAM,CAAC;QACxB,eAAe,EAAE,MAAM,CAAC;QACxB,eAAe,EAAE,eAAe,CAAC;QACjC,YAAY,EAAE,YAAY,CAAC;KAC5B,GAAG,OAAO,CAAC,IAAI,CAAC;IA0BjB;;;OAGG;WACiB,eAAe,CAAC,KAAK,EAAE;QACzC,oBAAoB,EAAE,oBAAoB,CAAC;QAC3C,oBAAoB,EAAE,mBAAmB,CAAC;QAC1C,eAAe,EAAE,MAAM,CAAC;QACxB,eAAe,EAAE,MAAM,CAAC;QACxB,eAAe,EAAE,eAAe,CAAC;QACjC,YAAY,EAAE,YAAY,CAAC;KAC5B,GAAG,OAAO,CAAC,IAAI,CAAC;IA0BjB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,WAAW;IAgC1B;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,gBAAgB;CAkBhC"}
|