fix: dont add the redundant public key when marshalling

This commit is contained in:
Jacob Heun
2020-07-18 13:46:51 +02:00
parent df0f27274d
commit 353a89e58b
2 changed files with 7 additions and 1 deletions

View File

@@ -9,6 +9,7 @@ chai.use(dirtyChai)
const crypto = require('../../src')
const ed25519 = crypto.keys.supportedKeys.ed25519
const { privateKeyLength } = require('../../src/keys/ed25519')
const fixtures = require('../fixtures/go-key-ed25519')
const testGarbage = require('../helpers/test-garbage-error-handling')
@@ -154,5 +155,10 @@ describe('ed25519', function () {
const sig = await key.sign(fixtures.redundantPubKey.data)
expect(sig).to.eql(fixtures.redundantPubKey.signature)
})
it('doesnt include the redundant public key when marshalling', async () => {
const key = await crypto.keys.unmarshalPrivateKey(fixtures.redundantPubKey.privateKey)
expect(key.marshal()).to.have.length(privateKeyLength)
})
})
})