Unable to decrypt

I’m getting the DOMException {} error and I’m unable to track down the issue.

https://cloudflareworkers.com/#5d65dd3ed841b8f535c6a8881f5ff783:https://tutorial.cloudflareworkers.com

Hi @thomas4, it looks like a couple arguments are just transposed:

await encrypt('test', 'secret')

should be

await encrypt('secret', 'test')

Since the transposition causes decrypt() to use a different key than the one that was used for encryption, the decryption fails its tag authentication check. We obviously need a proper error message for this – thank you for letting us know!

2 Likes