From 7b21a4bed4537428f8a8db5b591adbbe060ce935 Mon Sep 17 00:00:00 2001 From: lilia Date: Mon, 19 Sep 2016 17:58:17 -0700 Subject: [PATCH] Add version field to SessionRecord The session state format changed. Make a note of it. --- dist/libsignal-protocol.js | 5 ++++- src/SessionRecord.js | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/dist/libsignal-protocol.js b/dist/libsignal-protocol.js index a430245..f8ecadc 100644 --- a/dist/libsignal-protocol.js +++ b/dist/libsignal-protocol.js @@ -35515,6 +35515,7 @@ Internal.ChainType = { Internal.SessionRecord = function() { 'use strict'; var ARCHIVED_STATES_MAX_LENGTH = 40; + var SESSION_RECORD_VERSION = 'v1'; var StaticByteBufferProto = new dcodeIO.ByteBuffer().__proto__; var StaticArrayBufferProto = new ArrayBuffer().__proto__; @@ -35556,6 +35557,7 @@ Internal.SessionRecord = function() { var SessionRecord = function() { this._sessions = {}; + this.version = SESSION_RECORD_VERSION; }; SessionRecord.deserialize = function(serialized) { @@ -35571,7 +35573,8 @@ Internal.SessionRecord = function() { SessionRecord.prototype = { serialize: function() { return jsonThing({ - sessions : this._sessions + sessions : this._sessions, + version : this.version }); }, haveOpenSession: function() { diff --git a/src/SessionRecord.js b/src/SessionRecord.js index d76fdbc..bc5c628 100644 --- a/src/SessionRecord.js +++ b/src/SessionRecord.js @@ -16,6 +16,7 @@ Internal.ChainType = { Internal.SessionRecord = function() { 'use strict'; var ARCHIVED_STATES_MAX_LENGTH = 40; + var SESSION_RECORD_VERSION = 'v1'; var StaticByteBufferProto = new dcodeIO.ByteBuffer().__proto__; var StaticArrayBufferProto = new ArrayBuffer().__proto__; @@ -57,6 +58,7 @@ Internal.SessionRecord = function() { var SessionRecord = function() { this._sessions = {}; + this.version = SESSION_RECORD_VERSION; }; SessionRecord.deserialize = function(serialized) { @@ -72,7 +74,8 @@ Internal.SessionRecord = function() { SessionRecord.prototype = { serialize: function() { return jsonThing({ - sessions : this._sessions + sessions : this._sessions, + version : this.version }); }, haveOpenSession: function() {