Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@shardus/crypto-utils

Package Overview
Dependencies
Maintainers
6
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@shardus/crypto-utils - npm Package Compare versions

Comparing version 4.1.1 to 4.1.2

10

build/src/index.d.ts

@@ -8,3 +8,4 @@ /// <reference types="node" />

export declare type sharedKey = hexstring;
export declare const stringify: (input: any) => string;
export declare let stringify: (input: unknown) => string;
export declare let stringifierName: string;
export interface Keypair {

@@ -74,3 +75,3 @@ publicKey: publicKey;

*/
export declare function decrypt(payload: any, curveSk: curveSecretKey | Buffer, curvePk: curvePublicKey | Buffer): {
export declare function decrypt(payload: string, curveSk: curveSecretKey | Buffer, curvePk: curvePublicKey | Buffer): {
isValid: any;

@@ -105,2 +106,7 @@ message: string;

/**
* Sets a custom stringifier method
* @param method
*/
export declare function setCustomStringifier(method: (input: unknown) => string, name: string): void;
/**
* Returns a signature obtained by signing the input hash (hex string or buffer) with the sk string

@@ -107,0 +113,0 @@ * @param input

16

build/src/index.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.bufferToHex = exports._getAuthKey = exports.generateSharedKey = exports._ensureBuffer = exports.init = exports.verifyObj = exports.verify = exports.signObj = exports.sign = exports.authenticateObj = exports.authenticate = exports.tagObj = exports.tag = exports.decrypt = exports.encrypt = exports.convertPkToCurve = exports.convertSkToCurve = exports.generateKeypair = exports.hashObj = exports.hash = exports.randomBytes = exports.stringify = void 0;
exports.bufferToHex = exports._getAuthKey = exports.generateSharedKey = exports._ensureBuffer = exports.init = exports.verifyObj = exports.verify = exports.signObj = exports.sign = exports.setCustomStringifier = exports.authenticateObj = exports.authenticate = exports.tagObj = exports.tag = exports.decrypt = exports.encrypt = exports.convertPkToCurve = exports.convertSkToCurve = exports.generateKeypair = exports.hashObj = exports.hash = exports.randomBytes = exports.stringifierName = exports.stringify = void 0;
const sodium = require('sodium-native');

@@ -8,2 +8,3 @@ const xor = require('buffer-xor');

exports.stringify = fastStableStringify;
exports.stringifierName = 'fast-stable-stringify';
/**

@@ -69,3 +70,5 @@ * The key used for initializing the cryptographic hashing algorithms

// to fix that.
function hashObj(obj, removeSign = false, removeTag = false) {
function hashObj(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
obj, removeSign = false, removeTag = false) {
if (typeof obj !== 'object') {

@@ -257,2 +260,11 @@ throw TypeError('Input must be an object.');

/**
* Sets a custom stringifier method
* @param method
*/
function setCustomStringifier(method, name) {
exports.stringify = method;
exports.stringifierName = name;
}
exports.setCustomStringifier = setCustomStringifier;
/**
* Returns a signature obtained by signing the input hash (hex string or buffer) with the sk string

@@ -259,0 +271,0 @@ * @param input

{
"name": "@shardus/crypto-utils",
"version": "4.1.1",
"version": "4.1.2",
"description": "Provides simple crypto functions, as used by the ULC Project.",

@@ -12,3 +12,3 @@ "main": "./build/src/index.js",

"scripts": {
"release": "np --no-tests --no-yarn",
"release": "np --no-tests --no-yarn --any-branch",
"test": "echo \"Error: no test specified\" && exit 1",

@@ -15,0 +15,0 @@ "check": "gts check",

@@ -12,3 +12,4 @@ export type hexstring = string;

export const stringify = fastStableStringify as (input: any) => string;
export let stringify = fastStableStringify as (input: unknown) => string;
export let stringifierName = 'fast-stable-stringify';

@@ -28,2 +29,3 @@ type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;

export interface LooseObject {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[index: string]: any;

@@ -78,3 +80,3 @@ }

sodium.crypto_generichash(digest, buf, HASH_KEY);
let output: any;
let output;
switch (fmt) {

@@ -102,2 +104,3 @@ case 'buffer':

export function hashObj(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
obj: { [key: string]: any },

@@ -216,3 +219,3 @@ removeSign = false,

export function decrypt(
payload: any,
payload: string,
curveSk: curveSecretKey | Buffer,

@@ -324,2 +327,14 @@ curvePk: curvePublicKey | Buffer

/**
* Sets a custom stringifier method
* @param method
*/
export function setCustomStringifier(
method: (input: unknown) => string,
name: string
) {
stringify = method;
stringifierName = name;
}
/**
* Returns a signature obtained by signing the input hash (hex string or buffer) with the sk string

@@ -326,0 +341,0 @@ * @param input

Sorry, the diff of this file is not supported yet

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