I am trying to setup Signal protocol. Can someone please help me with this. https://github.com/WhisperSystems/libsignal-protocol-javascript
They had given the below code to use at the install time (that is for setup). I am not able to complete this code. I want to store the key in the browser itself for now.
var KeyHelper = libsignal.KeyHelper;
var registrationId = KeyHelper.generateRegistrationId();
// Store registrationId somewhere durable and safe.
KeyHelper.generateIdentityKeyPair().then(function(identityKeyPair) {
// keyPair -> { pubKey: ArrayBuffer, privKey: ArrayBuffer }
// Store identityKeyPair somewhere durable and safe.
});
KeyHelper.generatePreKey(keyId).then(function(preKey) {
store.storePreKey(preKey.keyId, preKey.keyPair);
});
KeyHelper.generateSignedPreKey(identityKeyPair, keyId).then(function(signedPreKey) {
store.storeSignedPreKey(signedPreKey.keyId, signedPreKey.keyPair);
});
// Register preKeys and signedPreKey with the server