Compare commits
25 Commits
v5.0.1
...
v5.1.0-rc.1
| Author | SHA1 | Date | |
|---|---|---|---|
| 6b35302442 | |||
| 2937e58215 | |||
| d42589b6cc | |||
| 26e9dfb4fb | |||
| f27d03a6bc | |||
| ce668d051c | |||
| e06579ecf5 | |||
| 6c30af245c | |||
| c9c40a6dde | |||
| e748ac3d00 | |||
| aec79f3a79 | |||
| bf92cb1522 | |||
| 14e1920ff5 | |||
| c95cdf5a11 | |||
| c14d0616ea | |||
| 0112701145 | |||
| cb69515be9 | |||
| 3cd791e08f | |||
| 6e233e860e | |||
| b4f0ea441b | |||
| 39974d3a61 | |||
| a998006842 | |||
| 765fbe2182 | |||
| 08dfa73b57 | |||
| 76c4875088 |
@@ -1,58 +0,0 @@
|
||||
steps:
|
||||
- label: ":eslint: JS Lint"
|
||||
command:
|
||||
- "yarn install"
|
||||
- "yarn lint:js"
|
||||
plugins:
|
||||
- docker#v3.0.1:
|
||||
image: "node:12"
|
||||
|
||||
- label: ":tslint: TS Lint"
|
||||
command:
|
||||
- "yarn install"
|
||||
- "yarn lint:ts"
|
||||
plugins:
|
||||
- docker#v3.0.1:
|
||||
image: "node:12"
|
||||
|
||||
- label: ":typescript: Types Lint"
|
||||
command:
|
||||
- "yarn install"
|
||||
- "yarn lint:types"
|
||||
plugins:
|
||||
- docker#v3.0.1:
|
||||
image: "node:12"
|
||||
|
||||
- label: "🛠 Build"
|
||||
command:
|
||||
- "yarn install"
|
||||
- "yarn build"
|
||||
plugins:
|
||||
- docker#v3.0.1:
|
||||
image: "node:12"
|
||||
|
||||
- label: ":jest: Tests"
|
||||
command:
|
||||
- "yarn install"
|
||||
- "yarn test"
|
||||
plugins:
|
||||
- docker#v3.0.1:
|
||||
image: "node:12"
|
||||
|
||||
- label: "📃 Docs"
|
||||
command:
|
||||
- "yarn install"
|
||||
- "yarn gendoc"
|
||||
plugins:
|
||||
- docker#v3.0.1:
|
||||
image: "node:12"
|
||||
|
||||
- wait
|
||||
|
||||
- label: "🐴 Trigger matrix-react-sdk"
|
||||
trigger: "matrix-react-sdk"
|
||||
branches: "develop"
|
||||
build:
|
||||
branch: "develop"
|
||||
message: "[js-sdk] ${BUILDKITE_MESSAGE}"
|
||||
async: true
|
||||
@@ -1,3 +1,25 @@
|
||||
Changes in [5.1.0-rc.1](https://github.com/matrix-org/matrix-js-sdk/releases/tag/v5.1.0-rc.1) (2020-02-26)
|
||||
==========================================================================================================
|
||||
[Full Changelog](https://github.com/matrix-org/matrix-js-sdk/compare/v5.0.1...v5.1.0-rc.1)
|
||||
|
||||
* Add latest dist-tag for releases
|
||||
[\#1230](https://github.com/matrix-org/matrix-js-sdk/pull/1230)
|
||||
* Add room method for alt_aliases
|
||||
[\#1225](https://github.com/matrix-org/matrix-js-sdk/pull/1225)
|
||||
* Remove buildkite pipeline
|
||||
[\#1227](https://github.com/matrix-org/matrix-js-sdk/pull/1227)
|
||||
* don't assume verify has been called when receiving a cancellation in
|
||||
verifier
|
||||
[\#1226](https://github.com/matrix-org/matrix-js-sdk/pull/1226)
|
||||
* Reduce secret size for new binary packing
|
||||
[\#1221](https://github.com/matrix-org/matrix-js-sdk/pull/1221)
|
||||
* misc rageshake fixes
|
||||
[\#1223](https://github.com/matrix-org/matrix-js-sdk/pull/1223)
|
||||
* Fix cancelled historical requests not appearing as cancelled
|
||||
[\#1220](https://github.com/matrix-org/matrix-js-sdk/pull/1220)
|
||||
* Fix renaming error that broke QR code verification
|
||||
[\#1217](https://github.com/matrix-org/matrix-js-sdk/pull/1217)
|
||||
|
||||
Changes in [5.0.1](https://github.com/matrix-org/matrix-js-sdk/releases/tag/v5.0.1) (2020-02-19)
|
||||
================================================================================================
|
||||
[Full Changelog](https://github.com/matrix-org/matrix-js-sdk/compare/v5.0.0...v5.0.1)
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "matrix-js-sdk",
|
||||
"version": "5.0.1",
|
||||
"version": "5.1.0-rc.1",
|
||||
"description": "Matrix Client-Server SDK for Javascript",
|
||||
"scripts": {
|
||||
"prepare": "yarn build",
|
||||
|
||||
+8
-6
@@ -294,14 +294,16 @@ fi
|
||||
rm "${release_text}"
|
||||
rm "${latest_changes}"
|
||||
|
||||
npm_publish_flags=''
|
||||
if [ $prerelease -eq 1 ]; then
|
||||
# Tag prereleases as `next` so the last stable release remains the default
|
||||
npm_publish_flags='--tag next'
|
||||
fi
|
||||
# Login and publish continues to use `npm`, as it seems to have more clearly
|
||||
# defined options and semantics than `yarn` for writing to the registry.
|
||||
npm publish $npm_publish_flags
|
||||
# Tag both releases and prereleases as `next` so the last stable release remains
|
||||
# the default.
|
||||
npm publish --tag next
|
||||
if [ $prerelease -eq 0 ]; then
|
||||
# For a release, also add the default `latest` tag.
|
||||
package=$(cat package.json | jq -er .name)
|
||||
npm dist-tag add "$package@$release" latest
|
||||
fi
|
||||
|
||||
if [ -z "$skip_jsdoc" ]; then
|
||||
echo "generating jsdocs"
|
||||
|
||||
@@ -598,6 +598,7 @@ describe("MegolmDecryption", function() {
|
||||
aliceClient.initCrypto(),
|
||||
bobClient.initCrypto(),
|
||||
]);
|
||||
aliceClient._crypto.downloadKeys = async () => {};
|
||||
const bobDevice = bobClient._crypto._olmDevice;
|
||||
|
||||
const roomId = "!someroom";
|
||||
@@ -649,6 +650,7 @@ describe("MegolmDecryption", function() {
|
||||
bobClient.initCrypto(),
|
||||
]);
|
||||
const bobDevice = bobClient._crypto._olmDevice;
|
||||
aliceClient._crypto.downloadKeys = async () => {};
|
||||
|
||||
const roomId = "!someroom";
|
||||
|
||||
|
||||
@@ -763,6 +763,19 @@ MatrixClient.prototype.getDeviceEd25519Key = function() {
|
||||
return this._crypto.getDeviceEd25519Key();
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the Curve25519 key for this device
|
||||
*
|
||||
* @return {?string} base64-encoded curve25519 key. Null if crypto is
|
||||
* disabled.
|
||||
*/
|
||||
MatrixClient.prototype.getDeviceCurve25519Key = function() {
|
||||
if (!this._crypto) {
|
||||
return null;
|
||||
}
|
||||
return this._crypto.getDeviceCurve25519Key();
|
||||
};
|
||||
|
||||
/**
|
||||
* Upload the device keys to the homeserver.
|
||||
* @return {object} A promise that will resolve when the keys are uploaded.
|
||||
|
||||
@@ -393,12 +393,6 @@ MegolmEncryption.prototype._splitUserDeviceMap = function(
|
||||
if (!sessionResult.sessionId) {
|
||||
// no session with this device, probably because there
|
||||
// were no one-time keys.
|
||||
//
|
||||
// we could send them a to_device message anyway, as a
|
||||
// signal that they have missed out on the key sharing
|
||||
// message because of the lack of keys, but there's not
|
||||
// much point in that really; it will mostly serve to clog
|
||||
// up to_device inboxes.
|
||||
|
||||
// mark this device as "handled" because we don't want to try
|
||||
// to claim a one-time-key for dead devices on every message.
|
||||
@@ -1247,6 +1241,9 @@ MegolmDecryption.prototype.onRoomKeyWithheldEvent = async function(event) {
|
||||
|
||||
if (content.code === "m.no_olm") {
|
||||
const sender = event.getSender();
|
||||
logger.warn(
|
||||
`${sender}:${senderKey} was unable to establish an olm session with us`,
|
||||
);
|
||||
// if the sender says that they haven't been able to establish an olm
|
||||
// session, let's proactively establish one
|
||||
|
||||
@@ -1258,21 +1255,30 @@ MegolmDecryption.prototype.onRoomKeyWithheldEvent = async function(event) {
|
||||
if (await this._olmDevice.getSessionIdForDevice(senderKey)) {
|
||||
// a session has already been established, so we don't need to
|
||||
// create a new one.
|
||||
logger.debug("New session already created. Not creating a new one.");
|
||||
await this._olmDevice.recordSessionProblem(senderKey, "no_olm", true);
|
||||
this.retryDecryptionFromSender(senderKey);
|
||||
return;
|
||||
}
|
||||
const device = this._crypto._deviceList.getDeviceByIdentityKey(
|
||||
let device = this._crypto._deviceList.getDeviceByIdentityKey(
|
||||
content.algorithm, senderKey,
|
||||
);
|
||||
if (!device) {
|
||||
logger.info(
|
||||
"Couldn't find device for identity key " + senderKey +
|
||||
": not establishing session",
|
||||
// if we don't know about the device, fetch the user's devices again
|
||||
// and retry before giving up
|
||||
await this._crypto.downloadKeys([sender], false);
|
||||
device = this._crypto._deviceList.getDeviceByIdentityKey(
|
||||
content.algorithm, senderKey,
|
||||
);
|
||||
await this._olmDevice.recordSessionProblem(senderKey, "no_olm", false);
|
||||
this.retryDecryptionFromSender(senderKey);
|
||||
return;
|
||||
if (!device) {
|
||||
logger.info(
|
||||
"Couldn't find device for identity key " + senderKey +
|
||||
": not establishing session",
|
||||
);
|
||||
await this._olmDevice.recordSessionProblem(senderKey, "no_olm", false);
|
||||
this.retryDecryptionFromSender(senderKey);
|
||||
return;
|
||||
}
|
||||
}
|
||||
await olmlib.ensureOlmSessionsForDevices(
|
||||
this._olmDevice, this._baseApis, {[sender]: [device]}, false,
|
||||
@@ -1481,7 +1487,6 @@ MegolmDecryption.prototype._retryDecryption = async function(senderKey, sessionI
|
||||
|
||||
MegolmDecryption.prototype.retryDecryptionFromSender = async function(senderKey) {
|
||||
const senderPendingEvents = this._pendingEvents[senderKey];
|
||||
logger.warn(senderPendingEvents);
|
||||
if (!senderPendingEvents) {
|
||||
return true;
|
||||
}
|
||||
@@ -1491,7 +1496,6 @@ MegolmDecryption.prototype.retryDecryptionFromSender = async function(senderKey)
|
||||
await Promise.all([...senderPendingEvents].map(async ([_sessionId, pending]) => {
|
||||
await Promise.all([...pending].map(async (ev) => {
|
||||
try {
|
||||
logger.warn(ev.getId());
|
||||
await ev.attemptDecryption(this._crypto);
|
||||
} catch (e) {
|
||||
// don't die if something goes wrong
|
||||
|
||||
+23
-8
@@ -1243,6 +1243,15 @@ Crypto.prototype.getDeviceEd25519Key = function() {
|
||||
return this._olmDevice.deviceEd25519Key;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the Curve25519 key for this device
|
||||
*
|
||||
* @return {string} base64-encoded curve25519 key.
|
||||
*/
|
||||
Crypto.prototype.getDeviceCurve25519Key = function() {
|
||||
return this._olmDevice.deviceCurve25519Key;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set the global override for whether the client should ever send encrypted
|
||||
* messages to unverified devices. This provides the default for rooms which
|
||||
@@ -2714,15 +2723,21 @@ Crypto.prototype._onToDeviceBadEncrypted = async function(event) {
|
||||
// on a current session.
|
||||
// Note that an undecryptable message from another device could easily be spoofed -
|
||||
// is there anything we can do to mitigate this?
|
||||
const device = this._deviceList.getDeviceByIdentityKey(algorithm, deviceKey);
|
||||
let device = this._deviceList.getDeviceByIdentityKey(algorithm, deviceKey);
|
||||
if (!device) {
|
||||
logger.info(
|
||||
"Couldn't find device for identity key " + deviceKey +
|
||||
": not re-establishing session",
|
||||
);
|
||||
await this._olmDevice.recordSessionProblem(deviceKey, "wedged", false);
|
||||
retryDecryption();
|
||||
return;
|
||||
// if we don't know about the device, fetch the user's devices again
|
||||
// and retry before giving up
|
||||
await this.downloadKeys([sender], false);
|
||||
device = this._deviceList.getDeviceByIdentityKey(algorithm, deviceKey);
|
||||
if (!device) {
|
||||
logger.info(
|
||||
"Couldn't find device for identity key " + deviceKey +
|
||||
": not re-establishing session",
|
||||
);
|
||||
await this._olmDevice.recordSessionProblem(deviceKey, "wedged", false);
|
||||
retryDecryption();
|
||||
return;
|
||||
}
|
||||
}
|
||||
const devicesByUser = {};
|
||||
devicesByUser[sender] = [device];
|
||||
|
||||
@@ -155,10 +155,13 @@ export class VerificationBase extends EventEmitter {
|
||||
} else if (e.getType() === "m.key.verification.cancel") {
|
||||
const reject = this._reject;
|
||||
this._reject = undefined;
|
||||
const content = e.getContent();
|
||||
const {reason, code} = content;
|
||||
reject(new Error(`Other side cancelled verification ` +
|
||||
`because ${reason} (${code})`));
|
||||
// there is only promise to reject if verify has been called
|
||||
if (reject) {
|
||||
const content = e.getContent();
|
||||
const {reason, code} = content;
|
||||
reject(new Error(`Other side cancelled verification ` +
|
||||
`because ${reason} (${code})`));
|
||||
}
|
||||
} else if (this._expectedEvent) {
|
||||
// only cancel if there is an event expected.
|
||||
// if there is no event expected, it means verify() wasn't called
|
||||
|
||||
@@ -80,7 +80,7 @@ export class ReciprocateQRCode extends Base {
|
||||
|
||||
const devices = (await this._baseApis.getStoredDevicesForUser(this.userId)) || [];
|
||||
const targetDevice = devices.find(d => {
|
||||
return d.deviceId === this.request.estimatedTargetDevice.deviceId;
|
||||
return d.deviceId === this.request.targetDevice.deviceId;
|
||||
});
|
||||
if (!targetDevice) throw new Error("Device not found, somehow");
|
||||
keys[`ed25519:${targetDevice.deviceId}`] = targetDevice.getFingerprint();
|
||||
|
||||
@@ -410,7 +410,7 @@ export class VerificationRequest extends EventEmitter {
|
||||
}
|
||||
|
||||
_generateSharedSecret() {
|
||||
const secretBytes = new Uint8Array(32); // 256bits
|
||||
const secretBytes = new Uint8Array(8);
|
||||
global.crypto.getRandomValues(secretBytes);
|
||||
this._sharedSecret = olmlib.encodeBase64(secretBytes);
|
||||
}
|
||||
@@ -565,7 +565,7 @@ export class VerificationRequest extends EventEmitter {
|
||||
*/
|
||||
async handleEvent(type, event, isLiveEvent, isRemoteEcho, isSentByUs) {
|
||||
// if reached phase cancelled or done, ignore anything else that comes
|
||||
if (!this.pending) {
|
||||
if (this.done || this.cancelled) {
|
||||
return;
|
||||
}
|
||||
const wasObserveOnly = this._observeOnly;
|
||||
|
||||
+13
-1
@@ -861,11 +861,23 @@ Room.prototype.getAliases = function() {
|
||||
Room.prototype.getCanonicalAlias = function() {
|
||||
const canonicalAlias = this.currentState.getStateEvents("m.room.canonical_alias", "");
|
||||
if (canonicalAlias) {
|
||||
return canonicalAlias.getContent().alias;
|
||||
return canonicalAlias.getContent().alias || null;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get this room's alternative aliases
|
||||
* @return {array} The room's alternative aliases, or an empty array
|
||||
*/
|
||||
Room.prototype.getAltAliases = function() {
|
||||
const canonicalAlias = this.currentState.getStateEvents("m.room.canonical_alias", "");
|
||||
if (canonicalAlias) {
|
||||
return canonicalAlias.getContent().alt_aliases || [];
|
||||
}
|
||||
return [];
|
||||
};
|
||||
|
||||
/**
|
||||
* Add events to a timeline
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user