@enbox/agent 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/dist/browser.js +2215 -0
- package/dist/browser.js.map +7 -0
- package/dist/browser.mjs +2215 -0
- package/dist/browser.mjs.map +7 -0
- package/dist/cjs/index.js +8530 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/package.json +1 -0
- package/dist/esm/agent-did-resolver-cache.js +87 -0
- package/dist/esm/agent-did-resolver-cache.js.map +1 -0
- package/dist/esm/bearer-identity.js +41 -0
- package/dist/esm/bearer-identity.js.map +1 -0
- package/dist/esm/connect.js +191 -0
- package/dist/esm/connect.js.map +1 -0
- package/dist/esm/crypto-api.js +346 -0
- package/dist/esm/crypto-api.js.map +1 -0
- package/dist/esm/did-api.js +278 -0
- package/dist/esm/did-api.js.map +1 -0
- package/dist/esm/dwn-api.js +336 -0
- package/dist/esm/dwn-api.js.map +1 -0
- package/dist/esm/dwn-registrar.js +120 -0
- package/dist/esm/dwn-registrar.js.map +1 -0
- package/dist/esm/hd-identity-vault.js +729 -0
- package/dist/esm/hd-identity-vault.js.map +1 -0
- package/dist/esm/identity-api.js +262 -0
- package/dist/esm/identity-api.js.map +1 -0
- package/dist/esm/index.js +23 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/local-key-manager.js +498 -0
- package/dist/esm/local-key-manager.js.map +1 -0
- package/dist/esm/oidc.js +507 -0
- package/dist/esm/oidc.js.map +1 -0
- package/dist/esm/permissions-api.js +322 -0
- package/dist/esm/permissions-api.js.map +1 -0
- package/dist/esm/prototyping/clients/dwn-rpc-types.js +2 -0
- package/dist/esm/prototyping/clients/dwn-rpc-types.js.map +1 -0
- package/dist/esm/prototyping/clients/dwn-server-info-cache-memory.js +74 -0
- package/dist/esm/prototyping/clients/dwn-server-info-cache-memory.js.map +1 -0
- package/dist/esm/prototyping/clients/http-dwn-rpc-client.js +105 -0
- package/dist/esm/prototyping/clients/http-dwn-rpc-client.js.map +1 -0
- package/dist/esm/prototyping/clients/json-rpc-socket.js +150 -0
- package/dist/esm/prototyping/clients/json-rpc-socket.js.map +1 -0
- package/dist/esm/prototyping/clients/json-rpc.js +58 -0
- package/dist/esm/prototyping/clients/json-rpc.js.map +1 -0
- package/dist/esm/prototyping/clients/server-info-types.js +2 -0
- package/dist/esm/prototyping/clients/server-info-types.js.map +1 -0
- package/dist/esm/prototyping/clients/web-socket-clients.js +90 -0
- package/dist/esm/prototyping/clients/web-socket-clients.js.map +1 -0
- package/dist/esm/prototyping/common/object.js +14 -0
- package/dist/esm/prototyping/common/object.js.map +1 -0
- package/dist/esm/prototyping/common/type-utils.js +2 -0
- package/dist/esm/prototyping/common/type-utils.js.map +1 -0
- package/dist/esm/prototyping/crypto/algorithms/aes-gcm.js +147 -0
- package/dist/esm/prototyping/crypto/algorithms/aes-gcm.js.map +1 -0
- package/dist/esm/prototyping/crypto/algorithms/aes-kw.js +137 -0
- package/dist/esm/prototyping/crypto/algorithms/aes-kw.js.map +1 -0
- package/dist/esm/prototyping/crypto/algorithms/ecdsa.js +307 -0
- package/dist/esm/prototyping/crypto/algorithms/ecdsa.js.map +1 -0
- package/dist/esm/prototyping/crypto/algorithms/eddsa.js +264 -0
- package/dist/esm/prototyping/crypto/algorithms/eddsa.js.map +1 -0
- package/dist/esm/prototyping/crypto/algorithms/hkdf.js +39 -0
- package/dist/esm/prototyping/crypto/algorithms/hkdf.js.map +1 -0
- package/dist/esm/prototyping/crypto/algorithms/pbkdf2.js +41 -0
- package/dist/esm/prototyping/crypto/algorithms/pbkdf2.js.map +1 -0
- package/dist/esm/prototyping/crypto/crypto-error.js +41 -0
- package/dist/esm/prototyping/crypto/crypto-error.js.map +1 -0
- package/dist/esm/prototyping/crypto/dsa.js +236 -0
- package/dist/esm/prototyping/crypto/dsa.js.map +1 -0
- package/dist/esm/prototyping/crypto/jose/jwe-compact.js +130 -0
- package/dist/esm/prototyping/crypto/jose/jwe-compact.js.map +1 -0
- package/dist/esm/prototyping/crypto/jose/jwe-flattened.js +294 -0
- package/dist/esm/prototyping/crypto/jose/jwe-flattened.js.map +1 -0
- package/dist/esm/prototyping/crypto/jose/jwe.js +308 -0
- package/dist/esm/prototyping/crypto/jose/jwe.js.map +1 -0
- package/dist/esm/prototyping/crypto/primitives/aes-gcm.js +352 -0
- package/dist/esm/prototyping/crypto/primitives/aes-gcm.js.map +1 -0
- package/dist/esm/prototyping/crypto/primitives/aes-kw.js +247 -0
- package/dist/esm/prototyping/crypto/primitives/aes-kw.js.map +1 -0
- package/dist/esm/prototyping/crypto/primitives/hkdf.js +80 -0
- package/dist/esm/prototyping/crypto/primitives/hkdf.js.map +1 -0
- package/dist/esm/prototyping/crypto/primitives/pbkdf2.js +85 -0
- package/dist/esm/prototyping/crypto/primitives/pbkdf2.js.map +1 -0
- package/dist/esm/prototyping/crypto/types/cipher.js +2 -0
- package/dist/esm/prototyping/crypto/types/cipher.js.map +1 -0
- package/dist/esm/prototyping/crypto/types/crypto-api.js +2 -0
- package/dist/esm/prototyping/crypto/types/crypto-api.js.map +1 -0
- package/dist/esm/prototyping/crypto/types/key-converter.js +2 -0
- package/dist/esm/prototyping/crypto/types/key-converter.js.map +1 -0
- package/dist/esm/prototyping/crypto/types/key-deriver.js +2 -0
- package/dist/esm/prototyping/crypto/types/key-deriver.js.map +1 -0
- package/dist/esm/prototyping/crypto/types/key-io.js +2 -0
- package/dist/esm/prototyping/crypto/types/key-io.js.map +1 -0
- package/dist/esm/prototyping/crypto/types/key-manager.js +2 -0
- package/dist/esm/prototyping/crypto/types/key-manager.js.map +1 -0
- package/dist/esm/prototyping/crypto/types/key-wrapper.js +2 -0
- package/dist/esm/prototyping/crypto/types/key-wrapper.js.map +1 -0
- package/dist/esm/prototyping/crypto/types/params-direct.js +2 -0
- package/dist/esm/prototyping/crypto/types/params-direct.js.map +1 -0
- package/dist/esm/prototyping/crypto/types/params-kms.js +2 -0
- package/dist/esm/prototyping/crypto/types/params-kms.js.map +1 -0
- package/dist/esm/prototyping/crypto/utils.js +19 -0
- package/dist/esm/prototyping/crypto/utils.js.map +1 -0
- package/dist/esm/prototyping/dids/resolver-cache-memory.js +77 -0
- package/dist/esm/prototyping/dids/resolver-cache-memory.js.map +1 -0
- package/dist/esm/prototyping/dids/utils.js +9 -0
- package/dist/esm/prototyping/dids/utils.js.map +1 -0
- package/dist/esm/rpc-client.js +123 -0
- package/dist/esm/rpc-client.js.map +1 -0
- package/dist/esm/store-data-protocols.js +38 -0
- package/dist/esm/store-data-protocols.js.map +1 -0
- package/dist/esm/store-data.js +320 -0
- package/dist/esm/store-data.js.map +1 -0
- package/dist/esm/store-did.js +136 -0
- package/dist/esm/store-did.js.map +1 -0
- package/dist/esm/store-identity.js +140 -0
- package/dist/esm/store-identity.js.map +1 -0
- package/dist/esm/store-key.js +136 -0
- package/dist/esm/store-key.js.map +1 -0
- package/dist/esm/sync-api.js +61 -0
- package/dist/esm/sync-api.js.map +1 -0
- package/dist/esm/sync-engine-level.js +618 -0
- package/dist/esm/sync-engine-level.js.map +1 -0
- package/dist/esm/test-harness.js +239 -0
- package/dist/esm/test-harness.js.map +1 -0
- package/dist/esm/types/agent.js +2 -0
- package/dist/esm/types/agent.js.map +1 -0
- package/dist/esm/types/dwn.js +31 -0
- package/dist/esm/types/dwn.js.map +1 -0
- package/dist/esm/types/identity-vault.js +2 -0
- package/dist/esm/types/identity-vault.js.map +1 -0
- package/dist/esm/types/identity.js +2 -0
- package/dist/esm/types/identity.js.map +1 -0
- package/dist/esm/types/key-manager.js +2 -0
- package/dist/esm/types/key-manager.js.map +1 -0
- package/dist/esm/types/permissions.js +2 -0
- package/dist/esm/types/permissions.js.map +1 -0
- package/dist/esm/types/sync.js +2 -0
- package/dist/esm/types/sync.js.map +1 -0
- package/dist/esm/types/vc.js +5 -0
- package/dist/esm/types/vc.js.map +1 -0
- package/dist/esm/utils-internal.js +147 -0
- package/dist/esm/utils-internal.js.map +1 -0
- package/dist/esm/utils.js +161 -0
- package/dist/esm/utils.js.map +1 -0
- package/dist/types/agent-did-resolver-cache.d.ts +30 -0
- package/dist/types/agent-did-resolver-cache.d.ts.map +1 -0
- package/dist/types/bearer-identity.d.ts +31 -0
- package/dist/types/bearer-identity.d.ts.map +1 -0
- package/dist/types/connect.d.ts +88 -0
- package/dist/types/connect.d.ts.map +1 -0
- package/dist/types/crypto-api.d.ts +286 -0
- package/dist/types/crypto-api.d.ts.map +1 -0
- package/dist/types/did-api.d.ts +119 -0
- package/dist/types/did-api.d.ts.map +1 -0
- package/dist/types/dwn-api.d.ts +66 -0
- package/dist/types/dwn-api.d.ts.map +1 -0
- package/dist/types/dwn-registrar.d.ts +29 -0
- package/dist/types/dwn-registrar.d.ts.map +1 -0
- package/dist/types/hd-identity-vault.d.ts +306 -0
- package/dist/types/hd-identity-vault.d.ts.map +1 -0
- package/dist/types/identity-api.d.ts +107 -0
- package/dist/types/identity-api.d.ts.map +1 -0
- package/dist/types/index.d.ts +30 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/local-key-manager.d.ts +311 -0
- package/dist/types/local-key-manager.d.ts.map +1 -0
- package/dist/types/oidc.d.ts +247 -0
- package/dist/types/oidc.d.ts.map +1 -0
- package/dist/types/permissions-api.d.ts +35 -0
- package/dist/types/permissions-api.d.ts.map +1 -0
- package/dist/types/prototyping/clients/dwn-rpc-types.d.ts +45 -0
- package/dist/types/prototyping/clients/dwn-rpc-types.d.ts.map +1 -0
- package/dist/types/prototyping/clients/dwn-server-info-cache-memory.d.ts +57 -0
- package/dist/types/prototyping/clients/dwn-server-info-cache-memory.d.ts.map +1 -0
- package/dist/types/prototyping/clients/http-dwn-rpc-client.d.ts +13 -0
- package/dist/types/prototyping/clients/http-dwn-rpc-client.d.ts.map +1 -0
- package/dist/types/prototyping/clients/json-rpc-socket.d.ts +43 -0
- package/dist/types/prototyping/clients/json-rpc-socket.d.ts.map +1 -0
- package/dist/types/prototyping/clients/json-rpc.d.ts +49 -0
- package/dist/types/prototyping/clients/json-rpc.d.ts.map +1 -0
- package/dist/types/prototyping/clients/server-info-types.d.ts +20 -0
- package/dist/types/prototyping/clients/server-info-types.d.ts.map +1 -0
- package/dist/types/prototyping/clients/web-socket-clients.d.ts +10 -0
- package/dist/types/prototyping/clients/web-socket-clients.d.ts.map +1 -0
- package/dist/types/prototyping/common/object.d.ts +2 -0
- package/dist/types/prototyping/common/object.d.ts.map +1 -0
- package/dist/types/prototyping/common/type-utils.d.ts +7 -0
- package/dist/types/prototyping/common/type-utils.d.ts.map +1 -0
- package/dist/types/prototyping/crypto/algorithms/aes-gcm.d.ts +151 -0
- package/dist/types/prototyping/crypto/algorithms/aes-gcm.d.ts.map +1 -0
- package/dist/types/prototyping/crypto/algorithms/aes-kw.d.ts +109 -0
- package/dist/types/prototyping/crypto/algorithms/aes-kw.d.ts.map +1 -0
- package/dist/types/prototyping/crypto/algorithms/ecdsa.d.ts +160 -0
- package/dist/types/prototyping/crypto/algorithms/ecdsa.d.ts.map +1 -0
- package/dist/types/prototyping/crypto/algorithms/eddsa.d.ts +157 -0
- package/dist/types/prototyping/crypto/algorithms/eddsa.d.ts.map +1 -0
- package/dist/types/prototyping/crypto/algorithms/hkdf.d.ts +21 -0
- package/dist/types/prototyping/crypto/algorithms/hkdf.d.ts.map +1 -0
- package/dist/types/prototyping/crypto/algorithms/pbkdf2.d.ts +21 -0
- package/dist/types/prototyping/crypto/algorithms/pbkdf2.d.ts.map +1 -0
- package/dist/types/prototyping/crypto/crypto-error.d.ts +29 -0
- package/dist/types/prototyping/crypto/crypto-error.d.ts.map +1 -0
- package/dist/types/prototyping/crypto/dsa.d.ts +169 -0
- package/dist/types/prototyping/crypto/dsa.d.ts.map +1 -0
- package/dist/types/prototyping/crypto/jose/jwe-compact.d.ts +135 -0
- package/dist/types/prototyping/crypto/jose/jwe-compact.d.ts.map +1 -0
- package/dist/types/prototyping/crypto/jose/jwe-flattened.d.ts +134 -0
- package/dist/types/prototyping/crypto/jose/jwe-flattened.d.ts.map +1 -0
- package/dist/types/prototyping/crypto/jose/jwe.d.ts +378 -0
- package/dist/types/prototyping/crypto/jose/jwe.d.ts.map +1 -0
- package/dist/types/prototyping/crypto/primitives/aes-gcm.d.ts +245 -0
- package/dist/types/prototyping/crypto/primitives/aes-gcm.d.ts.map +1 -0
- package/dist/types/prototyping/crypto/primitives/aes-kw.d.ts +103 -0
- package/dist/types/prototyping/crypto/primitives/aes-kw.d.ts.map +1 -0
- package/dist/types/prototyping/crypto/primitives/hkdf.d.ts +90 -0
- package/dist/types/prototyping/crypto/primitives/hkdf.d.ts.map +1 -0
- package/dist/types/prototyping/crypto/primitives/pbkdf2.d.ts +84 -0
- package/dist/types/prototyping/crypto/primitives/pbkdf2.d.ts.map +1 -0
- package/dist/types/prototyping/crypto/types/cipher.d.ts +14 -0
- package/dist/types/prototyping/crypto/types/cipher.d.ts.map +1 -0
- package/dist/types/prototyping/crypto/types/crypto-api.d.ts +35 -0
- package/dist/types/prototyping/crypto/types/crypto-api.d.ts.map +1 -0
- package/dist/types/prototyping/crypto/types/key-converter.d.ts +49 -0
- package/dist/types/prototyping/crypto/types/key-converter.d.ts.map +1 -0
- package/dist/types/prototyping/crypto/types/key-deriver.d.ts +50 -0
- package/dist/types/prototyping/crypto/types/key-deriver.d.ts.map +1 -0
- package/dist/types/prototyping/crypto/types/key-io.d.ts +49 -0
- package/dist/types/prototyping/crypto/types/key-io.d.ts.map +1 -0
- package/dist/types/prototyping/crypto/types/key-manager.d.ts +69 -0
- package/dist/types/prototyping/crypto/types/key-manager.d.ts.map +1 -0
- package/dist/types/prototyping/crypto/types/key-wrapper.d.ts +14 -0
- package/dist/types/prototyping/crypto/types/key-wrapper.d.ts.map +1 -0
- package/dist/types/prototyping/crypto/types/params-direct.d.ts +75 -0
- package/dist/types/prototyping/crypto/types/params-direct.d.ts.map +1 -0
- package/dist/types/prototyping/crypto/types/params-kms.d.ts +63 -0
- package/dist/types/prototyping/crypto/types/params-kms.d.ts.map +1 -0
- package/dist/types/prototyping/crypto/utils.d.ts +7 -0
- package/dist/types/prototyping/crypto/utils.d.ts.map +1 -0
- package/dist/types/prototyping/dids/resolver-cache-memory.d.ts +57 -0
- package/dist/types/prototyping/dids/resolver-cache-memory.d.ts.map +1 -0
- package/dist/types/prototyping/dids/utils.d.ts +3 -0
- package/dist/types/prototyping/dids/utils.d.ts.map +1 -0
- package/dist/types/rpc-client.d.ts +51 -0
- package/dist/types/rpc-client.d.ts.map +1 -0
- package/dist/types/store-data-protocols.d.ts +4 -0
- package/dist/types/store-data-protocols.d.ts.map +1 -0
- package/dist/types/store-data.d.ts +95 -0
- package/dist/types/store-data.d.ts.map +1 -0
- package/dist/types/store-did.d.ts +33 -0
- package/dist/types/store-did.d.ts.map +1 -0
- package/dist/types/store-identity.d.ts +34 -0
- package/dist/types/store-identity.d.ts.map +1 -0
- package/dist/types/store-key.d.ts +32 -0
- package/dist/types/store-key.d.ts.map +1 -0
- package/dist/types/sync-api.d.ts +41 -0
- package/dist/types/sync-api.d.ts.map +1 -0
- package/dist/types/sync-engine-level.d.ts +85 -0
- package/dist/types/sync-engine-level.d.ts.map +1 -0
- package/dist/types/test-harness.d.ts +69 -0
- package/dist/types/test-harness.d.ts.map +1 -0
- package/dist/types/types/agent.d.ts +172 -0
- package/dist/types/types/agent.d.ts.map +1 -0
- package/dist/types/types/dwn.d.ts +178 -0
- package/dist/types/types/dwn.d.ts.map +1 -0
- package/dist/types/types/identity-vault.d.ts +129 -0
- package/dist/types/types/identity-vault.d.ts.map +1 -0
- package/dist/types/types/identity.d.ts +16 -0
- package/dist/types/types/identity.d.ts.map +1 -0
- package/dist/types/types/key-manager.d.ts +9 -0
- package/dist/types/types/key-manager.d.ts.map +1 -0
- package/dist/types/types/permissions.d.ts +98 -0
- package/dist/types/types/permissions.d.ts.map +1 -0
- package/dist/types/types/sync.d.ts +66 -0
- package/dist/types/types/sync.d.ts.map +1 -0
- package/dist/types/types/vc.d.ts +7 -0
- package/dist/types/types/vc.d.ts.map +1 -0
- package/dist/types/utils-internal.d.ts +50 -0
- package/dist/types/utils-internal.d.ts.map +1 -0
- package/dist/types/utils.d.ts +37 -0
- package/dist/types/utils.d.ts.map +1 -0
- package/package.json +112 -0
- package/src/agent-did-resolver-cache.ts +95 -0
- package/src/bearer-identity.ts +42 -0
- package/src/connect.ts +296 -0
- package/src/crypto-api.ts +593 -0
- package/src/did-api.ts +429 -0
- package/src/dwn-api.ts +462 -0
- package/src/dwn-registrar.ts +127 -0
- package/src/hd-identity-vault.ts +853 -0
- package/src/identity-api.ts +324 -0
- package/src/index.ts +30 -0
- package/src/local-key-manager.ts +672 -0
- package/src/oidc.ts +857 -0
- package/src/permissions-api.ts +408 -0
- package/src/prototyping/clients/dwn-rpc-types.ts +55 -0
- package/src/prototyping/clients/dwn-server-info-cache-memory.ts +79 -0
- package/src/prototyping/clients/http-dwn-rpc-client.ts +110 -0
- package/src/prototyping/clients/json-rpc-socket.ts +169 -0
- package/src/prototyping/clients/json-rpc.ts +113 -0
- package/src/prototyping/clients/server-info-types.ts +21 -0
- package/src/prototyping/clients/web-socket-clients.ts +100 -0
- package/src/prototyping/common/object.ts +15 -0
- package/src/prototyping/common/type-utils.ts +6 -0
- package/src/prototyping/crypto/algorithms/aes-gcm.ts +211 -0
- package/src/prototyping/crypto/algorithms/aes-kw.ts +164 -0
- package/src/prototyping/crypto/algorithms/ecdsa.ts +365 -0
- package/src/prototyping/crypto/algorithms/eddsa.ts +310 -0
- package/src/prototyping/crypto/algorithms/hkdf.ts +40 -0
- package/src/prototyping/crypto/algorithms/pbkdf2.ts +44 -0
- package/src/prototyping/crypto/crypto-error.ts +45 -0
- package/src/prototyping/crypto/dsa.ts +367 -0
- package/src/prototyping/crypto/jose/jwe-compact.ts +225 -0
- package/src/prototyping/crypto/jose/jwe-flattened.ts +459 -0
- package/src/prototyping/crypto/jose/jwe.ts +653 -0
- package/src/prototyping/crypto/primitives/aes-gcm.ts +374 -0
- package/src/prototyping/crypto/primitives/aes-kw.ts +271 -0
- package/src/prototyping/crypto/primitives/hkdf.ts +121 -0
- package/src/prototyping/crypto/primitives/pbkdf2.ts +116 -0
- package/src/prototyping/crypto/types/cipher.ts +17 -0
- package/src/prototyping/crypto/types/crypto-api.ts +78 -0
- package/src/prototyping/crypto/types/key-converter.ts +53 -0
- package/src/prototyping/crypto/types/key-deriver.ts +56 -0
- package/src/prototyping/crypto/types/key-io.ts +51 -0
- package/src/prototyping/crypto/types/key-manager.ts +83 -0
- package/src/prototyping/crypto/types/key-wrapper.ts +17 -0
- package/src/prototyping/crypto/types/params-direct.ts +95 -0
- package/src/prototyping/crypto/types/params-kms.ts +76 -0
- package/src/prototyping/crypto/utils.ts +41 -0
- package/src/prototyping/dids/resolver-cache-memory.ts +83 -0
- package/src/prototyping/dids/utils.ts +10 -0
- package/src/rpc-client.ts +162 -0
- package/src/store-data-protocols.ts +40 -0
- package/src/store-data.ts +400 -0
- package/src/store-did.ts +105 -0
- package/src/store-identity.ts +109 -0
- package/src/store-key.ts +104 -0
- package/src/sync-api.ts +71 -0
- package/src/sync-engine-level.ts +714 -0
- package/src/test-harness.ts +330 -0
- package/src/types/agent.ts +195 -0
- package/src/types/dwn.ts +278 -0
- package/src/types/identity-vault.ts +137 -0
- package/src/types/identity.ts +18 -0
- package/src/types/key-manager.ts +15 -0
- package/src/types/permissions.ts +115 -0
- package/src/types/sync.ts +58 -0
- package/src/types/vc.ts +7 -0
- package/src/utils-internal.ts +157 -0
- package/src/utils.ts +181 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type { Jwk } from '@enbox/crypto';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export interface BytesToPrivateKeyParams {
|
|
5
|
+
algorithm: AlgorithmIdentifier;
|
|
6
|
+
privateKeyBytes: Uint8Array;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface BytesToPublicKeyParams {
|
|
10
|
+
algorithm: AlgorithmIdentifier;
|
|
11
|
+
publicKeyBytes: Uint8Array;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Parameters for encryption and decryption operations.
|
|
16
|
+
*
|
|
17
|
+
* Intended for use with a Key Management System.
|
|
18
|
+
*/
|
|
19
|
+
export interface CipherParams {
|
|
20
|
+
/** A {@link Jwk} containing the key to be used for encryption or decryption. */
|
|
21
|
+
key: Jwk;
|
|
22
|
+
|
|
23
|
+
/** Data to be encrypted or decrypted. */
|
|
24
|
+
data: Uint8Array;
|
|
25
|
+
|
|
26
|
+
/** Additional algorithm-specific parameters for encryption or decryption. */
|
|
27
|
+
[key: string]: unknown;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Parameters for derivation of cryptographic keys.
|
|
32
|
+
*/
|
|
33
|
+
export interface DeriveKeyParams {
|
|
34
|
+
/** The algorithm identifier. */
|
|
35
|
+
algorithm: AlgorithmIdentifier;
|
|
36
|
+
|
|
37
|
+
/** The base key to be used for derivation as a byte array. */
|
|
38
|
+
baseKeyBytes: Uint8Array;
|
|
39
|
+
|
|
40
|
+
/** The algorithm identifier for the derived key. */
|
|
41
|
+
derivedKeyAlgorithm?: AlgorithmIdentifier;
|
|
42
|
+
|
|
43
|
+
/** Additional algorithm-specific parameters for key derivation. */
|
|
44
|
+
[key: string]: unknown;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Parameters for derivation of cryptographic byte arrays.
|
|
49
|
+
*/
|
|
50
|
+
export interface DeriveKeyBytesParams {
|
|
51
|
+
/** The base key to be used for derivation as a byte array. */
|
|
52
|
+
baseKeyBytes: Uint8Array;
|
|
53
|
+
|
|
54
|
+
/** The desired length of the derived key in bits. */
|
|
55
|
+
length: number;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface PrivateKeyToBytesParams {
|
|
59
|
+
privateKey: Jwk;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface PublicKeyToBytesParams {
|
|
63
|
+
publicKey: Jwk;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Parameters for wrapping a key.
|
|
68
|
+
*/
|
|
69
|
+
export interface WrapKeyParams {
|
|
70
|
+
/** A {@link Jwk} containing the key used to encrypt the unwrapped key. */
|
|
71
|
+
encryptionKey: Jwk;
|
|
72
|
+
|
|
73
|
+
/** A {@link Jwk} containing the private key to be wrapped. */
|
|
74
|
+
unwrappedKey: Jwk;
|
|
75
|
+
|
|
76
|
+
/** An object defining the algorithm-specific parameters for encrypting the `unwrappedKey`. */
|
|
77
|
+
encryptParams?: unknown
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Parameters for unwrapping a key.
|
|
82
|
+
*/
|
|
83
|
+
export interface UnwrapKeyParams {
|
|
84
|
+
/** A {@link Jwk} containing the key used to decrypt the unwrapped key. */
|
|
85
|
+
decryptionKey: Jwk;
|
|
86
|
+
|
|
87
|
+
/** The wrapped private key as a byte array. */
|
|
88
|
+
wrappedKeyBytes: Uint8Array;
|
|
89
|
+
|
|
90
|
+
/** The algorithm identifier of the key encrypted in `wrappedKeyBytes`. */
|
|
91
|
+
wrappedKeyAlgorithm: string;
|
|
92
|
+
|
|
93
|
+
/** An object defining the algorithm-specific parameters for decrypting the `wrappedKeyBytes`. */
|
|
94
|
+
decryptParams?: unknown;
|
|
95
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { Jwk, KeyIdentifier } from '@enbox/crypto';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Parameters for KMS-based encryption and decryption operations.
|
|
5
|
+
*
|
|
6
|
+
* Intended for use with a Key Management System.
|
|
7
|
+
*/
|
|
8
|
+
export interface KmsCipherParams {
|
|
9
|
+
/** Identifier for the private key in the KMS. */
|
|
10
|
+
keyUri: KeyIdentifier;
|
|
11
|
+
|
|
12
|
+
/** Data to be encrypted or decrypted. */
|
|
13
|
+
data: Uint8Array;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Parameters for KMS-based derivation of a cryptographic key from a given base key.
|
|
18
|
+
*
|
|
19
|
+
* Intended for use with a Key Management System.
|
|
20
|
+
*/
|
|
21
|
+
export interface KmsDeriveKeyParams {
|
|
22
|
+
/** Identifier for the base key used in derivation in the KMS. */
|
|
23
|
+
baseKeyUri: KeyIdentifier;
|
|
24
|
+
|
|
25
|
+
/** An object defining the algorithm-specific parameters for the derived key. */
|
|
26
|
+
derivedKeyParams: unknown
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Parameters for KMS-based derivation of a byte array from a given base key.
|
|
31
|
+
*
|
|
32
|
+
* Intended for use with a Key Management System.
|
|
33
|
+
*/
|
|
34
|
+
export interface KmsDeriveKeyBytesParams {
|
|
35
|
+
/** Identifier for the base key used in derivation in the KMS. */
|
|
36
|
+
baseKeyUri: KeyIdentifier;
|
|
37
|
+
|
|
38
|
+
/** The desired length of the derived key in bits. */
|
|
39
|
+
length: number;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Parameters for unwrapping a key using a KMS. Intended for use with a Key Management System.
|
|
44
|
+
*/
|
|
45
|
+
export interface KmsUnwrapKeyParams {
|
|
46
|
+
/** Identifier for the private key in the KMS used for decrypting the wrapped key. */
|
|
47
|
+
decryptionKeyUri: KeyIdentifier;
|
|
48
|
+
|
|
49
|
+
/** The wrapped private key as a byte array. */
|
|
50
|
+
wrappedKeyBytes: Uint8Array;
|
|
51
|
+
|
|
52
|
+
/** The algorithm identifier of the key encrypted in `wrappedKeyBytes`. */
|
|
53
|
+
wrappedKeyAlgorithm: string;
|
|
54
|
+
|
|
55
|
+
/** An object defining the algorithm-specific parameters for decrypting the `wrappedKeyBytes`. */
|
|
56
|
+
decryptParams?: unknown;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Parameters for wrapping a key using a KMS. Intended for use with a Key Management System.
|
|
61
|
+
*/
|
|
62
|
+
export interface KmsWrapKeyParams {
|
|
63
|
+
/** Identifier for the private key in the KMS used for encrypting the unwrapped key. */
|
|
64
|
+
encryptionKeyUri: KeyIdentifier;
|
|
65
|
+
|
|
66
|
+
/** A {@link Jwk} containing the private key to be wrapped. */
|
|
67
|
+
unwrappedKey: Jwk;
|
|
68
|
+
|
|
69
|
+
/** An object defining the algorithm-specific parameters for encrypting the `unwrappedKey`. */
|
|
70
|
+
encryptParams?: unknown
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface KmsDeleteKeyParams {
|
|
74
|
+
/** Identifier for the key to be deleted in the KMS. */
|
|
75
|
+
keyUri: KeyIdentifier;
|
|
76
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Cipher, KeyWrapper } from '@enbox/crypto';
|
|
2
|
+
|
|
3
|
+
import type { KeyExporter, KeyImporter } from './types/key-io.js';
|
|
4
|
+
|
|
5
|
+
export function isCipher<EncryptInput, DecryptInput>(
|
|
6
|
+
obj: unknown
|
|
7
|
+
): obj is Cipher<EncryptInput, DecryptInput> {
|
|
8
|
+
return (
|
|
9
|
+
obj !== null && typeof obj === 'object'
|
|
10
|
+
&& 'encrypt' in obj && typeof obj.encrypt === 'function'
|
|
11
|
+
&& 'decrypt' in obj && typeof obj.decrypt === 'function'
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function isKeyExporter<ExportKeyInput, ExportKeyOutput>(
|
|
16
|
+
obj: unknown
|
|
17
|
+
): obj is KeyExporter<ExportKeyInput, ExportKeyOutput> {
|
|
18
|
+
return (
|
|
19
|
+
obj !== null && typeof obj === 'object'
|
|
20
|
+
&& 'exportKey' in obj && typeof obj.exportKey === 'function'
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function isKeyImporter<ImportKeyInput, ImportKeyExport>(
|
|
25
|
+
obj: unknown
|
|
26
|
+
): obj is KeyImporter<ImportKeyInput, ImportKeyExport> {
|
|
27
|
+
return (
|
|
28
|
+
obj !== null && typeof obj === 'object'
|
|
29
|
+
&& 'importKey' in obj && typeof obj.importKey === 'function'
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function isKeyWrapper<WrapKeyInput, UnwrapKeyInput>(
|
|
34
|
+
obj: unknown
|
|
35
|
+
): obj is KeyWrapper<WrapKeyInput, UnwrapKeyInput> {
|
|
36
|
+
return (
|
|
37
|
+
obj !== null && typeof obj === 'object'
|
|
38
|
+
&& 'wrapKey' in obj && typeof obj.wrapKey === 'function'
|
|
39
|
+
&& 'unwrapKey' in obj && typeof obj.unwrapKey === 'function'
|
|
40
|
+
);
|
|
41
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { DidResolverCache, DidResolutionResult } from '@enbox/dids';
|
|
2
|
+
|
|
3
|
+
import ms from 'ms';
|
|
4
|
+
import { TtlCache } from '@enbox/common';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Configuration parameters for creating an in-memory cache for DID resolution results.
|
|
8
|
+
*
|
|
9
|
+
* Allows customization of the cache time-to-live (TTL) setting.
|
|
10
|
+
*/
|
|
11
|
+
export type DidResolverCacheMemoryParams = {
|
|
12
|
+
/**
|
|
13
|
+
* Optional. The time-to-live for cache entries, expressed as a string (e.g., '1h', '15m').
|
|
14
|
+
* Determines how long a cache entry should remain valid before being considered expired.
|
|
15
|
+
*
|
|
16
|
+
* Defaults to '15m' if not specified.
|
|
17
|
+
*/
|
|
18
|
+
ttl?: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export class DidResolverCacheMemory implements DidResolverCache {
|
|
22
|
+
private cache: TtlCache<string, DidResolutionResult>;
|
|
23
|
+
|
|
24
|
+
constructor({ ttl = '15m' }: DidResolverCacheMemoryParams = {}) {
|
|
25
|
+
this.cache = new TtlCache({ ttl: ms(ttl) });
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Retrieves a DID resolution result from the cache.
|
|
30
|
+
*
|
|
31
|
+
* If the cached item has exceeded its TTL, it's scheduled for deletion and undefined is returned.
|
|
32
|
+
*
|
|
33
|
+
* @param didUri - The DID string used as the key for retrieving the cached result.
|
|
34
|
+
* @returns The cached DID resolution result or undefined if not found or expired.
|
|
35
|
+
*/
|
|
36
|
+
public async get(didUri: string): Promise<DidResolutionResult | void> {
|
|
37
|
+
if (!didUri) {
|
|
38
|
+
throw new Error('Key cannot be null or undefined');
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return this.cache.get(didUri);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Stores a DID resolution result in the cache with a TTL.
|
|
46
|
+
*
|
|
47
|
+
* @param didUri - The DID string used as the key for storing the result.
|
|
48
|
+
* @param resolutionResult - The DID resolution result to be cached.
|
|
49
|
+
* @returns A promise that resolves when the operation is complete.
|
|
50
|
+
*/
|
|
51
|
+
public async set(didUri: string, resolutionResult: DidResolutionResult): Promise<void> {
|
|
52
|
+
this.cache.set(didUri, resolutionResult);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Deletes a DID resolution result from the cache.
|
|
57
|
+
*
|
|
58
|
+
* @param didUri - The DID string used as the key for deletion.
|
|
59
|
+
* @returns A promise that resolves when the operation is complete.
|
|
60
|
+
*/
|
|
61
|
+
public async delete(didUri: string): Promise<void> {
|
|
62
|
+
this.cache.delete(didUri);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Clears all entries from the cache.
|
|
67
|
+
*
|
|
68
|
+
* @returns A promise that resolves when the operation is complete.
|
|
69
|
+
*/
|
|
70
|
+
public async clear(): Promise<void> {
|
|
71
|
+
this.cache.clear();
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* This method is a no-op but exists to be consistent with other DID Resolver Cache
|
|
76
|
+
* implementations.
|
|
77
|
+
*
|
|
78
|
+
* @returns A promise that resolves immediately.
|
|
79
|
+
*/
|
|
80
|
+
public async close(): Promise<void> {
|
|
81
|
+
// No-op since there is no underlying store to close.
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PortableDid } from '@enbox/dids';
|
|
2
|
+
|
|
3
|
+
export function isPortableDid(obj: unknown): obj is PortableDid {
|
|
4
|
+
// Validate that the given value is an object that has the necessary properties of PortableDid.
|
|
5
|
+
return !(!obj || typeof obj !== 'object' || obj === null)
|
|
6
|
+
&& 'uri' in obj
|
|
7
|
+
&& 'document' in obj
|
|
8
|
+
&& 'metadata' in obj
|
|
9
|
+
&& (!('keyManager' in obj) || obj.keyManager === undefined);
|
|
10
|
+
}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { CryptoUtils } from '@enbox/crypto';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import type { DwnRpc, DwnRpcRequest, DwnRpcResponse } from './prototyping/clients/dwn-rpc-types.js';
|
|
5
|
+
import type { DwnServerInfoRpc, ServerInfo } from './prototyping/clients/server-info-types.js';
|
|
6
|
+
import type { JsonRpcResponse } from './prototyping/clients/json-rpc.js';
|
|
7
|
+
|
|
8
|
+
import { createJsonRpcRequest } from './prototyping/clients/json-rpc.js';
|
|
9
|
+
import { HttpDwnRpcClient } from './prototyping/clients/http-dwn-rpc-client.js';
|
|
10
|
+
import { WebSocketDwnRpcClient } from './prototyping/clients/web-socket-clients.js';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Interface that can be implemented to communicate with {@link Web5Agent | Web5 Agent}
|
|
14
|
+
* implementations via JSON-RPC.
|
|
15
|
+
*/
|
|
16
|
+
export interface DidRpc {
|
|
17
|
+
get transportProtocols(): string[]
|
|
18
|
+
sendDidRequest(request: DidRpcRequest): Promise<DidRpcResponse>
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export enum DidRpcMethod {
|
|
22
|
+
Create = 'did.create',
|
|
23
|
+
Resolve = 'did.resolve'
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export type DidRpcRequest = {
|
|
27
|
+
data: string;
|
|
28
|
+
method: DidRpcMethod;
|
|
29
|
+
url: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export type DidRpcResponse = {
|
|
33
|
+
data?: string;
|
|
34
|
+
ok: boolean;
|
|
35
|
+
status: RpcStatus;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export type RpcStatus = {
|
|
39
|
+
code: number;
|
|
40
|
+
message: string;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export interface Web5Rpc extends DwnRpc, DidRpc, DwnServerInfoRpc {}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Client used to communicate with Dwn Servers
|
|
47
|
+
*/
|
|
48
|
+
export class Web5RpcClient implements Web5Rpc {
|
|
49
|
+
private transportClients: Map<string, Web5Rpc>;
|
|
50
|
+
|
|
51
|
+
constructor(clients: Web5Rpc[] = []) {
|
|
52
|
+
this.transportClients = new Map();
|
|
53
|
+
|
|
54
|
+
// include http and socket clients as default.
|
|
55
|
+
// can be overwritten for 'http:', 'https:', 'ws: or ':wss' if instantiated with other clients.
|
|
56
|
+
clients = [new HttpWeb5RpcClient(), new WebSocketWeb5RpcClient(), ...clients];
|
|
57
|
+
|
|
58
|
+
for (let client of clients) {
|
|
59
|
+
for (let transportScheme of client.transportProtocols) {
|
|
60
|
+
this.transportClients.set(transportScheme, client);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
get transportProtocols(): string[] {
|
|
66
|
+
return Array.from(this.transportClients.keys());
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
async sendDidRequest(request: DidRpcRequest): Promise<DidRpcResponse> {
|
|
70
|
+
// URL() will throw if provided `url` is invalid.
|
|
71
|
+
const url = new URL(request.url);
|
|
72
|
+
|
|
73
|
+
const transportClient = this.transportClients.get(url.protocol);
|
|
74
|
+
if (!transportClient) {
|
|
75
|
+
const error = new Error(`no ${url.protocol} transport client available`);
|
|
76
|
+
error.name = 'NO_TRANSPORT_CLIENT';
|
|
77
|
+
|
|
78
|
+
throw error;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return transportClient.sendDidRequest(request);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
sendDwnRequest(request: DwnRpcRequest): Promise<DwnRpcResponse> {
|
|
85
|
+
// will throw if url is invalid
|
|
86
|
+
const url = new URL(request.dwnUrl);
|
|
87
|
+
|
|
88
|
+
const transportClient = this.transportClients.get(url.protocol);
|
|
89
|
+
if (!transportClient) {
|
|
90
|
+
const error = new Error(`no ${url.protocol} transport client available`);
|
|
91
|
+
error.name = 'NO_TRANSPORT_CLIENT';
|
|
92
|
+
|
|
93
|
+
throw error;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return transportClient.sendDwnRequest(request);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
async getServerInfo(dwnUrl: string): Promise<ServerInfo> {
|
|
100
|
+
// will throw if url is invalid
|
|
101
|
+
const url = new URL(dwnUrl);
|
|
102
|
+
|
|
103
|
+
const transportClient = this.transportClients.get(url.protocol);
|
|
104
|
+
if(!transportClient) {
|
|
105
|
+
const error = new Error(`no ${url.protocol} transport client available`);
|
|
106
|
+
error.name = 'NO_TRANSPORT_CLIENT';
|
|
107
|
+
|
|
108
|
+
throw error;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return transportClient.getServerInfo(dwnUrl);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export class HttpWeb5RpcClient extends HttpDwnRpcClient implements Web5Rpc {
|
|
116
|
+
async sendDidRequest(request: DidRpcRequest): Promise<DidRpcResponse> {
|
|
117
|
+
const requestId = CryptoUtils.randomUuid();
|
|
118
|
+
const jsonRpcRequest = createJsonRpcRequest(requestId, request.method, {
|
|
119
|
+
data: request.data
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
const httpRequest = new Request(request.url, {
|
|
123
|
+
method : 'POST',
|
|
124
|
+
headers : {
|
|
125
|
+
'Content-Type': 'application/json',
|
|
126
|
+
},
|
|
127
|
+
body: JSON.stringify(jsonRpcRequest),
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
let jsonRpcResponse: JsonRpcResponse;
|
|
131
|
+
|
|
132
|
+
try {
|
|
133
|
+
const response = await fetch(httpRequest);
|
|
134
|
+
|
|
135
|
+
if (response.ok) {
|
|
136
|
+
jsonRpcResponse = await response.json();
|
|
137
|
+
|
|
138
|
+
// If the response is an error, throw an error.
|
|
139
|
+
if (jsonRpcResponse.error) {
|
|
140
|
+
const { code, message } = jsonRpcResponse.error;
|
|
141
|
+
throw new Error(`JSON RPC (${code}) - ${message}`);
|
|
142
|
+
}
|
|
143
|
+
} else {
|
|
144
|
+
throw new Error(`HTTP (${response.status}) - ${response.statusText}`);
|
|
145
|
+
}
|
|
146
|
+
} catch (error: any) {
|
|
147
|
+
throw new Error(`Error encountered while processing response from ${request.url}: ${error.message}`);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
return jsonRpcResponse.result as DidRpcResponse;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export class WebSocketWeb5RpcClient extends WebSocketDwnRpcClient implements Web5Rpc {
|
|
155
|
+
async sendDidRequest(_request: DidRpcRequest): Promise<DidRpcResponse> {
|
|
156
|
+
throw new Error(`not implemented for transports [${this.transportProtocols.join(', ')}]`);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
async getServerInfo(_dwnUrl: string): Promise<ServerInfo> {
|
|
160
|
+
throw new Error(`not implemented for transports [${this.transportProtocols.join(', ')}]`);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { ProtocolDefinition } from '@enbox/dwn-sdk-js';
|
|
2
|
+
|
|
3
|
+
export const IdentityProtocolDefinition: ProtocolDefinition = {
|
|
4
|
+
protocol : 'http://identity.foundation/protocols/web5/identity-store',
|
|
5
|
+
published : false,
|
|
6
|
+
types : {
|
|
7
|
+
portableDid: {
|
|
8
|
+
schema : 'https://identity.foundation/schemas/web5/portable-did',
|
|
9
|
+
dataFormats : [
|
|
10
|
+
'application/json'
|
|
11
|
+
]
|
|
12
|
+
},
|
|
13
|
+
identityMetadata: {
|
|
14
|
+
schema : 'https://identity.foundation/schemas/web5/identity-metadata',
|
|
15
|
+
dataFormats : [
|
|
16
|
+
'application/json'
|
|
17
|
+
]
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
structure: {
|
|
21
|
+
portableDid : {},
|
|
22
|
+
identityMetadata : {}
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const JwkProtocolDefinition: ProtocolDefinition = {
|
|
27
|
+
protocol : 'http://identity.foundation/protocols/web5/jwk-store',
|
|
28
|
+
published : false,
|
|
29
|
+
types : {
|
|
30
|
+
privateJwk: {
|
|
31
|
+
schema : 'https://identity.foundation/schemas/web5/private-jwk',
|
|
32
|
+
dataFormats : [
|
|
33
|
+
'application/json'
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
structure: {
|
|
38
|
+
privateJwk: {}
|
|
39
|
+
}
|
|
40
|
+
};
|