jsonld-signatures-bbs: TypeError: suite.ensureSuiteContext is not a function

This is caused by recent changes in https://github.com/digitalbazaar/jsonld-signatures

Here is an example implementation that would remove this error:

import sec from '@transmute/security-context';

ensureSuiteContext({ document }: any) {
    const contextUrl = sec.constants.BLS12381_2020_V1_URL;
    if (
      document['@context'] === contextUrl ||
      (Array.isArray(document['@context']) &&
        document['@context'].includes(contextUrl))
    ) {
      // document already includes the required context
      return;
    }
    throw new TypeError(
      `The document to be signed must contain this suite's @context, ` +
        `"${contextUrl}".`
    );
  }

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 2
  • Comments: 15

Most upvoted comments

The function is required by digital bazaar, the context url is in the form we agreed to use during the did WG.

On Sat, Apr 2, 2022, 2:11 PM Karim Stekelenburg @.***> wrote:

Hi @OR13 https://github.com/OR13 thanks for the link! I’m trying to understand the differences between these two implementations. Is there a specific reason the Transmute implementation requires the https://w3id.org/security/suites/bls12381-2020/v1 context on the input doc and this MATTR one doesn’t?

Mainly asking because I don’t see any mention of this context in the BBS spec either.

— Reply to this email directly, view it on GitHub https://github.com/mattrglobal/jsonld-signatures-bbs/issues/142#issuecomment-1086704742, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB7JLMAYMW6NQXLOQMAZKILVDCLXXANCNFSM5AEQHRQA . You are receiving this because you were mentioned.Message ID: @.***>