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

nkeys.js

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nkeys.js - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0-1

deno.lock

17

lib/base32.js

@@ -32,4 +32,4 @@ "use strict";

let value = 0;
let a = new Uint8Array(src);
let buf = new Uint8Array(src.byteLength * 2);
const a = new Uint8Array(src);
const buf = new Uint8Array(src.byteLength * 2);
let j = 0;

@@ -40,3 +40,3 @@ for (let i = 0; i < a.byteLength; i++) {

while (bits >= 5) {
let index = (value >>> (bits - 5)) & 31;
const index = (value >>> (bits - 5)) & 31;
buf[j++] = b32Alphabet.charAt(index).charCodeAt(0);

@@ -47,3 +47,3 @@ bits -= 5;

if (bits > 0) {
let index = (value << (5 - bits)) & 31;
const index = (value << (5 - bits)) & 31;
buf[j++] = b32Alphabet.charAt(index).charCodeAt(0);

@@ -57,7 +57,7 @@ }

let j = 0;
let a = new Uint8Array(src);
let out = new Uint8Array(a.byteLength * 5 / 8 | 0);
const a = new Uint8Array(src);
const out = new Uint8Array(a.byteLength * 5 / 8 | 0);
for (let i = 0; i < a.byteLength; i++) {
let v = String.fromCharCode(a[i]);
let vv = b32Alphabet.indexOf(v);
const v = String.fromCharCode(a[i]);
const vv = b32Alphabet.indexOf(v);
if (vv === -1) {

@@ -77,1 +77,2 @@ throw new Error("Illegal Base32 character: " + a[i]);

exports.base32 = base32;
//# sourceMappingURL=base32.js.map

@@ -128,1 +128,2 @@ "use strict";

exports.Codec = Codec;
//# sourceMappingURL=codec.js.map

@@ -288,3 +288,3 @@ "use strict";

for (let i = 0; i < data.byteLength; i++) {
let b = data[i];
const b = data[i];
crc = ((crc << 8) & 0xffff) ^ crc16tab[((crc >> 8) ^ b) & 0x00FF];

@@ -296,3 +296,3 @@ }

static validate(data, expected) {
let ba = crc16.checksum(data);
const ba = crc16.checksum(data);
return ba == expected;

@@ -302,1 +302,2 @@ }

exports.crc16 = crc16;
//# sourceMappingURL=crc16.js.map

@@ -30,2 +30,3 @@ "use strict";

class CurveKP {
seed;
constructor(seed) {

@@ -97,3 +98,3 @@ this.seed = seed;

}
let pub = this.decodePubCurveKey(recipient);
const pub = this.decodePubCurveKey(recipient);
// prefix a header to the nonce

@@ -134,1 +135,2 @@ const out = new Uint8Array(XKeyVersionV1.length + exports.curveNonceLen);

exports.CurveKP = CurveKP;
//# sourceMappingURL=curve.js.map

@@ -22,1 +22,2 @@ "use strict";

exports.getEd25519Helper = getEd25519Helper;
//# sourceMappingURL=helper.js.map

@@ -20,3 +20,3 @@ "use strict";

*/
//@ts-ignore
//@ts-ignore: building in node
const nacl = require("tweetnacl");

@@ -26,3 +26,3 @@ /**

*/
//@ts-ignore
//@ts-ignore: injection of configuration
const helper = {

@@ -37,23 +37,6 @@ randomBytes: nacl.randomBytes,

};
// This here to support node 10.
if (typeof TextEncoder === "undefined") {
//@ts-ignore
const util = require("util");
//@ts-ignore
global.TextEncoder = util.TextEncoder;
//@ts-ignore
global.TextDecoder = util.TextDecoder;
}
if (typeof atob === "undefined") {
global.atob = (a) => {
return Buffer.from(a, "base64").toString("binary");
};
global.btoa = (b) => {
return Buffer.from(b, "binary").toString("base64");
};
}
/**
* @ignore
*/
//@ts-ignore
//@ts-ignore: building in node
const { setEd25519Helper } = require("./helper");

@@ -64,3 +47,4 @@ setEd25519Helper(helper);

*/
//@ts-ignore
//@ts-ignore: building in node
__exportStar(require("./mod"), exports);
//# sourceMappingURL=index.js.map

@@ -15,4 +15,4 @@ import { KeyPair } from "./nkeys";

clear(): void;
seal(input: Uint8Array, recipient: string, nonce?: Uint8Array): Uint8Array;
open(message: Uint8Array, sender: string): Uint8Array | null;
seal(_: Uint8Array, _recipient: string, _nonce?: Uint8Array): Uint8Array;
open(_: Uint8Array, _sender: string): Uint8Array | null;
}

@@ -25,2 +25,3 @@ "use strict";

class KP {
seed;
constructor(seed) {

@@ -33,3 +34,3 @@ this.seed = seed;

}
let sd = codec_1.Codec.decodeSeed(this.seed);
const sd = codec_1.Codec.decodeSeed(this.seed);
return sd.buf;

@@ -80,6 +81,6 @@ }

}
seal(input, recipient, nonce) {
seal(_, _recipient, _nonce) {
throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.InvalidNKeyOperation);
}
open(message, sender) {
open(_, _sender) {
throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.InvalidNKeyOperation);

@@ -89,1 +90,2 @@ }

exports.KP = KP;
//# sourceMappingURL=kp.js.map

@@ -21,1 +21,2 @@ "use strict";

Object.defineProperty(exports, "encode", { enumerable: true, get: function () { return util_1.encode; } });
//# sourceMappingURL=mod.js.map

@@ -29,3 +29,3 @@ "use strict";

const rawSeed = (0, helper_1.getEd25519Helper)().randomBytes(len);
let str = codec_1.Codec.encodeSeed(prefix, new Uint8Array(rawSeed));
const str = codec_1.Codec.encodeSeed(prefix, new Uint8Array(rawSeed));
return prefix === Prefix.Curve

@@ -158,3 +158,3 @@ ? new curve_1.CurveKP(new Uint8Array(rawSeed))

static startsWithValidPrefix(s) {
let c = s[0];
const c = s[0];
return c == "S" || c == "P" || c == "O" || c == "N" || c == "C" ||

@@ -164,3 +164,3 @@ c == "A" || c == "U" || c == "X";

static isValidPrefix(prefix) {
let v = this.parsePrefix(prefix);
const v = this.parsePrefix(prefix);
return v !== Prefix.Unknown;

@@ -217,2 +217,5 @@ }

class NKeysError extends Error {
name;
code;
chainedError;
/**

@@ -233,1 +236,2 @@ * @param {NKeysErrorCode} code

exports.NKeysError = NKeysError;
//# sourceMappingURL=nkeys.js.map

@@ -14,4 +14,4 @@ import { KeyPair } from "./nkeys";

clear(): void;
seal(input: Uint8Array, recipient: string, nonce?: Uint8Array): Uint8Array;
open(message: Uint8Array, sender: string): Uint8Array | null;
seal(_: Uint8Array, _recipient: string, _nonce?: Uint8Array): Uint8Array;
open(_: Uint8Array, _sender: string): Uint8Array | null;
}

@@ -25,2 +25,3 @@ "use strict";

class PublicKey {
publicKey;
constructor(publicKey) {

@@ -57,3 +58,3 @@ this.publicKey = publicKey;

}
let buf = codec_1.Codec._decode(this.publicKey);
const buf = codec_1.Codec._decode(this.publicKey);
return (0, helper_1.getEd25519Helper)().verify(input, sig, buf.slice(1));

@@ -68,6 +69,6 @@ }

}
seal(input, recipient, nonce) {
seal(_, _recipient, _nonce) {
throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.InvalidNKeyOperation);
}
open(message, sender) {
open(_, _sender) {
throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.InvalidNKeyOperation);

@@ -77,1 +78,2 @@ }

exports.PublicKey = PublicKey;
//# sourceMappingURL=public.js.map

@@ -46,3 +46,3 @@ "use strict";

}
let a = [];
const a = [];
for (let i = 0; i < buf.byteLength; i++) {

@@ -61,1 +61,2 @@ if (i % 8 === 0) {

exports.dump = dump;
//# sourceMappingURL=util.js.map
{
"name": "nkeys.js",
"version": "1.1.0",
"version": "1.2.0-1",
"description": "A public-key signature system based on Ed25519 for the NATS ecosystem in javascript",

@@ -14,4 +14,4 @@ "main": "lib/index.js",

"stage": "npm run init && npm run cjs && npm run generate && tsc",
"prepare": "npm run stage && npm run generate && deno bundle modules/esm/mod.ts nkeys.mjs && tsc",
"test": "npm run prepare && ava --verbose && deno test -A test/",
"prepare": "npm run stage && npm run generate && deno bundle modules/esm/mod.ts nkeys.mjs",
"test": "npm run prepare && node --test && deno test -A test/",
"cover": "npm run clean && npm run prepare && deno test --coverage=coverage -A test/ && deno coverage ./coverage --lcov > ./coverage/out.lcov && genhtml -o ./coverage/html ./coverage/out.lcov && open ./coverage/html/index.html",

@@ -24,3 +24,3 @@ "doc": "npm run clean && rm -Rf docs && npm run stage && node_modules/.bin/typedoc --out docs/ && touch ./docs/.nojekyll",

"engines": {
"node": ">=10.0.0"
"node": ">=18.0.0"
},

@@ -42,14 +42,6 @@ "repository": {

"devDependencies": {
"@types/node": "^20.11.x",
"ava": "^6.1.x",
"typedoc": "^0.25.8",
"typescript": "^5.3.3"
},
"ava": {
"failFast": true,
"require": [],
"files": [
"./node_test/*.js"
]
"@types/node": "^20.12.10",
"typedoc": "^0.25.13",
"typescript": "^5.4.5"
}
}

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