Namespace: soundproof

soundproof

SoundProof module
Properties:
Name Type Description
version string The version of the SoundProof JS library.

Classes

BadSampleRateError
BrowserMicError
GenericSoundProofError
MediaError
MobileAppMicBusyError
MobileAppMicPermissionError
NetworkError
SoundProof

Type Definitions


checkSupportCallback(supported, err)

This callback gets the result of SoundProof support check. If the check passed, i.e., SoundProof is supported on this browser and system, then supported will be true and err will be undefined. If the check failed, then supported will be false and err will describe the why the check failed.
Parameters:
Name Type Description
supported boolean Indicates whether the check passed or failed.
err string A string describing the error if the check failed.

onAudioInitSuccess()

This callback gets called once the browser audio recording interface has been initialized successfully.

onComplete()

This callback gets called once SoundProof has been completed. The result will only be visible to the server, who can retrieve it via the /user/auth and /user/auth_status endpoints of the Auth API.

onDeviceTimeout(displayText)

This callback gets called if the user's device cannot be reached within a reasonably short amount of time, so the operation timed out. This may be an indication that the user’s phone does not currently have network connectivity. Hence, a recommended approach is to fallback to mobile TOTP by asking the user to open the mobile app and transfer the currently displayed code. Note that this callback will immediately be followed by more callbacks, in particular soundproof~onTimeout and soundproof~onComplete which will signal that SoundProof timed out and completed (unsuccessfully).
Parameters:
Name Type Description
displayText string A default message to show to the user. The web application can choose to display another message.

onError(err, displayText)

This callback gets called if SoundProof authentication fails due to an error.
Parameters:
Name Type Description
err soundproof.BadSampleRateError | soundproof.BrowserMicError | soundproof.GenericSoundProofError | soundproof.MediaError | soundproof.MobileAppMicPermissionError | soundproof.MobileAppMicBusyError | soundproof.NetworkError An optional error object describing the error that occurred, if any. It may be undefined.
displayText string A default message to show to the user. The web application can choose to display another message.

onNewDeviceMustApprove(displayText)

This callback gets 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). Your application can inform the user to reach for his/her device and accept or reject the login.
Parameters:
Name Type Description
displayText string A default message to show to the user. The web application can choose to display another message.

onRecordingEnd()

This callback gets called when SoundProof finishes recording audio.

onRecordingStart()

This callback gets called when SoundProof starts recording audio.

onRecordingTooSilent(displayText)

This callback gets called if SoundProof detects that there is not enough audio energy in the environment. A message can be displayed to the user to encourage him to make some arbitrary noise in order to inject some audio energy in the environment.
Parameters:
Name Type Description
displayText string A default message to show to the user. The web application can choose to display another message.

onRetry(displayText)

This callback gets called if the audio comparison fails for some reason and SoundProof automatically retries (one or maximum two times).
Parameters:
Name Type Description
displayText string A default message to show to the user. The web application can choose to display another message.

onSoundProofFailed(displayText)

This callback gets called if SoundProof failed while performed together with the approve combo. The process will still continue until the user accepts/rejects the login or the approve factor times-out. Your application can inform the user to reach for his/her device and accept or reject the login. Note that soundproof~onError will still get called in order provide more information about the error that caused SoundProof to fail. This callback just indicates that the current authentication attempt is not over yet, even if SoundProof failed, as the user can still manually approve the login.
Parameters:
Name Type Description
displayText string A default message to show to the user. The web application can choose to display another message.

onTimeout()

This callback gets called if SoundProof times out before the protocol has been completed. Your application will have to start the SoundProof authentication once again, or retry with another factor.