{"id":26802235,"url":"https://github.com/onqlavelabs/onqlave-node","last_synced_at":"2025-07-09T04:04:32.456Z","repository":{"id":165144593,"uuid":"626336997","full_name":"onqlavelabs/onqlave-node","owner":"onqlavelabs","description":"Onqlave SDK for the Node programming language.","archived":false,"fork":false,"pushed_at":"2024-01-10T17:20:59.000Z","size":281,"stargazers_count":5,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-01T02:43:10.884Z","etag":null,"topics":["encryption-tool","nodejs","sdk-nodejs"],"latest_commit_sha":null,"homepage":"https://docs.onqlave.com/guides/sdks/sdk-node/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/onqlavelabs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-11T09:07:05.000Z","updated_at":"2023-07-12T02:32:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"decafcba-dfd6-4c41-88b8-4fdb3c082a2a","html_url":"https://github.com/onqlavelabs/onqlave-node","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/onqlavelabs/onqlave-node","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onqlavelabs%2Fonqlave-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onqlavelabs%2Fonqlave-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onqlavelabs%2Fonqlave-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onqlavelabs%2Fonqlave-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/onqlavelabs","download_url":"https://codeload.github.com/onqlavelabs/onqlave-node/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onqlavelabs%2Fonqlave-node/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264390670,"owners_count":23600560,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["encryption-tool","nodejs","sdk-nodejs"],"created_at":"2025-03-29T21:16:47.779Z","updated_at":"2025-07-09T04:04:32.431Z","avatar_url":"https://github.com/onqlavelabs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Description\nThis node SDK is designed to help developers easily integrate Onqlave `Encryption As A Service` into their node backend.\n\n[![CI](https://img.shields.io/static/v1?label=CI\u0026message=passing\u0026color=green?style=plastic\u0026logo=github)](https://github.com/onqlavelabs/onqlave-node/actions)\n[![GitHub release](https://badge.fury.io/js/@onqlavelabs%2Fonqlave-node.svg)](https://npmjs.com/package/@onqlavelabs%2Fonqlave-node)\n[![License](https://img.shields.io/github/license/onqlavelabs/onqlave-node)](https://github.com/onqlavelabs/onqlave-node/blob/main/LICENSE)\n\n\n# Table of Contents\n\n- [Description](#description)\n- [Table of Contents](#table-of-contents)\n\t- [Features](#features)\n\t- [Installation](#installation)\n\t\t- [Requirements](#requirements)\n\t\t- [Configuration](#configuration)\n\t\t- [Usage](#usage)\n\t\t- [Encrypt](#encrypt)\n\t\t- [Decrypt](#decrypt)\n\t\t- [Encrypt Stream](#encrypt-stream)\n\t\t- [Decrypt Stream](#decrypt-stream)\n\t- [Reporting a Vulnerability](#reporting-a-vulnerability)\n\n\n## Features\n\n- Encrypt/Decrypt piece of information\n- Encrypt/Decrypt stream of data\n\n## Installation\n```sh\nnpm install @onqlavelabs/onqlave-node\n\n```\n### Requirements\n- Node 16.0.0 and above\n\n### Configuration\n\n\n### Usage\n\nTo use this SDK, you firstly need to obtain credential to access an Onqlave Arx by signing up to [Onqlave](https://onqlave.com) and following instruction to create your 1st Onqlave Arx.\n\nThe [Onqlave Node](https://github.com/onqlavelabs/onqlave-node) module is used to perform operations on the configured ARX such as encrypting, and decrypting for an Onqlave_ARX. [example](https://github.com/onqlavelabs/onqlave-node/blob/main/examples/index.js):\n\nTo use this module, the Onqlave client must first be initialized as follows.\n\n```javascript\nconst { Encryption, withCredential, withRetry, withArx, Credential, RetrySettings } = require('@onqlavelabs/onqlave-node');\nconst { createReadStream, createWriteStream } = require('fs');\n```\nOr using ES modules\n\n```javascript\nimport { Encryption, withCredential, withRetry, withArx, Credential, RetrySettings }  from '@onqlavelabs/onqlave-node';\nimport { createReadStream, createWriteStream } from 'fs';\n\nconst arxOption = withArx(\"\u003carx_url\u003e\"); //This is the Arx URL retruned of the API Key created during setup. Keep in in a safe place.\nconst apiKey = \"\u003capi_access_key\u003e\"       //This is the API Access Key returned of the API Key created during setup. Keep in in a safe place.\nconst signingKey = \"\u003capi_signing_key\u003e\"  //This is the API Signing Key retruned of the API Key created during setup. Keep in in a safe place.\nconst secretKey = \"\u003capi_secret_key\u003e\"    //This is the API Secret Key retruned of the API Key created during setup. Keep in in a safe place.\nconst credentialOption = withCredential(new Credential(apiKey, signingKey, secretKey));\nconst retryOption = withRetry(new RetrySettings(2, 400, 2000));\n\nconst service = new Encryption(arxOption, credentialOption, retryOption);\n```\n\nAll Onqlave APIs must be invoked using a `Encryption` instance.\n\n### Encrypt\n\nTo encrypt data, use the **Encrypt(plainData, associatedData)** method of the `Encryption` service. The **plainText** parameter is the `Buffer` representation of data you are wishing to encrypt. The **associatedData** parameter the `Buffer` representation of associated data which can be used to improve the authenticity of the data (it is not mandatory), as shown below.\n\n```javascript\n\n//Initilise the new encryption service using configurations as per [Usage]\nconst service = new Encryption(arxOption, credentialOption, retryOption);\n\nconst plainData = Buffer.from(\"This is the plain data\");\nconst additionalData = Buffer.from(\"This is to authenticated not to encrypt\"); //This can be an arbitrary piece of information you can use to for added security purpose.\nconst cipherData = await service.Encrypt(plainData, associatedData);\n```\n\n\n### Decrypt\nTo encrypt data, use the **Decrypt(cipherData, associatedData)** method of the `Encryption` service. The **cipherData** parameter is the `Buffer` representation of data you are wishing to decrypt (previousely encrypted). The **associatedData** parameter the `Buffer` representation of associated data which can be used to improve the authenticity of the data (it is not mandatory), as shown below.\n\n```javascript\n\n//Initilise the new encryption service using configurations as per [Usage]\nconst service = new Encryption(arxOption, credentialOption, retryOption);\n\nconst cipherData = Buffer.from(\"this data is already encrypted using `Encrypt` method\")\nconst additionalData = Buffer.from(\"This is to authenticated not to encrypt\"); //This can be an arbitrary piece of information you can use to for added security purpose.\nconst plainData = await service.Decrypt(cipherData, associatedData);\n```\n\n### Encrypt Stream\n\nTo encrypt stream of data, use the **encryptStream(plainStream, cipherStream, associatedData)** method of the `Encryption` service. The **plainStream** parameter is the `ReadStream` stream of data you are wishing to encrypt. The **cipherStream** parameter is the `WriteStream` stream you are wishing to write the cipher data to. The **associatedData** parameter the `Buffer` representation of associated data which can be used to improve the authenticity of the data (it is not mandatory), as shown below.\n\n\n```javascript\n\n//Initilise the new encryption service using configurations as per [Usage]\nconst service = new Encryption(arxOption, credentialOption, retryOption);\n\nconst plainStream = createReadStream(\"\u003cfile or network stream you are wishing to encrypt\u003e\", { highWaterMark: 64 * 1024 });\nconst cipherStream = createWriteStream(\"\u003cfile or network stream you are whishing to stream the encrypted data to\u003e\", { encoding: 'binary' });\nconst associatedData = Buffer.from(\"this data needs to be authenticated, but not encrypted\"); //This can be an arbitrary piece of information you can use to for added security purpose.\nawait service.encryptStream(plainStream, cipherStream, additionalData);\nplainStream.close();\ncipherStream.close();\n```\n\n\n### Decrypt Stream\nTo encrypt data, use the **decryptStream(cipherStream, plainStream, associatedData)** method of the `Encryption` service. The **cipherStream** parameter is the `ReadStream` stream of data you are wishing to decrypt and it was originally encrypted using [EncryptStream](#encrypt-stream). The **plainStream** parameter is the `WriteStream` stream you are wishing to write the plain data back to. The **associatedData** parameter the `Buffer` representation of associated data which can be used to improve the authenticity of the data (it is not mandatory), as shown below.\n\n```javascript\n\n//Initilise the new encryption service using configurations as per [Usage]\nconst service = new Encryption(arxOption, credentialOption, retryOption);\n\nconst cipherStream = createReadStream(\"\u003cfile or network stream you are wishing to decrypt\u003e\", { encoding: 'binary' });\nconst plainStream = createWriteStream(\"\u003cfile or network stream you are whishing to stream the decrypted data to\u003e\", { highWaterMark: 64 * 1024 });\nconst associatedData = Buffer.from(\"this data needs to be authenticated, but not encrypted\"); //This can be an arbitrary piece of information you can use to for added security purpose.\nawait service.decryptStream(cipherStream, plainStream, additionalData);\nplainStream.close();\ncipherStream.close();\n```\n\n## Reporting a Vulnerability\n\nIf you discover a potential security issue in this project, please reach out to us at security@onqlave.com. Please do not create public GitHub issues or Pull Requests, as malicious actors could potentially view them.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonqlavelabs%2Fonqlave-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fonqlavelabs%2Fonqlave-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonqlavelabs%2Fonqlave-node/lists"}