Fix up array buffer comparison
Well that didn't work. Luckily this comparison is primarily enforced at the libaxolotl level. With this and the corresponding change to libaxolotl, remote identity keys are always going to be stored as array buffers going forward. This will cause incompatibility with existing keys stored as strings, so updating to this point requires you to purge your identity key and session store.
This commit is contained in:
parent
853b578551
commit
1f8040998f
1 changed files with 5 additions and 2 deletions
|
@ -56,13 +56,16 @@
|
|||
}
|
||||
|
||||
function equalArrayBuffers(ab1, ab2) {
|
||||
if (ab1.bytelength !== ab2.bytelength) {
|
||||
if (!(ab1 instanceof ArrayBuffer && ab2 instanceof ArrayBuffer)) {
|
||||
return false;
|
||||
}
|
||||
if (ab1.byteLength !== ab2.byteLength) {
|
||||
return false;
|
||||
}
|
||||
var result = true;
|
||||
var ta1 = new Uint8Array(ab1);
|
||||
var ta2 = new Uint8Array(ab2);
|
||||
for (var i = 0; i < ab1.bytelength; ++i) {
|
||||
for (var i = 0; i < ab1.byteLength; ++i) {
|
||||
if (ta1[i] !== ta2[i]) { result = false; }
|
||||
}
|
||||
return result;
|
||||
|
|
Loading…
Reference in a new issue