You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-28 05:03:59 +03:00
Remove :deviceId from /keys/upload/:deviceId as not spec-compliant
This commit is contained in:
@@ -174,7 +174,7 @@ describe("Cross Signing", function() {
|
|||||||
HttpResponse.PUSH_RULES_RESPONSE,
|
HttpResponse.PUSH_RULES_RESPONSE,
|
||||||
{
|
{
|
||||||
method: "POST",
|
method: "POST",
|
||||||
path: "/keys/upload/Osborne2",
|
path: "/keys/upload",
|
||||||
data: {
|
data: {
|
||||||
one_time_key_counts: {
|
one_time_key_counts: {
|
||||||
curve25519: 100,
|
curve25519: 100,
|
||||||
@@ -237,7 +237,7 @@ describe("Cross Signing", function() {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
method: "POST",
|
method: "POST",
|
||||||
path: "/keys/upload/Osborne2",
|
path: "/keys/upload",
|
||||||
data: {
|
data: {
|
||||||
one_time_key_counts: {
|
one_time_key_counts: {
|
||||||
curve25519: 100,
|
curve25519: 100,
|
||||||
@@ -429,7 +429,7 @@ describe("Cross Signing", function() {
|
|||||||
HttpResponse.PUSH_RULES_RESPONSE,
|
HttpResponse.PUSH_RULES_RESPONSE,
|
||||||
{
|
{
|
||||||
method: "POST",
|
method: "POST",
|
||||||
path: "/keys/upload/Osborne2",
|
path: "/keys/upload",
|
||||||
data: {
|
data: {
|
||||||
one_time_key_counts: {
|
one_time_key_counts: {
|
||||||
curve25519: 100,
|
curve25519: 100,
|
||||||
@@ -487,7 +487,7 @@ describe("Cross Signing", function() {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
method: "POST",
|
method: "POST",
|
||||||
path: "/keys/upload/Osborne2",
|
path: "/keys/upload",
|
||||||
data: {
|
data: {
|
||||||
one_time_key_counts: {
|
one_time_key_counts: {
|
||||||
curve25519: 100,
|
curve25519: 100,
|
||||||
|
|||||||
@@ -1698,10 +1698,8 @@ MatrixBaseApis.prototype.search = function(opts, callback) {
|
|||||||
*
|
*
|
||||||
* @param {Object} content body of upload request
|
* @param {Object} content body of upload request
|
||||||
*
|
*
|
||||||
* @param {Object=} opts
|
* @param {Object=} opts this method no longer takes any opts,
|
||||||
*
|
* used to take opts.device_id but this was not removed from the spec as a redundant parameter
|
||||||
* @param {string=} opts.device_id explicit device_id to use for upload
|
|
||||||
* (default is to use the same as that used during auth).
|
|
||||||
*
|
*
|
||||||
* @param {module:client.callback=} callback
|
* @param {module:client.callback=} callback
|
||||||
*
|
*
|
||||||
@@ -1709,17 +1707,7 @@ MatrixBaseApis.prototype.search = function(opts, callback) {
|
|||||||
* an error response ({@link module:http-api.MatrixError}).
|
* an error response ({@link module:http-api.MatrixError}).
|
||||||
*/
|
*/
|
||||||
MatrixBaseApis.prototype.uploadKeysRequest = function(content, opts, callback) {
|
MatrixBaseApis.prototype.uploadKeysRequest = function(content, opts, callback) {
|
||||||
opts = opts || {};
|
return this._http.authedRequest(callback, "POST", "/keys/upload", undefined, content);
|
||||||
const deviceId = opts.device_id;
|
|
||||||
let path;
|
|
||||||
if (deviceId) {
|
|
||||||
path = utils.encodeUri("/keys/upload/$deviceId", {
|
|
||||||
$deviceId: deviceId,
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
path = "/keys/upload";
|
|
||||||
}
|
|
||||||
return this._http.authedRequest(callback, "POST", path, undefined, content);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
MatrixBaseApis.prototype.uploadKeySignatures = function(content) {
|
MatrixBaseApis.prototype.uploadKeySignatures = function(content) {
|
||||||
|
|||||||
@@ -1244,10 +1244,6 @@ Crypto.prototype.uploadDeviceKeys = function() {
|
|||||||
return crypto._signObject(deviceKeys).then(() => {
|
return crypto._signObject(deviceKeys).then(() => {
|
||||||
return crypto._baseApis.uploadKeysRequest({
|
return crypto._baseApis.uploadKeysRequest({
|
||||||
device_keys: deviceKeys,
|
device_keys: deviceKeys,
|
||||||
}, {
|
|
||||||
// for now, we set the device id explicitly, as we may not be using the
|
|
||||||
// same one as used in login.
|
|
||||||
device_id: deviceId,
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -1344,9 +1340,7 @@ function _maybeUploadOneTimeKeys(crypto) {
|
|||||||
return Promise.resolve(crypto._oneTimeKeyCount);
|
return Promise.resolve(crypto._oneTimeKeyCount);
|
||||||
}
|
}
|
||||||
// ask the server how many keys we have
|
// ask the server how many keys we have
|
||||||
return crypto._baseApis.uploadKeysRequest({}, {
|
return crypto._baseApis.uploadKeysRequest({}).then((res) => {
|
||||||
device_id: crypto._deviceId,
|
|
||||||
}).then((res) => {
|
|
||||||
return res.one_time_key_counts.signed_curve25519 || 0;
|
return res.one_time_key_counts.signed_curve25519 || 0;
|
||||||
});
|
});
|
||||||
}).then((keyCount) => {
|
}).then((keyCount) => {
|
||||||
@@ -1386,10 +1380,6 @@ async function _uploadOneTimeKeys(crypto) {
|
|||||||
|
|
||||||
const res = await crypto._baseApis.uploadKeysRequest({
|
const res = await crypto._baseApis.uploadKeysRequest({
|
||||||
one_time_keys: oneTimeJson,
|
one_time_keys: oneTimeJson,
|
||||||
}, {
|
|
||||||
// for now, we set the device id explicitly, as we may not be using the
|
|
||||||
// same one as used in login.
|
|
||||||
device_id: crypto._deviceId,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
await crypto._olmDevice.markKeysAsPublished();
|
await crypto._olmDevice.markKeysAsPublished();
|
||||||
|
|||||||
Reference in New Issue
Block a user