chore: add e2e tests for case insensitive aad compare [no ci]
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user