@libp2p/crypto
Advanced tools
Comparing version 5.0.12-2b49a5f74 to 5.0.12-5b084e968
@@ -14,3 +14,10 @@ import { concat } from 'uint8arrays/concat'; | ||
// ) | ||
export const derivedEmptyPasswordKey = { alg: 'A128GCM', ext: true, k: 'scm9jmO_4BJAgdwWGVulLg', key_ops: ['encrypt', 'decrypt'], kty: 'oct' }; | ||
export const derivedEmptyPasswordKey = { | ||
alg: 'A128GCM', | ||
ext: true, | ||
/* spell-checker:disable-next-line */ | ||
k: 'scm9jmO_4BJAgdwWGVulLg', | ||
key_ops: ['encrypt', 'decrypt'], | ||
kty: 'oct' | ||
}; | ||
// Based off of code from https://github.com/luke-park/SecureCompatibleEncryptionExamples | ||
@@ -17,0 +24,0 @@ export function create(opts) { |
@@ -27,3 +27,3 @@ import crypto from 'crypto'; | ||
async function encrypt(data, password) { | ||
// Generate a 128-bit salt using a CSPRNG. | ||
// Generate a 128-bit salt | ||
const salt = crypto.randomBytes(saltLength); | ||
@@ -30,0 +30,0 @@ if (typeof password === 'string') { |
@@ -44,3 +44,3 @@ /** | ||
* RSA keys are not supported as in practice we they are not stored in identity | ||
* multihashes since the hash would be very large. | ||
* multihash since the hash would be very large. | ||
*/ | ||
@@ -47,0 +47,0 @@ export declare function publicKeyFromMultihash(digest: MultihashDigest<0x0>): Ed25519PublicKey | Secp256k1PublicKey; |
@@ -71,3 +71,3 @@ /** | ||
* RSA keys are not supported as in practice we they are not stored in identity | ||
* multihashes since the hash would be very large. | ||
* multihash since the hash would be very large. | ||
*/ | ||
@@ -74,0 +74,0 @@ export function publicKeyFromMultihash(digest) { |
@@ -21,3 +21,3 @@ import type { JWKKeyPair } from '../interface.js'; | ||
/** | ||
* Turn PCKS#1 DER bytes to a PrivateKey | ||
* Turn PKCS#1 DER bytes to a PrivateKey | ||
*/ | ||
@@ -24,0 +24,0 @@ export declare function pkcs1ToRSAPrivateKey(bytes: Uint8Array): RSAPrivateKey; |
@@ -124,3 +124,3 @@ import { InvalidParametersError, InvalidPublicKeyError } from '@libp2p/interface'; | ||
/** | ||
* Turn PCKS#1 DER bytes to a PrivateKey | ||
* Turn PKCS#1 DER bytes to a PrivateKey | ||
*/ | ||
@@ -127,0 +127,0 @@ export function pkcs1ToRSAPrivateKey(bytes) { |
{ | ||
"name": "@libp2p/crypto", | ||
"version": "5.0.12-2b49a5f74", | ||
"version": "5.0.12-5b084e968", | ||
"description": "Crypto primitives for libp2p", | ||
@@ -95,3 +95,3 @@ "license": "Apache-2.0 OR MIT", | ||
"dependencies": { | ||
"@libp2p/interface": "2.6.0-2b49a5f74", | ||
"@libp2p/interface": "2.6.0-5b084e968", | ||
"@noble/curves": "^1.7.0", | ||
@@ -98,0 +98,0 @@ "@noble/hashes": "^1.6.1", |
@@ -16,3 +16,10 @@ import { concat } from 'uint8arrays/concat' | ||
// ) | ||
export const derivedEmptyPasswordKey = { alg: 'A128GCM', ext: true, k: 'scm9jmO_4BJAgdwWGVulLg', key_ops: ['encrypt', 'decrypt'], kty: 'oct' } | ||
export const derivedEmptyPasswordKey = { | ||
alg: 'A128GCM', | ||
ext: true, | ||
/* spell-checker:disable-next-line */ | ||
k: 'scm9jmO_4BJAgdwWGVulLg', | ||
key_ops: ['encrypt', 'decrypt'], | ||
kty: 'oct' | ||
} | ||
@@ -19,0 +26,0 @@ // Based off of code from https://github.com/luke-park/SecureCompatibleEncryptionExamples |
@@ -35,3 +35,3 @@ import crypto from 'crypto' | ||
async function encrypt (data: Uint8Array, password: string | Uint8Array): Promise<Uint8Array> { | ||
// Generate a 128-bit salt using a CSPRNG. | ||
// Generate a 128-bit salt | ||
const salt = crypto.randomBytes(saltLength) | ||
@@ -38,0 +38,0 @@ |
@@ -100,3 +100,3 @@ /** | ||
* RSA keys are not supported as in practice we they are not stored in identity | ||
* multihashes since the hash would be very large. | ||
* multihash since the hash would be very large. | ||
*/ | ||
@@ -103,0 +103,0 @@ export function publicKeyFromMultihash (digest: MultihashDigest<0x0>): Ed25519PublicKey | Secp256k1PublicKey { |
@@ -151,3 +151,3 @@ import { InvalidParametersError, InvalidPublicKeyError } from '@libp2p/interface' | ||
/** | ||
* Turn PCKS#1 DER bytes to a PrivateKey | ||
* Turn PKCS#1 DER bytes to a PrivateKey | ||
*/ | ||
@@ -154,0 +154,0 @@ export function pkcs1ToRSAPrivateKey (bytes: Uint8Array): RSAPrivateKey { |
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
376107
4488
+ Added@libp2p/interface@2.6.0-5b084e968(transitive)
- Removed@libp2p/interface@2.6.0-2b49a5f74(transitive)