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

Invalid JSON-LD syntax; "@value" value must not be an object or an array. #392

Closed
OR13 opened this issue Apr 25, 2020 · 4 comments
Closed

Comments

@OR13
Copy link

OR13 commented Apr 25, 2020

let object ={

 "https://identity.foundation/EcdsaSecp256k1RecoverySignature2020#publicKeyJwk": {
        "type": "@json",
        "@value": {
          "crv": "secp256k1",
          "kid": "JUvpllMEYUZ2joO59UNui_XYDqxVqiFLLAJ8klWuPBw",
          "kty": "EC",
          "x": "dWCvM4fTdeM0KmloF57zxtBPXTOythHPMm1HCLrdd3A",
          "y": "36uMVGM7hnw-N6GnjFcihWE3SkrhMLzzLCdPMXPEXlA"
        }
      }

}
const compacted = await jsonld.compact(
        object,
        "https://identity.foundation/EcdsaSecp256k1RecoverySignature2020"
      );

Is it not possible to compact something that uses @json ?

@OR13
Copy link
Author

OR13 commented Apr 25, 2020

I am getting:

{
      "id": "did:example:123#vm-1",
      "type": "sec:EcdsaSecp256k1RecoveryMethod2020",
      "controller": {
        "id": "did:example:123",
        "assertionMethod": [
          "did:example:123#vm-1"
        ],
        "publicKey": "did:example:123#vm-1"
      },
      "sec:privateKeyJwk": {
        "type": "@json",
        "@value": {
          "crv": "secp256k1",
          "d": "rhYFsBPF9q3-uZThy7B3c4LDF_8wnozFUAEm5LLC4Zw",
          "kid": "JUvpllMEYUZ2joO59UNui_XYDqxVqiFLLAJ8klWuPBw",
          "kty": "EC",
          "x": "dWCvM4fTdeM0KmloF57zxtBPXTOythHPMm1HCLrdd3A",
          "y": "36uMVGM7hnw-N6GnjFcihWE3SkrhMLzzLCdPMXPEXlA"
        }
      },
      "sec:publicKeyJwk": {
        "type": "@json",
        "@value": {
          "crv": "secp256k1",
          "kid": "JUvpllMEYUZ2joO59UNui_XYDqxVqiFLLAJ8klWuPBw",
          "kty": "EC",
          "x": "dWCvM4fTdeM0KmloF57zxtBPXTOythHPMm1HCLrdd3A",
          "y": "36uMVGM7hnw-N6GnjFcihWE3SkrhMLzzLCdPMXPEXlA"
        }
      }
    }

I want something more like....

{
      "id": "did:example:123#vm-1",
      "controller": "did:example:123",
      "type": "EcdsaSecp256k1RecoveryMethod2020",
      "publicKeyJwk": {
        "crv": "secp256k1",
        "kid": "JUvpllMEYUZ2joO59UNui_XYDqxVqiFLLAJ8klWuPBw",
        "kty": "EC",
        "x": "dWCvM4fTdeM0KmloF57zxtBPXTOythHPMm1HCLrdd3A",
        "y": "36uMVGM7hnw-N6GnjFcihWE3SkrhMLzzLCdPMXPEXlA"
      },
      "privateKeyJwk": {
        "crv": "secp256k1",
        "d": "rhYFsBPF9q3-uZThy7B3c4LDF_8wnozFUAEm5LLC4Zw",
        "kid": "JUvpllMEYUZ2joO59UNui_XYDqxVqiFLLAJ8klWuPBw",
        "kty": "EC",
        "x": "dWCvM4fTdeM0KmloF57zxtBPXTOythHPMm1HCLrdd3A",
        "y": "36uMVGM7hnw-N6GnjFcihWE3SkrhMLzzLCdPMXPEXlA"
      }
    },

@OR13
Copy link
Author

OR13 commented Apr 25, 2020

@OR13
Copy link
Author

OR13 commented Apr 25, 2020

// Note: `expansionMap` is intentionally not passed; we can safely drop
    // properties here and must allow for it
    const {'@graph': [framed]} = await jsonld.frame(verificationMethod, {
      '@context': constants.SECURITY_CONTEXT_URL,
      '@embed': '@always',
      id: verificationMethod
    }, {documentLoader, compactToRelative: false});
    if(!framed) {
      throw new Error(`Verification method ${verificationMethod} not found.`);
    }

    // ensure verification method has not been revoked
    if(framed.revoked !== undefined) {
      throw new Error('The verification method has been revoked.');
    }

    return framed;

by setting the @context in the frame... doesn't this pretty much prevent extension of linked data signatures that use getVerificationMethod but don't have types defined in the hardcoded security context?

@OR13
Copy link
Author

OR13 commented Apr 25, 2020

I figured out why... its because of the use of frame with a hard coded context that only supports w3id.org/security/v2...

@OR13 OR13 closed this as completed Apr 25, 2020
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

1 participant