src/crypto/index.js
// returns a promise which resolves to the response
returns a promise which resolves to the response
returns a promise which resolves to the response
function _uploadOneTimeKeys(crypto) {
    const oneTimeKeys = crypto._olmDevice.getOneTimeKeys();
    const oneTimeJson = {};
    for (const keyId in oneTimeKeys.curve25519) {
        if (oneTimeKeys.curve25519.hasOwnProperty(keyId)) {
            const k = {
                key: oneTimeKeys.curve25519[keyId],
            };
            crypto._signObject(k);
            oneTimeJson["signed_curve25519:" + keyId] = k;
        }
    }
    return crypto._baseApis.uploadKeysRequest({
        one_time_keys: oneTimeJson,
    }, {
        device_id: crypto._deviceId,
    }).then(function(res) {
        crypto._olmDevice.markKeysAsPublished();
        return res;
    });
}
function _uploadOneTimeKeys ( crypto ) { const oneTimeKeys = crypto . _olmDevice . getOneTimeKeys ( ) ; const oneTimeJson = { } ; for ( const keyId in oneTimeKeys . curve25519 ) { if ( oneTimeKeys . curve25519 . hasOwnProperty ( keyId ) ) { const k = { key : oneTimeKeys . curve25519 [ keyId ] , } ; crypto . _signObject ( k ) ; oneTimeJson [ "signed_curve25519:" + keyId ] = k ; } } return crypto . _baseApis . uploadKeysRequest ( { one_time_keys : oneTimeJson , } , { device_id : crypto . _deviceId , } ) . then ( function ( res ) { crypto . _olmDevice . markKeysAsPublished ( ) ; return res ; } ) ; }
returns a promise which resolves to the response
returns a promise which resolves to the response
// for now, we set the device id explicitly, as we may not be using the // same one as used in login.