fix device mapping upload format

pull/1207/head
Audric Ackermann 5 years ago
parent 7c89b291de
commit 14894a916e
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -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,22 +21,18 @@ 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({
() => type: TestUtils.MockConversationType.Primary,
new TestUtils.MockConversation({ })
type: TestUtils.MockConversationType.Primary, );
}) const secondaryConversations = new Array(numConversations / 2).fill({}).map(
); () =>
const secondaryConversations = new Array(numConversations / 2) new TestUtils.MockConversation({
.fill({}) type: TestUtils.MockConversationType.Secondary,
.map( })
() => );
new TestUtils.MockConversation({
type: TestUtils.MockConversationType.Secondary,
})
);
const conversations = [...primaryConversations, ...secondaryConversations]; const conversations = [...primaryConversations, ...secondaryConversations];
const sandbox = sinon.createSandbox(); const sandbox = sinon.createSandbox();

Loading…
Cancel
Save