Skip to content

Commit 1d97a5f

Browse files
committed
Merge pull request element-hq#470 from vector-im/rav/olm
HOWTO encryption
2 parents b532fd0 + f8e5bbe commit 1d97a5f

2 files changed

Lines changed: 54 additions & 2 deletions

File tree

‎README.md‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,31 @@ Deployment
5757
Just run `npm run build` and then mount the `vector` directory on your webserver to
5858
actually serve up the app, which is entirely static content.
5959

60+
Enabling encryption
61+
===================
62+
63+
End-to-end encryption in Vector and Matrix is not yet considered ready for
64+
day-to-day use; it is experimental and should be considered only as a
65+
proof-of-concept. See https://matrix.org/jira/browse/SPEC-162 for an overview
66+
of the current progress.
67+
68+
To build a version of vector with support for end-to-end encryption, install
69+
the olm module with `npm i https://matrix.org/packages/npm/olm/olm-0.1.0.tgz`
70+
before running `npm start`. The olm library will be detected and used if
71+
available.
72+
73+
To enable encryption for a room, type
74+
75+
```
76+
/encrypt on
77+
```
78+
79+
in the message bar in that room. Vector will then generate a set of keys, and
80+
encrypt all outgoing messages in that room. (Note that other people in that
81+
room will send messages in the clear unless they also `/encrypt on`.)
82+
83+
Note that historical encrypted messages cannot currently be decoded - history
84+
is therefore lost when the page is reloaded.
85+
86+
There is currently no visual indication of whether encryption is enabled for a
87+
room, or whether a particular message was encrypted.

‎webpack.config.js‎

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ var path = require('path');
22
var webpack = require('webpack');
33
var ExtractTextPlugin = require("extract-text-webpack-plugin");
44

5+
var olm_path = path.resolve('./node_modules/olm');
6+
57
module.exports = {
68
module: {
79
preLoaders: [
@@ -32,18 +34,40 @@ module.exports = {
3234
// alias any requires to the react module to the one in our path, otherwise
3335
// we tend to get the react source included twice when using npm link.
3436
react: path.resolve('./node_modules/react'),
37+
38+
// matrix-js-sdk will use olm if it is available,
39+
// but does not explicitly depend on it. Pull it
40+
// in from node_modules if it's there.
41+
olm: olm_path,
3542
},
3643
},
3744
plugins: [
38-
new webpack.IgnorePlugin(/^olm/),
3945
new webpack.DefinePlugin({
4046
'process.env': {
4147
NODE_ENV: JSON.stringify(process.env.NODE_ENV)
4248
}
4349
}),
50+
4451
new ExtractTextPlugin("bundle.css", {
4552
allChunks: true
46-
})
53+
}),
54+
55+
// olm.js includes "require 'fs'", which is never
56+
// executed in the browser. Ignore it.
57+
new webpack.IgnorePlugin(/^fs$/, /node_modules\/olm$/)
4758
],
4859
devtool: 'source-map'
4960
};
61+
62+
// ignore olm.js if it's not installed.
63+
(function() {
64+
var fs = require('fs');
65+
try {
66+
fs.lstatSync(olm_path);
67+
console.log("Olm is installed; including it in webpack bundle");
68+
} catch (e) {
69+
module.exports.plugins.push(
70+
new webpack.IgnorePlugin(/^olm$/)
71+
);
72+
}
73+
}) ();

0 commit comments

Comments
 (0)