Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32846077
D13523.1768096319.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
934 B
Referenced Files
None
Subscribers
None
D13523.1768096319.diff
View Options
diff --git a/native/crypto/olm-api.js b/native/crypto/olm-api.js
--- a/native/crypto/olm-api.js
+++ b/native/crypto/olm-api.js
@@ -14,10 +14,20 @@
import { commCoreModule } from '../native-modules.js';
-const olmAPI: OlmAPI = {
- async initializeCryptoAccount(): Promise<void> {
+let currentInitializeCryptoAccountPromise: ?Promise<void>;
+function initializeCryptoAccount(): Promise<void> {
+ if (currentInitializeCryptoAccountPromise) {
+ return currentInitializeCryptoAccountPromise;
+ }
+ currentInitializeCryptoAccountPromise = (async () => {
await commCoreModule.initializeCryptoAccount();
- },
+ currentInitializeCryptoAccountPromise = null;
+ })();
+ return currentInitializeCryptoAccountPromise;
+}
+
+const olmAPI: OlmAPI = {
+ initializeCryptoAccount,
getUserPublicKey: commCoreModule.getUserPublicKey,
encrypt: commCoreModule.encrypt,
encryptAndPersist: commCoreModule.encryptAndPersist,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Jan 11, 1:51 AM (4 h, 1 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5914942
Default Alt Text
D13523.1768096319.diff (934 B)
Attached To
Mode
D13523: [native] Run initializeCryptoAccount once at a time
Attached
Detach File
Event Timeline
Log In to Comment