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
0
Versions
619
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.1.0-2b49a5f74 to 5.1.0-5b084e968

10

dist/src/index.d.ts
/**
* @packageDocumentation
*
* - Manages the lifecycle of a key
* - Manages the life cycle of a key
* - Keys are encrypted at rest
* - Enforces the use of safe key names
* - Uses encrypted PKCS 8 for key storage
* - Uses PBKDF2 for a "stetched" key encryption key
* - Uses PBKDF2 for a "stretched" key encryption key
* - Enforces NIST SP 800-131A and NIST SP 800-132

@@ -29,5 +29,5 @@ * - Delays reporting errors to slow down brute force attacks

*
* A private key is stored as an encrypted PKCS 8 structure in the PEM format. It is protected by a key generated from the key chain's *passPhrase* using **PBKDF2**.
* A private key is stored as an encrypted PKCS 8 structure in the PEM format. It is protected by a key generated from the key chain's *pass phrase* using **PBKDF2**.
*
* The default options for generating the derived encryption key are in the `dek` object. This, along with the passPhrase, is the input to a `PBKDF2` function.
* The default options for generating the derived encryption key are in the `dek` object. This, along with the pass phrase, is the input to a `PBKDF2` function.
*

@@ -174,3 +174,3 @@ * ```TypeScript

* await libp2p.services.keychain.createKey('keyTest', 'RSA', 4096)
* const keyInfo = await libp2p.services.keychain.renameKey('keyTest', 'keyNewNtest')
* const keyInfo = await libp2p.services.keychain.renameKey('keyTest', 'keyNewTest')
* ```

@@ -177,0 +177,0 @@ */

/**
* @packageDocumentation
*
* - Manages the lifecycle of a key
* - Manages the life cycle of a key
* - Keys are encrypted at rest
* - Enforces the use of safe key names
* - Uses encrypted PKCS 8 for key storage
* - Uses PBKDF2 for a "stetched" key encryption key
* - Uses PBKDF2 for a "stretched" key encryption key
* - Enforces NIST SP 800-131A and NIST SP 800-132

@@ -29,5 +29,5 @@ * - Delays reporting errors to slow down brute force attacks

*
* A private key is stored as an encrypted PKCS 8 structure in the PEM format. It is protected by a key generated from the key chain's *passPhrase* using **PBKDF2**.
* A private key is stored as an encrypted PKCS 8 structure in the PEM format. It is protected by a key generated from the key chain's *pass phrase* using **PBKDF2**.
*
* The default options for generating the derived encryption key are in the `dek` object. This, along with the passPhrase, is the input to a `PBKDF2` function.
* The default options for generating the derived encryption key are in the `dek` object. This, along with the pass phrase, is the input to a `PBKDF2` function.
*

@@ -34,0 +34,0 @@ * ```TypeScript

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

/**
* Manages the lifecycle of a key. Keys are encrypted at rest using PKCS #8.
* Manages the life cycle of a key. Keys are encrypted at rest using PKCS #8.
*

@@ -17,0 +17,0 @@ * A key in the store has two entries

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

/**
* Manages the lifecycle of a key. Keys are encrypted at rest using PKCS #8.
* Manages the life cycle of a key. Keys are encrypted at rest using PKCS #8.
*

@@ -139,5 +139,5 @@ * A key in the store has two entries

}
const dsname = DsInfoName(name);
const datastoreName = DsInfoName(name);
try {
const res = await this.components.datastore.get(dsname);
const res = await this.components.datastore.get(datastoreName);
return JSON.parse(uint8ArrayToString(res));

@@ -178,4 +178,4 @@ }

}
const dsname = DsName(name);
const exists = await this.components.datastore.has(dsname);
const datastoreName = DsName(name);
const exists = await this.components.datastore.has(datastoreName);
if (exists) {

@@ -205,3 +205,3 @@ await randomDelay();

const batch = this.components.datastore.batch();
batch.put(dsname, uint8ArrayFromString(pem));
batch.put(datastoreName, uint8ArrayFromString(pem));
batch.put(DsInfoName(name), uint8ArrayFromString(JSON.stringify(keyInfo)));

@@ -216,5 +216,5 @@ await batch.commit();

}
const dsname = DsName(name);
const datastoreName = DsName(name);
try {
const res = await this.components.datastore.get(dsname);
const res = await this.components.datastore.get(datastoreName);
const pem = uint8ArrayToString(res);

@@ -238,6 +238,6 @@ const cached = privates.get(this);

}
const dsname = DsName(name);
const datastoreName = DsName(name);
const keyInfo = await this.findKeyByName(name);
const batch = this.components.datastore.batch();
batch.delete(dsname);
batch.delete(datastoreName);
batch.delete(DsInfoName(name));

@@ -278,7 +278,7 @@ await batch.commit();

}
const oldDsname = DsName(oldName);
const newDsname = DsName(newName);
const oldDatastoreName = DsName(oldName);
const newDatastoreName = DsName(newName);
const oldInfoName = DsInfoName(oldName);
const newInfoName = DsInfoName(newName);
const exists = await this.components.datastore.has(newDsname);
const exists = await this.components.datastore.has(newDatastoreName);
if (exists) {

@@ -289,3 +289,3 @@ await randomDelay();

try {
const pem = await this.components.datastore.get(oldDsname);
const pem = await this.components.datastore.get(oldDatastoreName);
const res = await this.components.datastore.get(oldInfoName);

@@ -295,5 +295,5 @@ const keyInfo = JSON.parse(uint8ArrayToString(res));

const batch = this.components.datastore.batch();
batch.put(newDsname, pem);
batch.put(newDatastoreName, pem);
batch.put(newInfoName, uint8ArrayFromString(JSON.stringify(keyInfo)));
batch.delete(oldDsname);
batch.delete(oldDatastoreName);
batch.delete(oldInfoName);

@@ -300,0 +300,0 @@ await batch.commit();

{
"name": "@libp2p/keychain",
"version": "5.1.0-2b49a5f74",
"version": "5.1.0-5b084e968",
"description": "Key management and cryptographically protected messages",

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

"dependencies": {
"@libp2p/crypto": "5.0.12-2b49a5f74",
"@libp2p/interface": "2.6.0-2b49a5f74",
"@libp2p/crypto": "5.0.12-5b084e968",
"@libp2p/interface": "2.6.0-5b084e968",
"@noble/hashes": "^1.6.1",

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

"devDependencies": {
"@libp2p/logger": "5.1.9-2b49a5f74",
"@libp2p/logger": "5.1.9-5b084e968",
"aegir": "^45.0.5",

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

@@ -27,7 +27,7 @@ # @libp2p/keychain

- Manages the lifecycle of a key
- Manages the life cycle of a key
- Keys are encrypted at rest
- Enforces the use of safe key names
- Uses encrypted PKCS 8 for key storage
- Uses PBKDF2 for a "stetched" key encryption key
- Uses PBKDF2 for a "stretched" key encryption key
- Enforces NIST SP 800-131A and NIST SP 800-132

@@ -53,5 +53,5 @@ - Delays reporting errors to slow down brute force attacks

A private key is stored as an encrypted PKCS 8 structure in the PEM format. It is protected by a key generated from the key chain's *passPhrase* using **PBKDF2**.
A private key is stored as an encrypted PKCS 8 structure in the PEM format. It is protected by a key generated from the key chain's *pass phrase* using **PBKDF2**.
The default options for generating the derived encryption key are in the `dek` object. This, along with the passPhrase, is the input to a `PBKDF2` function.
The default options for generating the derived encryption key are in the `dek` object. This, along with the pass phrase, is the input to a `PBKDF2` function.

@@ -58,0 +58,0 @@ ```TypeScript

/**
* @packageDocumentation
*
* - Manages the lifecycle of a key
* - Manages the life cycle of a key
* - Keys are encrypted at rest
* - Enforces the use of safe key names
* - Uses encrypted PKCS 8 for key storage
* - Uses PBKDF2 for a "stetched" key encryption key
* - Uses PBKDF2 for a "stretched" key encryption key
* - Enforces NIST SP 800-131A and NIST SP 800-132

@@ -29,5 +29,5 @@ * - Delays reporting errors to slow down brute force attacks

*
* A private key is stored as an encrypted PKCS 8 structure in the PEM format. It is protected by a key generated from the key chain's *passPhrase* using **PBKDF2**.
* A private key is stored as an encrypted PKCS 8 structure in the PEM format. It is protected by a key generated from the key chain's *pass phrase* using **PBKDF2**.
*
* The default options for generating the derived encryption key are in the `dek` object. This, along with the passPhrase, is the input to a `PBKDF2` function.
* The default options for generating the derived encryption key are in the `dek` object. This, along with the pass phrase, is the input to a `PBKDF2` function.
*

@@ -189,3 +189,3 @@ * ```TypeScript

* await libp2p.services.keychain.createKey('keyTest', 'RSA', 4096)
* const keyInfo = await libp2p.services.keychain.renameKey('keyTest', 'keyNewNtest')
* const keyInfo = await libp2p.services.keychain.renameKey('keyTest', 'keyNewTest')
* ```

@@ -192,0 +192,0 @@ */

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

/**
* Manages the lifecycle of a key. Keys are encrypted at rest using PKCS #8.
* Manages the life cycle of a key. Keys are encrypted at rest using PKCS #8.
*

@@ -168,6 +168,6 @@ * A key in the store has two entries

const dsname = DsInfoName(name)
const datastoreName = DsInfoName(name)
try {
const res = await this.components.datastore.get(dsname)
const res = await this.components.datastore.get(datastoreName)
return JSON.parse(uint8ArrayToString(res))

@@ -211,4 +211,4 @@ } catch (err: any) {

}
const dsname = DsName(name)
const exists = await this.components.datastore.has(dsname)
const datastoreName = DsName(name)
const exists = await this.components.datastore.has(datastoreName)
if (exists) {

@@ -241,3 +241,3 @@ await randomDelay()

const batch = this.components.datastore.batch()
batch.put(dsname, uint8ArrayFromString(pem))
batch.put(datastoreName, uint8ArrayFromString(pem))
batch.put(DsInfoName(name), uint8ArrayFromString(JSON.stringify(keyInfo)))

@@ -255,5 +255,5 @@ await batch.commit()

const dsname = DsName(name)
const datastoreName = DsName(name)
try {
const res = await this.components.datastore.get(dsname)
const res = await this.components.datastore.get(datastoreName)
const pem = uint8ArrayToString(res)

@@ -281,6 +281,6 @@ const cached = privates.get(this)

const dsname = DsName(name)
const datastoreName = DsName(name)
const keyInfo = await this.findKeyByName(name)
const batch = this.components.datastore.batch()
batch.delete(dsname)
batch.delete(datastoreName)
batch.delete(DsInfoName(name))

@@ -326,8 +326,8 @@ await batch.commit()

}
const oldDsname = DsName(oldName)
const newDsname = DsName(newName)
const oldDatastoreName = DsName(oldName)
const newDatastoreName = DsName(newName)
const oldInfoName = DsInfoName(oldName)
const newInfoName = DsInfoName(newName)
const exists = await this.components.datastore.has(newDsname)
const exists = await this.components.datastore.has(newDatastoreName)
if (exists) {

@@ -339,3 +339,3 @@ await randomDelay()

try {
const pem = await this.components.datastore.get(oldDsname)
const pem = await this.components.datastore.get(oldDatastoreName)
const res = await this.components.datastore.get(oldInfoName)

@@ -346,5 +346,5 @@

const batch = this.components.datastore.batch()
batch.put(newDsname, pem)
batch.put(newDatastoreName, pem)
batch.put(newInfoName, uint8ArrayFromString(JSON.stringify(keyInfo)))
batch.delete(oldDsname)
batch.delete(oldDatastoreName)
batch.delete(oldInfoName)

@@ -351,0 +351,0 @@ await batch.commit()

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

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