Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VerificationError: Document loader unable to load URL #121

Closed
UBgood opened this issue Jun 29, 2022 · 4 comments
Closed

VerificationError: Document loader unable to load URL #121

UBgood opened this issue Jun 29, 2022 · 4 comments

Comments

@UBgood
Copy link

UBgood commented Jun 29, 2022

So I have the following code:

import {Ed25519VerificationKey2018} from
  '@digitalbazaar/ed25519-verification-key-2018';
import {Ed25519Signature2018, suiteContext} from
  '@digitalbazaar/ed25519-signature-2018';

import vc from '@digitalbazaar/vc';
// generate key-pair
const keyPair = await Ed25519VerificationKey2018.generate({
  controller: "did:key:z6MkuBLrjSGt1PPADAvuv6rmvj4FfSAfffJotC6K8ZEorYmv#z6MkuBLrjSGt1PPADAvuv6rmvj4FfSAfffJotC6K8ZEorYmv"});
const suite = new Ed25519Signature2018({key: keyPair});
console.log("\nSuite: \n");
console.log(suite);

//generate signed VC
const credential = {
  "@context": [
    "https://www.w3.org/2018/credentials/v1",
    "https://www.w3.org/2018/credentials/examples/v1"
  ],
  "id": "https://example.com/credentials/1872",
  "type": ["VerifiableCredential", "AlumniCredential"],
  "issuer": "did:key:z6MkuBLrjSGt1PPADAvuv6rmvj4FfSAfffJotC6K8ZEorYmv#z6MkuBLrjSGt1PPADAvuv6rmvj4FfSAfffJotC6K8ZEorYmv",
  "issuanceDate": "2010-01-01T19:23:24Z",
  "credentialSubject": {
    "id": "did:example:ebfeb1f712ebc6f1c276e12ec21",
    "alumniOf": "Example University"
  },
};


const documentLoader = vc.defaultDocumentLoader;



const signedVC = await vc.issue({credential, suite, documentLoader});
console.log("\nSigned VC: \n");
console.log(signedVC);

const id = 'ebc6f1c2';
const holder = 'did:ex:12345';

//generate verifiable presentation

const presentation = vc.createPresentation({
  signedVC, id, holder
});

console.log("\nPresentation: \n");
console.log(presentation);

// generate signed verifiable presentation

const challenge = 'mychallengeword'
const vp = await vc.signPresentation({
  presentation, suite, challenge, documentLoader
});
console.log("\nSigned Presentation: \n");
console.log(vp);

// verify verifiable presentation

const result = await vc.verify({presentation, challenge, suite, documentLoader});
console.log("\nVerification of Presentation: \n");
console.log(result);

// verify verifiable credential

const result1 = await vc.verifyCredential({credential, suite, documentLoader});
console.log("\nVerification of Credential: \n");
console.log(result1);

Which gives me the following output:

Suite: 

Ed25519Signature2018 {
  type: 'Ed25519Signature2018',
  LDKeyClass: [class Ed25519VerificationKey2018 extends LDKeyPair] {
    suite: 'Ed25519VerificationKey2018',
    SUITE_CONTEXT: 'https://w3id.org/security/suites/ed25519-2018/v1'
  },
  contextUrl: 'https://w3id.org/security/suites/ed25519-2018/v1',
  proof: undefined,
  verificationMethod: 'did:key:z6MkuBLrjSGt1PPADAvuv6rmvj4FfSAfffJotC6K8ZEorYmv#z6MkuBLrjSGt1PPADAvuv6rmvj4FfSAfffJotC6K8ZEorYmv#z6MksNeXbSML9ffpQ9Xmt1kbtZUgPBJ6k54Mgw2gSfBbktaH',
  key: Ed25519VerificationKey2018 {
    id: 'did:key:z6MkuBLrjSGt1PPADAvuv6rmvj4FfSAfffJotC6K8ZEorYmv#z6MkuBLrjSGt1PPADAvuv6rmvj4FfSAfffJotC6K8ZEorYmv#z6MksNeXbSML9ffpQ9Xmt1kbtZUgPBJ6k54Mgw2gSfBbktaH',
    controller: 'did:key:z6MkuBLrjSGt1PPADAvuv6rmvj4FfSAfffJotC6K8ZEorYmv#z6MkuBLrjSGt1PPADAvuv6rmvj4FfSAfffJotC6K8ZEorYmv',
    revoked: undefined,
    type: 'Ed25519VerificationKey2018',
    publicKeyBase58: 'DvPV1C6tp8BMHeh5CSnm3TvgZc2FLBozzv7kcPDaqfnu',
    privateKeyBase58: '44zxPK9Mw4QFf95HfhrwYmMJp3ZkWMXu6DGVEBSxBpBdP7cE5e1sPUshLwGKBqE8rZasFQXr2pqebe5cxVnm6gPo'
  },
  signer: {
    sign: [AsyncFunction: sign],
    id: 'did:key:z6MkuBLrjSGt1PPADAvuv6rmvj4FfSAfffJotC6K8ZEorYmv#z6MkuBLrjSGt1PPADAvuv6rmvj4FfSAfffJotC6K8ZEorYmv#z6MksNeXbSML9ffpQ9Xmt1kbtZUgPBJ6k54Mgw2gSfBbktaH'
  },
  verifier: {
    verify: [AsyncFunction: verify],
    id: 'did:key:z6MkuBLrjSGt1PPADAvuv6rmvj4FfSAfffJotC6K8ZEorYmv#z6MkuBLrjSGt1PPADAvuv6rmvj4FfSAfffJotC6K8ZEorYmv#z6MksNeXbSML9ffpQ9Xmt1kbtZUgPBJ6k54Mgw2gSfBbktaH'
  },
  useNativeCanonize: undefined,
  _hashCache: null,
  alg: 'EdDSA',
  requiredKeyType: 'Ed25519VerificationKey2018'
}

Signed VC: 

{
  '@context': [
    'https://www.w3.org/2018/credentials/v1',
    'https://www.w3.org/2018/credentials/examples/v1'
  ],
  id: 'https://example.com/credentials/1872',
  type: [ 'VerifiableCredential', 'AlumniCredential' ],
  issuer: 'did:key:z6MkuBLrjSGt1PPADAvuv6rmvj4FfSAfffJotC6K8ZEorYmv#z6MkuBLrjSGt1PPADAvuv6rmvj4FfSAfffJotC6K8ZEorYmv',
  issuanceDate: '2010-01-01T19:23:24Z',
  credentialSubject: {
    id: 'did:example:ebfeb1f712ebc6f1c276e12ec21',
    alumniOf: 'Example University'
  },
  proof: {
    type: 'Ed25519Signature2018',
    created: '2022-06-29T08:15:27Z',
    verificationMethod: 'did:key:z6MkuBLrjSGt1PPADAvuv6rmvj4FfSAfffJotC6K8ZEorYmv#z6MkuBLrjSGt1PPADAvuv6rmvj4FfSAfffJotC6K8ZEorYmv#z6MksNeXbSML9ffpQ9Xmt1kbtZUgPBJ6k54Mgw2gSfBbktaH',
    proofPurpose: 'assertionMethod',
    jws: 'eyJhbGciOiJFZERTQSIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..4rHeafCjBK6rhyeGw326hthenbH7_nmFbab04UbnznQkUEC4Sq4nw1kZ9yiRI84gXikfxdxm55G3Mdc-do0wAw'
  }
}

Presentation: 

{
  '@context': [ 'https://www.w3.org/2018/credentials/v1' ],
  type: [ 'VerifiablePresentation' ],
  id: 'ebc6f1c2',
  holder: 'did:ex:12345'
}

Signed Presentation: 

{
  '@context': [ 'https://www.w3.org/2018/credentials/v1' ],
  type: [ 'VerifiablePresentation' ],
  id: 'ebc6f1c2',
  holder: 'did:ex:12345',
  proof: {
    type: 'Ed25519Signature2018',
    created: '2022-06-29T08:15:27Z',
    verificationMethod: 'did:key:z6MkuBLrjSGt1PPADAvuv6rmvj4FfSAfffJotC6K8ZEorYmv#z6MkuBLrjSGt1PPADAvuv6rmvj4FfSAfffJotC6K8ZEorYmv#z6MksNeXbSML9ffpQ9Xmt1kbtZUgPBJ6k54Mgw2gSfBbktaH',
    proofPurpose: 'authentication',
    challenge: 'mychallengeword',
    jws: 'eyJhbGciOiJFZERTQSIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..xak3utrxEnje3YzlJWrirIDQlsCmMqhVkgfbkUPbhV-G1T2HdoWfJ5gcIo1Fy58nBxZKX6tF-qu7vhujiMUeDg'
  }
}

Verification of Presentation: 

{
  presentationResult: {
    verified: false,
    results: [ [Object] ],
    error: VerificationError: Verification error(s).
        at Object.verify (/home/ebanush/Desktop/upb/trials/privacy-preserving-identities/issuing/node_modules/jsonld-signatures/lib/jsonld-signatures.js:125:22)
        at async _verifyPresentation (/home/ebanush/Desktop/upb/trials/privacy-preserving-identities/issuing/node_modules/@digitalbazaar/vc/lib/vc.js:440:30)
        at async file:///home/ebanush/Desktop/upb/trials/privacy-preserving-identities/issuing/issueVC.mjs:116:16 {
      errors: [Array]
    }
  },
  verified: false,
  credentialResults: undefined,
  error: VerificationError: Verification error(s).
      at Object.verify (/home/ebanush/Desktop/upb/trials/privacy-preserving-identities/issuing/node_modules/jsonld-signatures/lib/jsonld-signatures.js:125:22)
      at async _verifyPresentation (/home/ebanush/Desktop/upb/trials/privacy-preserving-identities/issuing/node_modules/@digitalbazaar/vc/lib/vc.js:440:30)
      at async file:///home/ebanush/Desktop/upb/trials/privacy-preserving-identities/issuing/issueVC.mjs:116:16 {
    errors: [
      Error: Document loader unable to load URL "did:key:z6MkuBLrjSGt1PPADAvuv6rmvj4FfSAfffJotC6K8ZEorYmv#z6MkuBLrjSGt1PPADAvuv6rmvj4FfSAfffJotC6K8ZEorYmv".
          at documentLoader (/home/ebanush/Desktop/upb/trials/privacy-preserving-identities/issuing/node_modules/@digitalbazaar/vc/lib/documentLoader.js:18:9)
          at /home/ebanush/Desktop/upb/trials/privacy-preserving-identities/issuing/node_modules/jsonld-signatures/lib/documentLoader.js:48:12
          at /home/ebanush/Desktop/upb/trials/privacy-preserving-identities/issuing/node_modules/jsonld-signatures/lib/documentLoader.js:48:12
          at AuthenticationProofPurpose.validate (/home/ebanush/Desktop/upb/trials/privacy-preserving-identities/issuing/node_modules/jsonld-signatures/lib/purposes/ControllerProofPurpose.js:94:32)
    ]
  }
}

Verification of Credential: 

{
  verified: false,
  results: [
    {
      proof: [Object],
      verified: false,
      verificationMethod: [Object],
      error: Error: Document loader unable to load URL "did:key:z6MkuBLrjSGt1PPADAvuv6rmvj4FfSAfffJotC6K8ZEorYmv#z6MkuBLrjSGt1PPADAvuv6rmvj4FfSAfffJotC6K8ZEorYmv".
          at documentLoader (/home/ebanush/Desktop/upb/trials/privacy-preserving-identities/issuing/node_modules/@digitalbazaar/vc/lib/documentLoader.js:18:9)
          at /home/ebanush/Desktop/upb/trials/privacy-preserving-identities/issuing/node_modules/jsonld-signatures/lib/documentLoader.js:48:12
          at /home/ebanush/Desktop/upb/trials/privacy-preserving-identities/issuing/node_modules/jsonld-signatures/lib/documentLoader.js:48:12
          at CredentialIssuancePurpose.validate (/home/ebanush/Desktop/upb/trials/privacy-preserving-identities/issuing/node_modules/jsonld-signatures/lib/purposes/ControllerProofPurpose.js:94:32)
          at async CredentialIssuancePurpose.validate (/home/ebanush/Desktop/upb/trials/privacy-preserving-identities/issuing/node_modules/@digitalbazaar/vc/lib/CredentialIssuancePurpose.js:53:22)
          at async /home/ebanush/Desktop/upb/trials/privacy-preserving-identities/issuing/node_modules/jsonld-signatures/lib/ProofSet.js:270:27
          at async Promise.all (index 0)
          at async _verify (/home/ebanush/Desktop/upb/trials/privacy-preserving-identities/issuing/node_modules/jsonld-signatures/lib/ProofSet.js:256:3)
          at async ProofSet.verify (/home/ebanush/Desktop/upb/trials/privacy-preserving-identities/issuing/node_modules/jsonld-signatures/lib/ProofSet.js:152:23)
          at async Object.verify (/home/ebanush/Desktop/upb/trials/privacy-preserving-identities/issuing/node_modules/jsonld-signatures/lib/jsonld-signatures.js:114:18),
      purposeResult: [Object]
    }
  ],
  error: VerificationError: Verification error(s).
      at Object.verify (/home/ebanush/Desktop/upb/trials/privacy-preserving-identities/issuing/node_modules/jsonld-signatures/lib/jsonld-signatures.js:125:22)
      at async _verifyCredential (/home/ebanush/Desktop/upb/trials/privacy-preserving-identities/issuing/node_modules/@digitalbazaar/vc/lib/vc.js:275:18)
      at async file:///home/ebanush/Desktop/upb/trials/privacy-preserving-identities/issuing/issueVC.mjs:122:17 {
    errors: [
      Error: Document loader unable to load URL "did:key:z6MkuBLrjSGt1PPADAvuv6rmvj4FfSAfffJotC6K8ZEorYmv#z6MkuBLrjSGt1PPADAvuv6rmvj4FfSAfffJotC6K8ZEorYmv".
          at documentLoader (/home/ebanush/Desktop/upb/trials/privacy-preserving-identities/issuing/node_modules/@digitalbazaar/vc/lib/documentLoader.js:18:9)
          at /home/ebanush/Desktop/upb/trials/privacy-preserving-identities/issuing/node_modules/jsonld-signatures/lib/documentLoader.js:48:12
          at /home/ebanush/Desktop/upb/trials/privacy-preserving-identities/issuing/node_modules/jsonld-signatures/lib/documentLoader.js:48:12
          at CredentialIssuancePurpose.validate (/home/ebanush/Desktop/upb/trials/privacy-preserving-identities/issuing/node_modules/jsonld-signatures/lib/purposes/ControllerProofPurpose.js:94:32)
          at async CredentialIssuancePurpose.validate (/home/ebanush/Desktop/upb/trials/privacy-preserving-identities/issuing/node_modules/@digitalbazaar/vc/lib/CredentialIssuancePurpose.js:53:22)
          at async /home/ebanush/Desktop/upb/trials/privacy-preserving-identities/issuing/node_modules/jsonld-signatures/lib/ProofSet.js:270:27
          at async Promise.all (index 0)
          at async _verify (/home/ebanush/Desktop/upb/trials/privacy-preserving-identities/issuing/node_modules/jsonld-signatures/lib/ProofSet.js:256:3)
          at async ProofSet.verify (/home/ebanush/Desktop/upb/trials/privacy-preserving-identities/issuing/node_modules/jsonld-signatures/lib/ProofSet.js:152:23)
          at async Object.verify (/home/ebanush/Desktop/upb/trials/privacy-preserving-identities/issuing/node_modules/jsonld-signatures/lib/jsonld-signatures.js:114:18)
    ]
  }
}

I am looking for a way to make the verification successful but couldn't find anything useful. It would be great if someone could guide me to what I should do regarding this. I have tried the did-method-key library but I think that is not directly related to the verifiable credentials implementation. Maybe this has something to do with the jsonld-signatures library but I'm not entirely sure about it. I tried to create a custom documentLoader but my code didn't run as expected

Here is the code for the custom document loader:

import pkg from 'jsonld-signatures';
const extendContextLoader =pkg;
//const vc = require('@digitalbazaar/vc');
// @digitalbazaar/vc exports its own secure documentLoader.
const {defaultDocumentLoader} = vc;
// a valid json-ld @context.
import myCustomContext from './myCustomContext.json' assert {type: "json"};

const documentLoader = extendContextLoader(async url => {
  if(url === 'did:test:context:foo') {
    return {
      contextUrl: null,
      documentUrl: url,
      document: myCustomContext
    };
  }
  return defaultDocumentLoader(url);
});

This doesn't work since it says that extendContextLoader is not a method.

@JSAssassin
Copy link
Contributor

Hi @UBgood, It looks like you'll need a documentLoader that can load the urls that start with did:key: so you probably need to do something like this - https://github.com/digitalbazaar/vc-status-list/blob/main/tests/20-main.spec.js#L37-L52 using didKeyDriver when creating your custom documentLoader . It also looks like you aren't destructuring extendContextLoader from jsonld-signatures and that's why it is complaining that it isn't a method. You'll have to debug but hopefully this is helpful.

@aljones15
Copy link
Contributor

aljones15 commented Jun 29, 2022

There is a package we maintain with a documentLoader that can handle some did:key:z formats:

https://www.npmjs.com/package/@digitalbazaar/security-document-loader

It looks like your did:key is base58 so it should be able to handle the did:key that you are using.

p.s. that loader might assume you're using the 2020 version of the keys and not the 2018. You might consider the 2020 versions of ed25519.

@UBgood
Copy link
Author

UBgood commented Jul 12, 2022

Thanks for the answers. I have tried to use the examples in the links provided by both @JSAssassin and @aljones15 . I came up with some changes and a try-catch block. But it still leads to a similar error.
Here is the new code:

/**
 * Verifiable Credentials and Verfiable Presentation using vc-js library
 */
 import {Ed25519VerificationKey2020} from
  '@digitalbazaar/ed25519-verification-key-2020';
 import {Ed25519Signature2020} from
  '@digitalbazaar/ed25519-signature-2020';
import {defaultDocumentLoader} from '@digitalbazaar/vc';

import * as vc from '@digitalbazaar/vc';

// cannot import extendContextLoader like
// import {extendContextLoader} from 'jsonld-signatures'; --> throw error
// SyntaxError: Named export 'extendContextLoader' not found. The requested module 'jsonld-signatures' is a CommonJS module, which may not support all module.exports as named exports.
// CommonJS modules can always be imported via the default export, for example using:
// thus import as follow
import pkg from 'jsonld-signatures';
const {extendContextLoader} = pkg;

import fetch from 'node-fetch';

// create an unsigned credential
const unsignedCredential = {
    '@context': [
      'https://www.w3.org/2018/credentials/v1',
      'https://w3id.org/security/suites/ed25519-2020/v1',
      {
        AlumniCredential: 'https://schema.org#AlumniCredential',
        alumniOf: 'https://schema.org#alumniOf'
      }
    ],
    id: 'http://example.edu/credentials/1872',
    type: [ 'VerifiableCredential', 'AlumniCredential' ],
    issuer: 'https://example.edu/issuers/565049',
    issuanceDate: '2010-01-01T19:23:24Z',
    credentialSubject: {
      id: 'https://example.edu/students/alice',
      alumniOf: 'Example University'
    }
};

// create the keypair to sign the credential
const controller = 'https://w3id.org/security#controller';
const keyPair = await Ed25519VerificationKey2020.from({
  type: 'Ed25519VerificationKey2020',
  controller,
  id: controller + '#z6MknCCLeeHBUaHu4aHSVLDCYQW9gjVJ7a63FpMvtuVMy53T',
  publicKeyMultibase: 'z6MknCCLeeHBUaHu4aHSVLDCYQW9gjVJ7a63FpMvtuVMy53T',
  privateKeyMultibase: 'zrv2EET2WWZ8T1Jbg4fEH5cQxhbUS22XxdweypUbjWVzv1YD6VqYu' +
    'W6LH7heQCNYQCuoKaDwvv2qCWz3uBzG2xesqmf'
});

// extend document loader
const documentLoader = extendContextLoader(async url => {
    if(url.startsWith('https://w3id.org/')) {
      let doc = await downloadPage(url)
      return {
        contextUrl: null,
        documentUrl: url,
        document: doc
      };
    }
    return defaultDocumentLoader(url);
});

// workaround for error
// jsonld.InvalidUrl: Dereferencing a URL did not result in a valid JSON-LD object
// details: {
//    code: 'loading remote context failed',
//    url: 'https://w3id.org/security/suites/ed25519-2020/v1'
// reference: https://github.com/digitalbazaar/jsonld-signatures/issues/108
async function downloadPage(url) {
  try {
    const response = await fetch(url);
    const doc = await response.json();
    return doc;
  } catch (error) {
    console.log('url download error', url, error);
  }
}

const suite = new Ed25519Signature2020({key: keyPair});
//suite.date = '2010-01-01T19:23:24Z';

// issue Verfiable Credential using jsonld signature library
// sign creds using jsonld-signature library
// const signedCredential = await jsigs.sign(unsignedCredential, {
//   suite,
//   purpose: new AssertionProofPurpose(),
//   documentLoader
// });

// issue VC 
const signedVC = await vc.issue({credential:unsignedCredential, suite, documentLoader});
console.log('verifable credentials', JSON.stringify(signedVC, null, 2));

// verify vc signature

const result = await vc.verifyCredential({credential:signedVC, suite, documentLoader});
console.log("\nVerification of VC: \n");
console.log(JSON.stringify(result, null, 2));
// issue verifiable presentation
// verify vp signature

Which gives me the following error:

verifable credentials {
  "@context": [
    "https://www.w3.org/2018/credentials/v1",
    "https://w3id.org/security/suites/ed25519-2020/v1",
    {
      "AlumniCredential": "https://schema.org#AlumniCredential",
      "alumniOf": "https://schema.org#alumniOf"
    }
  ],
  "id": "http://example.edu/credentials/1872",
  "type": [
    "VerifiableCredential",
    "AlumniCredential"
  ],
  "issuer": "https://example.edu/issuers/565049",
  "issuanceDate": "2010-01-01T19:23:24Z",
  "credentialSubject": {
    "id": "https://example.edu/students/alice",
    "alumniOf": "Example University"
  },
  "proof": {
    "type": "Ed25519Signature2020",
    "created": "2022-07-12T09:17:49Z",
    "verificationMethod": "https://w3id.org/security#controller#z6MknCCLeeHBUaHu4aHSVLDCYQW9gjVJ7a63FpMvtuVMy53T",
    "proofPurpose": "assertionMethod",
    "proofValue": "z5aWfTGzxEdSrBh6L9NhPZnostuWRqmCLUMDoxzvv89puzv1yxo6eUDXevDWADmDBwn5SP1z78wT8zLFiAq7g4Bik"
  }
}
url download error https://w3id.org/security#controller SyntaxError: Unexpected token < in JSON at position 0
    at JSON.parse (<anonymous>)
    at Response.json (file:///home/ebanush/Desktop/upb/trials/ppi-final/privacy-preserving-identities/node_modules/node-fetch/src/body.js:120:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async downloadPage (file:///home/ebanush/Desktop/upb/trials/ppi-final/privacy-preserving-identities/index.mjs:75:17)
    at async file:///home/ebanush/Desktop/upb/trials/ppi-final/privacy-preserving-identities/index.mjs:56:17
    at async CredentialIssuancePurpose.validate (/home/ebanush/Desktop/upb/trials/ppi-final/privacy-preserving-identities/node_modules/jsonld-signatures/lib/purposes/ControllerProofPurpose.js:94:26)
    at async CredentialIssuancePurpose.validate (/home/ebanush/Desktop/upb/trials/ppi-final/privacy-preserving-identities/node_modules/@digitalbazaar/vc/lib/CredentialIssuancePurpose.js:53:22)
    at async /home/ebanush/Desktop/upb/trials/ppi-final/privacy-preserving-identities/node_modules/jsonld-signatures/lib/ProofSet.js:270:27
    at async Promise.all (index 0)
    at async _verify (/home/ebanush/Desktop/upb/trials/ppi-final/privacy-preserving-identities/node_modules/jsonld-signatures/lib/ProofSet.js:256:3)

Verification of VC: 

{
  "verified": false,
  "results": [
    {
      "proof": {
        "@context": [
          "https://www.w3.org/2018/credentials/v1",
          "https://w3id.org/security/suites/ed25519-2020/v1",
          {
            "AlumniCredential": "https://schema.org#AlumniCredential",
            "alumniOf": "https://schema.org#alumniOf"
          }
        ],
        "type": "Ed25519Signature2020",
        "created": "2022-07-12T09:17:49Z",
        "verificationMethod": "https://w3id.org/security#controller#z6MknCCLeeHBUaHu4aHSVLDCYQW9gjVJ7a63FpMvtuVMy53T",
        "proofPurpose": "assertionMethod",
        "proofValue": "z5aWfTGzxEdSrBh6L9NhPZnostuWRqmCLUMDoxzvv89puzv1yxo6eUDXevDWADmDBwn5SP1z78wT8zLFiAq7g4Bik"
      },
      "verified": false,
      "verificationMethod": {
        "id": "https://w3id.org/security#controller#z6MknCCLeeHBUaHu4aHSVLDCYQW9gjVJ7a63FpMvtuVMy53T",
        "type": "Ed25519VerificationKey2020",
        "controller": "https://w3id.org/security#controller",
        "publicKeyMultibase": "z6MknCCLeeHBUaHu4aHSVLDCYQW9gjVJ7a63FpMvtuVMy53T"
      },
      "error": {
        "name": "TypeError",
        "message": "Cannot read properties of undefined (reading '@context')",
        "stack": "TypeError: Cannot read properties of undefined (reading '@context')\n    at CredentialIssuancePurpose.validate (/home/ebanush/Desktop/upb/trials/ppi-final/privacy-preserving-identities/node_modules/jsonld-signatures/lib/purposes/ControllerProofPurpose.js:96:19)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at async CredentialIssuancePurpose.validate (/home/ebanush/Desktop/upb/trials/ppi-final/privacy-preserving-identities/node_modules/@digitalbazaar/vc/lib/CredentialIssuancePurpose.js:53:22)\n    at async /home/ebanush/Desktop/upb/trials/ppi-final/privacy-preserving-identities/node_modules/jsonld-signatures/lib/ProofSet.js:270:27\n    at async Promise.all (index 0)\n    at async _verify (/home/ebanush/Desktop/upb/trials/ppi-final/privacy-preserving-identities/node_modules/jsonld-signatures/lib/ProofSet.js:256:3)\n    at async ProofSet.verify (/home/ebanush/Desktop/upb/trials/ppi-final/privacy-preserving-identities/node_modules/jsonld-signatures/lib/ProofSet.js:152:23)\n    at async Object.verify (/home/ebanush/Desktop/upb/trials/ppi-final/privacy-preserving-identities/node_modules/jsonld-signatures/lib/jsonld-signatures.js:114:18)\n    at async _verifyCredential (/home/ebanush/Desktop/upb/trials/ppi-final/privacy-preserving-identities/node_modules/@digitalbazaar/vc/lib/vc.js:275:18)\n    at async file:///home/ebanush/Desktop/upb/trials/ppi-final/privacy-preserving-identities/index.mjs:99:16"
      },
      "purposeResult": {
        "valid": false,
        "error": {
          "name": "TypeError",
          "message": "Cannot read properties of undefined (reading '@context')",
          "stack": "TypeError: Cannot read properties of undefined (reading '@context')\n    at CredentialIssuancePurpose.validate (/home/ebanush/Desktop/upb/trials/ppi-final/privacy-preserving-identities/node_modules/jsonld-signatures/lib/purposes/ControllerProofPurpose.js:96:19)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at async CredentialIssuancePurpose.validate (/home/ebanush/Desktop/upb/trials/ppi-final/privacy-preserving-identities/node_modules/@digitalbazaar/vc/lib/CredentialIssuancePurpose.js:53:22)\n    at async /home/ebanush/Desktop/upb/trials/ppi-final/privacy-preserving-identities/node_modules/jsonld-signatures/lib/ProofSet.js:270:27\n    at async Promise.all (index 0)\n    at async _verify (/home/ebanush/Desktop/upb/trials/ppi-final/privacy-preserving-identities/node_modules/jsonld-signatures/lib/ProofSet.js:256:3)\n    at async ProofSet.verify (/home/ebanush/Desktop/upb/trials/ppi-final/privacy-preserving-identities/node_modules/jsonld-signatures/lib/ProofSet.js:152:23)\n    at async Object.verify (/home/ebanush/Desktop/upb/trials/ppi-final/privacy-preserving-identities/node_modules/jsonld-signatures/lib/jsonld-signatures.js:114:18)\n    at async _verifyCredential (/home/ebanush/Desktop/upb/trials/ppi-final/privacy-preserving-identities/node_modules/@digitalbazaar/vc/lib/vc.js:275:18)\n    at async file:///home/ebanush/Desktop/upb/trials/ppi-final/privacy-preserving-identities/index.mjs:99:16"
        }
      }
    }
  ],
  "error": {
    "name": "VerificationError",
    "errors": [
      {
        "name": "TypeError",
        "message": "Cannot read properties of undefined (reading '@context')",
        "stack": "TypeError: Cannot read properties of undefined (reading '@context')\n    at CredentialIssuancePurpose.validate (/home/ebanush/Desktop/upb/trials/ppi-final/privacy-preserving-identities/node_modules/jsonld-signatures/lib/purposes/ControllerProofPurpose.js:96:19)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at async CredentialIssuancePurpose.validate (/home/ebanush/Desktop/upb/trials/ppi-final/privacy-preserving-identities/node_modules/@digitalbazaar/vc/lib/CredentialIssuancePurpose.js:53:22)\n    at async /home/ebanush/Desktop/upb/trials/ppi-final/privacy-preserving-identities/node_modules/jsonld-signatures/lib/ProofSet.js:270:27\n    at async Promise.all (index 0)\n    at async _verify (/home/ebanush/Desktop/upb/trials/ppi-final/privacy-preserving-identities/node_modules/jsonld-signatures/lib/ProofSet.js:256:3)\n    at async ProofSet.verify (/home/ebanush/Desktop/upb/trials/ppi-final/privacy-preserving-identities/node_modules/jsonld-signatures/lib/ProofSet.js:152:23)\n    at async Object.verify (/home/ebanush/Desktop/upb/trials/ppi-final/privacy-preserving-identities/node_modules/jsonld-signatures/lib/jsonld-signatures.js:114:18)\n    at async _verifyCredential (/home/ebanush/Desktop/upb/trials/ppi-final/privacy-preserving-identities/node_modules/@digitalbazaar/vc/lib/vc.js:275:18)\n    at async file:///home/ebanush/Desktop/upb/trials/ppi-final/privacy-preserving-identities/index.mjs:99:16"
      }
    ]
  }
}

@dlongley
Copy link
Member

From the example code above, this is not a valid verification method:

"verificationMethod": "https://w3id.org/security#controller#z6MknCCLeeHBUaHu4aHSVLDCYQW9gjVJ7a63FpMvtuVMy53T",

It's instead clearly some kind of conflation of a security vocabulary term (https://w3id.org/security#controller) and a hash fragment for what is probably a valid key. The controller var that is set when generating the keypair is wrong, it should probably be a DID instead of that security vocabulary term.

I suspect that this has already been fixed and the issue is just hanging out here -- so I'm going to close it. Feel free to re-open and re-engage if necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants