chore: add e2e tests for case insensitive aad compare [no ci]

This commit is contained in:
Mo
2023-09-13 07:10:58 -05:00
parent 1275a2e148
commit 94be549f30
3 changed files with 69 additions and 0 deletions

View File

@@ -128,6 +128,29 @@ describe('004 protocol operations', function () {
expect(decrypted.content).to.eql(payload.content)
})
it('should decrypt string with case-insensitive uuid check for aad', async () => {
/** If the server returns a lowercase uuid for the item, but the encrypted payload uses uppercase uuids, should still decrypt */
const uppercaseUuid = '959B042A-3892-461E-8C50-477C10C7C40A'
const lowercaseUuid = '959b042a-3892-461e-8c50-477c10c7c40a'
const payload = new DecryptedPayload({
uuid: uppercaseUuid,
content_type: ContentType.TYPES.Note,
content: FillItemContent({
title: 'hello',
text: 'world',
}),
})
const key = await protocol004.createItemsKey()
const params = await protocol004.generateEncryptedParameters(payload, key)
params.uuid = lowercaseUuid
const decrypted = await protocol004.generateDecryptedParameters(params, key)
expect(decrypted.content).to.eql(payload.content)
})
it('modifying the uuid of the payload should fail to decrypt', async function () {
const payload = Factory.createNotePayload()
const key = await protocol004.createItemsKey()