mirror of
https://github.com/fluencelabs/js-libp2p-crypto
synced 2025-05-31 19:01:20 +00:00
Merge pull request #158 from libp2p/v0.16.x-upgrade-node-forge
V0.16.x upgrade node forge
This commit is contained in:
commit
1c54a9b196
@ -45,7 +45,7 @@
|
|||||||
"keypair": "^1.0.1",
|
"keypair": "^1.0.1",
|
||||||
"libp2p-crypto-secp256k1": "~0.3.0",
|
"libp2p-crypto-secp256k1": "~0.3.0",
|
||||||
"multihashing-async": "~0.5.1",
|
"multihashing-async": "~0.5.1",
|
||||||
"node-forge": "~0.7.6",
|
"node-forge": "^0.8.5",
|
||||||
"pem-jwk": "^2.0.0",
|
"pem-jwk": "^2.0.0",
|
||||||
"protons": "^1.0.1",
|
"protons": "^1.0.1",
|
||||||
"rsa-pem-to-jwk": "^1.1.3",
|
"rsa-pem-to-jwk": "^1.1.3",
|
||||||
@ -53,9 +53,9 @@
|
|||||||
"ursa-optional": "~0.9.10"
|
"ursa-optional": "~0.9.10"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"aegir": "^18.0.3",
|
"aegir": "^20.0.0",
|
||||||
"benchmark": "^2.1.4",
|
"benchmark": "^2.1.4",
|
||||||
"bundlesize": "~0.17.0",
|
"bundlesize": "^0.18.0",
|
||||||
"chai": "^4.2.0",
|
"chai": "^4.2.0",
|
||||||
"chai-string": "^1.5.0",
|
"chai-string": "^1.5.0",
|
||||||
"dirty-chai": "^2.0.1"
|
"dirty-chai": "^2.0.1"
|
||||||
|
@ -28,7 +28,7 @@ exports.generateEphemeralKeyPair = require('./ephemeral-keys')
|
|||||||
|
|
||||||
// Generates a keypair of the given type and bitsize
|
// Generates a keypair of the given type and bitsize
|
||||||
exports.generateKeyPair = (type, bits, cb) => {
|
exports.generateKeyPair = (type, bits, cb) => {
|
||||||
let key = supportedKeys[type.toLowerCase()]
|
const key = supportedKeys[type.toLowerCase()]
|
||||||
|
|
||||||
if (!key) {
|
if (!key) {
|
||||||
return cb(new Error('invalid or unsupported key type'))
|
return cb(new Error('invalid or unsupported key type'))
|
||||||
@ -40,7 +40,7 @@ exports.generateKeyPair = (type, bits, cb) => {
|
|||||||
// Generates a keypair of the given type and bitsize
|
// Generates a keypair of the given type and bitsize
|
||||||
// seed is a 32 byte uint8array
|
// seed is a 32 byte uint8array
|
||||||
exports.generateKeyPairFromSeed = (type, seed, bits, cb) => {
|
exports.generateKeyPairFromSeed = (type, seed, bits, cb) => {
|
||||||
let key = supportedKeys[type.toLowerCase()]
|
const key = supportedKeys[type.toLowerCase()]
|
||||||
if (!key) {
|
if (!key) {
|
||||||
return cb(new Error('invalid or unsupported key type'))
|
return cb(new Error('invalid or unsupported key type'))
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ module.exports = (cipherType, hash, secret, callback) => {
|
|||||||
return callback(err)
|
return callback(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
let result = []
|
const result = []
|
||||||
let j = 0
|
let j = 0
|
||||||
|
|
||||||
whilst(
|
whilst(
|
||||||
|
@ -6,7 +6,7 @@ const BN = require('asn1.js').bignum
|
|||||||
// Adapted from https://tools.ietf.org/html/draft-ietf-jose-json-web-signature-41#appendix-C
|
// Adapted from https://tools.ietf.org/html/draft-ietf-jose-json-web-signature-41#appendix-C
|
||||||
exports.toBase64 = function toBase64 (bn, len) {
|
exports.toBase64 = function toBase64 (bn, len) {
|
||||||
// if len is defined then the bytes are leading-0 padded to the length
|
// if len is defined then the bytes are leading-0 padded to the length
|
||||||
let s = bn.toArrayLike(Buffer, 'be', len).toString('base64')
|
const s = bn.toArrayLike(Buffer, 'be', len).toString('base64')
|
||||||
|
|
||||||
return s
|
return s
|
||||||
.replace(/(=*)$/, '') // Remove any trailing '='s
|
.replace(/(=*)$/, '') // Remove any trailing '='s
|
||||||
|
@ -19,7 +19,7 @@ function doTests (fncName, fnc, num, skipBuffersAndStrings) {
|
|||||||
// skip this garbage because it's a buffer or a string and we were told do do that
|
// skip this garbage because it's a buffer or a string and we were told do do that
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let args = []
|
const args = []
|
||||||
for (let i = 0; i < num; i++) {
|
for (let i = 0; i < num; i++) {
|
||||||
args.push(garbage)
|
args.push(garbage)
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ describe('Util', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('toBase64 zero padding', (done) => {
|
it('toBase64 zero padding', (done) => {
|
||||||
let bnpad = new BN('ff', 16)
|
const bnpad = new BN('ff', 16)
|
||||||
expect(util.toBase64(bnpad, 2)).to.eql('AP8')
|
expect(util.toBase64(bnpad, 2)).to.eql('AP8')
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user