New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

oprf

Package Overview
Dependencies
Maintainers
2
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

oprf - npm Package Compare versions

Comparing version 0.9.3 to 0.9.4

17

dist/oprf.d.ts

@@ -19,2 +19,6 @@ import BN = require('bn.js');

hashToPoint(input: string): number[];
/**
* Generates a random 32-byte array of numbers
* @returns {BN}
*/
generateRandomScalar(): BN;

@@ -27,2 +31,6 @@ /**

maskInput(input: string): IMaskedData;
/**
* Returns whether the given point exists on the elliptic curve
* @param p point input
*/
isValidPoint(p: number[]): number;

@@ -49,3 +57,3 @@ /**

/**
* Unmasks a salted value to reveal the original input value salted with a private key
* Applies the multiplicative inverse of the mask to the masked point
* @param salted a salted point

@@ -55,9 +63,4 @@ * @param mask the original mask that was applied

*/
unmaskInput(salted: number[], mask: BN): number[];
unmaskInput(maskedPoint: number[], mask: BN): number[];
/**
* Converts a number to its binary representation
* @param n
*/
private numToBin;
/**
* Converts an array of numbers to its big number representation

@@ -64,0 +67,0 @@ * @param bytes

@@ -35,5 +35,12 @@ "use strict";

};
/**
* Generates a random 32-byte array of numbers
* @returns {BN}
*/
OPRF.prototype.generateRandomScalar = function () {
var m = this.sodium.randombytes_buf(32);
return this.bytesToBN(m).mod(this.prime);
var m = null;
do {
m = this.sodium.randombytes_buf(32);
} while (m >= this.prime);
return this.bytesToBN(m);
};

@@ -58,2 +65,6 @@ /**

};
/**
* Returns whether the given point exists on the elliptic curve
* @param p point input
*/
OPRF.prototype.isValidPoint = function (p) {

@@ -95,3 +106,3 @@ var point = new Uint8Array(p);

/**
* Unmasks a salted value to reveal the original input value salted with a private key
* Applies the multiplicative inverse of the mask to the masked point
* @param salted a salted point

@@ -101,4 +112,4 @@ * @param mask the original mask that was applied

*/
OPRF.prototype.unmaskInput = function (salted, mask) {
var point = this.ed.decodePoint(salted);
OPRF.prototype.unmaskInput = function (maskedPoint, mask) {
var point = this.ed.decodePoint(maskedPoint);
var inv = mask.invm(this.prime);

@@ -109,18 +120,2 @@ var unmasked = point.mul(inv);

/**
* Converts a number to its binary representation
* @param n
*/
OPRF.prototype.numToBin = function (n) {
var result = [];
while (n > 0) {
var bit = Math.floor(n % 2) !== 0 ? 1 : 0;
result.unshift(bit);
n = Math.floor(n / 2);
}
while (result.length !== 8) {
result.unshift(0);
}
return result;
};
/**
* Converts an array of numbers to its big number representation

@@ -127,0 +122,0 @@ * @param bytes

{
"name": "oprf",
"version": "0.9.3",
"version": "0.9.4",
"description": "Oblivious pseudo-random function over an elliptic curve (ED25519)",

@@ -5,0 +5,0 @@ "main": "dist/oprf.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc