Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
[![Build Status](https://travis-ci.org/multiparty/umbral.svg?branch=master)](https://travis-ci.org/multiparty/umbral)
npm install umbral
The module must be initialized with a sodium instance.
let _sodium = null;
await _sodium.ready;
umbral.init(_sodium);
/**
* Encrypts a user's record
* @param {Uint8Array} randId - random ID
* @param {IRecord} record - user record
* @param {Uint8Array[]} publicKeys - options counselor public keys
* @param {Uint8Array} skUser - user's secret key
* @returns {IEncryptedData[]} an array of records encrypted under each public key
*/
function encryptData(randId: Uint8Array, record: IRecord, publicKeys: Uint8Array[], skUser: Uint8Array)
The function should be provided with matched encrypted records
/**
* Decrypts an array of encrypted data
* @param {IEncryptedData[]} encryptedData - an array of encrypted data of matched users
* @param {Uint8Array} skOC - secret key of an options counselor
* @param pkUser - user's private key
* @returns {IRecord[]} array of decrypted records from matched users
*/
function decryptData(encryptedData: IEncryptedData[], skOC: Uint8Array, pkUser: Uint8Array)
await _sodium.ready;
umbral.init(_sodium);
const ocKeyPair = _sodium.crypto_box_keypair();
const userKeyPairA = _sodium.crypto_box_keypair();
const userKeyPairB = _sodium.crypto_box_keypair();
const perpId = 'facebook.com/Mallory';
const randId: Uint8Array = hashId(perpId);
const encryptedDataA = umbral.encryptData(randId, { perpId, 'Alice' }, [ocKeyPair.publicKey], userKeyPairA.privateKey);
const encryptedDataB = umbral.encryptData(randId, { perpId, 'Bob' }, [ocKeyPair.publicKey], userKeyPairB.privateKey);
const decryptedRecords = umbral.decryptData([encryptedDataA[0], encryptedDataB[0]],
ocKeyPair.privateKey,
[userKeyPairA.publicKey, userKeyPairB.publicKey]);
Additional examples can be found under test/tests.ts
A record is currently only a perpetrator ID and a user ID. This can be amended to include additional information.
export interface IRecord {
readonly perpId: string;
readonly userId: string;
}
FAQs
[![npm version](https://badge.fury.io/js/umbral.svg)](https://badge.fury.io/js/umbral) [![Build Status](https://travis-ci.org/multiparty/umbral.svg?branch=master)](https://travis-ci.org/multiparty/umbral) [![Coverage Status](https://coveralls.io/repos/git
The npm package umbral receives a total of 0 weekly downloads. As such, umbral popularity was classified as not popular.
We found that umbral demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.