diff --git a/README.md b/README.md index 91109f9688..529e7cdf0f 100644 --- a/README.md +++ b/README.md @@ -57,3 +57,31 @@ Deployment Just run `npm run build` and then mount the `vector` directory on your webserver to actually serve up the app, which is entirely static content. +Enabling encryption +=================== + +End-to-end encryption in Vector and Matrix is not yet considered ready for +day-to-day use; it is experimental and should be considered only as a +proof-of-concept. See https://matrix.org/jira/browse/SPEC-162 for an overview +of the current progress. + +To build a version of vector with support for end-to-end encryption, install +the olm module with `npm i https://matrix.org/packages/npm/olm/olm-0.1.0.tgz` +before running `npm start`. The olm library will be detected and used if +available. + +To enable encryption for a room, type + +``` +/encrypt on +``` + +in the message bar in that room. Vector will then generate a set of keys, and +encrypt all outgoing messages in that room. (Note that other people in that +room will send messages in the clear unless they also `/encrypt on`.) + +Note that historical encrypted messages cannot currently be decoded - history +is therefore lost when the page is reloaded. + +There is currently no visual indication of whether encryption is enabled for a +room, or whether a particular message was encrypted. diff --git a/webpack.config.js b/webpack.config.js index 3c71ed368a..c19438a0df 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -2,6 +2,8 @@ var path = require('path'); var webpack = require('webpack'); var ExtractTextPlugin = require("extract-text-webpack-plugin"); +var olm_path = path.resolve('./node_modules/olm'); + module.exports = { module: { preLoaders: [ @@ -32,18 +34,40 @@ module.exports = { // alias any requires to the react module to the one in our path, otherwise // we tend to get the react source included twice when using npm link. react: path.resolve('./node_modules/react'), + + // matrix-js-sdk will use olm if it is available, + // but does not explicitly depend on it. Pull it + // in from node_modules if it's there. + olm: olm_path, }, }, plugins: [ - new webpack.IgnorePlugin(/^olm/), new webpack.DefinePlugin({ 'process.env': { NODE_ENV: JSON.stringify(process.env.NODE_ENV) } }), + new ExtractTextPlugin("bundle.css", { allChunks: true - }) + }), + + // olm.js includes "require 'fs'", which is never + // executed in the browser. Ignore it. + new webpack.IgnorePlugin(/^fs$/, /node_modules\/olm$/) ], devtool: 'source-map' }; + +// ignore olm.js if it's not installed. +(function() { + var fs = require('fs'); + try { + fs.lstatSync(olm_path); + console.log("Olm is installed; including it in webpack bundle"); + } catch (e) { + module.exports.plugins.push( + new webpack.IgnorePlugin(/^olm$/) + ); + } +}) ();