Skip to content

Commit

Permalink
test: test private key must be defined
Browse files Browse the repository at this point in the history
This test was excluded because the precondition wasn't hit when calling
`keyring.onDecrypt` (I think due to another precondition somewhere
else).

It might be a bit sneaky to call the "private" method (`_unwrapKey`) in
the tests, but it hits the precondition we're trying to test more
directly.
  • Loading branch information
richardTowers committed Jan 15, 2020
1 parent 310a767 commit 0a3107b
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ describe('RawRsaKeyringNode encrypt/decrypt', () => {
return expect(keyring.onEncrypt(material)).to.rejectedWith(Error)
})

xit('Precondition: Private key must be defined to support decrypt.', async () => {
it('Precondition: Private key must be defined to support decrypt.', async () => {
const keyring = new RawRsaKeyringNode({
rsaKey: { publicKey: publicPem },
keyName,
Expand All @@ -177,7 +177,6 @@ describe('RawRsaKeyringNode encrypt/decrypt', () => {

const suite = new NodeAlgorithmSuite(AlgorithmSuiteIdentifier.ALG_AES256_GCM_IV12_TAG16_HKDF_SHA256)
const material = new NodeDecryptionMaterial(suite, {})
await keyring.onDecrypt(material, [encryptedDataKey])
return expect(keyring.onDecrypt(material, [encryptedDataKey])).to.rejectedWith(Error)
return expect(keyring._unwrapKey(material, encryptedDataKey)).to.rejectedWith(Error)
})
})

0 comments on commit 0a3107b

Please sign in to comment.