-
Notifications
You must be signed in to change notification settings - Fork 66
Description
As the Derived Key implementation is not clearly documented, I thought derivedSeedHex would be interchangeable with seedHex; thus, I copied the implementation provided in this repository (including src/lib/ecies/index.js) and configured it on a React Native project running on top of Expo.
After fiddling around to make the crypto, buffer, and stream implementation load correctly, I tried it with my own seedHex (directly out of my browser's localStorage).
Everything seemed to be working; however, as soon as I replaced the seedHex with the derivedSeedHex (given by doing the derived authorization flow on the identity), the implementation started to throw the following error:
[Unhandled promise rejection: Error: Incorrect MAC]
at src/lib/ecies/index.js:26:1 in kdf
at src/lib/ecies/index.js:170:2 in decrypt
at http://127.0.0.1:19000/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false&minify=false:192892:18 in decryptShared
at src/pages/Inbox/index.tsx:41:20 in useCallback$argument_0
at [native code]:null in flushedQueue
at [native code]:null in invokeCallbackAndReturnFlushedQueue
The error comes from the following section, and removing it, will cause invalid encryption.
assert(hmacGood.equals(msgMac), "Incorrect MAC");
With that said:
- Does the Derived Keys support decrypting messages? (or in other words, Am I doing something wrong?)
- If they don't support decryption: when will this feature be available?
- If they do support decryption: is it only from the messages encoded using Derived Keys?
- All and all, how should I proceed to implement such a feature?