Skip to main content

Usage

Note: You first need to call sendAuthenticationCode before calliing this method.

Authenticates the user with the user secret and the authentication code.

The userSecret is used as entropy for the client share secret encryption key.

User's encrypted client share is fetched from the backend, and decrypted on the frontend using this secret. The client share never leaves the user's device.

If the user does not have any shares, they are generated through 2-of-2 distributed key generation between the client and Marble's server.

// Note: You first need to call sendAuthenticationCode to send the code to the user.

const result = await marbleSDK.auth.authenticateWithSecret({
email: "theodor@marblewallet.com",
userSecret: "424242...",
code: "123456",
});

Return value

The function will return null if the code was sent successfully. If the code was not sent successfully, the function will throw an error.

Configuration


email (optional)

The user's email address. This is the email address that will receive the authentication code. One of email or phoneNumber is required.

phoneNumber (optional)

The user's phone number (E.164 format). This is the phone number that will receive the authentication code. One of email or phoneNumber is required.

userSecret (required)

The user's secret. This is the high-entropy secret stored by the application that is used to encrypt/decrypt the client share.

code (required)

The authentication code sent to the user via email link / email code / SMS code.