diff --git a/CHANGELOG.md b/CHANGELOG.md index 295f099..7777d1c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,22 @@ # bedrock-profile ChangeLog +## 10.0.0 - 2021-04-TBD + +### Changed +- **BREAKING**: Supports `ed25519-2020` signature suite and verification keys. +- **BREAKING**: Remove `referenceId: 'primary'`. ReferenceId will no longer be set. +- Update deps. + - **BREAKING**: Uses [@digitalbazaar/did-method-key@1.0](https://github.com/digitalbazaar/did-method-key-js/blob/master/CHANGELOG.md). + - `did-method-key` has been renamed to `@digitalbazaar/did-method-key` and uses `crypto-ld@5.0` based key suites. + - **BREAKING**: Renamed `ocapld` to [@digitalbazaar/zcapld@4.0](https://github.com/digitalbazaar/zcapld/blob/main/CHANGELOG.md). + - fetchInSecurityContext API uses the new zcap-context. + - **BREAKING**: Uses [@digitalbazaar/webkms-client@6.0](https://github.com/digitalbazaar/webkms-client/blob/main/CHANGELOG.md). + - Uses new `webkms-context@1.0`, `aes-key-wrapping-2019-context@1.0.3` and `sha256-hmac-key-2019-context@1.0.3` libs. + - **BREAKING**: Uses [did-veres-one@14.0.0-beta.0](https://github.com/veres-one/did-veres-one/blob/v14.x/CHANGELOG.md). + - Uses [crypto-ld@6.0.0](https://github.com/digitalbazaar/crypto-ld/blob/master/CHANGELOG.md). + - Uses [edv-client@9.0.0](https://github.com/digitalbazaar/edv-client/blob/master/CHANGELOG.md). +- Update test deps and peerDeps. + ## 9.0.1 - 2021-04-14 ### Fixed diff --git a/LICENSE.md b/LICENSE.md index a86e2f8..91c3522 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,7 +1,7 @@ Bedrock Non-Commercial License v1.0 =================================== -Copyright (c) 2011-2020 Digital Bazaar, Inc. +Copyright (c) 2011-2021 Digital Bazaar, Inc. All rights reserved. Summary diff --git a/lib/config.js b/lib/config.js index d7071fd..85c0e8c 100644 --- a/lib/config.js +++ b/lib/config.js @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Digital Bazaar, Inc. All rights reserved. + * Copyright (c) 2020-2021 Digital Bazaar, Inc. All rights reserved. */ 'use strict'; diff --git a/lib/documentLoader.js b/lib/documentLoader.js new file mode 100644 index 0000000..1084652 --- /dev/null +++ b/lib/documentLoader.js @@ -0,0 +1,22 @@ +/*! + * Copyright (c) 2020-2021 Digital Bazaar, Inc. All rights reserved. + */ +'use strict'; + +const {didIo} = require('bedrock-did-io'); +const {documentLoader} = require('bedrock-jsonld-document-loader'); + +module.exports = async url => { + let document; + if(url.startsWith('did:')) { + document = await didIo.get({did: url}); + return { + contextUrl: null, + documentUrl: url, + document + }; + } + + // finally, try the bedrock document loader + return documentLoader(url); +}; diff --git a/lib/index.js b/lib/index.js index 38f3022..07c2d95 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1,5 +1,5 @@ /*! - * Copyright (c) 2020 Digital Bazaar, Inc. All rights reserved. + * Copyright (c) 2020-2021 Digital Bazaar, Inc. All rights reserved. */ 'use strict'; diff --git a/lib/kms.js b/lib/kms.js index 6130209..c963f25 100644 --- a/lib/kms.js +++ b/lib/kms.js @@ -1,5 +1,5 @@ /*! - * Copyright (c) 2020 Digital Bazaar, Inc. All rights reserved. + * Copyright (c) 2020-2021 Digital Bazaar, Inc. All rights reserved. */ 'use strict'; @@ -12,7 +12,7 @@ const { KeystoreAgent, KeyAgreementKey, KmsClient -} = require('webkms-client'); +} = require('@digitalbazaar/webkms-client'); const {util: {clone, BedrockError}} = bedrock; exports.createKeystore = async ({ @@ -74,11 +74,11 @@ exports.generateKey = async ( } else if(type === 'kek' || type === 'AesKeyWrappingKey2019') { type = 'AesKeyWrappingKey2019'; Class = Kek; - } else if(type === 'Ed25519VerificationKey2018') { - type = 'Ed25519VerificationKey2018'; + } else if(type === 'Ed25519VerificationKey2020') { + type = 'Ed25519VerificationKey2020'; Class = AsymmetricKey; - } else if(type === 'keyAgreement' || type === 'X25519KeyAgreementKey2019') { - type = 'X25519KeyAgreementKey2019'; + } else if(type === 'keyAgreement' || type === 'X25519KeyAgreementKey2020') { + type = 'X25519KeyAgreementKey2020'; Class = KeyAgreementKey; } else { throw new Error(`Unknown key type "${type}".`); diff --git a/lib/logger.js b/lib/logger.js index 1262a78..7caf242 100644 --- a/lib/logger.js +++ b/lib/logger.js @@ -1,5 +1,5 @@ /*! - * Copyright (c) 2020 Digital Bazaar, Inc. All rights reserved. + * Copyright (c) 2020-2021 Digital Bazaar, Inc. All rights reserved. */ 'use strict'; diff --git a/lib/profileAgents.js b/lib/profileAgents.js index e5393c5..9659019 100644 --- a/lib/profileAgents.js +++ b/lib/profileAgents.js @@ -1,5 +1,5 @@ /*! - * Copyright (c) 2020 Digital Bazaar, Inc. All rights reserved. + * Copyright (c) 2020-2021 Digital Bazaar, Inc. All rights reserved. */ 'use strict'; @@ -7,7 +7,7 @@ const assert = require('assert-plus'); const base64url = require('base64url-universal'); const bedrock = require('bedrock'); const crypto = require('crypto'); -const {CapabilityAgent} = require('webkms-client'); +const {CapabilityAgent} = require('@digitalbazaar/webkms-client'); const database = require('bedrock-mongodb'); const {promisify} = require('util'); const kms = require('./kms'); @@ -92,7 +92,11 @@ exports.create = async ({ const handle = 'primary'; // 2. Generate capability agent to represent controller of profile agent // (and its zcap key) - const controller = await CapabilityAgent.fromSecret({handle, secret}); + const controller = await CapabilityAgent.fromSecret({ + handle, + keyType: 'Ed25519VerificationKey2020', + secret, + }); // 3. Create keystore in order to create the zCap key for the profile agent. // This keystore must be in the private KMS because it is accessed by a // capabilityAgent that is generated from a secret that is stored in the @@ -104,13 +108,12 @@ exports.create = async ({ const keystore = await kms.createKeystore({ capabilityAgent: controller, kmsBaseUrl: privateKmsBaseUrl, - referenceId: 'primary' }); // 4. Create the zCap key for the profile agent const keystoreAgent = kms.getKeystoreAgent( {capabilityAgent: controller, keystore}); const key = await keystoreAgent.generateKey( - {type: 'Ed25519VerificationKey2018', kmsModule: KMS_MODULE}); + {type: 'Ed25519VerificationKey2020', kmsModule: KMS_MODULE}); // 5. Use the zCap key to create the DID for the profile agent key.id = await utils.computeKeyId({key, didMethod: 'key'}); // 6. Generate profile agent's CapabilityAgent instance @@ -122,7 +125,6 @@ exports.create = async ({ const paKeystore = await kms.createKeystore({ capabilityAgent, kmsBaseUrl: publicKmsBaseUrl, - referenceId: 'primary' }); const profileAgent = { id: capabilityAgent.id, @@ -411,7 +413,11 @@ exports.delegateCapabilityInvocationKey = async ({ } = profileAgent; const {seed} = secrets; const controller = - await CapabilityAgent.fromSecret({handle: 'primary', secret: seed}); + await CapabilityAgent.fromSecret({ + handle: 'primary', + secret: seed, + keyType: 'Ed25519VerificationKey2020', + }); const keystore = await kms.getKeystore({id: keystoreId}); const keystoreAgent = kms.getKeystoreAgent( @@ -426,7 +432,7 @@ exports.delegateCapabilityInvocationKey = async ({ invocationTarget: { id: capabilityInvocationKey.kmsId, type: capabilityInvocationKey.type, - verificationMethod: key.id + publicAlias: key.id }, expires }; @@ -450,7 +456,11 @@ exports.getAgents = async ({profileAgent, secrets} = {}) => { } = profileAgent; const {seed} = secrets; const controller = - await CapabilityAgent.fromSecret({handle: 'primary', secret: seed}); + await CapabilityAgent.fromSecret({ + handle: 'primary', + secret: seed, + keyType: 'Ed25519VerificationKey2020' + }); const keystore = await kms.getKeystore({id: keystoreId}); const keystoreAgent = kms.getKeystoreAgent( {capabilityAgent: controller, keystore}); @@ -490,7 +500,11 @@ exports.getSigner = async ({profileAgentRecord}) => { capabilityInvocationKey } = profileAgent; const controller = - await CapabilityAgent.fromSecret({handle: 'primary', secret: seed}); + await CapabilityAgent.fromSecret({ + handle: 'primary', + secret: seed, + keyType: 'Ed25519VerificationKey2020' + }); const keystore = await kms.getKeystore({id: keystoreId}); const keystoreAgent = kms.getKeystoreAgent( diff --git a/lib/profiles.js b/lib/profiles.js index 4154248..60807ae 100644 --- a/lib/profiles.js +++ b/lib/profiles.js @@ -1,5 +1,5 @@ /*! - * Copyright (c) 2020 Digital Bazaar, Inc. All rights reserved. + * Copyright (c) 2020-2021 Digital Bazaar, Inc. All rights reserved. */ 'use strict'; @@ -52,12 +52,11 @@ module.exports.create = async ({ const profileKeystore = await kms.createKeystore({ capabilityAgent: paZcapAgent, kmsBaseUrl: publicKmsBaseUrl, - referenceId: 'primary', }); const profileKeystoreAgent = kms.getKeystoreAgent( {capabilityAgent: paZcapAgent, keystore: profileKeystore}); const key = await profileKeystoreAgent.generateKey( - {type: 'Ed25519VerificationKey2018', kmsModule: KMS_MODULE}); + {type: 'Ed25519VerificationKey2020', kmsModule: KMS_MODULE}); // 2. Use the ProfileZcapKey to generate the Profile DID key.id = await utils.computeKeyId({key, didMethod, didOptions}); // 3. Delegate a capability from the Profile DID to the ProfileAgent to @@ -70,9 +69,9 @@ module.exports.create = async ({ controller: paZcapAgent.id, invocationTarget: { id: (await key.getKeyDescription()).id, - type: 'Ed25519VerificationKey2018', + type: 'Ed25519VerificationKey2020', proofPurpose: 'capabilityInvocation', - verificationMethod: key.id + publicAlias: key.id } }; const zcap = await delegateCapability( @@ -84,6 +83,7 @@ module.exports.create = async ({ // DID#KEY_IDENTIFIER const profileDid = key.id.split('#')[0]; profileKeystore.controller = profileDid; + await kms.updateKeystoreConfig({ keystoreAgent: profileKeystoreAgent, keystoreConfig: profileKeystore, diff --git a/lib/utils.js b/lib/utils.js index 05b6101..9f3b456 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -1,12 +1,20 @@ /*! - * Copyright (c) 2020 Digital Bazaar, Inc. All rights reserved. + * Copyright (c) 2020-2021 Digital Bazaar, Inc. All rights reserved. */ 'use strict'; const database = require('bedrock-mongodb'); -const {LDKeyPair} = require('crypto-ld'); +const {CryptoLD} = require('crypto-ld'); const v1 = require('did-veres-one'); -const didKey = require('did-method-key'); +const didKey = require('@digitalbazaar/did-method-key'); +const {Ed25519VerificationKey2018} = + require('@digitalbazaar/ed25519-verification-key-2018'); +const {Ed25519VerificationKey2020} = + require('@digitalbazaar/ed25519-verification-key-2020'); + +const cryptoLd = new CryptoLD(); +cryptoLd.use(Ed25519VerificationKey2018); +cryptoLd.use(Ed25519VerificationKey2020); exports.getCollection = collectionName => database.collections[collectionName]; @@ -25,18 +33,18 @@ exports.computeKeyId = async ({ key, didMethod = 'key', didOptions = {}} = {}) => { // the keyDescription is required to get publicKeyBase58 const keyDescription = await key.getKeyDescription(); - const publicKey = await LDKeyPair.from(keyDescription); + const publicKey = await cryptoLd.from(keyDescription); let driver; let keyId; if(didMethod === 'key') { driver = didKey.driver(); - keyId = await driver.computeKeyId({key: publicKey}); + keyId = await driver.computeId({keyPair: publicKey}); } else if(didMethod === 'v1') { // For v1 dids, mode is set to test or live. const mode = didOptions.mode || 'live'; driver = v1.driver({mode}); - keyId = await driver.computeKeyId({ + keyId = await driver.computeId({ key: publicKey, didType: 'nym', mode }); } else { diff --git a/lib/zcaps.js b/lib/zcaps.js index d49099f..f954c31 100644 --- a/lib/zcaps.js +++ b/lib/zcaps.js @@ -1,18 +1,22 @@ /*! - * Copyright (c) 2020 Digital Bazaar, Inc. All rights reserved. + * Copyright (c) 2020-2021 Digital Bazaar, Inc. All rights reserved. */ 'use strict'; -const {CapabilityDelegation} = require('ocapld'); +const documentLoader = require('./documentLoader'); +const {CapabilityDelegation, constants: {ZCAP_CONTEXT_URL}} = + require('@digitalbazaar/zcapld'); const {EdvClient} = require('edv-client'); -const jsigs = require('jsonld-signatures'); +const {Ed25519Signature2018} = require('@digitalbazaar/ed25519-signature-2018'); +const {Ed25519Signature2020} = require('@digitalbazaar/ed25519-signature-2020'); +const {sign} = require('jsonld-signatures'); -const {SECURITY_CONTEXT_V2_URL, sign, suites} = jsigs; -const {Ed25519Signature2018} = suites; const SUPPORTED_KEY_TYPES = [ 'Ed25519VerificationKey2018', + 'Ed25519VerificationKey2020', 'Sha256HmacKey2019', - 'X25519KeyAgreementKey2019' + 'X25519KeyAgreementKey2019', + 'X25519KeyAgreementKey2020' ]; exports.delegateCapability = async ( @@ -27,8 +31,14 @@ exports.delegateCapability = async ( '"invocationTarget" must be an object that includes a "type".'); } // TODO: Look into requiring an invoker or controller on a zcap + let contextUrl; + if(signer.type === 'Ed25519VerificationKey2018') { + contextUrl = [ZCAP_CONTEXT_URL, Ed25519Signature2018.CONTEXT_URL]; + } else if(signer.type === 'Ed25519VerificationKey2020') { + contextUrl = [ZCAP_CONTEXT_URL, Ed25519Signature2020.CONTEXT_URL]; + } let zcap = { - '@context': SECURITY_CONTEXT_V2_URL, + '@context': contextUrl, // use 128-bit random multibase encoded value id: await exports.id() }; @@ -54,21 +64,21 @@ exports.delegateCapability = async ( zcap.expires = expires; } let {parentCapability} = request; - const {id: target, type: targetType, verificationMethod} = invocationTarget; + const {id: target, type: targetType, publicAlias} = invocationTarget; if(SUPPORTED_KEY_TYPES.includes(targetType)) { if(!target) { throw new TypeError( '"invocationTarget.id" must be set for Web KMS capabilities.'); } - if(!verificationMethod) { - throw new TypeError('"invocationTarget.verificationMethod" is required.'); + if(!publicAlias) { + throw new TypeError('"invocationTarget.publicAlias" is required.'); } // TODO: fetch `target` from a key mapping document in the profile's // edv to get public key ID to set as `referenceId` zcap.invocationTarget = { id: target, type: targetType, - verificationMethod, + publicAlias, }; zcap.parentCapability = parentCapability || target; zcap = await exports.delegate({zcap, signer}); @@ -184,16 +194,22 @@ exports.id = async () => `urn:zcap:${await EdvClient.generateId()}`; exports.delegate = async ({zcap, signer, capabilityChain}) => { capabilityChain = Array.isArray(capabilityChain) ? capabilityChain : [zcap.parentCapability]; + let suite; + if(signer.type === 'Ed25519VerificationKey2018') { + suite = new Ed25519Signature2018({ + signer, + }); + } else if(signer.type === 'Ed25519VerificationKey2020') { + suite = new Ed25519Signature2020({ + signer, + }); + } // attach capability delegation proof return sign(zcap, { - // TODO: map `signer.type` to signature suite - suite: new Ed25519Signature2018({ - signer, - verificationMethod: signer.id - }), + suite, purpose: new CapabilityDelegation({ capabilityChain }), - compactProof: false + documentLoader }); }; diff --git a/package.json b/package.json index ce2666a..65b61ec 100644 --- a/package.json +++ b/package.json @@ -23,21 +23,27 @@ }, "homepage": "https://github.com/digitalbazaar/bedrock-profile", "dependencies": { + "@digitalbazaar/did-method-key": "^1.0.0", + "@digitalbazaar/ed25519-signature-2018": "^2.0.1", + "@digitalbazaar/ed25519-signature-2020": "^2.1.0", + "@digitalbazaar/ed25519-verification-key-2018": "^3.1.1", + "@digitalbazaar/ed25519-verification-key-2020": "^2.1.1", + "@digitalbazaar/webkms-client": "^6.0.0", + "@digitalbazaar/zcapld": "^4.0.0", "assert-plus": "^1.0.0", "base64url-universal": "^1.1.0", - "crypto-ld": "^3.7.0", - "did-method-key": "^0.7.0", - "did-veres-one": "^12.1.1", - "edv-client": "^6.0.1", - "jsonld-signatures": "^5.1.0", - "ocapld": "^2.0.0", - "webkms-client": "^3.0.0" + "crypto-ld": "^6.0.0", + "did-veres-one": "14.0.0-beta.0", + "edv-client": "^9.0.0", + "jsonld-signatures": "^9.0.2" }, "peerDependencies": { "bedrock": "^4.1.1", - "bedrock-edv-storage": "^4.1.1", + "bedrock-did-io": "^2.0.0", + "bedrock-edv-storage": "^9.0.0", "bedrock-https-agent": "^2.0.0", - "bedrock-mongodb": "^8.0.0" + "bedrock-jsonld-document-loader": "^1.0.1", + "bedrock-mongodb": "^8.2.0" }, "directories": { "lib": "./lib" diff --git a/test/mocha/10-profile-agents.js b/test/mocha/10-profile-agents.js index 8fde82a..005e455 100644 --- a/test/mocha/10-profile-agents.js +++ b/test/mocha/10-profile-agents.js @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Digital Bazaar, Inc. All rights reserved. + * Copyright (c) 2020-2021 Digital Bazaar, Inc. All rights reserved. */ 'use strict'; diff --git a/test/mocha/12-profile-agents-get-by-token.js b/test/mocha/12-profile-agents-get-by-token.js index e7a6635..7c1f16e 100644 --- a/test/mocha/12-profile-agents-get-by-token.js +++ b/test/mocha/12-profile-agents-get-by-token.js @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Digital Bazaar, Inc. All rights reserved. + * Copyright (c) 2020-2021 Digital Bazaar, Inc. All rights reserved. */ 'use strict'; diff --git a/test/mocha/20-profiles.js b/test/mocha/20-profiles.js index 3a32088..1a59b22 100644 --- a/test/mocha/20-profiles.js +++ b/test/mocha/20-profiles.js @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Digital Bazaar, Inc. All rights reserved. + * Copyright (c) 2020-2021 Digital Bazaar, Inc. All rights reserved. */ 'use strict'; @@ -43,6 +43,7 @@ describe('profiles API', () => { assertNoError(error); should.exist(profile); profile.id.should.be.a('string'); + profile.id.startsWith('did:v1:').should.equal(true); const agents = await profileAgentCollection.find({ 'profileAgent.profile': profile.id, }).toArray(); @@ -80,9 +81,7 @@ describe('profiles API', () => { agents.should.have.length(1); const [a] = agents; a.should.have.keys(['_id', 'id', 'controller', 'meta', 'config']); - a.config.should.have.keys([ - 'id', 'sequence', 'controller', 'referenceId' - ]); + a.config.should.have.keys(['id', 'sequence', 'controller']); a.config.controller.should.equal(profile.id); }); it('should throw error if didMethod is not `key` or `v1`', async () => { diff --git a/test/mocha/helpers.js b/test/mocha/helpers.js index e2e2cad..6fa78b9 100644 --- a/test/mocha/helpers.js +++ b/test/mocha/helpers.js @@ -1,5 +1,5 @@ /*! - * Copyright (c) 2020 Digital Bazaar, Inc. All rights reserved. + * Copyright (c) 2020-2021 Digital Bazaar, Inc. All rights reserved. */ 'use strict'; diff --git a/test/mocha/mock.data.js b/test/mocha/mock.data.js index d40dccc..42621e1 100644 --- a/test/mocha/mock.data.js +++ b/test/mocha/mock.data.js @@ -1,11 +1,12 @@ /*! - * Copyright (c) 2020 Digital Bazaar, Inc. All rights reserved. + * Copyright (c) 2020-2021 Digital Bazaar, Inc. All rights reserved. */ /* jshint node: true */ 'use strict'; const {util: {uuid}} = require('bedrock'); +const {constants: {ZCAP_CONTEXT_URL}} = require('@digitalbazaar/zcapld'); const data = {}; module.exports = data; @@ -32,7 +33,7 @@ function createAccount(email) { } const zcap0 = { - '@context': 'https://w3id.org/security/v2', + '@context': ZCAP_CONTEXT_URL, id: 'urn:zcap:z19vWhR8EsNbWqvazp5bg6BTu', controller: 'did:key:z6Mkkt1BWYLPAAXwYBwyVHAZkL94tgT8QbQv2SUxeW1U3DaG', // eslint-disable-next-line max-len @@ -41,14 +42,14 @@ const zcap0 = { invocationTarget: { // eslint-disable-next-line max-len id: 'https://bedrock.localhost:18443/kms/keystores/z1AAWWM7Zd4YyyV3NfaCqFuzQ/keys/z19wxodgv1UhrToQMvSxGhQG6', - type: 'Ed25519VerificationKey2018', + type: 'Ed25519VerificationKey2020', // eslint-disable-next-line max-len - verificationMethod: 'did:key:z6MkkrtV7wnBpXKBtiZjxaSghCo8ttb5kZUJTk8bEwTTTYvg#z6MkkrtV7wnBpXKBtiZjxaSghCo8ttb5kZUJTk8bEwTTTYvg' + publicAlias: 'did:key:z6MkkrtV7wnBpXKBtiZjxaSghCo8ttb5kZUJTk8bEwTTTYvg#z6MkkrtV7wnBpXKBtiZjxaSghCo8ttb5kZUJTk8bEwTTTYvg' }, // eslint-disable-next-line max-len parentCapability: 'https://bedrock.localhost:18443/kms/keystores/z1AAWWM7Zd4YyyV3NfaCqFuzQ/keys/z19wxodgv1UhrToQMvSxGhQG6', proof: { - type: 'Ed25519Signature2018', + type: 'Ed25519Signature2020', created: '2020-02-27T21:22:48Z', // eslint-disable-next-line max-len verificationMethod: 'did:key:z6MkkrtV7wnBpXKBtiZjxaSghCo8ttb5kZUJTk8bEwTTTYvg#z6MkkrtV7wnBpXKBtiZjxaSghCo8ttb5kZUJTk8bEwTTTYvg', @@ -57,13 +58,13 @@ const zcap0 = { // eslint-disable-next-line max-len 'https://bedrock.localhost:18443/kms/keystores/z1AAWWM7Zd4YyyV3NfaCqFuzQ/keys/z19wxodgv1UhrToQMvSxGhQG6' ], - // eslint-disable-next-line max-len - jws: 'eyJhbGciOiJFZERTQSIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..bWt6_Q65omg8rE44a_1dzWFGcFQbUrVqZ_hnAqIKlWSQ1HpTSV6OyhAQfBlVhPCsrVplqC8oVEJmp4UWqy6gCw' + // a valid signature is not required for the test + proofValue: 'zMOCK_PROOF' } }; const zcap1 = { - '@context': 'https://w3id.org/security/v2', + '@context': ZCAP_CONTEXT_URL, id: 'urn:zcap:z1ACgNxti98PXBjtw7ogfsN45', controller: 'did:key:z6Mkkt1BWYLPAAXwYBwyVHAZkL94tgT8QbQv2SUxeW1U3DaG', referenceId: 'bedrock.localhost:users', @@ -78,7 +79,7 @@ const zcap1 = { // eslint-disable-next-line max-len parentCapability: 'https://bedrock.localhost:18443/edvs/z1A9uTYSmCU3DYQr7jhruhCuK/zcaps/documents', proof: { - type: 'Ed25519Signature2018', + type: 'Ed25519Signature2020', created: '2020-02-27T21:22:48Z', // eslint-disable-next-line max-len verificationMethod: 'did:key:z6MkkrtV7wnBpXKBtiZjxaSghCo8ttb5kZUJTk8bEwTTTYvg#z6MkkrtV7wnBpXKBtiZjxaSghCo8ttb5kZUJTk8bEwTTTYvg', @@ -87,13 +88,13 @@ const zcap1 = { // eslint-disable-next-line max-len 'https://bedrock.localhost:18443/edvs/z1A9uTYSmCU3DYQr7jhruhCuK/zcaps/documents' ], - // eslint-disable-next-line max-len - jws: 'eyJhbGciOiJFZERTQSIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..jXUHaPhgTLFafpi5d7ya-vAnYfgZQrRYYNxCtkH5PRTIb31EWYt9oFKEbxo2Fxn8lB0HTPC67phQUkd-J0DhDA' + // a valid signature is not required for the test + proofValue: 'zMOCK_PROOF' } }; const zcap2 = { - '@context': 'https://w3id.org/security/v2', + '@context': ZCAP_CONTEXT_URL, id: 'urn:zcap:z19u4rwByrmyKFr1XC9AYNYcs', controller: 'did:key:z6Mkkt1BWYLPAAXwYBwyVHAZkL94tgT8QbQv2SUxeW1U3DaG', referenceId: 'bedrock.localhost:settings', @@ -108,7 +109,7 @@ const zcap2 = { // eslint-disable-next-line max-len parentCapability: 'https://bedrock.localhost:18443/edvs/z19jTB2drTyi4JHrARunxze8E/zcaps/documents', proof: { - type: 'Ed25519Signature2018', + type: 'Ed25519Signature2020', created: '2020-02-27T21:22:48Z', // eslint-disable-next-line max-len verificationMethod: 'did:key:z6MkkrtV7wnBpXKBtiZjxaSghCo8ttb5kZUJTk8bEwTTTYvg#z6MkkrtV7wnBpXKBtiZjxaSghCo8ttb5kZUJTk8bEwTTTYvg', @@ -117,8 +118,8 @@ const zcap2 = { // eslint-disable-next-line max-len 'https://bedrock.localhost:18443/edvs/z19jTB2drTyi4JHrARunxze8E/zcaps/documents' ], - // eslint-disable-next-line max-len - jws: 'eyJhbGciOiJFZERTQSIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..4wl0uIr1meF5c_gXlQysfK6xhAlB5mQ7ZclxxursKTwEYiWDUTXbk0H9lElPJDpbN5vC64yh_pR5zeycm8-4Bw' + // a valid signature is not required for the test + proofValue: 'zMOCK_PROOF' } }; diff --git a/test/package.json b/test/package.json index b384de9..8a98530 100644 --- a/test/package.json +++ b/test/package.json @@ -10,28 +10,30 @@ "coverage-report": "nyc report" }, "dependencies": { + "@digitalbazaar/zcapld": "^4.0.0", "bedrock": "^4.1.1", "bedrock-account": "^5.0.0", - "bedrock-did-context": "^1.0.0", - "bedrock-edv-storage": "^4.1.1", - "bedrock-express": "^3.2.0", + "bedrock-did-context": "^2.0.0", + "bedrock-did-io": "^2.0.0", + "bedrock-edv-storage": "^9.0.0", + "bedrock-express": "^4.0.0", "bedrock-https-agent": "^2.0.0", "bedrock-jsonld-document-loader": "^1.0.1", - "bedrock-kms": "^3.0.1", - "bedrock-kms-http": "^4.0.0", - "bedrock-ledger-context": "^15.0.0", - "bedrock-mongodb": "^8.0.0", + "bedrock-kms": "^6.0.0", + "bedrock-kms-http": "^5.0.0", + "bedrock-ledger-context": "^18.0.0", + "bedrock-mongodb": "^8.2.0", "bedrock-package-manager": "^1.0.1", - "bedrock-passport": "^6.0.0", - "bedrock-permission": "^3.0.0", + "bedrock-passport": "^6.1.0", + "bedrock-permission": "^3.2.0", "bedrock-profile": "file:..", - "bedrock-security-context": "^3.0.0", - "bedrock-server": "^2.6.0", - "bedrock-ssm-mongodb": "^3.0.0", - "bedrock-test": "^5.3.0", - "bedrock-validation": "^4.4.0", - "bedrock-veres-one-context": "^10.0.1", - "bedrock-zcap-storage": "^3.0.0", + "bedrock-security-context": "^4.1.0", + "bedrock-server": "^2.7.0", + "bedrock-ssm-mongodb": "^5.0.0", + "bedrock-test": "^5.3.2", + "bedrock-validation": "^5.0.0", + "bedrock-veres-one-context": "^11.0.0", + "bedrock-zcap-storage": "^3.2.0", "cross-env": "^7.0.2", "nyc": "^15.1.0", "sinon": "^9.0.2" diff --git a/test/test.config.js b/test/test.config.js index abb69f8..36f576f 100644 --- a/test/test.config.js +++ b/test/test.config.js @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Digital Bazaar, Inc. All rights reserved. + * Copyright (c) 2020-2021 Digital Bazaar, Inc. All rights reserved. */ 'use strict'; diff --git a/test/test.js b/test/test.js index 20078fb..45fcb06 100644 --- a/test/test.js +++ b/test/test.js @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Digital Bazaar, Inc. All rights reserved. + * Copyright (c) 2020-2021 Digital Bazaar, Inc. All rights reserved. */ const bedrock = require('bedrock'); require('bedrock-account');