{"id":13454958,"url":"https://github.com/davesag/jose-simple","last_synced_at":"2025-07-27T16:31:05.376Z","repository":{"id":23804174,"uuid":"99889372","full_name":"davesag/jose-simple","owner":"davesag","description":"Jose-Simple allows the encryption and decryption of data using the JOSE (JSON Object Signing and Encryption) standard.","archived":false,"fork":false,"pushed_at":"2024-04-23T05:46:09.000Z","size":2607,"stargazers_count":63,"open_issues_count":0,"forks_count":4,"subscribers_count":7,"default_branch":"develop","last_synced_at":"2024-11-16T10:18:29.511Z","etag":null,"topics":["base64","decryption","encryption","jose","json","jwt","signing"],"latest_commit_sha":null,"homepage":"https://codeburst.io/securing-tokens-with-help-from-jose-33d8c31835a1","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/davesag.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"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},"funding":{"github":["davesag"]}},"created_at":"2017-08-10T06:31:26.000Z","updated_at":"2024-08-20T04:07:29.000Z","dependencies_parsed_at":"2023-12-24T04:24:29.134Z","dependency_job_id":"0b7a4d28-7989-4412-8835-2d750e84db2d","html_url":"https://github.com/davesag/jose-simple","commit_stats":{"total_commits":337,"total_committers":6,"mean_commits":"56.166666666666664","dds":"0.11869436201780414","last_synced_commit":"6c21904a60ed59293880ea18ebdce0fd870db335"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davesag%2Fjose-simple","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davesag%2Fjose-simple/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davesag%2Fjose-simple/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davesag%2Fjose-simple/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davesag","download_url":"https://codeload.github.com/davesag/jose-simple/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227817166,"owners_count":17824199,"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":["base64","decryption","encryption","jose","json","jwt","signing"],"created_at":"2024-07-31T08:00:59.775Z","updated_at":"2024-12-02T23:12:16.826Z","avatar_url":"https://github.com/davesag.png","language":"JavaScript","funding_links":["https://github.com/sponsors/davesag"],"categories":["Packages","包","目录"],"sub_categories":["Security","安全","安全相关"],"readme":"# jose-simple\n\n\u003e Proper encryption ought to be simple, and widespread.\n\nJose-Simple simplifies the encryption and decryption of data using the JOSE (JSON Object Signing and Encryption) standard.\n\n[![NPM](https://nodei.co/npm/jose-simple.png)](https://nodei.co/npm/jose-simple/)\n\n## Caveats\n\n- The project depends on [`node-jose`](https://github.com/cisco/node-jose) by Cisco.\n- `node-jose` [does not allow you to use private keys with passwords](https://github.com/cisco/node-jose/issues/69#issuecomment-236133179), and [they have no intention of changing that](https://github.com/cisco/node-jose/issues/234#issuecomment-457615794).\n- **Requires Node 10.12.0 or better** if you want to run the tests. Works fine under Node 12+, and might run under versions of node going back to 8.x but no further.\n\n## Installation\n\n```sh\nnpm install jose-simple\n```\n\n## Links\n\n- [Securing Tokens with help from JOSE](https://codeburst.io/securing-tokens-with-help-from-jose-33d8c31835a1).\n\n## Usage\n\n```js\nconst jose = require('jose-simple')\n// You need a private / public JWE key pair.\n// Either load them from `.pem` files, create them, or somehow acquire them.\n// The private key must not have a passphrase or cypher!\n// see https://github.com/cisco/node-jose/issues/69#issuecomment-236133179\n// see also https://github.com/cisco/node-jose/issues/234#issuecomment-457615794\n// see unit tests for a simple example.\n\nconst { encrypt, decrypt } = jose(privateKey, publicKey)\n\nconst someData = {\n  some: 'amazing data',\n  you: 'want to keep hidden',\n  from: 'prying eyes'\n}\n\nencrypt(someData).then(encrypted =\u003e {\n  console.log('encrypted', encrypted)\n  decrypt(encrypted).then(decrypted =\u003e {\n    console.log('decrypted', decrypted)\n    // decrypted will be the same as someData\n  })\n})\n```\n\n### Options\n\nSee [`encrypt.js#L660-L668`](https://github.com/cisco/node-jose/blob/master/lib/jwe/encrypt.js#L660-L668)\n\nYou can add `encrypt` options as follows:\n\n```js\nconst { encrypt, decrypt } = jose(privateKey, publicKey, {\n  format: 'compact'\n  protect: true,\n  // or any of the encrypt options than can be passed to JWE.createEncrypt.\n  // https://github.com/cisco/node-jose/blob/master/lib/jwe/encrypt.js#L660-L668\n})\n```\n\n## Development\n\n\u003c!-- prettier-ignore --\u003e\n| Branch | Status | Coverage | Audit | Comment |\n| ------ | ------ | -------- | ----- | ------- |\n| `develop` | [![CircleCI](https://circleci.com/gh/davesag/jose-simple/tree/develop.svg?style=svg)](https://circleci.com/gh/davesag/jose-simple/tree/develop) | [![codecov](https://codecov.io/gh/davesag/jose-simple/branch/develop/graph/badge.svg)](https://codecov.io/gh/davesag/jose-simple) | [![Vulnerabilities](https://snyk.io/test/github/davesag/jose-simple/develop/badge.svg)](https://snyk.io/test/github/davesag/jose-simple/develop) | Work in progress |\n| `main` | [![CircleCI](https://circleci.com/gh/davesag/jose-simple/tree/main.svg?style=svg)](https://circleci.com/gh/davesag/jose-simple/tree/main) | [![codecov](https://codecov.io/gh/davesag/jose-simple/branch/main/graph/badge.svg)](https://codecov.io/gh/davesag/jose-simple) | [![Vulnerabilities](https://snyk.io/test/github/davesag/jose-simple/main/badge.svg)](https://snyk.io/test/github/davesag/jose-simple/main) | Latest release |\n\n### Prerequisites\n\n- [NodeJS](htps://nodejs.org), I use [`nvm`](https://github.com/creationix/nvm) to manage Node versions — `brew install nvm`.\n\n### Test it\n\n- `npm test` — runs the unit tests. The tests give an example of how to create key pairs too. (Leverages the [`crypto.generateKeyPair`](https://nodejs.org/dist/latest-v10.x/docs/api/crypto.html#crypto_crypto_generatekeypair_type_options_callback) libraries introduced in Node `10.12.0`.)\n- `npm run test:unit:cov` — runs the unit tests with code coverage\n\n### Lint it\n\n```sh\nnpm run lint\n```\n\n### Contributing\n\nContributions are welcome. Please see [CONTRIBUTING](CONTRIBUTING.md) for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavesag%2Fjose-simple","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavesag%2Fjose-simple","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavesag%2Fjose-simple/lists"}