Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33027498
D8751.1768396777.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D8751.1768396777.diff
View Options
diff --git a/keyserver/src/user/login.js b/keyserver/src/user/login.js
--- a/keyserver/src/user/login.js
+++ b/keyserver/src/user/login.js
@@ -3,7 +3,6 @@
import type { Account as OlmAccount } from '@commapp/olm';
import { getRustAPI } from 'rust-node-addon';
-import type { OLMOneTimeKeys } from 'lib/types/crypto-types';
import { getCommConfig } from 'lib/utils/comm-config.js';
import { ServerError } from 'lib/utils/errors.js';
import { values } from 'lib/utils/objects.js';
@@ -15,7 +14,10 @@
} from './identity.js';
import { getMessageForException } from '../responders/utils.js';
import { fetchCallUpdateOlmAccount } from '../updaters/olm-account-updater.js';
-import { validateAccountPrekey } from '../utils/olm-utils.js';
+import {
+ getOneTimeKeyValues,
+ validateAccountPrekey,
+} from '../utils/olm-utils.js';
type UserCredentials = { +username: string, +password: string };
@@ -26,12 +28,6 @@
+oneTimeKey: $ReadOnlyArray<string>,
};
-function getOneTimeKeyValues(keyBlob: string): $ReadOnlyArray<string> {
- const content: OLMOneTimeKeys = JSON.parse(keyBlob);
- const keys: $ReadOnlyArray<string> = values(content.curve25519);
- return keys;
-}
-
function retrieveAccountKeysSet(account: OlmAccount): AccountKeysSet {
const identityKeys = account.identity_keys();
diff --git a/keyserver/src/utils/olm-utils.js b/keyserver/src/utils/olm-utils.js
--- a/keyserver/src/utils/olm-utils.js
+++ b/keyserver/src/utils/olm-utils.js
@@ -8,7 +8,11 @@
} from '@commapp/olm';
import uuid from 'uuid';
-import { olmEncryptedMessageTypes } from 'lib/types/crypto-types.js';
+import {
+ olmEncryptedMessageTypes,
+ type OLMOneTimeKeys,
+} from 'lib/types/crypto-types.js';
+import { values } from 'lib/utils/objects.js';
type PickledOlmAccount = {
+picklingKey: string,
@@ -99,6 +103,12 @@
}
}
+function getOneTimeKeyValues(keyBlob: string): $ReadOnlyArray<string> {
+ const content: OLMOneTimeKeys = JSON.parse(keyBlob);
+ const keys: $ReadOnlyArray<string> = values(content.curve25519);
+ return keys;
+}
+
export {
createPickledOlmAccount,
createPickledOlmSession,
@@ -106,4 +116,5 @@
unpickleOlmAccount,
unpickleOlmSession,
validateAccountPrekey,
+ getOneTimeKeyValues,
};
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jan 14, 1:19 PM (3 h, 22 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5928688
Default Alt Text
D8751.1768396777.diff (2 KB)
Attached To
Mode
D8751: [Keyserver] Refactor getOneTimeKeyValues
Attached
Detach File
Event Timeline
Log In to Comment