diff --git a/examples/crypto-browser/lib/.gitignore b/examples/crypto-browser/lib/.gitignore new file mode 100644 index 000000000..dd5fde76b --- /dev/null +++ b/examples/crypto-browser/lib/.gitignore @@ -0,0 +1,2 @@ +olm.js +olm.wasm \ No newline at end of file diff --git a/examples/crypto-browser/lib/matrix.js b/examples/crypto-browser/lib/matrix.js new file mode 120000 index 000000000..518d47ddb --- /dev/null +++ b/examples/crypto-browser/lib/matrix.js @@ -0,0 +1 @@ +../../../dist/browser-matrix.js \ No newline at end of file diff --git a/examples/crypto-browser/olm-device-export-import.html b/examples/crypto-browser/olm-device-export-import.html new file mode 100644 index 000000000..7f4b356b1 --- /dev/null +++ b/examples/crypto-browser/olm-device-export-import.html @@ -0,0 +1,59 @@ + + +
+ + + +yarn build
)
+ olm.js
and olm.wasm
+ from a recent release of Olm (was tested with version 3.1.4)
+ in directory lib/
+ python3 -m http.server
) and go to it through your browser+aliceMatrixClient = await newMatrixClient("alice-"+randomHex()); +await aliceMatrixClient.exportDevice(); +await aliceMatrixClient.getAccessToken(); ++
exportDevice
and getAccessToken
somewhere
+ (not in a JS variable as it will be destroyed when you refresh the page)
+ ALICE_ID
+ with the user ID of Alice (you can find it in the exported data)
+ +bobMatrixClient = await newMatrixClient("bob-"+randomHex()); +roomId = await bobMatrixClient.createEncryptedRoom([ALICE_ID]); +await bobMatrixClient.sendTextMessage('Hi Alice!', roomId); ++
+aliceMatrixClient = await importMatrixClient(EXPORTED_DATA, ACCESS_TOKEN); ++
- Inspired by examples/browser
-
yarn build
)
- matrix.js
, olm.js
and olm.wasm
- in directory lib/
- python3 -m http.server
) and go to it through your browser-aliceMatrixClient = await newMatrixClient("alice-"+randomHex()); -await aliceMatrixClient.exportDevice(); -await aliceMatrixClient.getAccessToken(); --
exportDevice
and getAccessToken
somewhere
- (not in a JS variable as it will be destroyed when you refresh the page)
- ALICE_ID
- with the user ID of Alice (you can find it in the exported data)
- -bobMatrixClient = await newMatrixClient("bob-"+randomHex()); -roomId = await bobMatrixClient.createEncryptedRoom([ALICE_ID]); -await bobMatrixClient.sendTextMessage('Hi Alice!', roomId); --
-aliceMatrixClient = await importMatrixClient(EXPORTED_DATA, ACCESS_TOKEN); --