deso-protocol / deso-protocol/identity
`derivedSeedHex` and Messages throws `Incorrect HMAC` error
- Dominant language
- TypeScript
- Stars
- 69
- Forks
- 64
- PR merge metrics
- No merged PRs in 30d
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`](https://github.com/deso-protocol/identity/blob/main/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](https://github.com/deso-protocol/identity/blob/main/src/lib/ecies/index.js#L162), and removing it, will cause invalid encryption.
```
assert(hmacGood.equals(msgMac), "Incorrect MAC");
```
With that said:
1. Does the Derived Keys support decrypting messages? (or in other words, Am I doing something wrong?)
2. If they don't support decryption: when will this feature be available?
3. If they do support decryption: is it only from the messages encoded using Derived Keys?
4. All and all, how should I proceed to implement such a feature?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.