Class: SoundProof

soundproof. SoundProof


new SoundProof(config)

Initialize a SoundProof authentication process.
Parameters:
Name Type Description
config Object An object containing configuration properties and callback functions, which are triggered upon various events during the SoundProof authentication process.
Properties
Name Type Description
baseURL string Optional. The base URL of the Futurae server backend to which the SoundProof object should connect to. Default value is "https://api.futurae.com".
audio.deviceId string Optional. A string specifying the device Id which is required to be used as a microphone input for SoundProof. See MediaDevices.enumerateDevices() for information on how to enumerate devices and select a specific device. Omitting this param makes SoundProof try to heuristically find and use the builtin microphone, if possible, or fallback to the default system input. Specify "default" to force use of default system input.
audio.encodingWorkerPath string Optional. By default it is assumed that the JavaScript audio encoding web workers are served from the same path through which soundproof.min.js is served. If this is not the case, you can specify the path here (example: "/assets/js/").
callback.onAudioInitSuccess soundproof~onAudioInitSuccess Optional. Called once the browser audio recording interface has been initialized successfully.
callback.onComplete soundproof~onComplete Optional. Called once SoundProof authentication has been completed.
callback.onDeviceTimeout soundproof~onDeviceTimeout Optional. Called if the user's device cannot be reached within a reasonably short amount of time. This means that the SoundProof authentication attempt timed out so more callbacks are going to be immediately invoked (soundproof~onTimeout and soundproof~onComplete).
callback.onError soundproof~onError Optional. Called if SoundProof authentication fails due to an error.
callback.onNewDeviceMustApprove soundproof~onNewDeviceMustApprove Optional. Called if SoundProof failed because the user is logging in for the first time from this browser, and he must manually approve the login (see "new_device_must_approve" param in /user/auth endpoint of the Futurae Auth API).
callback.onRecordingStart soundproof~onRecordingStart Optional. Called when SoundProof starts recording audio.
callback.onRecordingEnd soundproof~onRecordingEnd Optional. Called when SoundProof finishes recording audio.
callback.onRecordingTooSilent soundproof~onRecordingTooSilent Optional. Called if SoundProof detects that there is not enough audio energy in the environment.
callback.onRetry soundproof~onRetry Optional. Called if the audio comparison fails for some reason and SoundProof automatically retries (one or maximum two times).
callback.onSoundProofFailed soundproof~onSoundProofFailed Optional. Called if SoundProof fails while performed with the approve combo enabled.
callback.onTimeout soundproof~onTimeout Optional. Called if SoundProof times out before the protocol has been completed.
socket.transports array Optional. SoundProof makes use of SockJS in order to establish a WebSocket connection with the Futurae server. SockJS supports a number of fallback transports in case a WebSocket is not feasible. This option allows you to supply a list transports that may be used by SockJS. By default all available transports will be used. For example, by specifying ['xhr-streaming', 'xhr-polling'] you allow only XHR-based transports. For more information see also https://github.com/sockjs/sockjs-client.
Properties:
Name Type Description
version string The version of the SoundProof JS library.

Methods


<static> checkSupport(cb)

Check browser support. Returns the result in a callback.
Parameters:
Name Type Description
cb soundproof~checkSupportCallback A callback with the result of the SoundProof support check.

start(sessionToken)

Start the SoundProof authentication process.
Parameters:
Name Type Description
sessionToken string The session token, which is retrieved by calling the /user/auth_prep endpoint of the Auth API in the backend.