Merge pull request #1207 from Bilb/fix-device-mapping-upload

fix device mapping upload format
pull/1209/head
Audric Ackermann 5 years ago committed by GitHub
commit b0dca1a566
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,4 +1,4 @@
/* global log, libloki, window */ /* global log, libloki, window, dcodeIO */
/* global storage: false */ /* global storage: false */
/* global log: false */ /* global log: false */
@ -223,7 +223,23 @@ class LokiHomeServerInstance extends LokiFileServerInstance {
this.ourKey this.ourKey
); );
return this._setOurDeviceMapping(authorisations, isPrimary); const authorisationsBase64 = authorisations.map(authorisation => {
const requestSignature = dcodeIO.ByteBuffer.wrap(
authorisation.requestSignature
).toString('base64');
const grantSignature = authorisation.grantSignature
? dcodeIO.ByteBuffer.wrap(authorisation.grantSignature).toString(
'base64'
)
: null;
return {
...authorisation,
requestSignature,
grantSignature,
};
});
return this._setOurDeviceMapping(authorisationsBase64, isPrimary);
} }
// you only upload to your own home server // you only upload to your own home server

@ -21,17 +21,13 @@ describe('Sync Message Utils', () => {
// Fill half with secondaries, half with primaries // Fill half with secondaries, half with primaries
const numConversations = 20; const numConversations = 20;
const primaryConversations = new Array(numConversations / 2) const primaryConversations = new Array(numConversations / 2).fill({}).map(
.fill({})
.map(
() => () =>
new TestUtils.MockConversation({ new TestUtils.MockConversation({
type: TestUtils.MockConversationType.Primary, type: TestUtils.MockConversationType.Primary,
}) })
); );
const secondaryConversations = new Array(numConversations / 2) const secondaryConversations = new Array(numConversations / 2).fill({}).map(
.fill({})
.map(
() => () =>
new TestUtils.MockConversation({ new TestUtils.MockConversation({
type: TestUtils.MockConversationType.Secondary, type: TestUtils.MockConversationType.Secondary,

Loading…
Cancel
Save