@zksig/sdk
TypeScript icon, indicating that this package has built-in type declarations

0.0.29 • Public • Published

ZKsig JavaScript SDK

Documentation

Library for interacting with the ZKsig digital signature contract in the following ways:

  • Create agreements
  • Sign agreements
  • Get a list of agreements by address
  • Get an agreement by address and index
  • Get a list of signatures by address
  • Get a signature by address and index

Contract

Interacting with the ZKsig smart contract depends on ethers.

// Get a list of agreements for 0xa96bb1719fa7f78b8B2d3c24BBc79e52Ae9a3988
const provider = new providers.Web3Provider(window.ethereum);
const signer = provider.getSigner();

const contract = new ZKsigDigitalSignatureContract({
  chainId: await signer.getChainId(),
  signer,
});
const agreements = await contract.getAgreements({
  page: 1,
  perPage: 10,
});
// Get a user's profile
const provider = new providers.Web3Provider(window.ethereum);
const signer = provider.getSigner();

const contract = new ZKsigDigitalSignatureContract({
  chainId: await signer.getChainId(),
  signer,
});
const profile = await contract.getProfile();

PDF Agreements with ZKsigAgreement

The ZKsigAgreement class helps interact with a PDF agreement in the following ways:

  • Add signature fields to a PDF
  • Add the agreement to the blockchain
const agreement = new ZKsigAgreement();
await agreement.init(pdfBytes);
await agreement.addSignatureField({
  page: 1, // page on which the signature should be
  x: 10, // x coordinate on the PDF where the signature should start
  y: 10, // y coordinate on the PDF where the signature should start
  identifier: "employee", // signature field name used to group multiple fields with the same signer
});
await agreement.createOnChain(signer);

Readme

Keywords

none

Package Sidebar

Install

npm i @zksig/sdk

Weekly Downloads

1

Version

0.0.29

License

MIT

Unpacked Size

15.9 MB

Total Files

155

Last publish

Collaborators

  • mehtaphysical