@spur.us/monocle-backend
v0.5.1
Published
Monocle Backend SDK - REST client for Backend Decryption & Decryption API
Downloads
20,067
Readme
Spur's JavaScript Monocle Backend SDK.
Installation
npm install @spur.us/monocle-backend
# or
yarn add @spur.us/monocle-backend
# or
pnpm add @spur.us/monocle-backendUsage
The package needs to be configured with your Monocle application's secret key, which is available in the Spur Dashboard.
import { createMonocleClient } from '@spur.us/monocle-backend';
const monocleClient = await createMonocleClient({
secretKey: process.env.MONOCLE_SECRET_KEY,
});Decrypt assessment via API
try {
const assessment = await monocleClient.decryptAssessment(encryptedAssessment);
} catch (error) {
// Error handling
}Decrypt assessment locally
[!IMPORTANT] This is only available to Enterprise customers
try {
const assessment = await monocleClient.decryptAssessment(
encryptedAssessment,
{ privateKeyPem: process.env.MONOCLE_PRIVATE_KEY }
);
} catch (error) {
// Error handling
}Contributing
We welcome all contributors!
Please read our contributing guidelines to learn how to submit issues or open pull requests.
License
This project is licensed under the MIT license.
