mirror of
https://github.com/fluencelabs/js-libp2p-crypto
synced 2025-06-29 15:41:49 +00:00
feat: refactor to use async/await (#131)
BREAKING CHANGE: API refactored to use async/await feat: WIP use async await fix: passing tests chore: update travis node.js versions fix: skip ursa optional tests on windows fix: benchmarks docs: update docs fix: remove broken and intested private key decrypt chore: update deps
This commit is contained in:
@ -32,23 +32,11 @@ describe('RSA crypto libs', function () {
|
||||
rsa = crypto.keys.supportedKeys.rsa
|
||||
})
|
||||
|
||||
it('generates a valid key', (done) => {
|
||||
crypto.keys.generateKeyPair('RSA', 512, (err, key) => {
|
||||
if (err) {
|
||||
return done(err)
|
||||
}
|
||||
|
||||
expect(key).to.be.an.instanceof(rsa.RsaPrivateKey)
|
||||
|
||||
key.hash((err, digest) => {
|
||||
if (err) {
|
||||
return done(err)
|
||||
}
|
||||
|
||||
expect(digest).to.have.length(34)
|
||||
done()
|
||||
})
|
||||
})
|
||||
it('generates a valid key', async () => {
|
||||
const key = await crypto.keys.generateKeyPair('RSA', 512)
|
||||
expect(key).to.be.an.instanceof(rsa.RsaPrivateKey)
|
||||
const digest = await key.hash()
|
||||
expect(digest).to.have.length(34)
|
||||
})
|
||||
|
||||
after(() => {
|
||||
|
Reference in New Issue
Block a user