0.0.29 • Published 1 year ago
@zksig/sdk v0.0.29
ZKsig JavaScript SDK
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.
- Read methods require an Ethers Provider.
- Write methods require an Ethers Signer
// 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);
0.0.28
1 year ago
0.0.29
1 year ago
0.0.24
1 year ago
0.0.25
1 year ago
0.0.26
1 year ago
0.0.27
1 year ago
0.0.21
1 year ago
0.0.22
1 year ago
0.0.23
1 year ago
0.0.20
1 year ago
0.0.10
1 year ago
0.0.11
1 year ago
0.0.12
1 year ago
0.0.13
1 year ago
0.0.14
1 year ago
0.0.15
1 year ago
0.0.9
1 year ago
0.0.16
1 year ago
0.0.8
1 year ago
0.0.17
1 year ago
0.0.18
1 year ago
0.0.19
1 year ago
0.0.7
1 year ago
0.0.6
2 years ago
0.0.5
2 years ago
0.0.4
2 years ago
0.0.3
2 years ago
0.0.2
2 years ago
0.0.1
2 years ago