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

@digitalbazaar/ed25519-verification-key-2020

Package Overview
Dependencies
Maintainers
5
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@digitalbazaar/ed25519-verification-key-2020 - npm Package Compare versions

Comparing version 4.0.0 to 4.1.0

lib/validators.js

5

lib/ed25519-browser.js
/*!
* Copyright (c) 2020-2022 Digital Bazaar, Inc. All rights reserved.
*/
import {assertKeyBytes} from './validators.js';
import * as ed25519 from '@noble/ed25519';

@@ -33,2 +34,6 @@

async function generateKeyPairFromSeed(seed) {
assertKeyBytes({
bytes: seed,
expectedLength: 32,
});
const publicKey = await ed25519.getPublicKey(seed);

@@ -35,0 +40,0 @@ const secretKey = new Uint8Array(64);

26

lib/ed25519.js

@@ -12,3 +12,3 @@ /*!

} from 'node:crypto';
import {assertKeyBytes} from './validators.js';
import {promisify} from 'node:util';

@@ -115,9 +115,13 @@

}
if(!privateKeyBytes && !(seedBytes instanceof Uint8Array &&
seedBytes.length === 32)) {
throw new TypeError('`seedBytes` must be a 32 byte Buffer.');
if(!privateKeyBytes) {
assertKeyBytes({
bytes: seedBytes,
expectedLength: 32
});
}
if(!seedBytes && !(privateKeyBytes instanceof Uint8Array &&
privateKeyBytes.length === 64)) {
throw new TypeError('`privateKeyBytes` must be a 64 byte Buffer.');
if(!seedBytes) {
assertKeyBytes({
bytes: privateKeyBytes,
expectedLength: 64
});
}

@@ -147,6 +151,8 @@ let p;

function publicKeyDerEncode({publicKeyBytes}) {
if(!(publicKeyBytes instanceof Uint8Array && publicKeyBytes.length === 32)) {
throw new TypeError('`publicKeyBytes` must be a 32 byte Buffer.');
}
assertKeyBytes({
bytes: publicKeyBytes,
expectedLength: 32,
code: 'invalidPublicKeyLength'
});
return Buffer.concat([DER_PUBLIC_KEY_PREFIX, publicKeyBytes]);
}

@@ -6,2 +6,3 @@ /*!

import * as base64url from 'base64url-universal';
import {assertKeyBytes} from './validators.js';
import ed25519 from './ed25519.js';

@@ -69,2 +70,8 @@ import {LDKeyPair} from 'crypto-ld';

}
// check that the passed in keyBytes are 32 bytes
assertKeyBytes({
bytes: this._publicKeyBuffer,
code: 'invalidPublicKeyLength',
expectedLength: 32
});
}

@@ -71,0 +78,0 @@

{
"name": "@digitalbazaar/ed25519-verification-key-2020",
"version": "4.0.0",
"version": "4.1.0",
"description": "Javascript library for generating and working with Ed25519VerificationKey2020 key pairs, for use with crypto-ld.",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/digitalbazaar/ed25519-verification-key-2020",

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