@libp2p/crypto
Advanced tools
Comparing version 5.0.1 to 5.0.2
@@ -7,8 +7,8 @@ import { InvalidParametersError } from '@libp2p/interface'; | ||
import webcrypto from '../../webcrypto/index.js'; | ||
const bits = { | ||
'P-256': 256, | ||
'P-384': 384, | ||
'P-521': 521 | ||
const curveLengths = { | ||
'P-256': 32, | ||
'P-384': 48, | ||
'P-521': 66 | ||
}; | ||
const curveTypes = Object.keys(bits); | ||
const curveTypes = Object.keys(curveLengths); | ||
const names = curveTypes.join(' / '); | ||
@@ -41,6 +41,4 @@ export async function generateEphemeralKeyPair(curve) { | ||
name: 'ECDH', | ||
// @ts-expect-error namedCurve is missing from the types | ||
namedCurve: curve, | ||
public: key | ||
}, privateKey, bits[curve]); | ||
}, privateKey, curveLengths[curve] * 8); | ||
return new Uint8Array(buffer, 0, buffer.byteLength); | ||
@@ -55,7 +53,2 @@ }; | ||
} | ||
const curveLengths = { | ||
'P-256': 32, | ||
'P-384': 48, | ||
'P-521': 66 | ||
}; | ||
// Marshal converts a jwk encoded ECDH public key into the | ||
@@ -62,0 +55,0 @@ // form specified in section 4.3.6 of ANSI X9.62. (This is the format |
{ | ||
"name": "@libp2p/crypto", | ||
"version": "5.0.1", | ||
"version": "5.0.2", | ||
"description": "Crypto primitives for libp2p", | ||
@@ -95,3 +95,3 @@ "license": "Apache-2.0 OR MIT", | ||
"dependencies": { | ||
"@libp2p/interface": "^2.0.1", | ||
"@libp2p/interface": "^2.1.0", | ||
"@noble/curves": "^1.4.0", | ||
@@ -98,0 +98,0 @@ "@noble/hashes": "^1.4.0", |
@@ -10,9 +10,9 @@ import { InvalidParametersError } from '@libp2p/interface' | ||
const bits = { | ||
'P-256': 256, | ||
'P-384': 384, | ||
'P-521': 521 | ||
const curveLengths = { | ||
'P-256': 32, | ||
'P-384': 48, | ||
'P-521': 66 | ||
} | ||
const curveTypes = Object.keys(bits) | ||
const curveTypes = Object.keys(curveLengths) | ||
const names = curveTypes.join(' / ') | ||
@@ -67,8 +67,6 @@ | ||
name: 'ECDH', | ||
// @ts-expect-error namedCurve is missing from the types | ||
namedCurve: curve, | ||
public: key | ||
}, | ||
privateKey, | ||
bits[curve] | ||
curveLengths[curve] * 8 | ||
) | ||
@@ -89,8 +87,2 @@ | ||
const curveLengths = { | ||
'P-256': 32, | ||
'P-384': 48, | ||
'P-521': 66 | ||
} | ||
// Marshal converts a jwk encoded ECDH public key into the | ||
@@ -97,0 +89,0 @@ // form specified in section 4.3.6 of ANSI X9.62. (This is the format |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
379883
4514
0
313
Updated@libp2p/interface@^2.1.0