You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[](https://github.com/ajimae/ncrypt-js/releases)[](https://github/languages/code-size/ajimae/ncrypt-js)[](https://github.com/ajimae/ncrypt-js/issues)
5
+
[](https://github.com/ajimae/ncrypt-js/releases)[](https://github/languages/code-size/ajimae/ncrypt-js)[](https://github.com/ajimae/ncrypt-js/issues)[](https://www.npmjs.com/package/ncrypt-js/v/2.0.0#license)
6
6
7
7
**_NcryptJs_** is a light weight javascript data encryption and decryption library. This library implements the nodejs default crypto functionality as a mid-channel cipher in addition to a simple and elegant custom data encoding and encryption algorithm.
8
8
@@ -85,7 +85,7 @@ var { ncrypt } = require("ncrypt-js");
85
85
86
86
### Using randomString method
87
87
88
-
The `randomString()` static method can generate [random bytes](https://nodejs.org/api/crypto.html#cryptorandombytessize-callback) encoded into a `hexadecimal` or `base64` strings. This string can be useful in a variety of use cases e.g to generate database ids, to generate a unique string for a list, a unique serial strings etc.
88
+
The `randomString()` static method can generate [random bytes](https://nodejs.org/api/crypto.html#cryptorandombytessize-callback) encoded into a `hexadecimal` or `base64` strings. This string can be useful in a variety of use cases e.g to generate database ids, to generate a unique string for a list, a unique serial strings, api keys etc.
89
89
90
90
```ts
91
91
var { ncrypt } =require('ncrypt-js'); // or import ncrypt from 'ncrypt-js'
// decrypting the encrypted super sensitive data here
124
124
var decryptedData = decrypt(encryptedData);
125
125
console.log("... and then decryption...");
126
126
console.log("Decipher Text : " + decryptedData);
@@ -189,7 +189,7 @@ If you are using any sort of environmental key-value store, e.g `.env` and for a
189
189
KEY='sshhhh this is a super secret key'
190
190
191
191
# used internally to set the `encoding` - ['base64' | 'binary' | 'hex' | 'ucs-2' | 'ucs2' | 'utf16le']
192
-
NCRPT_ENC='hex'
192
+
NCRYPT_ENC='hex'
193
193
194
194
SECRET='this is our hashing secret'
195
195
```
@@ -200,7 +200,9 @@ var { ncrypt } = require('ncrypt-js');
200
200
var { encrypt, decrypt } = new ncrypt(process.env.SECRET);
201
201
...
202
202
```
203
-
_**NOTE:** The secret is required to decrypt the encrypted data, if the secret used to encrypt a specific data is lost, then that data cannot be decripted._
203
+
_**NOTE:** The secret is required to decrypt the encrypted data, if the secret used to encrypt a specific data is lost, then that data cannot be decrypted._
204
+
205
+
_Same goes for encoding, if data was encrypted using `hex` encoding format, decrypting with a `base64` encoding or other encoding format and vise versa will not work_
204
206
205
207
## Built With
206
208
@@ -210,7 +212,7 @@ Written in [TypeScript](https://typscriptlang.org/), built into ECMAScript 5 usi
210
212
211
213
To contribute, simply fork this project, and issue a pull request.
212
214
213
-
## Version Management
215
+
## Versioning
214
216
215
217
We use [SemVer](http://semver.org/) for version management. For the versions available, see the [tags on this repository](https://github.com/ajimae/ncrypt-js/tags).
0 commit comments