Learn how to decrypt Onboardbase secrets coming directly in a NodeJS environment

CryptoJS

CryptoJS is a growing collection of standard and secure cryptographic algorithms implemented in JavaScript using best practices and patterns.

Install CryptoJS via NPM / YARN

// NPM
npm install crypto-js

// YARN
yarn add crypto-js

Fetch Your Secrets From Onboardbase Public API

Refer to this API resource on how you can retrieve your secrets from Onboardbase. Your response should contain an array of secrets you have created as seen below

{
    "status": "success",
    "message": "Secret successfully fetched",
    "data": {
        "project": "my-project",
        "environment": "development",
        "secrets": [
            "your secret"
        ]
    }
}

Your secrets are encoded using AES-CBC (Cypher Block Chaining) cryptographic algorithm. To decode these secrets, you will need your API KEY passcode. A passcode is an alphanumeric value that you provided when generating your API KEY from your Onboardbase account settings.

To read more about authentication, Click here

import * as CryptoJS from 'crypto-js'

const encodedSecret = '';
const passcode = 'Your API key passcode';
const bytes = CryptoJS.AES.decrypt(encodedSecret, passcode);
const decodedSecret = bytes.toString(CryptoJS.enc.Utf8);