dist/sdk.es6.js
/**
     * Creates the Cyberus Key session.
     *
     * @param {string} clientId Public client ID generated during creating the account.
     * @param {Geolocation} [geo] Give a value if you want to pass optional geolocation measurement.
     *    It can be later use to compare it against the mobile's measurement (if you have set `fail_on_geo_mismatch`).
     *    Those measurements can be used also to general improvement of the security.
     * @param {string} [origin] The origin domain of the request being made. If `null` then the Referer header will be used.
     * @throws WrongJsonError, OpenApiError, ResourceNotFoundError, OTPGenerationError, UnknownError
     * @returns {Promise<string>} The Cyberus Key session id.
     * @memberof CyberusKeyAPI
     */
Creates the Cyberus Key session.
@param {string} clientId Public client ID generated during creating the account.
@param {Geolocation} [geo] Give a value if you want to pass optional geolocation measurement.
It can be later use to compare it against the mobile's measurement (if you have set `fail_on_geo_mismatch`).
Those measurements can be used also to general improvement of the security.
@param {string} [origin] The origin domain of the request being made. If `null` then the Referer header will be used.
Creates the Cyberus Key session . @param { string } clientId Public client ID generated during creating the account . @param { Geolocation } [ geo ] Give a value if you want to pass optional geolocation measurement . It can be later use to compare it against the mobile ' s measurement ( if you have set ` fail_on_geo_mismatch ` ) . Those measurements can be used also to general improvement of the security . @param { string } [ origin ] The origin domain of the request being made . If ` null ` then the Referer header will be used .
createSession(clientId, origin, geo) {
        return __awaiter(this, void 0, void 0, function* () {
            const data = { client_id: clientId };
            if (geo) {
                data['lat'] = geo.latitude;
                data['lng'] = geo.longitude;
            }
            else if (this._cachedGeo) {
                data['lat'] = this._cachedGeo.latitude;
                data['lng'] = this._cachedGeo.longitude;
            }
            if (origin) {
                data['origin'] = origin;
            }
            const params = {
                method: 'POST',
                body: this._getUrlEncodedBody(data),
                headers: {
                    'Content-Type': 'application/x-www-form-urlencoded'
                }
            };
            return fetch(this._getUrl('sessions'), params)
                .then((response) => response.json())
                .then((json) => json.data.session_id);
        });
    }
createSession ( clientId , origin , geo ) { return __awaiter ( this , void 0 , void 0 , function * ( ) { const data = { client_id : clientId } ; if ( geo ) { data [ 'lat' ] = geo . latitude ; data [ 'lng' ] = geo . longitude ; } else if ( this . _cachedGeo ) { data [ 'lat' ] = this . _cachedGeo . latitude ; data [ 'lng' ] = this . _cachedGeo . longitude ; } if ( origin ) { data [ 'origin' ] = origin ; } const params = { method : 'POST' , body : this . _getUrlEncodedBody ( data ) , headers : { 'Content-Type' : 'application/x-www-form-urlencoded' } } ; return fetch ( this . _getUrl ( 'sessions' ) , params ) . then ( ( response ) => response . json ( ) ) . then ( ( json ) => json . data . session_id ) ; } ) ; }
Creates the Cyberus Key session.
Creates the Cyberus Key session .