npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@pathcheck/bbs-jxt-sdk

v0.1.8

Published

Verifiable QR SDK for BBS+ Vaccination Credentials with JSON-XT

Downloads

6

Readme

Verifiable QR SDK for BBS+ on JSON-XT Credentials

JavaScript Implementation of W3C Verifiable QR Credentials with BBS+ and minimization to a QR code with JSON-XT.

Install

npm install @pathcheck/bbs-jxt-sdk --save

Usage

1. Generating Keys

Generate private and public keys with the provided script:

npm explore @pathcheck/bbs-jxt-sdk -- npm run-script keys <YOUR_DOMAIN> <YOUR_KEY_NAME> <YOUR_CONTROLLER_NAME>

Example:

npm explore @pathcheck/bbs-jxt-sdk -- npm run-script keys PCF.PW 1A10 WEB1

Returns:

/*******************************************************************************
Here are your SECRET keys. Key this private and use it to sign new packages.
*******************************************************************************/
{
  id: 'did:web:PCF.PW:1A10#WEB1',
  controller: 'did:web:PCF.PW:1A10',
  privateKeyBase58: '3AmVDMSEiZ9s79fCrHHhTuYMGSfeHvbZ92NhMh3AqrxW',
  publicKeyBase58: 'yX1rjAqqRhUk8BTgVDdFn9buUZ59pmRpJouc8raqAXztwooW3Gs7Fsy8GhDWUdZkdEFjdDbGk925zMSQ6xkrCbwzUrDnzpe8sPLB7gi15Gva4zRN77GiqRgDLtjRDVkXmmv'
}


/***************************************************************************************************
Here are your PUBLIC DID document. Save this part as a .json and upload it to PCF.PW/1A10/did.json
****************************************************************************************************/
{
  '@context': 'https://w3id.org/security/v2',
  id: 'did:web:PCF.PW:1A10',
  assertionMethod: [
    {
      id: 'did:web:PCF.PW:1A10#WEB1',
      controller: 'did:web:PCF.PW:1A10',
      publicKeyBase58: 'yX1rjAqqRhUk8BTgVDdFn9buUZ59pmRpJouc8raqAXztwooW3Gs7Fsy8GhDWUdZkdEFjdDbGk925zMSQ6xkrCbwzUrDnzpe8sPLB7gi15Gva4zRN77GiqRgDLtjRDVkXmmv'
    }
  ],
  authentication: [
    {
      id: 'did:web:PCF.PW:1A10#WEB1',
      controller: 'did:web:PCF.PW:1A10',
      publicKeyBase58: 'yX1rjAqqRhUk8BTgVDdFn9buUZ59pmRpJouc8raqAXztwooW3Gs7Fsy8GhDWUdZkdEFjdDbGk925zMSQ6xkrCbwzUrDnzpe8sPLB7gi15Gva4zRN77GiqRgDLtjRDVkXmmv'
    }
  ]
}

2. Uploading Public Keys

Copy the second segment (PUBLIC DID DOCUMENT) as a JSON file to your domain/controllerName/did.json

{
  "@context": "https://w3id.org/security/v2",
  "id": "did:web:PCF.PW:1A10",
  "assertionMethod": [
    {
      "id": "did:web:PCF.PW:1A10#WEB1",
      "controller": "did:web:PCF.PW:1A10",
      "publicKeyBase58": "yX1rjAqqRhUk8BTgVDdFn9buUZ59pmRpJouc8raqAXztwooW3Gs7Fsy8GhDWUdZkdEFjdDbGk925zMSQ6xkrCbwzUrDnzpe8sPLB7gi15Gva4zRN77GiqRgDLtjRDVkXmmv"
    }
  ],
  "authentication": [
    {
      "id": "did:web:PCF.PW:1A10#WEB1",
      "controller": "did:web:PCF.PW:1A10",
      "publicKeyBase58": "yX1rjAqqRhUk8BTgVDdFn9buUZ59pmRpJouc8raqAXztwooW3Gs7Fsy8GhDWUdZkdEFjdDbGk925zMSQ6xkrCbwzUrDnzpe8sPLB7gi15Gva4zRN77GiqRgDLtjRDVkXmmv"
    }
  ]
}

The DID:WEB Resolver will point to that address (e.g. http://pcf.pw/1A10/did.json) to download your public keys and verify the package.

3. Preparing to Sign

With the keys:

const keyPair = {
  id: 'did:web:PCF.PW:1A10#WEB1',
  controller: 'did:web:PCF.PW:1A10',
  privateKeyBase58: '3AmVDMSEiZ9s79fCrHHhTuYMGSfeHvbZ92NhMh3AqrxW',
  publicKeyBase58: 'yX1rjAqqRhUk8BTgVDdFn9buUZ59pmRpJouc8raqAXztwooW3Gs7Fsy8GhDWUdZkdEFjdDbGk925zMSQ6xkrCbwzUrDnzpe8sPLB7gi15Gva4zRN77GiqRgDLtjRDVkXmmv'
}

And a JSON-LD Payload (We are using EU's Digital COVID Certificate, version 1.2.0, as an example)

const TEST_PAYLOAD = {
    "@context": ["https://www.w3.org/2018/credentials/v1", "https://w3id.org/dgc/v1", "https://w3id.org/security/bbs/v1"],
    "type": ["VerifiableCredential"],
    "credentialSubject": {
        "@context": ["https://w3id.org/dgc/v1"],
        "type": "DGCCertificate",
        "personalInformation": {
            "@context": ["https://w3id.org/dgc/v1"],
            "type": "DGCSubject",
            "familyName": "d'Arsøns - van Halen",
            "givenName": "François-Joan",
            "stdFamilyName": "DARSONS<VAN<HALEN",
            "stdGivenName": "FRANCOIS<JOAN",
            "birthDate": "2009-02-28"
        },
        "proofOfRecovery": [{
            "@context": ["https://w3id.org/dgc/v1"],
            "type": "DGCProofOfRecovery",
            "id": "urn:uvci:01:NL:LSP/REC/1289821",
            "issuerName": "Ministry of VWS",
            "countryOfTest": "NL",
            "infectionInformation": {
                "@context": ["https://w3id.org/dgc/v1"],
                "type": "DGCInfectionInformation",
                "diseaseRecoveredFrom": "840539006",
                "dateFirstPositive": "2021-04-21",
                "validFrom": "2021-05-01",
                "validUntil": "2021-10-21"
            }
        }],
        "proofOfVaccination": [{
            "@context": ["https://w3id.org/dgc/v1"],
            "type": "DGCProofOfVaccination",
            "id": "urn:uvci:01:NL:PlA8UWS60Z4RZXVALl6GAZ",
            "issuerName": "Ministry of VWS",
            "countryOfVaccination": "NL",
            "vaccinationInformation": {
                "@context": ["https://w3id.org/dgc/v1"],
                "type": "DGCVaccinationInformation",
                "diseaseProtectedFrom": "840539006",
                "prophylaxis": "1119349007",
                "dateOfVaccination": "2021-05-05",
                "dose": 1,
                "totalDoses": 2,
                "marketingAuthHolder": "ORG-100030215",
                "medicinalProductName": "EU/1/20/1528"
            }
        }, {
            "@context": ["https://w3id.org/dgc/v1"],
            "type": "DGCProofOfVaccination",
            "id": "urn:uvci:01:NL:ATS342XDYS358FDFH3GTK5",
            "issuerName": "Ministry of VWS",
            "countryOfVaccination": "NL",
            "vaccinationInformation": {
                "@context": ["https://w3id.org/dgc/v1"],
                "type": "DGCVaccinationInformation",
                "diseaseProtectedFrom": "840539006",
                "prophylaxis": "1119349007",
                "dateOfVaccination": "2021-05-25",
                "dose": 2,
                "totalDoses": 2,
                "marketingAuthHolder": "ORG-100030215",
                "medicinalProductName": "EU/1/20/1528"
            }
        }],
        "proofOfCovidTest": [{
            "@context": ["https://w3id.org/dgc/v1"],
            "type": "DGCProofOfCovidTest",
            "id": "urn:uvci:01:NL:GGD/81AAH16AZ",
            "issuerName": "Ministry of VWS",
            "countryOfTestAdminstration": "NL",
            "testInformation": {
                "@context": ["https://w3id.org/dgc/v1"],
                "type": "DGCTestInformation",
                "diseaseTestedFrom": "840539006",
                "testName": "COVID PCR",
                "testManufacturer": "1232",
                "testType": "LP217198-3",
                "sampleCollectionDateTime": "2021-02-13T14:20:00Z",
                "testResult": "260415000",
                "testCenter": "GGD Fryslân, L-Heliconweg"
            }
        }, {
            "@context": ["https://w3id.org/dgc/v1"],
            "type": "DGCProofOfCovidTest",
            "id": "urn:uvci:01:NL:GGD/23BBS36BC",
            "issuerName": "Ministry of VWS",
            "countryOfTestAdminstration": "NL",
            "testInformation": {
                "@context": ["https://w3id.org/dgc/v1"],
                "type": "DGCTestInformation",
                "diseaseTestedFrom": "840539006",
                "testName": "NAAT TEST",
                "testManufacturer": "1343",
                "testType": "LP6464-4",
                "sampleCollectionDateTime": "2021-04-13T14:20:00Z",
                "testResult": "260373001",
                "testCenter": "GGD Fryslân, L-Heliconweg"
            }
        }]
    }
};

Call the signAndPack function to create the URI for the QR Code:

const {signAndPack, unpackAndVerify} = require('@pathcheck/bbs-jxt-sdk');

const qrUri = await signAndPack(TEST_PAYLOAD, keyPair);

And call the unpack and verify to convert the URI into the payload:

const jsonld = await unpackAndVerify(qrUri);

Development

npm install

Test

npm test