{"id":16327305,"url":"https://github.com/bryopsida/crypto","last_synced_at":"2026-02-01T12:40:31.159Z","repository":{"id":105079125,"uuid":"597871466","full_name":"bryopsida/crypto","owner":"bryopsida","description":"A Node.JS Typescript library leveraging usage of @bryopsida/key-store to protect data using sealed data encryption keys","archived":false,"fork":false,"pushed_at":"2026-01-23T19:09:23.000Z","size":1048,"stargazers_count":0,"open_issues_count":11,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-24T09:08:32.098Z","etag":null,"topics":["data-encryption-key","encryption","nodejs","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bryopsida.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-02-05T21:47:09.000Z","updated_at":"2025-11-20T21:45:54.000Z","dependencies_parsed_at":"2023-09-28T04:45:50.448Z","dependency_job_id":"f3627dd1-04b5-4703-80dc-32965becb9b4","html_url":"https://github.com/bryopsida/crypto","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/bryopsida/crypto","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bryopsida%2Fcrypto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bryopsida%2Fcrypto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bryopsida%2Fcrypto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bryopsida%2Fcrypto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bryopsida","download_url":"https://codeload.github.com/bryopsida/crypto/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bryopsida%2Fcrypto/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28978179,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-01T12:13:08.691Z","status":"ssl_error","status_checked_at":"2026-02-01T12:13:08.356Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["data-encryption-key","encryption","nodejs","typescript"],"created_at":"2024-10-10T23:11:02.998Z","updated_at":"2026-02-01T12:40:31.138Z","avatar_url":"https://github.com/bryopsida.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Crypto\n\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=bryopsida_crypto\u0026metric=alert_status)](https://sonarcloud.io/summary/new_code?id=bryopsida_crypto) [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=bryopsida_crypto\u0026metric=coverage)](https://sonarcloud.io/summary/new_code?id=bryopsida_crypto) [![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=bryopsida_crypto\u0026metric=security_rating)](https://sonarcloud.io/summary/new_code?id=bryopsida_crypto) [![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=bryopsida_crypto\u0026metric=vulnerabilities)](https://sonarcloud.io/summary/new_code?id=bryopsida_crypto) [![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=bryopsida_crypto\u0026metric=code_smells)](https://sonarcloud.io/summary/new_code?id=bryopsida_crypto) [![Bugs](https://sonarcloud.io/api/project_badges/measure?project=bryopsida_crypto\u0026metric=bugs)](https://sonarcloud.io/summary/new_code?id=bryopsida_crypto)\n\n## What is this?\n\nA library to faciliate using data encryption keys as well as do some light encryption/decryption.\n\n## How do I use this?\n\n```typescript\nimport { randomBytes, randomUUID } from 'crypto'\nimport { tmpdir } from 'os'\nimport { FileKeyStore, IKeyStore } from '@bryopsida/key-store'\nimport { IDataEncryptor, EncryptOpts, Crypto } from '../src/crypto'\nimport { writeFile } from 'fs/promises'\nimport { describe, expect, it, beforeEach } from '@jest/globals'\n\n//setup a key store, in this case on the file system\nconst key = randomBytes(32)\nconst salt = randomBytes(16)\nconst context = randomBytes(32)\nconst masterKey = randomBytes(32).toString('base64')\nconst masterSalt = randomBytes(16).toString('base64')\nconst masterKeyFile = randomUUID()\nconst masterSaltFile = randomUUID()\nconst storeDir = tmpdir()\nconst keyStoreDir = randomUUID()\nawait writeFile(`${storeDir}/${masterKeyFile}`, masterKey)\nawait writeFile(`${storeDir}/${masterSaltFile}`, masterSalt)\nkeyStore = new FileKeyStore(\n  `${storeDir}/${keyStoreDir}`,\n  () =\u003e Promise.resolve(key),\n  () =\u003e Promise.resolve(salt),\n  () =\u003e Promise.resolve(context)\n)\n\n// now we can make the crypto instance\ncrypto = new Crypto(\n  keyStore,\n  `${storeDir}/${masterKeyFile}`,\n  `${storeDir}/${masterSaltFile}`\n)\n\n// an example of encrypting to a encoded value and decrypting\nit('can encrypt and decrypted encoded text', async () =\u003e {\n  const rootKeyId = await crypto.generateRootKey(32, 'encoded-test')\n  const dek = await crypto.generateDataEncKey(\n    32,\n    rootKeyId,\n    'encoded-test',\n    'dek'\n  )\n  const encryptedData = await crypto.encryptAndEncode({\n    plaintext: Buffer.from('test-data'),\n    keyId: dek,\n    rootKeyId,\n    rootKeyContext: 'encoded-test',\n    dekContext: 'dek',\n    context: Buffer.from('data-context'),\n  })\n  const plainText = (\n    await crypto.decryptEncoded(\n      encryptedData,\n      'encoded-test',\n      'dek',\n      'data-context'\n    )\n  ).toString('utf8')\n  expect(plainText).toEqual('test-data')\n})\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbryopsida%2Fcrypto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbryopsida%2Fcrypto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbryopsida%2Fcrypto/lists"}