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

@libp2p/keychain

Package Overview
Dependencies
Maintainers
6
Versions
604
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@libp2p/keychain - npm Package Compare versions

Comparing version 5.0.14-c4e862731 to 5.0.14-cc7fcfe98

19

dist/src/index.d.ts

@@ -62,4 +62,23 @@ /**

export interface KeychainInit {
/**
* The password is used to derive a key which encrypts the keychain at rest
*/
pass?: string;
/**
* This key configures how the keychain encryption key is derived from the
* configured password
*/
dek?: DEKConfig;
/**
* The 'self' key is the private key of the node from which the peer id is
* derived.
*
* It cannot be renamed or removed.
*
* By default it is stored under the 'self' key, to use a different name, pass
* this option.
*
* @default 'self'
*/
selfKey?: string;
}

@@ -66,0 +85,0 @@ export interface KeychainComponents {

1

dist/src/keychain.d.ts

@@ -25,2 +25,3 @@ import { serviceCapabilities } from '@libp2p/interface';

private readonly log;
private readonly self;
/**

@@ -27,0 +28,0 @@ * Creates a new instance of a key chain

8

dist/src/keychain.js

@@ -82,2 +82,3 @@ /* eslint max-nested-callbacks: ["error", 5] */

log;
self;
/**

@@ -90,2 +91,3 @@ * Creates a new instance of a key chain

this.init = mergeOptions(defaultOptions, init);
this.self = init.selfKey ?? 'self';
// Enforce NIST SP 800-132

@@ -229,3 +231,3 @@ if (this.init.pass != null && this.init.pass?.length < 20) {

async removeKey(name) {
if (!validateKeyName(name) || name === 'self') {
if (!validateKeyName(name) || name === this.self) {
await randomDelay();

@@ -265,7 +267,7 @@ throw new InvalidParametersError(`Invalid key name '${name}'`);

async renameKey(oldName, newName) {
if (!validateKeyName(oldName) || oldName === 'self') {
if (!validateKeyName(oldName) || oldName === this.self) {
await randomDelay();
throw new InvalidParametersError(`Invalid old key name '${oldName}'`);
}
if (!validateKeyName(newName) || newName === 'self') {
if (!validateKeyName(newName) || newName === this.self) {
await randomDelay();

@@ -272,0 +274,0 @@ throw new InvalidParametersError(`Invalid new key name '${newName}'`);

{
"name": "@libp2p/keychain",
"version": "5.0.14-c4e862731",
"version": "5.0.14-cc7fcfe98",
"description": "Key management and cryptographically protected messages",

@@ -62,4 +62,4 @@ "license": "Apache-2.0 OR MIT",

"dependencies": {
"@libp2p/crypto": "5.0.11-c4e862731",
"@libp2p/interface": "2.5.0-c4e862731",
"@libp2p/crypto": "5.0.11-cc7fcfe98",
"@libp2p/interface": "2.5.0-cc7fcfe98",
"@noble/hashes": "^1.6.1",

@@ -74,3 +74,3 @@ "asn1js": "^3.0.5",

"devDependencies": {
"@libp2p/logger": "5.1.8-c4e862731",
"@libp2p/logger": "5.1.8-cc7fcfe98",
"aegir": "^45.0.5",

@@ -77,0 +77,0 @@ "datastore-core": "^10.0.2"

@@ -66,4 +66,25 @@ /**

export interface KeychainInit {
/**
* The password is used to derive a key which encrypts the keychain at rest
*/
pass?: string
/**
* This key configures how the keychain encryption key is derived from the
* configured password
*/
dek?: DEKConfig
/**
* The 'self' key is the private key of the node from which the peer id is
* derived.
*
* It cannot be renamed or removed.
*
* By default it is stored under the 'self' key, to use a different name, pass
* this option.
*
* @default 'self'
*/
selfKey?: string
}

@@ -70,0 +91,0 @@

@@ -96,2 +96,3 @@ /* eslint max-nested-callbacks: ["error", 5] */

private readonly log: Logger
private readonly self: string

@@ -105,2 +106,3 @@ /**

this.init = mergeOptions(defaultOptions, init)
this.self = init.selfKey ?? 'self'

@@ -271,3 +273,3 @@ // Enforce NIST SP 800-132

async removeKey (name: string): Promise<KeyInfo> {
if (!validateKeyName(name) || name === 'self') {
if (!validateKeyName(name) || name === this.self) {
await randomDelay()

@@ -313,7 +315,7 @@ throw new InvalidParametersError(`Invalid key name '${name}'`)

async renameKey (oldName: string, newName: string): Promise<KeyInfo> {
if (!validateKeyName(oldName) || oldName === 'self') {
if (!validateKeyName(oldName) || oldName === this.self) {
await randomDelay()
throw new InvalidParametersError(`Invalid old key name '${oldName}'`)
}
if (!validateKeyName(newName) || newName === 'self') {
if (!validateKeyName(newName) || newName === this.self) {
await randomDelay()

@@ -320,0 +322,0 @@ throw new InvalidParametersError(`Invalid new key name '${newName}'`)

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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