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

Example code is broken #99

Closed
aljones15 opened this issue Apr 23, 2021 · 5 comments
Closed

Example code is broken #99

aljones15 opened this issue Apr 23, 2021 · 5 comments

Comments

@aljones15
Copy link
Contributor

The README contains this snippet:

import vc from '@digitalbazaar/vc';

// Required to set up a suite instance with private key
import {Ed25519VerificationKey2020} from
  '@digitalbazaar/ed25519-verification-key-2020';
import {Ed25519Signature2020} from '@digitalbazaar/ed25519-signature-2020';

const keyPair = await Ed25519VerificationKey2020.generate();

const suite = new Ed25519Signature2020({key: keyPair});

The above code is fine but trying this:

const verifiableCredential = await vc.issue({credential, suite});
/* throws:
        TypeError: "suite.verificationMethod" property is required.
    at Proxy.issue (node_modules/@digitalbazaar/vc/lib/vc.js:120:11)
    at createCompressedVC (tests/helpers.js:12:41)
    at async Context.<anonymous> (tests/10-interop.js:118:36)
*/
{
  suite: Ed25519Signature2020 {
    type: 'Ed25519Signature2020',
    LDKeyClass: [class Ed25519VerificationKey2020 extends LDKeyPair] {
      suite: 'Ed25519VerificationKey2020',
      SUITE_CONTEXT: 'https://w3id.org/security/suites/ed25519-2020/v1'
    },
    contextUrl: 'https://w3id.org/security/suites/ed25519-2020/v1',
    proof: undefined,
    verificationMethod: undefined,
    key: Ed25519VerificationKey2020 {
      id: undefined,
      controller: undefined,
      revoked: undefined,
      type: 'Ed25519VerificationKey2020',
      publicKeyMultibase: 'zGa7L2jfyoM63VwYW8v3ZdevMUXPohDpC76YaVgzk3NYf',
      privateKeyMultibase: 'z58FGsdi4MWh1NJhRSm4oCjQr3XkNeBrwdAS6KfxpoM9giDuctvWSzKnuqAnp6pSvjPDojwhZNRAxvXv8ZGDr3osM'                                                                                            
    },
    signer: { sign: [AsyncFunction: sign], id: undefined },
    verifier: { verify: [AsyncFunction: verify], id: undefined },
    useNativeCanonize: undefined,
    requiredKeyType: 'Ed25519VerificationKey2020'
  }
}
{
  keyPair: Ed25519VerificationKey2020 {
    id: undefined,
    controller: undefined,
    revoked: undefined,
    type: 'Ed25519VerificationKey2020',
    publicKeyMultibase: 'zGa7L2jfyoM63VwYW8v3ZdevMUXPohDpC76YaVgzk3NYf',
    privateKeyMultibase: 'z58FGsdi4MWh1NJhRSm4oCjQr3XkNeBrwdAS6KfxpoM9giDuctvWSzKnuqAnp6pSvjPDojwhZNRAxvXv8ZGDr3osM'                                                                                              
  }
}

Basically the verificationMethod is missing when creating an Ed25519-verification-key-2020 I believe we need a did key here.

@davidlehn
Copy link
Member

Also see #93. The 2020 tests haven't been added yet. The tests and README examples need updating.

@mrappard
Copy link

Can we get an update on this. It's been a month.

@dmitrizagidulin
Copy link
Contributor

This issue has been addressed in recent vc-js versions. (Specifically, verificationMethod is now being determined in
jsonld-signatures _processSignatureParams() from the suite/key, when appropriate.)

@spetrac
Copy link

spetrac commented Aug 14, 2024

Why has this issue been closed? The problem is still not resolved. Today, over 3 years later, I still have the exact same problem when I run the example code from the website.

@dlongley
Copy link
Member

Rather than reopening this since the examples have changed significantly, I've opened a new issue for someone to ensure the examples are runnable and refresh them as needed: #185.

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

6 participants