🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
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.

latest
npmnpm
Version
2.0.0
Version published
Maintainers
1
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