question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

LinkedDataSignature.getVerificationMethod limited to w3id.org security context definitions.

See original GitHub issue

Related: https://github.com/digitalbazaar/jsonld.js/issues/392

https://github.com/digitalbazaar/jsonld-signatures/blob/master/lib/suites/LinkedDataSignature.js#L233

This prevents suite implementers from relying on the base class, and forces them to comprehend JSON-LD and implement their own getVerificationMethod… here is one example:

async getVerificationMethod({ proof, documentLoader }) {
    if (this.key) {
      return this.key.publicNode();
    }
    // replaces:
    // const verificationMethod = await super.getVerificationMethod({
    //   proof,
    //   documentLoader,
    // });
    // Because hard coding security contexts prevents extension using base class
    // https://github.com/digitalbazaar/jsonld-signatures/blob/master/lib/suites/LinkedDataSignature.js#L233
    let controller = (await documentLoader(proof.verificationMethod)).document;
    const verificationMethod = await jsonld.frame(
      controller,
      {
        "@context": [
          "https://w3id.org/security/v2",
          "https://identity.foundation/EcdsaSecp256k1RecoverySignature2020/lds-ecdsa-secp256k1-recovery2020-0.0.jsonld",
        ],
        "@embed": "@always",
        id: proof.verificationMethod,
      },
      { documentLoader, compactToRelative: false }
    );
    await this.assertVerificationMethod({ verificationMethod });
    return verificationMethod;
  }

Perhaps this is by design… but its feels a bit odd.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
OR13commented, Jul 20, 2020

Recommendation is to do 1 of 2 things…

  1. overwrite security-v2 (if you can) — only do this to test what the future will look like.
  2. put you context on the input document, and DO NOT use compactProof: false
0reactions
OR13commented, Jul 21, 2020

thanks! I actually prefer the edit in this case!

Read more comments on GitHub >

github_iconTop Results From Across the Web

w3id.org - Permanent Identifiers for the Web
Secure, permanent URLs for your Web application that will stand the test of time. Content. Purpose; Management; System Operations; Creating a New Identifier ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found