6

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
tarun14110
  • 940
  • 5
  • 26
  • 57
  • I have posted an intro code of how to use it here. https://stackoverflow.com/a/45456125/7995536 – SomeoneNew Aug 02 '17 at 09:01
  • 1
    I too am surprised that Signal doesn't have a tutorial for an actual working example! It seems impossible to get started because they leave out lots of details. It's a shame because the idea sounds impressive and really helpful. – Ryan Aug 11 '18 at 13:21

1 Answers1

0

You can check this example https://github.com/signalapp/libsignal-protocol-java/pull/21/commits/3496ed996359f6d3d8ee52dcecb8f8b0d45b3cbc

This is Java based project but it might help you in your JS code https://github.com/lvijay/DemoSignal

Muhammad Ahmed
  • 1,038
  • 1
  • 7
  • 7