Skip to main content
Related Links
This SDK provides a set of JavaScript utilities for interacting with the Encryption Service, offering functions and helpers to facilitate encryption and decryption.

Pre-requisites

Before installing this package, make sure to follow below steps:
1

Request repository access to the Packages

Reach out to Platform team to request access to the Packages repository:
2

Generate a personal access token

Generate a personal access token with the following scopes:
repo
read:packages
3

Create an .npmrc file

Create an .npmrc file and add below code:
@locai1:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=YOUR_PERSONAL_ACCESS_TOKEN

Install

Download the package using your preferred package manager:
pnpm install @locai1/encrova-sdk

Quickstart

  • Import the EncryptionService from the package.
  • Initialize the EncryptionService with environment and API_KEY.
  • Call the desired method on the EncryptionService instance.
  •     import {
        EncryptionServiceEnv,
        EncryptionService,
    } from "encrova-sdk"
    
        const ENCROVA_ENV = EncryptionServiceEnv.dev
        const ENCROVA_API_KEY = "";
    
        const encService = new EncryptionService({
        env: ENCROVA_ENV,
        apiKey: ENCROVA_API_KEY,
    });
    
        // Generate Secret Key
    
        const {secretKey} = await encService.generateSecretKey({
        projectName: 'sample_project',
        projectDescription: 'This is a sample project',
        type: 'symmetric',
    });
    
        // Example: Symmetric Encryption of data
        const response = await encService.encryptSymmetric(
        "{ name: 'jhon', email: '[email protected]' }",
        secretKey,
        );
    
        // Example: Symmetric Decryption of data
        const decryptedData = await encService.decryptSymmetric(
        response.encryptedData,
        );