covalent-js-sign
v1.0.3
Published
Covalent browser compatible library for typed data signature creation and verification
Downloads
4
Maintainers
Readme
js-sign
This library help create Covalent signature which is intended to authenticate the data communicate with Covalent API endpoints. Generally, only one function call is required to create the necessary signature.
Currently, when using some Covalent API endpoints, the only data that required signing is the wallet address.
Installation
Browser javascript
<script src="https://cdn.jsdelivr.net/npm/covalent-js-sign/dist/lib.min.js"></script>
Node.JS
npm i --save covalent-js-sign
Private library inclusion
- Please download the single library, covalent-js-sign.js, directly from the github gist,
https://gist.github.com/cloggo/8f1b16ef2bdcfd663e587dba11f2d116#file-covalent-js-sign-js
Usage
// Node.JS
import { createSignaturePayloadB64 } from 'covalent-js-sign';
// To create the payload to that include the challenge data and the signature in base64,
const privateKey = "59e96b740f0af54f2d4335ddd033816fa24348b4097d3fddad4f6edc939f52e9";
const walletAddress = "0x71d094E5382CA33B25B92d3A75d5C6f269A78fAe";
const chainId = "1"; // default is "1"
// Node.JS
const payload = createSignaturePayloadB64(privateKey, walletAddress, chainId);
// browser
const payload = covalent.createSignaturePayloadB64(privateKey, walletAddress, chainId);