The Rupt Core SDK is designed to be used on the server. It operates as a convenient wrapper for all Rupt API methods and benefits from type safety and intellisense.
yarn add @ruptjs/core
or if using npm
npm install @ruptjs/core
Replace API_SECRET
with your Rupt API secret key. This can be found in your Rupt dashboard. Select the secret key for the api key you want to use.
import RuptCore from '@ruptjs/core';
const Rupt = new RuptCore(API_SECRET);
Returns a list of your challenges. The challenges are returned sorted by creation date, with the most recently created challenges appearing first.
const { data, total } = await Rupt.getChallenges({
page: 1,
limit: 10,
});
Retrieve the details of an existing challenge. Supply the unique challenge ID from the Rupt SDK onChallenge
callback.
const { challenge } = await Rupt.getChallenge(CHALLENGE_ID);
Retrieve the list of devices for an existing challenge.
const { data } = await Rupt.getChallengeDevices(CHALLENGE_ID);
Kick an attached device for an existing challenge. Supply the unique challenge ID from the Rupt SDK onChallenge
callback. Supply the unique device ID from the list of devices for the challenge.
await Rupt.kickChallengeDevice({
challenge: "CHALLENGE_ID",
device: "DEVICE_ID",
});
Send a two-factor authentication code for an existing challenge.
await Rupt.sendChallengeCode({
challenge: "CHALLENGE_ID",
device: "DEVICE_ID",
language: "en",
channel: "email"
});
Verify a device for an existing challenge.
await Rupt.verifyChallengeCode({
challenge: "CHALLENGE_ID",
code: "123456"
});
Complete an existing challenge.
const { challenge } = await Rupt.completeChallenge(CHALLENGE_ID);
Evaluate an action for a user.
const { verdict, reasons, challenge_id } = await Rupt.evaluate({
action: "login",
user: "USER_ID",
fingerprint: ["FINGERPRINT_ID", "LAST_FINGERPRINT_ID"], // Use the rupt client sdk method `getHash` to get the fingerprint hashes from the browser
ip: "IP_ADDRESS",
});
To learn more, visit the api documentation