Page MenuHomePhabricator

D3209.diff
No OneTemporary

D3209.diff

diff --git a/server/src/scripts/generate-olm-config.js b/server/src/scripts/generate-olm-config.js
new file mode 100644
--- /dev/null
+++ b/server/src/scripts/generate-olm-config.js
@@ -0,0 +1,37 @@
+// @flow
+
+import olm from '@matrix-org/olm';
+import fs from 'fs';
+import path from 'path';
+import uuid from 'uuid';
+
+import { main } from './utils';
+
+const olmConfigRelativePath = './secrets/olm_config.json';
+
+async function generateOlmConfig() {
+ await olm.init();
+ const account = new olm.Account();
+ account.create();
+ const picklingKey = uuid.v4();
+ const pickledAccount = account.pickle(picklingKey);
+
+ const olmConfig = {
+ picklingKey: picklingKey,
+ pickledAccount: pickledAccount,
+ };
+ const scriptWorkingDirectory = path.resolve();
+
+ if (!scriptWorkingDirectory.endsWith('comm/server')) {
+ throw new Error('Script must be run in server directory in comm project.');
+ }
+
+ const olmConfigFilePath = path.join(
+ scriptWorkingDirectory,
+ olmConfigRelativePath,
+ );
+
+ fs.writeFileSync(olmConfigFilePath, JSON.stringify(olmConfig));
+}
+
+main([generateOlmConfig]);

File Metadata

Mime Type
text/plain
Expires
Tue, Dec 3, 2:20 AM (21 h, 23 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2609799
Default Alt Text
D3209.diff (1 KB)

Event Timeline