spec/integ/matrix-client-crypto.spec.js
/**
 * Set an expectation that ali will claim one of bob's keys; then flush the http request.
 *
 * @return {promise} resolves once the http request has completed.
 */
Set an expectation that ali will claim one of bob's keys; then flush the http request.
@return {promise} resolves once the http request has completed.
Set an expectation that ali will claim one of bob ' s keys ; then flush the http request . @return { promise } resolves once the http request has completed .
function expectAliClaimKeys() {
    expect(bobOneTimeKeys).toBeDefined();
    aliHttpBackend.when("POST", "/keys/claim").respond(200, function(path, content) {
        const claimType = content.one_time_keys[bobUserId][bobDeviceId];
        expect(claimType).toEqual("signed_curve25519");
        let keyId = null;
        for (keyId in bobOneTimeKeys) {
            if (bobOneTimeKeys.hasOwnProperty(keyId)) {
                if (keyId.indexOf(claimType + ":") === 0) {
                    break;
                }
            }
        }
        const result = {};
        result[bobUserId] = {};
        result[bobUserId][bobDeviceId] = {};
        result[bobUserId][bobDeviceId][keyId] = bobOneTimeKeys[keyId];
        return {one_time_keys: result};
    });
    return aliHttpBackend.flush("/keys/claim", 1);
}
function expectAliClaimKeys ( ) { expect ( bobOneTimeKeys ) . toBeDefined ( ) ; aliHttpBackend . when ( "POST" , "/keys/claim" ) . respond ( 200 , function ( path , content ) { const claimType = content . one_time_keys [ bobUserId ] [ bobDeviceId ] ; expect ( claimType ) . toEqual ( "signed_curve25519" ) ; let keyId = null ; for ( keyId in bobOneTimeKeys ) { if ( bobOneTimeKeys . hasOwnProperty ( keyId ) ) { if ( keyId . indexOf ( claimType + ":" ) === 0 ) { break ; } } } const result = { } ; result [ bobUserId ] = { } ; result [ bobUserId ] [ bobDeviceId ] = { } ; result [ bobUserId ] [ bobDeviceId ] [ keyId ] = bobOneTimeKeys [ keyId ] ; return { one_time_keys : result } ; } ) ; return aliHttpBackend . flush ( "/keys/claim" , 1 ) ; }
Set an expectation that ali will claim one of bob's keys; then flush the http request.
Set an expectation that ali will claim one of bob ' s keys ; then flush the http request .
// can't query keys before bob has uploaded them