The SoundProof Object

This page describes the SoundProof object, which is the object which has to be instantiated when performing SoundProof authentication. It is defined in the soundproof namespace.

soundproof.SoundProof

Properties

NameTypeDescription
versionstringThe version of the SoundProof JS library.

new SoundProof(config)

Initialize a SoundProof authentication process.

ParamTypeDescription
configObjectAn object containing configuration properties and callback functions, which are triggered upon various events during the SoundProof authentication process.
config.baseURLstringOptional. The base URL of the Futurae server backend to which the SoundProof object should connect to. Default value is “https://api.futurae.com".
config.audio.deviceIdstringOptional. 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.
config.audio.encodingWorkerPathstringOptional. 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/”).
config.callback.onAudioInitSuccessonAudioInitSuccessOptional. Called once the browser audio recording interface has been initialized successfully.
config.callback.onCompleteonCompleteOptional. Called once SoundProof authentication has been completed.
config.callback.onDeviceTimeoutonDeviceTimeoutOptional. Called if the user’s device cannot be activated remotely in order to perform SoundProof within a reasonably short amount of time. This callback will be immediately followed by more callbacks about the status of the authentication attempt.
config.callback.onErroronErrorOptional. Called if there is an error during SoundProof authentication. Note that depending on the error, SoundProof may or may not continue.
config.callback.onNewDeviceMustApproveonNewDeviceMustApproveOptional. 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).
config.callback.onRecordingStartonRecordingStartOptional. Called when SoundProof starts recording audio.
config.callback.onRecordingEndonRecordingEndOptional. Called when SoundProof finishes recording audio.
config.callback.onRecordingTooSilentonRecordingTooSilentOptional. Called if SoundProof detects that there is not enough audio energy in the environment.
config.callback.onRetryonRetryOptional. Called if the audio comparison fails for some reason and SoundProof automatically retries (one or maximum two times).
config.callback.onSoundProofFailedonSoundProofFailedOptional. Called if SoundProof fails while performed with the approve combo enabled.
config.callback.onTimeoutonTimeoutOptional. Called if SoundProof times out before the protocol has been completed.
config.socket.transportsarrayOptional. 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.

soundProof.start(sessionToken)

Start the SoundProof authentication process.

Kind: instance method of SoundProof

ParamTypeDescription
sessionTokenstringThe session token, which is retrieved by calling the /user/auth_prep endpoint of the Auth API in the backend.

SoundProof.checkSupport(cb)

Check browser support. Returns the result in a callback.

Kind: static method of SoundProof

ParamTypeDescription
cbcheckSupportCallbackA callback with the result of the SoundProof support check.