Coder Social home page Coder Social logo

mattrglobal / jsonld-signatures-bbs Goto Github PK

View Code? Open in Web Editor NEW
134.0 19.0 38.0 1.67 MB

A linked data proof suite for BBS+ signatures

License: Apache License 2.0

JavaScript 2.14% TypeScript 95.79% Shell 2.07%
jsonld jsonld-signatures digital-signatures

jsonld-signatures-bbs's Introduction

MATTR

jsonld-signatures-bbs

npm-version npm-unstable-version push-master push-release codecov

The following repository contains a linked data proof implementation for creating BBS+ Signatures using BLS12-381 key pairs.

Due to the properties of a BBS+ Signatures, zero knowledge proof can be derived from the signature, where-by the party generating the proof can elect to selectively disclose statements from the originally signed payload.

This library is runnable in browser and Node.js through the WASM based crypto implementation provided by bbs-signatures. Note bbs-signatures also has an optional dependency on node-bbs-signatures which can be used when running in Node.JS environments to obtain better performance. For environments that do not feature WASM support such as react native, bbs-signatures includes an automatic roll back to an asm.js version but note however the performance difference between asm.js and WASM is significant, for those inclined there are runnable benchmarks in bbs-signatures.

Getting started

To use this package within your project simply run

npm install @mattrglobal/jsonld-signatures-bbs

Or with Yarn

yarn add @mattrglobal/jsonld-signatures-bbs

Sample

See the sample directory for a runnable demo.

Examples

The following is an example of a signed JSON-LD document featuring a BbsBlsSignature2020 type signature.

{
  "@context": [
    "https://www.w3.org/2018/credentials/v1",
    "https://w3id.org/citizenship/v1",
    "https://w3id.org/security/bbs/v1"
  ],
  "id": "https://issuer.oidp.uscis.gov/credentials/83627465",
  "type": ["VerifiableCredential", "PermanentResidentCard"],
  "issuer": "did:example:489398593",
  "identifier": "83627465",
  "name": "Permanent Resident Card",
  "description": "Government of Example Permanent Resident Card.",
  "issuanceDate": "2019-12-03T12:19:52Z",
  "expirationDate": "2029-12-03T12:19:52Z",
  "credentialSubject": {
    "id": "did:example:b34ca6cd37bbf23",
    "type": ["PermanentResident", "Person"],
    "givenName": "JOHN",
    "familyName": "SMITH",
    "gender": "Male",
    "image": "data:image/png;base64,iVBORw0KGgokJggg==",
    "residentSince": "2015-01-01",
    "lprCategory": "C09",
    "lprNumber": "999-999-999",
    "commuterClassification": "C1",
    "birthCountry": "Bahamas",
    "birthDate": "1958-07-17"
  },
  "proof": {
    "type": "BbsBlsSignature2020",
    "created": "2020-04-26T04:21:07Z",
    "verificationMethod": "did:example:489398593#test",
    "proofPurpose": "assertionMethod",
    "proofValue": "jx2VhjyZqUT91e2OhzweJA7G2u2UvmiDtIfmr+wUWNHWno+UOAh0FaNpM8Br+5j2JBkH981/nO1I7/9PFaRrng6NXu7vzDroKtuyj6nHGkMmGq4OMmBzIqRnG3ybin/Sxmu5YwqOxPMRsWH3H+2wSA=="
  }
}

Whereby a zero knowledge proof disclosing only givenName, familyName and gender can be derived, from the above assertion using the following as the reveal document which is a JSON-LD frame.

{
  "@context": [
    "https://www.w3.org/2018/credentials/v1",
    "https://w3id.org/citizenship/v1",
    "https://w3id.org/security/bbs/v1"
  ],
  "type": ["VerifiableCredential", "PermanentResidentCard"],
  "credentialSubject": {
    "type": ["PermanentResident", "Person"],
    "@explicit": true,
    "givenName": {},
    "familyName": {},
    "gender": {}
  }
}

That gives rise to the output zero knowledge proof

{
  "@context": [
    "https://www.w3.org/2018/credentials/v1",
    "https://w3id.org/citizenship/v1",
    "https://w3id.org/security/bbs/v1"
  ],
  "id": "https://issuer.oidp.uscis.gov/credentials/83627465",
  "type": ["PermanentResidentCard", "VerifiableCredential"],
  "description": "Government of Example Permanent Resident Card.",
  "identifier": "83627465",
  "name": "Permanent Resident Card",
  "credentialSubject": {
    "id": "did:example:b34ca6cd37bbf23",
    "type": ["Person", "PermanentResident"],
    "familyName": "SMITH",
    "gender": "Male",
    "givenName": "JOHN"
  },
  "expirationDate": "2029-12-03T12:19:52Z",
  "issuanceDate": "2019-12-03T12:19:52Z",
  "issuer": "did:example:489398593",
  "proof": {
    "type": "BbsBlsSignatureProof2020",
    "created": "2020-05-25T23:07:10Z",
    "verificationMethod": "did:example:489398593#test",
    "proofPurpose": "assertionMethod",
    "proofValue": "ABgA/4N3qygQRJlX3gmQOlJRGbO1KTXKQUmaN02xl+FiNZUDmGfa5OoKtg0RJ4wxxA08t3Vut61G/pq4yN0bygaFk5EJF6j7zFXmz9Vc7EdlDAvUkXqPaKA8inSBNv97HiZ1o5hIpoRnepW89p4JXPVrFi8XbDARSZpCg18GUuUMaPQLHKU82M/9l8tqqG1lKBOs+sRAAAAAdKRrRPj6zAz5LPZgDZJ0J2rNJjQI+JNYbV4AYEVwW37sxQ99aGGvmBk3DL0sod1V/gAAAAJMLYjmrb92zV087wO8UtFLwMj7qJuqV9VkMDghdrrc3BGtJuQgKx2GTrOb4CQxI1bf+iG0USjTktcjTlKv3X5spg3+ihOnyve0HnMWWggAW22j8b78jbl7lkYGJvzIXTzrVJ5KdYp3tXMDTAX7CLEXAAAACVY8oocA9Bz1w42F8Yv7UAPHv4pSvunXqndFOet3kWtzYHYEbO5gc42wPQtLmTtmqP6kUbQv6ruxzRmANulB8fUfy2jah/QeHKvsp907YDnSfo2wofRxa/vzsZnVriw0UmZnP0sYjbhmCkhoQZkxhqel3IkOF+H80wzvCKCl6eq5biEFMYA4bXpDX6Ap5/6WS5SSFaJRWxW+hpR/9EuQE11sGtk2W2Wn4eBrQUgVqYgPLI+U/ONaUJrh+GVJ/XXx7xxbAUf/NeQ/13AkTnYNn1fUdiOJ2oKl1lGr59udFq2tBBsyC3msTtQPYJS084355GRBur5jnzPNJ2W6Gu3ZqqQeRrVyw1gzdhVDNOE8KUm9OQ3AvCuxo8PHNrqzNvc6VA==",
    "nonce": "37pdwue1a8FWLqgwCd0QJ0IJTFhp609KtxeCTWZGnfAVE+sOBDffYez+TY/bmVy+6z4="
  }
}

Getting started as a contributor

The following describes how to get started as a contributor to this project

Prerequisites

The following is a list of dependencies you must install to build and contribute to this project

For more details see our contribution guidelines

Install

To install the package dependencies run:

yarn install --frozen-lockfile

Build

To build the project run:

yarn build

Test

To run the test in the project run:

yarn test

Security Policy

Please see our security policy for additional details about responsible disclosure of security related issues.


Copyright © MATTR Limited. Some rights reserved.
“MATTR” is a trademark of MATTR Limited, registered in New Zealand and other countries.

jsonld-signatures-bbs's People

Contributors

anton-iskryzhytskyi avatar benliumattr avatar caleb-mattr avatar chiechelski avatar colinyip avatar dependabot[bot] avatar diogo-sousa-mattr avatar haardikk21 avatar kdenhartog avatar kenhuang avatar mate-from-mattr avatar pablodenadai avatar shinitiandrei avatar timoglastra avatar tmarkovski avatar tosirisuk avatar tplooker avatar wayne-shih avatar yamdan avatar zedmattr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jsonld-signatures-bbs's Issues

unexpected type

when using this library with vc-js I am getting:

 {
      '@context': [
        'https://www.w3.org/2018/credentials/v1',
        'https://www.w3.org/2018/credentials/examples/v1',
        'https://w3id.org/zkp/v1'
      ],
      id: 'http://example.gov/credentials/3732',
      type: [ 'VerifiableCredential', 'UniversityDegreeCredential' ],
      issuer: {
        id: 'did:key:z5TcESXuYUE9aZWYwSdrUEGK1HNQFHyTt4aVpaCTVZcDXQmUheFwfNZmRksaAbBneNm5KyE52SdJeRCN1g6PJmF31GsHWwFiqUDujvasK3wTiDr3vvkYwEJHt7H5RGEKYEp1ErtQtcEBgsgY2DA9JZkHj1J9HZ8MRDTguAhoFtR4aTBQhgnkP4SwVbxDYMEZoF2TMYn3s#zUC7LTa4hWtaE9YKyDsMVGiRNqPMN3s4rjBdB3MFi6PcVWReNfR72y3oGW2NhNcaKNVhMobh7aHp8oZB3qdJCs7RebM2xsodrSm8MmePbN25NTGcpjkJMwKbcWfYDX7eHCJjPGM'
      },
      issuanceDate: '2020-03-10T04:24:12.164Z',
      credentialSubject: {
        id: 'did:key:z5TcESXuYUE9aZWYwSdrUEGK1HNQFHyTt4aVpaCTVZcDXQmUheFwfNZmRksaAbBneNm5KyE52SdJeRCN1g6PJmF31GsHWwFiqUDujvasK3wTiDr3vvkYwEJHt7H5RGEKYEp1ErtQtcEBgsgY2DA9JZkHj1J9HZ8MRDTguAhoFtR4aTBQhgnkP4SwVbxDYMEZoF2TMYn3s#zUC7LTa4hWtaE9YKyDsMVGiRNqPMN3s4rjBdB3MFi6PcVWReNfR72y3oGW2NhNcaKNVhMobh7aHp8oZB3qdJCs7RebM2xsodrSm8MmePbN25NTGcpjkJMwKbcWfYDX7eHCJjPGM',
        degree: { type: 'BachelorDegree', name: 'Bachelor of Science and Arts' }
      },
      proof: {
        type: 'https://w3c-ccg.github.io/ldp-bbs2020/context/v1#BbsBlsSignature2020',
        created: '2020-12-06T15:46:40Z',
        proofPurpose: 'assertionMethod',
        proofValue: 'rBPvc+5C69UU5rg2oRbcNLVtZP0SdlQNB9/aA1E9Xac+HkGBrjolfxm8Hk1oaaSaKKFPLjzGvHPO7O2PiUQGPMj8XTVxeWDYgnQW6U+KFtpPaOEsbwEl5PW+eLYxCu6cwxLMd6WviNhKJpM2ScBZMA==',
        verificationMethod: 'did:key:z5TcESXuYUE9aZWYwSdrUEGK1HNQFHyTt4aVpaCTVZcDXQmUheFwfNZmRksaAbBneNm5KyE52SdJeRCN1g6PJmF31GsHWwFiqUDujvasK3wTiDr3vvkYwEJHt7H5RGEKYEp1ErtQtcEBgsgY2DA9JZkHj1J9HZ8MRDTguAhoFtR4aTBQhgnkP4SwVbxDYMEZoF2TMYn3s#zUC7LTa4hWtaE9YKyDsMVGiRNqPMN3s4rjBdB3MFi6PcVWReNfR72y3oGW2NhNcaKNVhMobh7aHp8oZB3qdJCs7RebM2xsodrSm8MmePbN25NTGcpjkJMwKbcWfYDX7eHCJjPGM'
      }
    }

Specifically:

type: 'https://w3c-ccg.github.io/ldp-bbs2020/context/v1#BbsBlsSignature2020',

I would expect this to be BbsBlsSignature2020 IF BbsBlsSignature2020 is defined in https://w3id.org/zkp/v1.

Create BBS+ signatures that features a privacy preserving subject authentication binding

Currently the BBS signatures in the initial implementation, do not support commited values in the signature being generated, the following needs to be done to accomplish this

  • Break out the required API from URSA and expose it across the FFI.
  • Consume it in the FFI layer of this library
  • Expand the top level API of a BBS signature to take in the commitment and pass it to URSA for signing.
  • Create a BLS12381 commitment key pair? E.g a class that wraps the secret and a particular commitment?

compatibility between did-key and bls keypair

Hello ,

I'm working on your example published in the sample folder .
I want to replace the did example by a real decentralized identity , so i decided to use did-method-key-js ( https://github.com/digitalbazaar/did-method-key-js )
This is your keypair used in the exemple after adding the did keys :
image

I have some issues with that because i can't generate a did doc using Bls12381G2KeyPair , i have got this error :
image
do you have any idea to solve this issue ?

Question: How to generate a dynamic key pair that works with the samples?

This is a question, not a bug (I assume). Is there a forum (e.g. rocket chat or slack channel) in which to ask these questions?

That said, my question is how to generate a dynamic key pair that works with the samples? I am trying to write an issuer and holder to implement an issuance flow.

I am doing the same as found in the demo_single.ts sample except instead of loading the static key pair as is done at https://github.com/mattrglobal/jsonld-signatures-bbs/blob/master/sample/ts-node/src/demo_single.ts#L65, I am dynamically generating the key pair by calling "Bls12381G2KeyPair.generate()" as is required by a real issuer. The sign operation does not return an error but the verify fails with the following error:

No "verificationMethod" found in proof. at BbsBlsSignature2020.getVerificationMethod (node_modules/@mattrglobal/jsonld-signatures-bbs/src/BbsBlsSignature2020.ts:333:13

When I look at the static key pair that is loaded from https://github.com/mattrglobal/jsonld-signatures-bbs/blob/master/sample/ts-node/src/data/keyPair.json, it has an "id" field from which the verificationMethod is derived; however, when I generate a key pair using "Bls12381G2KeyPair.generate()", it is of the following form and does not have an "id" field.

{ "type":"Bls12381G2Key2020", "privateKeyBuffer":, ..., "publicKeyBuffer": ... }

Any help is appreciated.

Removing credentialSubject.id causes null credentialSubject

Impressed with your demo and sessions in IIW32, I tried to use this to implement a kind of anonymous credentials, where derived proof does not contain explicit correlating factors such as credential id & holder's id.

So first I prepared the following VC without credential id (id) nor holder's id (credentialSubject.id):

{
    "@context": [
        "https://www.w3.org/2018/credentials/v1",
        "https://w3id.org/citizenship/v1",
        "https://w3id.org/security/v3-unstable"
    ],
    "type": [
        "VerifiableCredential",
        "PermanentResidentCard"
    ],
    "issuer": "did:example:489398593",
    "identifier": "83627465",
    "name": "Permanent Resident Card",
    "description": "Government of Example Permanent Resident Card.",
    "issuanceDate": "2019-12-03T12:19:52Z",
    "expirationDate": "2029-12-03T12:19:52Z",
    "credentialSubject": {
        "type": [
            "PermanentResident",
            "Person"
        ],
        "givenName": "JOHN",
        "familyName": "SMITH",
        "gender": "Male",
        "image": "data:image/png;base64,iVBORw0KGgokJggg==",
        "residentSince": "2015-01-01",
        "lprCategory": "C09",
        "lprNumber": "999-999-999",
        "commuterClassification": "C1",
        "birthCountry": "Bahamas",
        "birthDate": "1958-07-17"
    },
    "proof": {
        "type": "BbsBlsSignature2020",
        "created": "2021-05-20T10:47:06Z",
        "proofPurpose": "assertionMethod",
        "proofValue": "uDZeTO5az28aSmHa6jZHassZ/Vl7MlIUSG72kAOcaiUqLZ0AZEGNBpbZOGm3RG6SA4pBgFhImka1gBmqrq3BiKTfpgayF9paPZdWywFpZ55OuKOnaa5h2yTKzV/uWTE1IXmtxn78lmt5pGIu1QxAqQ==",
        "verificationMethod": "did:example:489398593#test"
    }
}

Then prepared the following JSON-LD frame to hide the other correlating factors, i.e., identifier, issuanceDate, expirationDate, and all the attributes except for commuterClassification from the above VC. (I chose commuterClassification just as an example of less-correlating factors)

{
    "@context": [
        "https://www.w3.org/2018/credentials/v1",
        "https://w3id.org/citizenship/v1",
        "https://w3id.org/security/v3-unstable"
    ],
    "type": [
        "VerifiableCredential",
        "PermanentResidentCard"
    ],
    "@explicit": true,
    "issuer": {},
    "name": {},
    "description": {},
    "credentialSubject": {
        "type": [
            "PermanentResident",
            "Person"
        ],
        "@explicit": true,
        "commuterClassification": {}
    }
}

That would give rise to the following anonymous proof only showing that the prover (holder) is classified as C1 according to the government (issuer).

{
    "@context": [
        "https://www.w3.org/2018/credentials/v1",
        "https://w3id.org/citizenship/v1",
        "https://w3id.org/security/v3-unstable"
    ],
    "id": "urn:bnid:_:c14n0",
    "type": [
        "PermanentResidentCard",
        "VerifiableCredential"
    ],
    "description": "Government of Example Permanent Resident Card.",
    "name": "Permanent Resident Card",
    "credentialSubject": {
        "id": "urn:bnid:_:c14n1",
        "type": [
            "Person",
            "PermanentResident"
        ],
        "commuterClassification": "C1"
    },
    "issuer": "did:example:489398593",
    "proof": {
        "type": "BbsBlsSignatureProof2020",
        "created": "2021-05-20T10:47:06Z",
        "nonce": "08RvG0XlkxzTEHOAlVA/n3+X+EwHjMpwrYz3n3uFxO08DUbIOB/wG9JThCFhWNbIhwk=",
        "proofPurpose": "assertionMethod",
        "proofValue": "ABkALBPfoOgWKdyTzL7AKEcgXDuM++AQph0Xsk/EIf3LBYoNFeopQhM/m10okCoMPJwENm3hrKe6Ch+bRRiNSFLGmY9CU5CYLkV0YqZuX4JS3ejnI0iyOdYodcwGZzN6TWJw4z0qiFabXGHXd1l1bSDN9klPheJSsVbbBxMUFPMk5LAF5G7ENdYRmSN/bTVufsilCzudAAAAdIsnE4A2rBf0n8NraMb516NFVVnu7Nj1RQdynvgWJcYQEt8fNuhAkEW0+gCbGXmXWAAAAAJBmlfIJpP0CYvf5FCaxR4lgz/vURlIdPKunpas1FXZnwRCuB3EvLewbQrDGTI/vFCBcq9kIffBadcdPCvpu5Lnl85kTuPtKMr+hC7gBd27rmBd36xrzFka+vyclN1h0IgCINpgh17/JnjuaayOgCVWAAAADm/tGDRgaoyFBdOVIncjyaObn8LMwUgScMETJfpgklsgJdOOzbi/NAxEAT0EsEN4dn3+IsgKPCxo7keJcp72FvI3nCM8fiCKtr4TCV142Grhr7DogNB3ewrkF+fjaEq9jGZw9K4CukFhHJaVxjFXfCfbBY5vA0mpPOH7n5DVNxu3MWLs1h6u+pi/jXf1v24a3tJyRlR+UdKAFmvGKd67tWVDZSNkZwITTdryvvNDH8WhJFmqkDEBXfq7E3MGatZWGylgzBYeQ600/GmjPSAYyIk6DGBXh2D0P16DUhAcIqMtA1lyRe47CaWTxhUGj7qZ/Jg3kPvJ+S9Onr2ADybw2sQ1hY0bRM5EAGCi2Vlnl7a42VXc7LWNds6RjZ3+7HSEXQuA59Sw6DbpYpFy5+4gLbUoAYInFTcyDnGZ89rOqpDFLwsNAdXncacfhRzIHL3qhLVMl/d1GQHg+pPkmEADLPJKyAETS0KhaaEX1cxc6rN9fFEjRsQZpuLn0XiKVyHOTzQ0frxBI/GsiSJ9J/jj2jaB72CG/dVj2KkX4enns+DJA9G1lMVtupZRq6EBpQUiW4uSc67eG+c33Oj2Q0tCceQ=",
        "verificationMethod": "did:example:489398593#test"
    }
}

However, what I actually got is null credentialSubject as follows. The case might be the same as the ones mentioned in issue #121 and w3c/vc-di-bbs#45.

{
    "@context": [
        "https://www.w3.org/2018/credentials/v1",
        "https://w3id.org/citizenship/v1",
        "https://w3id.org/security/v3-unstable"
    ],
    "id": "urn:bnid:_:c14n0",
    "type": [
        "PermanentResidentCard",
        "VerifiableCredential"
    ],
    "description": "Government of Example Permanent Resident Card.",
    "name": "Permanent Resident Card",
    "credentialSubject": null, // <-- unexpected
    "issuer": "did:example:489398593",
    "proof": {
        "type": "BbsBlsSignatureProof2020",
        "created": "2021-05-20T10:47:06Z",
        "nonce": "08RvG0XlkxzTEHOAlVA/n3+X+EwHjMpwrYz3n3uFxO08DUbIOB/wG9JThCFhWNbIhwk=",
        "proofPurpose": "assertionMethod",
        "proofValue": "ABkALBPfoOgWKdyTzL7AKEcgXDuM++AQph0Xsk/EIf3LBYoNFeopQhM/m10okCoMPJwENm3hrKe6Ch+bRRiNSFLGmY9CU5CYLkV0YqZuX4JS3ejnI0iyOdYodcwGZzN6TWJw4z0qiFabXGHXd1l1bSDN9klPheJSsVbbBxMUFPMk5LAF5G7ENdYRmSN/bTVufsilCzudAAAAdIsnE4A2rBf0n8NraMb516NFVVnu7Nj1RQdynvgWJcYQEt8fNuhAkEW0+gCbGXmXWAAAAAJBmlfIJpP0CYvf5FCaxR4lgz/vURlIdPKunpas1FXZnwRCuB3EvLewbQrDGTI/vFCBcq9kIffBadcdPCvpu5Lnl85kTuPtKMr+hC7gBd27rmBd36xrzFka+vyclN1h0IgCINpgh17/JnjuaayOgCVWAAAADm/tGDRgaoyFBdOVIncjyaObn8LMwUgScMETJfpgklsgJdOOzbi/NAxEAT0EsEN4dn3+IsgKPCxo7keJcp72FvI3nCM8fiCKtr4TCV142Grhr7DogNB3ewrkF+fjaEq9jGZw9K4CukFhHJaVxjFXfCfbBY5vA0mpPOH7n5DVNxu3MWLs1h6u+pi/jXf1v24a3tJyRlR+UdKAFmvGKd67tWVDZSNkZwITTdryvvNDH8WhJFmqkDEBXfq7E3MGatZWGylgzBYeQ600/GmjPSAYyIk6DGBXh2D0P16DUhAcIqMtA1lyRe47CaWTxhUGj7qZ/Jg3kPvJ+S9Onr2ADybw2sQ1hY0bRM5EAGCi2Vlnl7a42VXc7LWNds6RjZ3+7HSEXQuA59Sw6DbpYpFy5+4gLbUoAYInFTcyDnGZ89rOqpDFLwsNAdXncacfhRzIHL3qhLVMl/d1GQHg+pPkmEADLPJKyAETS0KhaaEX1cxc6rN9fFEjRsQZpuLn0XiKVyHOTzQ0frxBI/GsiSJ9J/jj2jaB72CG/dVj2KkX4enns+DJA9G1lMVtupZRq6EBpQUiW4uSc67eG+c33Oj2Q0tCceQ=",
        "verificationMethod": "did:example:489398593#test"
    }
}

I wrote a small patch in order to get my expected result (derived proof with credentialSubject) by modifying the way of converting blank node ids inside and now preparing it as PR. Hope this would help.

(I know the above example is an extreme case and not necessarily a practical one. I just wanted to evaluate the privacy-preserving ability of JSON-LD ZKP with BBS+ as an enabler of anonymous credential)

Ursa dependency

Currently this repository depends on URSA through an included binary in the repository, this needs to change to support the different javascript environments e.g browser via WASM and react-native through a native binary consumable on IOS and android.

Review FFI types being used

Currently we are using JSON structures serialised as strings across the FFI which has a performance impact in signing and verifying signatures, review the need for this and potentially implement more efficient data types for transmitting this information.

Absolute IRI "sec:BbsBlsSignature2020" confused with prefix "sec".

   "@mattrglobal/jsonld-signatures-bbs": "0.7.1-unstable.2673a0a",

I believe this is caused by the interaction between sec-v3-unstable...

type: "sec:BbsBlsSignature2020"

imo this call to super should be with

"https://w3id.org/security#BbsBlsSignature2020"

See similar approach taken here:

https://github.com/w3c-ccg/lds-jws2020/blob/master/packages/json-web-signature-2020/src/JsonWebSignature.ts#L25

Sample VC document uses conflicting contexts

The test documents test_vc.json and test_signed_vc.json require contexts that are conflicting and unable to be processed. For example the term Ed25519Signature2018 is defined in both https://www.w3.org/2018/credentials/v1 and https://w3id.org/security/v3-unstable as protected. This breaks LD tooling.
Temporary fix that passes is to revert security-v3 to https://w3c-ccg.github.io/ldp-bbs2020/contexts/v1.
I'm assuming this issue may be tracked elsewhere, I just ran into it trying to use the test vectors.

Consider other options for dealing with `@included` tag

While adding support for using multiple proofs when deriving proofs, the JSON-LD tooling started restructuring the proof property when it's an array to look like this:

{
   "@context":[
      "http://schema.org/",
      "https://w3id.org/security/v2",
      "https://w3c-ccg.github.io/ldp-bbs2020/context/v1"
   ],
   "id":"urn:bnid:_:c14n0",
   "type":"Person",
   "firstName":"Jane",
   "lastName":"Does",
   "proof":{
      "@included":[
         {
            "type":"BbsBlsSignatureProof2020",
            "created":"2020-07-21T04:16:41Z",
            "nonce":"G4C8oLYnaEdi3A7bjcj02EDT5FsOHwvdaO8q4FABCXKlcF9aKMfa38JCAytyVJIbTB4=",
            "proofPurpose":"assertionMethod",
            "proofValue":"AAoCr5idePIMqXPqImvUKZ4SIO+XFQRg5izZ1OuFk1TIGZsKOU/6/gyGZVbzG0t6YfBJpJlC2w6wGhZZDzNv0r63tkZXZXREpRrtIKUUp8TyR+GExcn3BHy5W0Of23LYP30giJEyt8iK3IFwV9u5u/e5a+iTTrfrWTIR18rcJzmMRq63UqyUeYOC7f2xQo676Z0WsQAAAHSww0m4k/iEuQ1Zkl/9f/Cjd4PZVSe0BV+Z99Fmq4nfSYOxdw73AaHE5TNU2bBLcGMAAAACFQ6I0dPGvNmdGBI28kGhyErRtl13eiRhdeYa5UrpXNRJfd/+1Jk8s2rNQ6HRBqVHxTls1D8VeI4CdBOuk6HDZ5OSLKvR2y8Ef9LF1EEobJqbhuM63qIkDcracUmUq3RRFjzjP1NjPUmCnrsIDN4xZQAAAAVR//qK2tEUKj8+UmWqAoaGmOPnI2owBEOqYw/VxgaTi2rhgLg7TEWMPjqk5zgdKw8q6PjtMupFjIUYSQrb8D/VNsETX4EAJlw39YomZ7d5KYVU65KSRToeurgQge7TWhhLwKkkdsJtruK5837u8IePxKhXVLtXFZ/yHW0+HBctUyl/o7lLcJJAq+M60BQX9RO3KZWC+qyT7mEHPtzTXjVT",
            "verificationMethod":"did:example:489398593#test"
         },
         {
            "type":"BbsBlsSignatureProof2020",
            "created":"2020-07-21T04:16:41Z",
            "nonce":"J1eKj7MWLlUpArBC9Er33xAp+dX1M4/sn+JrKzyAFoCMGCPc39adDnIMdtAUNRDjBic=",
            "proofPurpose":"assertionMethod",
            "proofValue":"AAoCr5Kmw2rb5Q+tOZBjEMtMaq9BJW1Xu3oaTIyoL8+E1cPAt+w9Wk1LFVq6OqpJUi4LeZDuODIH+hfIODA5V8UgrHLvd7h4zzt4X6+9p9wLs864t8+PC6Fga/6Rn2bHomLt8YuYXLgkJwAQOprnSB8cn8UK50spQrlYuLBpg4KwjnB1gPXO/5Dz82jNnQGC6iBZSQAAAHSpRhUs0OF8HDq9dZVpxWqpVpnSUrk2G/gckaf31vcjkzd8i4FOl6ktbb5tQtAlLhwAAAACD5du3LggpqdIHJqLEfmZ68iFTrQua7KlPjTMkBCK64A7leUWw+SNiFcJjYDrqcKWXg1m2hruDIpGJxjqdbuSpI3qpzLgPMEEsV0EkMMlFB0S3MNJM44+n+EPP3RvTRJh7tYQoUJCIHXiwZhBVlXsWgAAAAUPfNtowQxhJ2cdrlxy9CG6u4jXcAFwTlN3z/A7Gp5G/ky6XHbo5Lw7ItyBukNYV9QOcC2esxqW7NHzFcN32bKgRlIwTl24/LaD/Cp5oRwku3HUdgbIIAH7awGUb6bez9AeOw+BaMSpArlHjr3SU2ORICFsp7LJ46pd5Y/QL0mciRAvD6XLWL1xl6JpcAq49mIwzd3ZtgeOFepZxr/iQ/5M",
            "verificationMethod":"did:example:489398593#test"
         }
      ]
   }
}

Rather the output needs to look like this to properly validate the signatures:

{
      "@context":[
         "http://schema.org/",
         "https://w3id.org/security/v2",
         "https://w3c-ccg.github.io/ldp-bbs2020/context/v1"
      ],
      "id":"urn:bnid:_:c14n0",
      "type":"Person",
      "firstName":"Jane",
      "lastName":"Does"
   },
   "proof":[
      {
         "type":"BbsBlsSignatureProof2020",
         "nonce":"G4C8oLYnaEdi3A7bjcj02EDT5FsOHwvdaO8q4FABCXKlcF9aKMfa38JCAytyVJIbTB4=",
         "proofValue":"AAoCr5idePIMqXPqImvUKZ4SIO+XFQRg5izZ1OuFk1TIGZsKOU/6/gyGZVbzG0t6YfBJpJlC2w6wGhZZDzNv0r63tkZXZXREpRrtIKUUp8TyR+GExcn3BHy5W0Of23LYP30giJEyt8iK3IFwV9u5u/e5a+iTTrfrWTIR18rcJzmMRq63UqyUeYOC7f2xQo676Z0WsQAAAHSww0m4k/iEuQ1Zkl/9f/Cjd4PZVSe0BV+Z99Fmq4nfSYOxdw73AaHE5TNU2bBLcGMAAAACFQ6I0dPGvNmdGBI28kGhyErRtl13eiRhdeYa5UrpXNRJfd/+1Jk8s2rNQ6HRBqVHxTls1D8VeI4CdBOuk6HDZ5OSLKvR2y8Ef9LF1EEobJqbhuM63qIkDcracUmUq3RRFjzjP1NjPUmCnrsIDN4xZQAAAAVR//qK2tEUKj8+UmWqAoaGmOPnI2owBEOqYw/VxgaTi2rhgLg7TEWMPjqk5zgdKw8q6PjtMupFjIUYSQrb8D/VNsETX4EAJlw39YomZ7d5KYVU65KSRToeurgQge7TWhhLwKkkdsJtruK5837u8IePxKhXVLtXFZ/yHW0+HBctUyl/o7lLcJJAq+M60BQX9RO3KZWC+qyT7mEHPtzTXjVT",
         "verificationMethod":"did:example:489398593#test",
         "proofPurpose":"assertionMethod",
         "created":"2020-07-21T04:16:41Z"
      },
      {
         "type":"BbsBlsSignatureProof2020",
         "nonce":"J1eKj7MWLlUpArBC9Er33xAp+dX1M4/sn+JrKzyAFoCMGCPc39adDnIMdtAUNRDjBic=",
        "proofValue":"AAoCr5Kmw2rb5Q+tOZBjEMtMaq9BJW1Xu3oaTIyoL8+E1cPAt+w9Wk1LFVq6OqpJUi4LeZDuODIH+hfIODA5V8UgrHLvd7h4zzt4X6+9p9wLs864t8+PC6Fga/6Rn2bHomLt8YuYXLgkJwAQOprnSB8cn8UK50spQrlYuLBpg4KwjnB1gPXO/5Dz82jNnQGC6iBZSQAAAHSpRhUs0OF8HDq9dZVpxWqpVpnSUrk2G/gckaf31vcjkzd8i4FOl6ktbb5tQtAlLhwAAAACD5du3LggpqdIHJqLEfmZ68iFTrQua7KlPjTMkBCK64A7leUWw+SNiFcJjYDrqcKWXg1m2hruDIpGJxjqdbuSpI3qpzLgPMEEsV0EkMMlFB0S3MNJM44+n+EPP3RvTRJh7tYQoUJCIHXiwZhBVlXsWgAAAAUPfNtowQxhJ2cdrlxy9CG6u4jXcAFwTlN3z/A7Gp5G/ky6XHbo5Lw7ItyBukNYV9QOcC2esxqW7NHzFcN32bKgRlIwTl24/LaD/Cp5oRwku3HUdgbIIAH7awGUb6bez9AeOw+BaMSpArlHjr3SU2ORICFsp7LJ46pd5Y/QL0mciRAvD6XLWL1xl6JpcAq49mIwzd3ZtgeOFepZxr/iQ/5M",
         "verificationMethod":"did:example:489398593#test",
         "proofPurpose":"assertionMethod",
         "created":"2020-07-21T04:16:41Z"
      }
   ]
}

Right now the solution for this is to just remove the @included property before returning the document from the deriveProof API. This is a working solution, but this issue is being created to consider other potential options as well.

Invalid Frame on verification of a BBS signature

Im uncertain where this fails but seems to me that it comes from this lib.

I have a strane error coming from trying to recreate the bbs signature sample with libraries that I want to use.
I try to great a keypair with did-key.js and use that to sign.
That works
Then I want to verify but get a strange JSON LD verification error, and dont know where to start.

Any thoughts?

Screenshot 2021-05-06 at 17 03 15

Screenshot 2021-05-06 at 17 03 30

Stub out the re-specification format of the specification

Following the process set out by the other CCG and W3C work items, setup a the base specification document in a re-spec format such that we can enable Github pages on it in the future to render it like other community drafts.

bundle with src?

Is there anyway to bundle this with the src dir? debugging problems hits a brick wall when I land in here

Enable Codecov

Enable codecov as a tool for tracking test coverage in the repository

Issue with change log generation

Running yarn version:release causes the change log to detect all previously released changes as new ones leading to have to do a manual change log adjustment.

Not able to match suites using JSON ld signatures

Intro

My verification method fails because JSON ld is not able to match suit and type. With a credential I have made earlier.
But as you can see, there are some mismatch when jsonld wants to match the proof.
Trying to match with a precursor called sec:

Screenshot 2021-06-16 at 14 13 08

That leads to 0 results and fails with no proofs to match.

Screenshot 2021-06-16 at 14 14 19

Where is this problem laying?

Solution

Doing return this.type.includes(proof.type); makes my software happy again, but I know that that is not an accepted solution, because the semantics of things becomes diffuse becuase of that. But it is the only issue I have, this missmatch of matching coming from somewhere

Data for testing

My current document for verification looks like this

{
  '@context': [
    'https://www.w3.org/2018/credentials/v1',
    'https://w3id.org/traceability/v1',
    'https://w3id.org/security/bbs/v1'
  ],
  id: 'https://www.diwala.io/4eeope1d1d',
  issuer: 'did:key:zUC76TFzdrf6kvBFoe1kQg3QZsupm6aatPr46eXMnPm86p5LooBf7ieWLerrNsvSVJtpujpXq4XPYSdc9fViBmAAmxAhdW8meRyJ2GDzAa5WKL7ja7EH6HiUxhEuK4dhxXLdFuN',
  type: [ 'VerifiableCredential', 'EmailVerification' ],
  name: 'Verified email',
  description: 'This is a credential of email attribute that has been verified through sending an email to the owner',
  issuanceDate: 'Mon Jun 14 2021',
  credentialSubject: { type: [ 'Person' ], email: '[email protected]' },
  proof: {
    type: 'BbsBlsSignature2020',
    created: '2021-06-14T20:59:15Z',
    proofPurpose: 'assertionMethod',
    proofValue: 'tHGx5dZ+CUBp2FFRyziz57Rn1Fmp1hMKu1hBkg4kkwStgLy1+zYH066j1+CgXTFIYUHlKfzccE4m7waZyoLEkBLFiK2g54Q2i+CdtYBgDdkUDsoULSBMcH1MwGHwdjfXpldFNFrHFx/IAvLVniyeMQ==',
    verificationMethod: 'did:key:zUC76TFzdrf6kvBFoe1kQg3QZsupm6aatPr46eXMnPm86p5LooBf7ieWLerrNsvSVJtpujpXq4XPYSdc9fViBmAAmxAhdW8meRyJ2GDzAa5WKL7ja7EH6HiUxhEuK4dhxXLdFuN#zUC76TFzdrf6kvBFoe1kQg3QZsupm6aatPr46eXMnPm86p5LooBf7ieWLerrNsvSVJtpujpXq4XPYSdc9fViBmAAmxAhdW8meRyJ2GDzAa5WKL7ja7EH6HiUxhEuK4dhxXLdFuN'
  }
}

Environment

Im using @mattrglobal/jsonld-signatures-bbs -- 0.10.0 -- BbsBlsSignature2020 on both sides, Issuance and Verifications.
Using "jsonld-signatures": "^9.0.2" directly on verification side and on the issuer side im using

yarn why v1.22.10
[1/4] 🤔  Why do we have the module "jsonld-signatures"...?
[2/4] 🚚  Initialising dependency graph...
[3/4] 🔍  Finding dependency...
[4/4] 🚡  Calculating file sizes...
=> Found "[email protected]"
info Has been hoisted to "jsonld-signatures"
info This module exists because it's specified in "dependencies".
info Disk size without dependencies: "136KB"
info Disk size with unique dependencies: "2.81MB"
info Disk size with transitive dependencies: "7.27MB"
info Number of shared dependencies: 12
=> Found "@mattrglobal/jsonld-signatures-bbs#[email protected]"
info This module exists because "@mattrglobal#jsonld-signatures-bbs" depends on it.
info Disk size without dependencies: "2.34MB"
info Disk size with unique dependencies: "6.93MB"
info Disk size with transitive dependencies: "9.74MB"
info Number of shared dependencies: 16
✨  Done in 9.85s.

Derive proofs for documents signed by more than one key

I am working on a digital contract system where more than one party will be signing a document. Currently, it seems that generating multiple signatures is handled by the underlying libraries, but not for deriving proofs. In the sample app, I can copy:

const signedDocument = await sign(inputDocument, {
  suite: new BbsBlsSignature2020({ key: keyPair }),
  purpose: new purposes.AssertionProofPurpose(),
  documentLoader,
  compactProof: false
});

to

const signedDocument2 = await sign(signedDocument, {
  suite: new BbsBlsSignature2020({ key: keyPair }),
  purpose: new purposes.AssertionProofPurpose(),
  documentLoader,
  compactProof: false
});

And it will generate a document with an array for proof element. Verification also succeeds. The sample continues to:

const derivedProof = await deriveProof(signedDocument, revealDocument, {
  suite: new BbsBlsSignatureProof2020(),
  documentLoader
})

Where it fails in BbsBlsSignatureProof2020 because proof.type is undefined. proof is a hash with keys '0' and '1'. I added the following shim to get by that error:

if(proof['0']) proof = proof['0']

There is then an error that the message and signature don't match unless you add the line:

proof['@context'] = 'https://w3id.org/security/v2'

With these changes, a single proof can be derived and verified. The proper behavior though is to return an array of proofs in the derived document and to verify them all.

TypeError: suite.ensureSuiteContext is not a function

I'm just starting to use this library, so I'm probably doing something wrong but it is not obvious to me. Thanks for any help.

Should the BbsBlsSignature2020 class extend suites.LinkedDataSignature rather than suites.LinkedDataProof, as it seems like that would fix my problem since the ensureSuiteContext function is defined in LinkedDataSignature which extends LinkedDataProof.

I am getting the following error with my sample app (see below):

TypeError: suite.ensureSuiteContext is not a function
    at Object.sign (/Users/keith/dev/agency/server/src/lib/node_modules/jsonld-signatures/lib/jsonld-signatures.js:61:9)
    at BBS.<anonymous> (/Users/keith/dev/agency/server/src/lib/bbs.js:65:66)
    at step (/Users/keith/dev/agency/server/src/lib/bbs.js:33:23)
    at Object.next (/Users/keith/dev/agency/server/src/lib/bbs.js:14:53)
    at /Users/keith/dev/agency/server/src/lib/bbs.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/keith/dev/agency/server/src/lib/bbs.js:4:12)
    at BBS.signDoc (/Users/keith/dev/agency/server/src/lib/bbs.js:57:16)
    at /Users/keith/dev/agency/server/src/lib/bbs.js:84:46
    at step (/Users/keith/dev/agency/server/src/lib/bbs.js:33:23)

Here is my sample app.

import { Bls12381G2KeyPair, BbsBlsSignature2020, BbsBlsSignatureProof2020, deriveProof } from "@mattrglobal/jsonld-signatures-bbs";
import { extendContextLoader, sign, verify, purposes } from "jsonld-signatures";

const purpose = new purposes.AssertionProofPurpose();

export class BBS {

    constructor() { }

    public async generateKeyPair(): Promise<Bls12381G2KeyPair> {
        return await Bls12381G2KeyPair.generate();
    }

    public async signDoc(keyPair: Bls12381G2KeyPair, doc: any): Promise<any> {
        const suite = new BbsBlsSignature2020({ key: keyPair });
        const opts = { suite, purpose };
        return await sign(doc, opts);
    }
}

async function main() {
    const bbs = new BBS();
    const kp = await bbs.generateKeyPair();
    const signedDoc = await bbs.signDoc(kp, inputDoc);
    console.log(`Signed doc: ${JSON.stringify(signedDoc)}`);
}

const inputDoc = {
    "@context": [
        "https://www.w3.org/2018/credentials/v1",
        "https://w3id.org/citizenship/v1",
        "https://w3id.org/security/bbs/v1"
    ],
    "id": "https://issuer.oidp.uscis.gov/credentials/83627465",
    "type": ["VerifiableCredential", "PermanentResidentCard"],
    "issuer": "did:example:489398593",
    "identifier": "83627465",
    "name": "Permanent Resident Card",
    "description": "Government of Example Permanent Resident Card.",
    "issuanceDate": "2019-12-03T12:19:52Z",
    "expirationDate": "2029-12-03T12:19:52Z",
    "credentialSubject": {
        "id": "did:example:b34ca6cd37bbf23",
        "type": ["PermanentResident", "Person"],
        "givenName": "JOHN",
        "familyName": "SMITH",
        "gender": "Male",
        "image": "data:image/png;base64,iVBORw0KGgokJggg==",
        "residentSince": "2015-01-01",
        "lprCategory": "C09",
        "lprNumber": "999-999-999",
        "commuterClassification": "C1",
        "birthCountry": "Bahamas",
        "birthDate": "1958-07-17"
    },
};

// tslint:disable-next-line: no-floating-promises
main();

Various warnings when bundling with CRA

./node_modules/@transmute/did-key-bls12381/node_modules/@mattrglobal/bbs-signatures/lib/wasm.js
Critical dependency: the request of a dependency is an expression

./node_modules/@transmute/did-key-bls12381/node_modules/@mattrglobal/node-bbs-signatures/lib/bls12381.js
Critical dependency: the request of a dependency is an expression

./node_modules/@transmute/did-key-bls12381/node_modules/@mattrglobal/node-bbs-signatures/lib/bls12381toBbs.js
Critical dependency: the request of a dependency is an expression

./node_modules/@transmute/did-key-bls12381/node_modules/@mattrglobal/node-bbs-signatures/lib/bbsSignature.js
Critical dependency: the request of a dependency is an expression

./node_modules/@mattrglobal/node-bbs-signatures/lib/bls12381.js
Critical dependency: the request of a dependency is an expression

./node_modules/@mattrglobal/node-bbs-signatures/lib/bls12381toBbs.js
Critical dependency: the request of a dependency is an expression

./node_modules/@mattrglobal/node-bbs-signatures/lib/bbsSignature.js
Critical dependency: the request of a dependency is an expression

Invalid VC JSON-LD documents in sample

At https://github.com/mattrglobal/jsonld-signatures-bbs/blob/master/sample/src/data/inputDocument.json used in a sample script, there is one unreachable context https://w3c-ccg.github.io/ldp-bbs2020/context/v1. This results in errors in different JSON-LD operations.
For example, if one tries to get Compacted form of the document using https://json-ld.org/playground/, he will get processing error like

 jsonld.InvalidUrl: Dereferencing a URL did not result in a valid JSON-LD object. Possible causes are an inaccessible URL perhaps due to a same-origin policy (ensure the server uses CORS if you are using client-side JavaScript), too many redirects, a non-JSON response, or more than one HTTP Link Header was provided for a remote context.

The same observes when using Golang library (https://github.com/piprate/json-gold):

failed to normalize JSON-LD document: loading remote context failed: Dereferencing a URL did not result in a valid JSON-LD context: https://w3c-ccg.github.io/ldp-bbs2020/context/v1

Nesting and frames support

{
  "@context": {"a": "https://example.com/a", "a1": "https://example.com/a1", "b": "https://example.com/b", "c": "https://example.com/c"},
  "a":{
    "b": {
      "c": "hello"
    }
  },
  "a1": "hello2"
}
{
  "@context": {"a": "https://example.com/a", "a1": "https://example.com/a1", "b": "https://example.com/b", "c": "https://example.com/c"},
 "@explicit": true,
  "a": {
   "@explicit": true,
    "b":{}
   }
}

trying to figure out how to get deriveProof on nest claims, for example:

{
    "@context": [
      "https://www.w3.org/2018/credentials/v1",
      "https://www.w3.org/2018/credentials/examples/v1",
      "https://w3c-ccg.github.io/ldp-bbs2020/context/v1"
    ],
    "id": "http://example.gov/credentials/3732",
    "type": [
      "VerifiableCredential",
      "UniversityDegreeCredential"
    ],
    "issuer": {
      "id": "did:key:z5TcESXuYUE9aZWYwSdrUEGK1HNQFHyTt4aVpaCTVZcDXQmUheFwfNZmRksaAbBneNm5KyE52SdJeRCN1g6PJmF31GsHWwFiqUDujvasK3wTiDr3vvkYwEJHt7H5RGEKYEp1ErtQtcEBgsgY2DA9JZkHj1J9HZ8MRDTguAhoFtR4aTBQhgnkP4SwVbxDYMEZoF2TMYn3s"
    },
    "issuanceDate": "2020-03-10T04:24:12.164Z",
    "credentialSubject": {
      "id": "did:key:z5TcESXuYUE9aZWYwSdrUEGK1HNQFHyTt4aVpaCTVZcDXQmUheFwfNZmRksaAbBneNm5KyE52SdJeRCN1g6PJmF31GsHWwFiqUDujvasK3wTiDr3vvkYwEJHt7H5RGEKYEp1ErtQtcEBgsgY2DA9JZkHj1J9HZ8MRDTguAhoFtR4aTBQhgnkP4SwVbxDYMEZoF2TMYn3s#zUC7LTa4hWtaE9YKyDsMVGiRNqPMN3s4rjBdB3MFi6PcVWReNfR72y3oGW2NhNcaKNVhMobh7aHp8oZB3qdJCs7RebM2xsodrSm8MmePbN25NTGcpjkJMwKbcWfYDX7eHCJjPGM",
      "degree": {
        "type": "BachelorDegree",
        "name": "Bachelor of Science and Arts"
      }
    },
    "proof": {
      "type": "BbsBlsSignature2020",
      "created": "2020-12-06T16:10:24Z",
      "proofPurpose": "assertionMethod",
      "proofValue": "sKNVGJssWdZcvmCqvcfgz7s64Ibj0ZfqSmZIwgy+yIhCUOlWflsBKCfVNGAPfd8yW/pryt87c7ho/PAJofdFZZB97gpQkpisI/+Rcs2xLtVRrpTiu4YU3sXEFbgPjA3GY/fZOpdFTABVutDvckchLw==",
      "verificationMethod": "did:key:z5TcESXuYUE9aZWYwSdrUEGK1HNQFHyTt4aVpaCTVZcDXQmUheFwfNZmRksaAbBneNm5KyE52SdJeRCN1g6PJmF31GsHWwFiqUDujvasK3wTiDr3vvkYwEJHt7H5RGEKYEp1ErtQtcEBgsgY2DA9JZkHj1J9HZ8MRDTguAhoFtR4aTBQhgnkP4SwVbxDYMEZoF2TMYn3s#zUC7LTa4hWtaE9YKyDsMVGiRNqPMN3s4rjBdB3MFi6PcVWReNfR72y3oGW2NhNcaKNVhMobh7aHp8oZB3qdJCs7RebM2xsodrSm8MmePbN25NTGcpjkJMwKbcWfYDX7eHCJjPGM"
    }
  }

with

   const deriveProofFrame = {
      "@context": [
        "https://www.w3.org/2018/credentials/v1",
        "https://www.w3.org/2018/credentials/examples/v1",
        "https://w3c-ccg.github.io/ldp-bbs2020/context/v1",
      {
        "degree": "https://example.com/degree"
      }
      ],
      "type": ["VerifiableCredential", "UniversityDegreeCredential"],
      "@explicit": true,
      "credentialSubject": {
        "@explicit": true,
        degree: {
          name: {}
        }
      }
    }

Create the BBS proof module

Create the Linked Data proof class that takes in a BBS signature and a list of the to be revealed attributes and generates a linked data proof (zero knowledge proof).

Safe hash to generator functionality in URSA

We need to deterministically derive the generators for the statements to be signed. Creating these generators must be done using an algorithm which safely generates these values.

This algorithm is called simplified SWU, the following links detail how it works

https://tools.ietf.org/html/draft-irtf-cfrg-hash-to-curve-06

https://github.com/cfrg/draft-irtf-cfrg-hash-to-curve/blob/master/doc/svdw_params.pdf

This functionality must be implemented in URSA and then consumed by this library when generating a BBSSignature

What is the main reason sample is using a special document loader?

Just trying to make sense on how this can be used in real live scenario and why this sample loads JSON from file? Which really lives live somewhere? Is it to keep test efficient and fast?

Would it work without that special loader, since jsonld will try to load urls?

Export types from package

Some of the types this package defines are useful for consumers to have available in typescript environments such as KeyPairSigner, therefore this package should export these from the top level.

Require certain statements to be revealed in a proof

When it comes to verifiable credentials, there are core statements in the credential, that the relying party MUST be able to see in a given proof in order for them to decide whether the presentation is valid, i.e expiry, revocation or issuance date.

With this, there is two major options,

  1. The relying party must explicitly request this information in a proof request and the proof must be able to prove these statements or prove they were not included in the credential i.e the issuer did not include expiry information.
  2. The issuer designates in the signature they generate, the set of statments that must be revealed from the signature, for the relying party to have all information required to decide whether the presentation is valid for them, e.g the issuer would air mark that the expiry, revocation and issuance date fields must be revealed in the credential, in order for the signature to validate.

Update samples and docs

With the latest pending release changes to the API warrants updating the samples and associated documentation

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}".`
    );
  }

Unable to deriveProof due to getProofs not including proofValue

Attempting to deriveProof on a signed VC is failing due to getProofs returning an array of objects which only contains the type property - and ignoring the proofValue property which is required for suite.deriveProof with BbsBlsSignatureProof2020

Starting with this signed VC:

{
        "@context": [
            "https://www.w3.org/2018/credentials/v1",
            "https://www.w3.org/2018/credentials/examples/v1",
            "https://raw.githubusercontent.com/FlexFinTx/jsonld-contexts/master/contexts/nationalId.jsonld",
            "https://w3c-ccg.github.io/ldp-bbs2020/context/v1"
        ],
        "id": "http://example.gov/credentials/3732",
        "type": [
            "VerifiableCredential",
            "NationalIDCredential"
        ],
        "issuanceDate": "2020-03-10T04:24:12.164Z",
        "expirationDate": "2020-03-10T04:24:12.164Z",
        "credentialSubject": {
            "id": "did:flex:testnet:EiCHzIhOUeAdS3vjjdsIQ8v2CfXN935B7F6NIokzPJo_5g",
            "type": "NationalIDCredential",
            "nationalId": "9999999999",
            "givenName": "Haardik",
            "familyName": "Haardik",
            "gender": "Male",
            "birthDate": "1999-05-21",
            "address": "123 St, XYZ Avenue, Harare, Zimbabwe"
        },
        "issuer": "did:flex:testnet:EiD31RGW1u_FGmh4OK4WcQggSYsBKW98jYW8ev2njoyzwg",
        "proof": {
            "type": "https://w3c-ccg.github.io/ldp-bbs2020/context/v1#BbsBlsSignature2020",
            "created": "2020-08-31T07:42:14Z",
            "verificationMethod": "did:flex:testnet:EiD31RGW1u_FGmh4OK4WcQggSYsBKW98jYW8ev2njoyzwg#primary",
            "proofPurpose": "assertionMethod",
            "proofValue": "i8HrBN7DuLcmzban0c3TBHn956YI57kV+U3PrYMecalNckWjur5kWQO1tHIN0927M6gQ1jtLa3R9HodeA54HLUXCd6AyzCx+uh9qs7daex8Nzc7GxnGhXgZj+EkquvHBawMRuXk8P6H3MxAYSlk9jg=="
        }
    }

and the following documentLoader

import fetch from "node-fetch";
import { extendContextLoader } from "jsonld-signatures";
import bbsContext from "./fixtures/lds-bbsbls2020-v0.0.json";
import jsonld from "jsonld";

export const documents = {
  "https://w3c-ccg.github.io/ldp-bbs2020/context/v1": bbsContext,
};

const getJson = async (url: string): Promise<any> => {
  return fetch(url, {
    headers: {
      Accept: "application/ld+json",
    },
    method: "get",
  }).then((data) => data.json());
};

const customDocLoader = (url: string): any => {
  if (url.startsWith("did:flex:testnet:")) {
    const didDocument = getJson(
      "https://testnet.sidetree.flexfintx.com/api/v1/" + url
    ).then(() => {
      return {
        contextUrl: null,
        document: didDocument,
        documentUrl: url,
      };
    });
  }

  const context = documents[url];

  if (context) {
    return {
      contextUrl: null, // this is for a context via a link header
      document: context, // this is the actual document that was loaded
      documentUrl: url, // this is the actual context URL after redirects
    };
  }

  return jsonld.documentLoaders.node()(url);
};

export default extendContextLoader(customDocLoader);

Calling deriveProof with a valid json-ld frame on this will result in a proof object which only contains type.

For simplicity of replication, running the following:

  const getproofs = await getProofs({
    document: vc,
    documentLoader: documentLoader,
  });

  console.log("GP: ", getproofs);

returns

GP:  {
  proofs: [
    {
      '@context': 'https://w3id.org/security/v2',
      type: 'https://w3c-ccg.github.io/ldp-bbs2020/context/v1#BbsBlsSignature2020'
    }
  ],
  document: {
    '@context': 'https://w3id.org/security/v2',
    id: 'http://example.gov/credentials/3732',
    type: [
      'https://www.w3.org/2018/credentials#VerifiableCredential',
      'https://raw.githubusercontent.com/FlexFinTx/jsonld-contexts/master/contexts/nationalId.jsonld#'
    ],
    'https://www.w3.org/2018/credentials#credentialSubject': {
      id: 'did:flex:testnet:EiCHzIhOUeAdS3vjjdsIQ8v2CfXN935B7F6NIokzPJo_5g',
      type: 'https://raw.githubusercontent.com/FlexFinTx/jsonld-contexts/master/contexts/nationalId.jsonld#',
      'http://schema.org/address': '123 St, XYZ Avenue, Harare, Zimbabwe',
      'http://schema.org/birthDate': '1999-05-21',
      'http://schema.org/familyName': 'Haardik',
      'http://schema.org/gender': 'Male',
      'http://schema.org/givenName': 'Haardik',
      'http://schema.org/identifier': '9999999999'
    },
    'https://www.w3.org/2018/credentials#expirationDate': { type: 'xsd:dateTime', '@value': '2020-03-10T04:24:12.164Z' },
    'https://www.w3.org/2018/credentials#issuanceDate': { type: 'xsd:dateTime', '@value': '2020-03-10T04:24:12.164Z' },
    'https://www.w3.org/2018/credentials#issuer': {
      id: 'did:flex:testnet:EiD31RGW1u_FGmh4OK4WcQggSYsBKW98jYW8ev2njoyzwg'
    }
  }
}

This is a problem because suite.deriveProof expects the proofs[0] object to contain a proofValue (in the case of BbsBlsSignatureProof2020). Not being present is causing deriveProof to fail with

TypeError [ERR_INVALID_ARG_TYPE]: The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received undefined
    at Function.from (buffer.js:331:9)
    at BbsBlsSignatureProof2020.deriveProof (/Users/haardikh/code/flex-ivapi/node_modules/@mattrglobal/jsonld-signatures-bbs/src/BbsBlsSignatureProof2020.ts:75:30)
    at Object.exports.deriveProof (/Users/haardikh/code/flex-ivapi/node_modules/@mattrglobal/jsonld-signatures-bbs/src/deriveProof.ts:46:21)
    at processTicksAndRejections (internal/process/task_queues.js:97:5) {
  code: 'ERR_INVALID_ARG_TYPE'
}

Remove inheriting from jsonld-signatures abstract classes

Because jsonld-signatures is un-typed (written in JS) and this library leverages types through typescript when inheriting from an un-typed abstract based class the TS compiler is essentially blind. To improve the development experience we should sever this dependency and do one of the following

  1. Define our own base classes but in typescript
  2. Depend on types defined in transmutes version
  3. Dont define an abstract base class and just define the remaining API's directly in the signature suite classes.

See here for an example

yarn install gives 404 for @mattrglobal/node-bbs-signatures

I downloaded the repo, run yarn install, and got 404 status code downloading tarball https://github.com/mattrglobal/node-bbs-signatures/releases/download/0.5.0/node-v72-linux-x64.tar.gz.

It seems my system is trying to download v72 when the available is v64, but I don't know why.

Here is the full output:

yarn install v1.16.0
[1/4] Resolving packages...
[2/4] Fetching packages...
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.                                                                                                   
[3/4] Linking dependencies...
[4/4] Building fresh packages...
[1/4] ⡀ @mattrglobal/node-bbs-signatures
[2/4] ⡀ sodium-native
[-/4] ⢀ waiting...
error /home/geovane/dev/swarm/tmp/jsonld-signatures-bbs/node_modules/@mattrglobal/node-bbs-signatures: Command failed.                                                                                            
Exit code: 1
Command: node-pre-gyp install --fallback-to-build=false
Arguments:
Directory: /home/geovane/dev/swarm/tmp/jsonld-signatures-bbs/node_modules/@mattrglobal/node-bbs-signatures                                                                                                        
Output:
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using [email protected]
node-pre-gyp info using [email protected] | linux | x64
node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp info check checked for "/home/geovane/dev/swarm/tmp/jsonld-signatures-bbs/node_modules/@mattrglobal/node-bbs-signatures/native/index.node" (not found)                                               
node-pre-gyp http GET https://github.com/mattrglobal/node-bbs-signatures/releases/download/0.5.0/node-v72-linux-x64.tar.gz                                                                                        
node-pre-gyp http 404 https://github.com/mattrglobal/node-bbs-signatures/releases/download/0.5.0/node-v72-linux-x64.tar.gz                                                                                        
node-pre-gyp ERR! install error
node-pre-gyp ERR! stack Error: 404 status code downloading tarball https://github.com/mattrglobal/node-bbs-signatures/releases/download/0.5.0/node-v72-linux-x64.tar.gz                                           
node-pre-gyp ERR! stack     at Request.<anonymous> (/home/geovane/dev/swarm/tmp/jsonld-signatures-bbs/node_modules/node-pre-gyp/lib/install.js:142:27)                                                            
node-pre-gyp ERR! stack     at Request.emit (events.js:208:15)
node-pre-gyp ERR! stack     at Request.onRequestResponse (/home/geovane/dev/swarm/tmp/jsonld-signatures-bbs/node_modules/request/request.js:1059:10)                                                              
node-pre-gyp ERR! stack     at ClientRequest.emit (events.js:203:13)
node-pre-gyp ERR! stack     at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:565:23)                                                                                                         
node-pre-gyp ERR! stack     at HTTPParser.parserOnHeadersComplete (_http_common.js:116:17)
node-pre-gyp ERR! stack     at TLSSocket.socketOnData (_http_client.js:452:22)
node-pre-gyp ERR! stack     at TLSSocket.emit (events.js:203:13)
node-pre-gyp ERR! stack     at addChunk (_stream_readable.js:294:12)
node-pre-gyp ERR! stack     at readableAddChunk (_stream_readable.js:275:11)
node-pre-gyp ERR! System Linux 4.19.0-8-amd64
node-pre-gyp ERR! command "/home/geovane/.nvm/versions/node/v12.6.0/bin/node" "/home/geovane/dev/swarm/tmp/jsonld-signatures-bbs/node_modules/@mattrglobal/node-bbs-signatures/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build=false"
node-pre-gyp ERR! cwd /home/geovane/dev/swarm/tmp/jsonld-signatures-bbs/node_modules/@mattrglobal/node-bbs-signatures                                                                                             
node-pre-gyp ERR! node -v v12.6.0
node-pre-gyp ERR! node-pre-gyp -v v0.14.0

Verifying derived proof fails in Browser environment

The following derived proof verifies in NodeJS (node 10, using test setup in this repo), but fails in my browser (Brave Version 1.23.71 Chromium: 90.0.4430.72 (Official Build) (x86_64) and also tried Google Chrome). The other operations (issue, verify, derive) work fine, so I don't think it has anything to do with my setup.

Not sure if it's helpful, but I've also attached the stack trace of the error below.

The derived credential
{
  "@context": [
    "https://www.w3.org/2018/credentials/v1",
    "https://w3id.org/citizenship/v1",
    "https://w3id.org/security/bbs/v1"
  ],
  "id": "https://issuer.oidp.uscis.gov/credentials/83627465",
  "type": ["PermanentResidentCard", "VerifiableCredential"],
  "description": "Government of Example Permanent Resident Card.",
  "identifier": "83627465",
  "name": "Permanent Resident Card",
  "credentialSubject": {
    "id": "did:example:b34ca6cd37bbf23",
    "type": ["Person", "PermanentResident"],
    "givenName": "JOHN"
  },
  "expirationDate": "2029-12-03T12:19:52Z",
  "issuanceDate": "2019-12-03T12:19:52Z",
  "issuer": "did:example:489398593",
  "proof": {
    "type": "BbsBlsSignatureProof2020",
    "created": "2021-04-20T06:56:05Z",
    "nonce": "lw6Mn3vl7Se9QxB0agM2ntjN9NHkposIqPaJca4WoOxJeSnGZ5sUbePms2ijUkIpaE4=",
    "proofPurpose": "assertionMethod",
    "proofValue": "ABkB/waPib6r63rXkeHFn/xnzD+0an0dkhBNpD3Kq+1b1H3Oj7lA1sLnR9DLCaeWq18eDdyzlK/fR87PlMUt78kvu/UTcCUSIP/GNIgBJNLZF0zXDkh+pIIU9BL1rrtDBHsx1IZUtWVvmxISJ75+q4CUqUNoHaETyIZ5E6w0cGeoamI43InYDRYlC/ImgGy0kdS9BQYxAAAAdJJ8O/STiAn32OGG+Lm/EkDqcrymKOp5qvbnQenTZjB5WKDAuRw/4CngV4sU2Ftu/gAAAAI8VUYXyzwpuYPexn9nsuEgkSU1Lclgi0ObgMknUgGQ8EB4MmLwCZEkKFRFTz2lTNw+4AaItcaZ4h8UDFTGcKaosNsbPe8aPIWpgcd1i+H4KTfJLGI9JvVzJZIcWZK7CMp9kIODi49Kg/dEizp/dvrIAAAAC1QnOfssbTRJCuQXs6Ryo80Bq+bkVXd5JekGreoR10SWTpexPAQfjOhjE9cJQHNI+EWTQo3OQBEcxOKxGkdbyAYoHqz740JT7UtOUkoso2xTGC/+HBmKFrT+DiJZrUtQhTS2Eh8WZYvWuLqguLFBuDnYLsKFdvlq5PKAhS8JBIbbQJV8nwGBdPLkJabcTH035YQKfoJIDhXG+Zke6/ACYL0hqL2p8bOYO+chxxq1yRvTNzbLDKKxgh0N4fIZlOBiInHnzGso+WFIZObNUJM2dxc3eA4/QNaKYa9J5v9rTn0ZBAOmBNjUHD1ATPDAz8gPxf56Ba3VepryHVXtdtBO1Z5i5VMYEP2ODd5kgmys3lPjp88TpWqmMRpSyP4UI62CZggH+ZIxlXPavjP8OXrabODoKMqzU+Hz0fCQ64xECNA8D7o/qVKeudSKJzOoRCRgdiP5ZpSiY1sdRyW85Zj7CtE=",
    "verificationMethod": "did:example:489398593#test"
  }
}
The error
Uncaught (in promise) RuntimeError: unreachable
    at <anonymous>:wasm-function[450]:0x4f76e
    at <anonymous>:wasm-function[662]:0x587c4
    at <anonymous>:wasm-function[1003]:0x5fb1b
    at <anonymous>:wasm-function[925]:0x5eb70
    at <anonymous>:wasm-function[1004]:0x5fb51
    at <anonymous>:wasm-function[745]:0x5ae01
    at <anonymous>:wasm-function[114]:0x29958
    at <anonymous>:wasm-function[646]:0x57e65
    at <anonymous>:wasm-function[234]:0x3f1eb
    at <anonymous>:wasm-function[600]:0x562d2
    at <anonymous>:wasm-function[506]:0x52410
    at _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h9c9dac1409fe2461 (<anonymous>:wasm-function[1043]:0x600fb)
    at __wbg_adapter_32 (http://localhost:8000/commons.js:24746:10)
    at real (http://localhost:8000/commons.js:24731:20)
(anonymous) @ 001aa38a:0x4f76e
(anonymous) @ 001aa38a:0x587c4
(anonymous) @ 001aa38a:0x5fb1b
(anonymous) @ 001aa38a:0x5eb70
(anonymous) @ 001aa38a:0x5fb51
(anonymous) @ 001aa38a:0x5ae01
(anonymous) @ 001aa38a:0x29958
(anonymous) @ 001aa38a:0x57e65
(anonymous) @ 001aa38a:0x3f1eb
(anonymous) @ 001aa38a:0x562d2
(anonymous) @ 001aa38a:0x52410
_dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h9c9dac1409fe2461 @ 001aa38a:0x600fb
__wbg_adapter_32 @ wasm.js:180
real @ wasm.js:165
Promise.then (async)
../@mattrglobal/bbs-signatures/lib/wasm.js.module.exports.__wbg_then_4a7a614abbbe6d81 @ wasm.js:576
(anonymous) @ 001aa38a:0x58680
(anonymous) @ 001aa38a:0x5c05a
(anonymous) @ 001aa38a:0x4ff6b
(anonymous) @ 001aa38a:0x4a9f0
wasm_bindgen__convert__closures__invoke2_mut__h1b8f593dd423e948 @ 001aa38a:0x600a2
__wbg_adapter_96 @ wasm.js:360
cb0 @ wasm.js:558
../@mattrglobal/bbs-signatures/lib/wasm.js.module.exports.__wbg_new_d0c63652ab4d825c @ wasm.js:563
(anonymous) @ 001aa38a:0x608ba
(anonymous) @ 001aa38a:0x5a2d1
blsVerifyProof @ 001aa38a:0x5f2ed
../@mattrglobal/bbs-signatures/lib/wasm.js.module.exports.blsVerifyProof @ wasm.js:341
../@mattrglobal/bbs-signatures/lib/index.js.module.exports.blsVerifyProof @ index.js:127
async function (async)
../@mattrglobal/bbs-signatures/lib/index.js.module.exports.blsVerifyProof @ index.js:126
verifyProof @ BbsBlsSignatureProof2020.js:217
async function (async)
verifyProof @ BbsBlsSignatureProof2020.js:184
(anonymous) @ ProofSet.js:323
async function (async)
(anonymous) @ ProofSet.js:322
_verify @ ProofSet.js:320
async function (async)
_verify @ ProofSet.js:311
verify @ ProofSet.js:248
async function (async)
verify @ ProofSet.js:243
verify @ jsonld-signatures.js:111
_verifyCredential @ vc.js:271
verifyCredential @ vc.js:222
_callee4$ @ issue.js:48
tryCatch @ runtime.js:63
invoke @ runtime.js:293
(anonymous) @ runtime.js:118
asyncGeneratorStep @ asyncToGenerator.js:3
_next @ asyncToGenerator.js:25
(anonymous) @ asyncToGenerator.js:32
(anonymous) @ asyncToGenerator.js:21
_verifyDerived @ issue.js:48
verifyDerived @ issue.js:48
_callee2$ @ BbsComponent.js:90
tryCatch @ runtime.js:63
invoke @ runtime.js:293
(anonymous) @ runtime.js:118
asyncGeneratorStep @ asyncToGenerator.js:3
_next @ asyncToGenerator.js:25
Promise.then (async)
asyncGeneratorStep @ asyncToGenerator.js:13
_next @ asyncToGenerator.js:25
(anonymous) @ asyncToGenerator.js:32
(anonymous) @ asyncToGenerator.js:21
_deriveCredential @ BbsComponent.js:89
deriveCredential @ BbsComponent.js:89
(anonymous) @ BbsComponent.js:117
commitHookEffectListMount @ react-dom.development.js:19732
commitPassiveHookEffects @ react-dom.development.js:19770
callCallback @ react-dom.development.js:189
invokeGuardedCallbackDev @ react-dom.development.js:238
invokeGuardedCallback @ react-dom.development.js:293
flushPassiveEffectsImpl @ react-dom.development.js:22854
unstable_runWithPriority @ scheduler.development.js:653
runWithPriority$1 @ react-dom.development.js:11040
flushPassiveEffects @ react-dom.development.js:22821
performSyncWorkOnRoot @ react-dom.development.js:21738
(anonymous) @ react-dom.development.js:11090
unstable_runWithPriority @ scheduler.development.js:653
runWithPriority$1 @ react-dom.development.js:11040
flushSyncCallbackQueueImpl @ react-dom.development.js:11085
flushSyncCallbackQueue @ react-dom.development.js:11073
unbatchedUpdates @ react-dom.development.js:21910
legacyRenderSubtreeIntoContainer @ react-dom.development.js:24758
render @ react-dom.development.js:24841
(anonymous) @ app.js:165
setTimeout (async)
(anonymous) @ ready.js:37
(anonymous) @ app.js:160
Promise.then (async)
(anonymous) @ app.js:153
Promise.then (async)
(anonymous) @ app.js:43
./.cache/app.js @ app.js:38
__webpack_require__ @ bootstrap:832
fn @ bootstrap:129
0 @ index.js:3
__webpack_require__ @ bootstrap:832
(anonymous) @ bootstrap:972
(anonymous) @ bootstrap:972

To add some extra context. I'm using vc-js, but it seems like this has nothing to do with it. It fails on the lower level WASM operation. I'm using the same versions in my browser environment of libraries as used in the tests of this repo.

  const result = await vc.verifyCredential({
    credential: {
      "@context": [
        "https://www.w3.org/2018/credentials/v1",
        "https://w3id.org/citizenship/v1",
        "https://w3id.org/security/bbs/v1",
      ],
      id: "https://issuer.oidp.uscis.gov/credentials/83627465",
      type: ["PermanentResidentCard", "VerifiableCredential"],
      description: "Government of Example Permanent Resident Card.",
      identifier: "83627465",
      name: "Permanent Resident Card",
      credentialSubject: {
        id: "did:example:b34ca6cd37bbf23",
        type: ["Person", "PermanentResident"],
        givenName: "JOHN",
      },
      expirationDate: "2029-12-03T12:19:52Z",
      issuanceDate: "2019-12-03T12:19:52Z",
      issuer: "did:example:489398593",
      proof: {
        type: "BbsBlsSignatureProof2020",
        created: "2021-04-20T06:56:05Z",
        nonce:
          "lw6Mn3vl7Se9QxB0agM2ntjN9NHkposIqPaJca4WoOxJeSnGZ5sUbePms2ijUkIpaE4=",
        proofPurpose: "assertionMethod",
        proofValue:
          "ABkB/waPib6r63rXkeHFn/xnzD+0an0dkhBNpD3Kq+1b1H3Oj7lA1sLnR9DLCaeWq18eDdyzlK/fR87PlMUt78kvu/UTcCUSIP/GNIgBJNLZF0zXDkh+pIIU9BL1rrtDBHsx1IZUtWVvmxISJ75+q4CUqUNoHaETyIZ5E6w0cGeoamI43InYDRYlC/ImgGy0kdS9BQYxAAAAdJJ8O/STiAn32OGG+Lm/EkDqcrymKOp5qvbnQenTZjB5WKDAuRw/4CngV4sU2Ftu/gAAAAI8VUYXyzwpuYPexn9nsuEgkSU1Lclgi0ObgMknUgGQ8EB4MmLwCZEkKFRFTz2lTNw+4AaItcaZ4h8UDFTGcKaosNsbPe8aPIWpgcd1i+H4KTfJLGI9JvVzJZIcWZK7CMp9kIODi49Kg/dEizp/dvrIAAAAC1QnOfssbTRJCuQXs6Ryo80Bq+bkVXd5JekGreoR10SWTpexPAQfjOhjE9cJQHNI+EWTQo3OQBEcxOKxGkdbyAYoHqz740JT7UtOUkoso2xTGC/+HBmKFrT+DiJZrUtQhTS2Eh8WZYvWuLqguLFBuDnYLsKFdvlq5PKAhS8JBIbbQJV8nwGBdPLkJabcTH035YQKfoJIDhXG+Zke6/ACYL0hqL2p8bOYO+chxxq1yRvTNzbLDKKxgh0N4fIZlOBiInHnzGso+WFIZObNUJM2dxc3eA4/QNaKYa9J5v9rTn0ZBAOmBNjUHD1ATPDAz8gPxf56Ba3VepryHVXtdtBO1Z5i5VMYEP2ODd5kgmys3lPjp88TpWqmMRpSyP4UI62CZggH+ZIxlXPavjP8OXrabODoKMqzU+Hz0fCQ64xECNA8D7o/qVKeudSKJzOoRCRgdiP5ZpSiY1sdRyW85Zj7CtE=",
        verificationMethod: "did:example:489398593#test",
      },
    },
    documentLoader: customLoader,
    suite: new BbsBlsSignatureProof2020(),
  });

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.