ncrypt-js 2.1.1 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -7
- package/dist/src/ncrypt.js +1 -1
- package/package.json +2 -3
- package/tsconfig.json +0 -23
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# NcryptJs
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
 [](https://coveralls.io/github/ajimae/ncrypt-js) 
|
|
4
4
|
|
|
5
|
-
[](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'
|
|
@@ -120,7 +120,7 @@ console.log("Encryption process...");
|
|
|
120
120
|
console.log("Plain Text : " + data);
|
|
121
121
|
console.log("Cipher Text : " + encryptedData);
|
|
122
122
|
|
|
123
|
-
//
|
|
123
|
+
// 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
|
-
|
|
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
|
|
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
|
-
##
|
|
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).
|
|
216
218
|
|
package/dist/src/ncrypt.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ncrypt-js",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.2",
|
|
4
4
|
"description": "a light weight javascript data encryption and decryption library",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -51,7 +51,6 @@
|
|
|
51
51
|
"files": [
|
|
52
52
|
"dist",
|
|
53
53
|
"package.json",
|
|
54
|
-
"LICENSE"
|
|
55
|
-
"tsconfig.json"
|
|
54
|
+
"LICENSE"
|
|
56
55
|
]
|
|
57
56
|
}
|
package/tsconfig.json
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "es2015",
|
|
4
|
-
"module": "commonjs",
|
|
5
|
-
"lib": ["es2015", "es2016", "dom", "es2017", "es6", "es5"],
|
|
6
|
-
"esModuleInterop": true,
|
|
7
|
-
"noImplicitAny": true,
|
|
8
|
-
"moduleResolution": "node",
|
|
9
|
-
"declaration": true,
|
|
10
|
-
"sourceMap": false,
|
|
11
|
-
"outDir": "dist",
|
|
12
|
-
"baseUrl": ".",
|
|
13
|
-
"paths": {
|
|
14
|
-
"*": ["node_modules/*","src/types/*"]
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
"include": [
|
|
18
|
-
"src/**/*", "index.ts",
|
|
19
|
-
],
|
|
20
|
-
"exclude": [
|
|
21
|
-
"test/**/*"
|
|
22
|
-
]
|
|
23
|
-
}
|