hapi icon indicating copy to clipboard operation
hapi copied to clipboard

typo on iron introduction page

Open Taehyeong-Gim opened this issue 3 years ago • 1 comments
trafficstars

Context

I think there is an typo on explaning the seal process.

pagelink : https://hapi.dev/module/iron/#introduction

The example said mac the encrypted object with salt E and iv.

Following the iron code linked below, HACM key(Key I) is used to make mac instaed of salt E. So if I understood correctly, the sentence should be mac the encrypted object along with KeyI and iv.

https://github.com/hapijs/iron/blob/62e00b64bd405a2c8bc773328774da9f7cc92d3c/lib/index.js#L229

Taehyeong-Gim avatar Jul 13 '22 04:07 Taehyeong-Gim

I think you're right. If I understood correctly as well, when we call hmacWithPassword we're calling another time generateKey: https://github.com/hapijs/iron/blob/62e00b64bd405a2c8bc773328774da9f7cc92d3c/lib/index.js#L156 which is where we create keyI using saltI. Since we're calling Crypto.createHmac with key.key that we get from the line I mentioned above, then we'd be using keyI and not saltE.

Let's see if other people understand the same we did. 😃

Nargonath avatar Jul 13 '22 07:07 Nargonath