{"id":20159706,"url":"https://github.com/nowsecure/node-nscrypto","last_synced_at":"2025-07-19T13:10:50.393Z","repository":{"id":29584350,"uuid":"33124170","full_name":"nowsecure/node-nscrypto","owner":"nowsecure","description":"Node.js bindings for nscrypto-cpp","archived":false,"fork":false,"pushed_at":"2015-04-01T08:17:32.000Z","size":154,"stargazers_count":11,"open_issues_count":0,"forks_count":1,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-24T01:25:33.461Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","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/nowsecure.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-03-30T13:18:59.000Z","updated_at":"2021-01-13T19:45:27.000Z","dependencies_parsed_at":"2022-07-17T21:01:04.428Z","dependency_job_id":null,"html_url":"https://github.com/nowsecure/node-nscrypto","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nowsecure%2Fnode-nscrypto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nowsecure%2Fnode-nscrypto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nowsecure%2Fnode-nscrypto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nowsecure%2Fnode-nscrypto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nowsecure","download_url":"https://codeload.github.com/nowsecure/node-nscrypto/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248119296,"owners_count":21050755,"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":[],"created_at":"2024-11-14T00:09:36.903Z","updated_at":"2025-04-09T23:36:56.720Z","avatar_url":"https://github.com/nowsecure.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# node-nscrypto\n\nWrapper around [nscrypto-cpp](https://github.com/nowsecure/nscrypto-cpp).\n\n[![Build Status](https://travis-ci.org/nowsecure/node-nscrypto.svg?branch=travis-ci-support)](https://travis-ci.org/nowsecure/node-nscrypto)\n\n## PREREQUISITES\n\n* A relatively recent Node or io.js version (tested with Node@0.1[02] and io.js@latest).\n* A C++11 compiler.\n* A recent OpenSSL library. If you're on Mac OS X: Apple has deprecated OpenSSL in favor of its own TLS and crypto libraries, and you should look at [Homebrew](http://brew.sh/) to install a recent OpenSSL version.\n\n## INSTALLATION\n\nFrom the NPM repository:\n\n```\n$ npm install nscrypto\n```\n\nFrom Github (don't rely on this for stability):\n\n```\n$ npm install nowsecure/node-nscrypto\n```\n\nOr clone the repository and build it directly:\n\n```\n$ git clone https://github.com/nowsecure/node-nscrypto.git\n$ cd node-nscrypto\n$ npm install\n```\n\nFor installations on Mac OS X, the default assumption is that you use a Homebrew-installed OpenSSL library that is installed in `/usr/local/opt/openssl/`. If you have OpenSSL installed somewhere else, you can override the library and include paths:\n\n```\n$ env OPENSSL_INCLUDE_DIR=/path/to/include/dir OPENSSL_LIB_DIR=/path/to/lib/dir npm install nscrypto\n```\n\n## API\n\nAll API calls require the `nscrypto` module to be loaded:\n\n```\nvar nscrypto = require('nscrypto');\n```\n\n### Key generation ([ref](https://github.com/nowsecure/nscrypto-cpp#key-generation))\n\n```\nnscrypto.generateKeyPair() : Object\n```\n\nThe returned object has two properties of type `Buffer`:\n\n* `public`: the generated public key\n* `private`: the generated private key\n\n### Encryption ([ref](https://github.com/nowsecure/nscrypto-cpp#encryption-and-decryption))\n\n```\nnscrypto.{client,server}.encrypt(\n  sPriv     : Buffer,\n  rPub      : Buffer,\n  sId       : String,\n  rId       : String,\n  plaintext : Buffer\n) : Object\n```\n\nReturned object has two properties:\n\n* `enc`: the encrypted data\n* `eph`: the ephemeral key\n\n### Decryption ([ref](https://github.com/nowsecure/nscrypto-cpp#encryption-and-decryption))\n\n```\nnscrypto.{client,server}.decrypt(\n  rPriv     : Buffer,\n  sPub      : Buffer,\n  sId       : String,\n  rId       : String,\n  encrypted : Object\n) : Buffer\n```\n\n`message` is an object as the one returned by the encryption functions, having `enc` and `eph` properties.\n\nThe returned `Buffer` is the decrypted plaintext.\n\n## CHANGELOG\n\n* 1.1.0 : Make OpenSSL library/include paths overridable on Mac OS X\n* 1.0.0 : Initial release\n\n## SEE ALSO\n\n[nscrypto-cpp](https://github.com/nowsecure/nscrypto-cpp#nscrypto-cpp)\n\n## AUTHOR\n\nRobert Klep \u003c\u003crklep@nowsecure.com\u003e\u003e\n\n## LICENCE\n\nSee [LICENSE.md](LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnowsecure%2Fnode-nscrypto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnowsecure%2Fnode-nscrypto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnowsecure%2Fnode-nscrypto/lists"}