https://github.com/compwright/defuse-node
Unofficial Javascript port of defuse/php-encryption for Node.js
https://github.com/compwright/defuse-node
cross-platform encryption javascript php
Last synced: 6 months ago
JSON representation
Unofficial Javascript port of defuse/php-encryption for Node.js
- Host: GitHub
- URL: https://github.com/compwright/defuse-node
- Owner: compwright
- Created: 2022-09-21T02:09:15.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-10-02T17:38:21.000Z (about 1 year ago)
- Last Synced: 2025-05-15T10:19:56.765Z (8 months ago)
- Topics: cross-platform, encryption, javascript, php
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/defuse-node
- Size: 736 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
# defuse-node
Javascript port of [defuse/php-encryption](https://github.com/defuse/php-encryption) for Node.js.
> This is an unofficial port. The creators of defuse/php-encryption recommend libsodium for cross-platform use cases. Use this library at your own risk :bangbang:
This port implements everything in the official library EXCEPT for:
* File
* Crypto.legacyDecrypt()
For a compatibility demo, see https://github.com/compwright/defuse-node-compat-demo
If you would like to contribute any missing part, feel free to open a pull request.
## Requirements
Node.js 16+ with OpenSSL
## Installation
With NPM:
```
$ npm install --save defuse-node
```
With Yarn:
```
$ yarn add defuse-node
```
## Quick Start
```javascript
import { Key, Crypto } from 'defuse-node'
const key = Key.loadFromAsciiSafeString('...')
// Encrypt
const data = 'Hello, world'
const ciphertext = Crypto.encrypt(data, key)
// Decrypt
const plaintext = Crypto.decrypt(ciphertext, key)
```
## Documentation
See https://github.com/defuse/php-encryption#getting-started
## License
MIT License