Socket
Book a DemoInstallSign in
Socket

@cere/cere-signer

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cere/cere-signer

This lib provides an ability to sign data and verify signed data using blake2b algorithm.

2.0.0
latest
npmnpm
Version published
Weekly downloads
5
150%
Maintainers
1
Weekly downloads
 
Created
Source

Description

This lib provides an ability to sign data and verify signed data using blake2b algorithm.

Release Notes

v1.3.3

  • Updated permission

v1.3.0

  • Change Stub signature to properly generated by user's private key

v1.2.0

  • Added substrate signer function

Installation

nvm exec npm i

Test

nvm exec npm test

Using

Sign whole object

import { signObject } from '@cere-io/cere-signer';

const obj = { id: 1 };

signObject(obj);

// after that inside our object a new field called 'signature' will be appeared
console.log(obj.signature);

Sign object with pointing a sequence of fields

import { signObject } from '@cere-io/cere-signer';

const obj = { id: 1, event_type: 'checkin', payload: {} };

// we can provide any additional fields as varargs. Order is important!
signObject(obj, 'id', 'event_type', 'payload');

// after that inside our object a new field called 'signature' will be appeared
console.log(obj.signature);

Verify signature

Here we use the same approach as above: we can verify a whole object as well as provide a sequence of fields:

import { verifySignature } from '@cere-io/cere-signer';

const signature = 'sig';
const obj = { id: 1 };

const res = verifySignature(obj, signature); // result as boolean
import { verifySignature } from '@cere-io/cere-signer';

const signature = 'sig';
const obj = { id: 1, event_type: 'checkin', payload: {} };

// the order of fields is important! use the same order as you provided to signObject method.
const res = verifySignature(obj, signature, 'id', 'event_type', 'payload'); // result as boolean

FAQs

Package last updated on 29 Apr 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.