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

@identity.com/verifiable-presentations

v3.0.3

Published

Utility Library to securely handle verifiable presentations

Downloads

1,765

Readme

verifiable-presentations

Utility Library to securely handle verifiable presentations.

CircleCI

Verifiable-presentations provides methods to run operations over a collection of verifiable credentials and evidences, such as query for credential identifiers, search for claims, fetch claim values, and non-cryptographically and cryptographically secure verify the data against the proofs.

Documentation

Usage example:

import { VerifiablePresentationManagerFactory } from '@identity.com/verifiable-presentations';

const secureRedundantManager = VerifiablePresentationManagerFactory.createSecureRedundantManager();

const artifacts = {
    presentations: [
        emailCredentialJson,
        phoneNumberCredentialJson,
        idDocumentCredentialJson
    ],
    evidences: [
        idDocumentEvidence
    ]
} as CredentialArtifacts;

let status = await secureRedundantManager.addCredentialArtifacts(artifacts);

status = await presentationManager.verifyAllArtifacts();

status = await presentationManager.purgeInvalidArtifacts();

const presentations = await secureRedundantManager.listPresentations();

const evidences = await secureRedundantManager.listEvidences();

let claims = await presentationManager.listClaims();

claims = await presentationManager.listPresentationClaims(presentations[0]);

const criteria = {
    claimPath: 'contact.phoneNumber.countryCode'

}
claims = await presentationManager.findClaims(criteria);

const claimValue = await presentationManager.getClaimValue(claims[0]);

PIIFactory

A class to allow easy extraction of PII from a DSR Response based on a specific dsrRequest implementation, with a given mapping and formatters specific to that DSR. It also allows generating a new Scope Request based on unique URL generation.

const mapping = {
  first_name: { identifier: 'claim-cvc:Name.givenNames-v1' },
  last_name: { identifier: 'claim-cvc:Name.familyNames-v1' },
  date_of_birth: { identifier: 'claim-cvc:Document.dateOfBirth-v1' },
  street: { identifier: 'claim-cvc:Identity.address-v1' },
};
const formatters = {
  street: { format: claimValue => `${claimValue.street} ${claimValue.unit}` },
  date_of_birth: { format: claimValue => `${claimValue.year}-${claimValue.month}-${claimValue.day}` },
};

const piiFactory = new PIIFactory(dsrRequest, mapping, formatters);

const eventsURL = 'https://testEvents';
const idvDid = 'did:ethr:0x1a88a35421a4a0d3e13fe4e8ebcf18e9a249dc5a';
const dsrResolver = {
    id: '123',
    // key pair generated purely for this test
    signingKeys: {
    xpub: '0414a08b13afa8d33c499ec828065775915ddf0301634d35e26c6cec4ad0f0f2b72c79e90357d47c7ba65a3c03bb22ac7e273c5d01494448a155df8a28da33b48d',
    xprv: 'a4947aa34ce507e995a60a455582d97f3fd1163eba3dd990ea1541a8fa049828',
    },
};
const urlGeneratorFn = evidenceName => `https://<test cloud provider>/<unique Id>/${evidenceName}.json`;


// generate a DSR
const dsr = await piiFactory.generateDSR(eventsURL, idvDid, dsrResolver, urlGeneratorFn);

// extract PII from a DSR response
const extractedPII = await piiFactory.extractPII(dsrResponse);

For more detailed working examples, please, refer to the tests in index.test.ts.