@ethsign/sign-sdk
v0.1.0
Published
## Installation
Downloads
105
Keywords
Readme
sign-sdk
Installation
npm install @ethsign/sign-sdk
Usage
server side
init
import { privateKeyToAccount } from 'viem/accounts';
import { SignClient } from '@ethsign/sign-sdk';
const privateKey = '0xxxxxx'; // eth private key
const tenantId = 'xxxx'; //sent us your publicKey to get it
const client = new SignClient({
account: privateKeyToAccount(privateKey),
tenantId: tenantId,
});
check contract status
const contractId = 'xxxx'; // main contract id
const userAddress = '0xxxxxx'; // eth address
const contractInfo = await client.checkContractStatus(contractId, userAddress);
generate webApiKey
const contractId = contractInfo.contractId; // come from checkContractStatus response
const webApiKey = await client.generateWebApiKey(contractId);
client side
init
import { SignWebClient } from '@ethsign/sign-sdk';
const webClient = new SignWebClient({
getApiKey: async () => {
return await getWebApiKey(); // request server side to get webApikey
},
});
generate previewUrl
const contractId = contractInfo.contractId; // come from checkContractStatus response
const password = 'xxx'; //optional,if contract is password protected
const previewUrl = await webClient.generatePreviewUrl(contractId, password);
download contract
const contractId = contractInfo.contractId; // come from checkContractStatus response
const password = 'xxx'; //optional,if contract is password protected
const res = await webClient.downloadContract(contractId, password);