@sequencemedia/crypto 1.1.73 → 1.2.0
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/babel.config.cjs +0 -2
- package/package.json +3 -10
- package/lib/index.cjs +0 -1
- package/lib/shell/decrypt.cjs +0 -2
- package/lib/shell/encrypt.cjs +0 -2
package/babel.config.cjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sequencemedia/crypto",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"crypto",
|
|
6
6
|
"node",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"decode",
|
|
12
12
|
"shell"
|
|
13
13
|
],
|
|
14
|
-
"main": "./
|
|
14
|
+
"main": "./src/index.mjs",
|
|
15
15
|
"type": "module",
|
|
16
16
|
"types": "./crypto.d.mts",
|
|
17
17
|
"author": {
|
|
@@ -25,12 +25,6 @@
|
|
|
25
25
|
"url": "git@github.com:sequencemedia/crypto.git"
|
|
26
26
|
},
|
|
27
27
|
"scripts": {
|
|
28
|
-
"build": "npm run babel",
|
|
29
|
-
"watch": "npm run babel -- -w",
|
|
30
|
-
"clean": "rimraf lib",
|
|
31
|
-
"babel": "babel src -d lib --out-file-extension .cjs",
|
|
32
|
-
"prepublishOnly": "npm run build",
|
|
33
|
-
"prebuild": "npm run clean",
|
|
34
28
|
"lint": "eslint . --ext .mjs --ext .cjs",
|
|
35
29
|
"lint:fix": "npm run lint -- --fix",
|
|
36
30
|
"prepare": "husky install"
|
|
@@ -51,7 +45,6 @@
|
|
|
51
45
|
"husky": "^8.0.3"
|
|
52
46
|
},
|
|
53
47
|
"exports": {
|
|
54
|
-
"
|
|
55
|
-
"require": "./lib/index.cjs"
|
|
48
|
+
".": "./src/index.mjs"
|
|
56
49
|
}
|
|
57
50
|
}
|
package/lib/index.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.decrypt=decrypt;exports.encrypt=encrypt;exports.hashKey=hashKey;var _crypto=_interopRequireDefault(require("crypto"));function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}function hashKey(secret){if(!secret)throw new Error('A secret is required');return _crypto.default.createHash('sha256').update(secret).digest('base64').substring(0,32);}function encrypt(buffer,secret,bytes=16,algorithm='aes-256-ctr'){const iv=_crypto.default.randomBytes(bytes);const cipher=_crypto.default.createCipheriv(algorithm,hashKey(secret),iv);return Buffer.concat([iv,cipher.update(buffer),cipher.final()]);}function decrypt(buffer,secret,bytes=16,algorithm='aes-256-ctr'){const iv=buffer.slice(0,bytes);const decipher=_crypto.default.createDecipheriv(algorithm,hashKey(secret),iv);return Buffer.concat([decipher.update(buffer.slice(bytes)),decipher.final()]);}
|
package/lib/shell/decrypt.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";var _crypto=require("@sequencemedia/crypto");const{env:{CRYPTO_KEY}={},stdout,openStdin}=process;let collector=Buffer.from('');openStdin().on('data',buffer=>{collector=Buffer.concat([collector,buffer]);}).on('end',()=>{stdout.write((0,_crypto.decrypt)(collector,CRYPTO_KEY));});
|
package/lib/shell/encrypt.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";var _crypto=require("@sequencemedia/crypto");const{env:{CRYPTO_KEY}={},stdout,openStdin}=process;let collector=Buffer.from('');openStdin().on('data',buffer=>{collector=Buffer.concat([collector,buffer]);}).on('end',()=>{stdout.write((0,_crypto.encrypt)(collector,CRYPTO_KEY));});
|