1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-26 17:03:12 +03:00

Lookups are URL safe

This commit is contained in:
Travis Ralston
2019-08-21 14:30:24 -06:00
parent 3d5a79be3b
commit b306df726a

View File

@@ -1908,7 +1908,8 @@ MatrixBaseApis.prototype.identityHashedLookup = async function(
// Abuse the olm hashing // Abuse the olm hashing
const olmutil = new global.Olm.Utility(); const olmutil = new global.Olm.Utility();
params["addresses"] = addressPairs.map(p => { params["addresses"] = addressPairs.map(p => {
const hashed = olmutil.sha256(`${p[0]} ${p[1]} ${params['pepper']}`); const hashed = olmutil.sha256(`${p[0]} ${p[1]} ${params['pepper']}`)
.replace(/\+/g, '-').replace(/\//g, '_'); // URL-safe base64
localMapping[hashed] = p[0]; localMapping[hashed] = p[0];
return hashed; return hashed;
}); });