I am creating a school project, a secure chat like whatsapp / signal. https://github.com/andeluvian/React-Chat
The application works ok, its still a mess but what i need help with to continue the project is to create a local storage for registrationId, keyId,IdentityKeyPair, PreKey, SignedPreKey
What i have tested with is the InMemoryStorage and i can see from logs that i can save most of everything in there.
When i cleared the Authentication.Js to create the localStorage i kinda feel like its not really what i should be doing.
At the SubmitHandle(e)
i do
window.localStorage.setItem('username', this.state.username);
var registrationid = KeyHelper.generateregistrationId();
window.localstorage.setItem('registrationId', registrationId);
At this point everything is fine however when i add identitykeyPair/PreKey/SignedPreKey which is another object i feel like im getting into a mess i use JSON.Stringify to put the objects into localstorage and get Inside Storage
preKey:"{"keyId":1,"keyPair":{"pubKey":{},"privKey":{}}}"
And using JSON.parse i get:
Object
keyId:1
-keyPair: Object
+privKey:Object
+pubKey:Object
:D the pub and privkey should be ArrayBuffer. Can someone brave enough help me create this part where i can store my junk into localstorage and also retrieve it?
Ps. I know there is a lot of easy ways and different libraries out there, but I am kinda limited to the project scope and requirements.
-E2E encrypted chat -Use whisper systems signal protocol
My app uses https://github.com/kentandlime/simple-chat-api as API because the frontend is made from their tutorial.
git elsehow/signal-protocol
I am using the forked library for signal protocol