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

@provenance/proof-points

v7.4.0

Published

Library for working with Provenance Proof Points

Downloads

1,059

Readme

Provenance Proof Points

Documentation, Javascript package and smart contracts for working with Provenance Proof Points

Introduction

This repo contains everything you need to work with Provenance Proof Points. That includes:

  • Specification documentation
  • Solidity smart contracts that implement the blockchain part of the spec
  • A javascript library that implements the client side part of the spec

Quick Start

This section covers how to use the NPM package to issue, revoke and validate Proof Points.

Functionality is split into two areas:

  • Issuing and revoking proof points is accomplished using an instance of EthereumProofPointIssuer
  • Validating proof points is done using an instance of ProofPointValidator

To construct a EthereumProofPointIssuer or ProofPointValidator object you will need an ethers.providers.JsonRpcProvider instance and the address of a ProofPointRegistryStorage1 contract. The production instance of the ProofPointRegistryStorage1 contract is deployed on kovan and its address is published at https://open.provenance.org/developers . If you want to issue a Proof Point you will also need a funded Ethereum account.

If you want to deploy your own instance of the Proof Point registry contracts you can use the static EthereumProofPointRegistryRoot.deploy(...) method.

Install required NPM packages:

$ npm i @provenance/proof-points ethers

Validate a Proof Point

import { ProofPointId, EthereumAddress, ProofPointValidator } from '@provenance/proof-points';
import { ethers } from ethers;

const registryRootAddress = EthereumAddress.parse('0x...');
const ipfsSettings = {
  host: 'example.com',
  port: 443,
  protocol: 'https'
}
const ethereumProvider = new ethers.providers.JsonRpcProvider();

const proofPointValidator = await ProofPointValidator.init(
    registryRootAddress,
    ethereumProvider,
    ipfsSettings
);

const proofPointId = ProofPointId.parse('Qm...');

const {  
    isValid,
    proofPoint,
    statusCode,
    statusMessage
} = await proofPointValidator.validate(proofPointId)

Issue or Revoke a Proof Point

import { 
  EthereumAddress, 
  EthereumProofPointIssuer
} from '@provenance/proof-points';
import { ethers } from ethers;

const registryRootAddress = EthereumAddress.parse('0x...');
const ipfsSettings = {
  host: 'example.com',
  port: 443,
  protocol: 'https'
}
const ethereumProvider = new ethers.providers.JsonRpcProvider();

const ethereumProofPointIssuer = await EthereumProofPointIssuer.init(
    registryRootAddress,
    ipfsSettings,
    ethereumProvider
);

const type = 'https://open.provenance.org/ontology/ptf/v2/CertificationCredential';
const issuer = 'did:web:example.com';
const content = { 
    id: "https://provenance.org/users/example",
    hasCertification: "https://provenance.org/certifications/example" 
};
const validFromDate = new Date();
const validUntilDate = new Date();

const {
  proofPointId;
  transactionHash;
  proofPointObject;
} = await ethereumProofPointIssuer.issue(
    type,
    issuer,
    content,
    validFromDate,
    validUntilDate
);

await ethereumProofPointIssuer.revoke(proofPointId);

Contribute

This section covers how to set up so that you can build the smart contracts and Javascript library and run the unit tests. This is mainly of interest for developers who wish to contribute to the smart contracts or Javascript library.

Clone the repo

git clone https://github.com/ProjectProvenance/proof-points.git 
cd proof-points

Install javascript dependencies

npm install

Compile solidity contracts

npm run compile-solidity

Compile the typescript

npm run compile-typescript

Install IPFS then in a separate terminal start an IPFS daemon

ipfs daemon

Run unit tests

npm test

Publishing NPM Package

Use the following command substituting the correct version number. A git tag will be created and if the CircleCI build is successful then the package will be published to NPM

npm version 10.0.1
git push --follow-tags