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
642
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

to
5.1.4-fc5122110

6

dist/src/utils/export.d.ts

@@ -1,2 +0,2 @@

import type { Ed25519PrivateKey, PrivateKey, RSAPrivateKey, Secp256k1PrivateKey } from '@libp2p/interface';
import type { ECDSAPrivateKey, Ed25519PrivateKey, PrivateKey, RSAPrivateKey, Secp256k1PrivateKey } from '@libp2p/interface';
import type { Multibase } from 'multiformats/bases/interface';

@@ -25,2 +25,6 @@ /**

/**
* Exports the key into a password protected `format`
*/
export declare function exportECDSAPrivateKey(key: ECDSAPrivateKey, password: string, format?: ExportFormat): Promise<Multibase<'m'>>;
/**
* Exports the key as libp2p-key - a aes-gcm encrypted value with the key

@@ -27,0 +31,0 @@ * derived from the password.

@@ -37,2 +37,5 @@ import { randomBytes } from '@libp2p/crypto';

}
if (key.type === 'ECDSA') {
return exportECDSAPrivateKey(key, password, format);
}
throw new UnsupportedKeyTypeError();

@@ -63,2 +66,13 @@ }

/**
* Exports the key into a password protected `format`
*/
export async function exportECDSAPrivateKey(key, password, format = 'libp2p-key') {
if (format === 'libp2p-key') {
return exporter(privateKeyToProtobuf(key), password);
}
else {
throw new InvalidParametersError(`export format '${format}' is not supported`);
}
}
/**
* Exports the key as libp2p-key - a aes-gcm encrypted value with the key

@@ -65,0 +79,0 @@ * derived from the password.

8

package.json
{
"name": "@libp2p/keychain",
"version": "5.1.4-b2124c2db",
"version": "5.1.4-fc5122110",
"description": "Key management and cryptographically protected messages",

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

"dependencies": {
"@libp2p/crypto": "5.0.15-b2124c2db",
"@libp2p/interface": "2.7.0-b2124c2db",
"@libp2p/crypto": "5.0.15-fc5122110",
"@libp2p/interface": "2.7.0-fc5122110",
"@noble/hashes": "^1.6.1",

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

"devDependencies": {
"@libp2p/logger": "5.1.13-b2124c2db",
"@libp2p/logger": "5.1.13-fc5122110",
"aegir": "^45.1.1",

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

@@ -12,3 +12,3 @@ import { randomBytes } from '@libp2p/crypto'

import { ITERATIONS, KEY_SIZE, SALT_LENGTH } from './constants.js'
import type { Ed25519PrivateKey, PrivateKey, RSAPrivateKey, Secp256k1PrivateKey } from '@libp2p/interface'
import type { ECDSAPrivateKey, Ed25519PrivateKey, PrivateKey, RSAPrivateKey, Secp256k1PrivateKey } from '@libp2p/interface'
import type { Multibase } from 'multiformats/bases/interface'

@@ -47,2 +47,6 @@

if (key.type === 'ECDSA') {
return exportECDSAPrivateKey(key, password, format)
}
throw new UnsupportedKeyTypeError()

@@ -74,2 +78,13 @@ }

/**
* Exports the key into a password protected `format`
*/
export async function exportECDSAPrivateKey (key: ECDSAPrivateKey, password: string, format: ExportFormat = 'libp2p-key'): Promise<Multibase<'m'>> {
if (format === 'libp2p-key') {
return exporter(privateKeyToProtobuf(key), password)
} else {
throw new InvalidParametersError(`export format '${format}' is not supported`)
}
}
/**
* Exports the key as libp2p-key - a aes-gcm encrypted value with the key

@@ -76,0 +91,0 @@ * derived from the password.

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