mirror of
https://github.com/gchq/CyberChef
synced 2025-01-01 07:18:47 +00:00
Tidied up PGP operations and added progress callback
This commit is contained in:
parent
1143c23ad9
commit
e41145427e
9 changed files with 143 additions and 456 deletions
8
.babelrc
8
.babelrc
|
@ -1,17 +1,11 @@
|
|||
{
|
||||
"plugins": [
|
||||
["transform-runtime", {
|
||||
"polyfill": false,
|
||||
"regenerator": true
|
||||
}]
|
||||
],
|
||||
"presets": [
|
||||
["env", {
|
||||
"targets": {
|
||||
"chrome": 40,
|
||||
"firefox": 35,
|
||||
"edge": 14,
|
||||
"node": "6.5",
|
||||
"node": "6.5"
|
||||
},
|
||||
"modules": false,
|
||||
"useBuiltIns": true
|
||||
|
|
|
@ -318,7 +318,7 @@ module.exports = function (grunt) {
|
|||
chunks: false,
|
||||
modules: false,
|
||||
entrypoints: false,
|
||||
warningsFilter: /source-map/,
|
||||
warningsFilter: [/source-map/, /dependency is an expression/],
|
||||
}
|
||||
},
|
||||
start: {
|
||||
|
|
347
package-lock.json
generated
347
package-lock.json
generated
|
@ -529,17 +529,6 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"babel-helper-bindify-decorators": {
|
||||
"version": "6.24.1",
|
||||
"resolved": "https://registry.npmjs.org/babel-helper-bindify-decorators/-/babel-helper-bindify-decorators-6.24.1.tgz",
|
||||
"integrity": "sha1-FMGeXxQte0fxmlJDHlKxzLxAozA=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"babel-runtime": "6.26.0",
|
||||
"babel-traverse": "6.26.0",
|
||||
"babel-types": "6.26.0"
|
||||
}
|
||||
},
|
||||
"babel-helper-builder-binary-assignment-operator-visitor": {
|
||||
"version": "6.24.1",
|
||||
"resolved": "https://registry.npmjs.org/babel-helper-builder-binary-assignment-operator-visitor/-/babel-helper-builder-binary-assignment-operator-visitor-6.24.1.tgz",
|
||||
|
@ -586,18 +575,6 @@
|
|||
"babel-types": "6.26.0"
|
||||
}
|
||||
},
|
||||
"babel-helper-explode-class": {
|
||||
"version": "6.24.1",
|
||||
"resolved": "https://registry.npmjs.org/babel-helper-explode-class/-/babel-helper-explode-class-6.24.1.tgz",
|
||||
"integrity": "sha1-fcKjkQ3uAHBW4eMdZAztPVTqqes=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"babel-helper-bindify-decorators": "6.24.1",
|
||||
"babel-runtime": "6.26.0",
|
||||
"babel-traverse": "6.26.0",
|
||||
"babel-types": "6.26.0"
|
||||
}
|
||||
},
|
||||
"babel-helper-function-name": {
|
||||
"version": "6.24.1",
|
||||
"resolved": "https://registry.npmjs.org/babel-helper-function-name/-/babel-helper-function-name-6.24.1.tgz",
|
||||
|
@ -724,83 +701,18 @@
|
|||
"integrity": "sha1-ytnK0RkbWtY0vzCuCHI5HgZHvpU=",
|
||||
"dev": true
|
||||
},
|
||||
"babel-plugin-syntax-async-generators": {
|
||||
"version": "6.13.0",
|
||||
"resolved": "https://registry.npmjs.org/babel-plugin-syntax-async-generators/-/babel-plugin-syntax-async-generators-6.13.0.tgz",
|
||||
"integrity": "sha1-a8lj67FuzLrmuStZbrfzXDQqi5o=",
|
||||
"dev": true
|
||||
},
|
||||
"babel-plugin-syntax-class-constructor-call": {
|
||||
"version": "6.18.0",
|
||||
"resolved": "https://registry.npmjs.org/babel-plugin-syntax-class-constructor-call/-/babel-plugin-syntax-class-constructor-call-6.18.0.tgz",
|
||||
"integrity": "sha1-nLnTn+Q8hgC+yBRkVt3L1OGnZBY=",
|
||||
"dev": true
|
||||
},
|
||||
"babel-plugin-syntax-class-properties": {
|
||||
"version": "6.13.0",
|
||||
"resolved": "https://registry.npmjs.org/babel-plugin-syntax-class-properties/-/babel-plugin-syntax-class-properties-6.13.0.tgz",
|
||||
"integrity": "sha1-1+sjt5oxf4VDlixQW4J8fWysJ94=",
|
||||
"dev": true
|
||||
},
|
||||
"babel-plugin-syntax-decorators": {
|
||||
"version": "6.13.0",
|
||||
"resolved": "https://registry.npmjs.org/babel-plugin-syntax-decorators/-/babel-plugin-syntax-decorators-6.13.0.tgz",
|
||||
"integrity": "sha1-MSVjtNvePMgGzuPkFszurd0RrAs=",
|
||||
"dev": true
|
||||
},
|
||||
"babel-plugin-syntax-do-expressions": {
|
||||
"version": "6.13.0",
|
||||
"resolved": "https://registry.npmjs.org/babel-plugin-syntax-do-expressions/-/babel-plugin-syntax-do-expressions-6.13.0.tgz",
|
||||
"integrity": "sha1-V0d1YTmqJtOQ0JQQsDdEugfkeW0=",
|
||||
"dev": true
|
||||
},
|
||||
"babel-plugin-syntax-dynamic-import": {
|
||||
"version": "6.18.0",
|
||||
"resolved": "https://registry.npmjs.org/babel-plugin-syntax-dynamic-import/-/babel-plugin-syntax-dynamic-import-6.18.0.tgz",
|
||||
"integrity": "sha1-jWomIpyDdFqZgqRBBRVyyqF5sdo=",
|
||||
"dev": true
|
||||
},
|
||||
"babel-plugin-syntax-exponentiation-operator": {
|
||||
"version": "6.13.0",
|
||||
"resolved": "https://registry.npmjs.org/babel-plugin-syntax-exponentiation-operator/-/babel-plugin-syntax-exponentiation-operator-6.13.0.tgz",
|
||||
"integrity": "sha1-nufoM3KQ2pUoggGmpX9BcDF4MN4=",
|
||||
"dev": true
|
||||
},
|
||||
"babel-plugin-syntax-export-extensions": {
|
||||
"version": "6.13.0",
|
||||
"resolved": "https://registry.npmjs.org/babel-plugin-syntax-export-extensions/-/babel-plugin-syntax-export-extensions-6.13.0.tgz",
|
||||
"integrity": "sha1-cKFITw+QiaToStRLrDU8lbmxJyE=",
|
||||
"dev": true
|
||||
},
|
||||
"babel-plugin-syntax-function-bind": {
|
||||
"version": "6.13.0",
|
||||
"resolved": "https://registry.npmjs.org/babel-plugin-syntax-function-bind/-/babel-plugin-syntax-function-bind-6.13.0.tgz",
|
||||
"integrity": "sha1-SMSV8Xe98xqYHnMvVa3AvdJgH0Y=",
|
||||
"dev": true
|
||||
},
|
||||
"babel-plugin-syntax-object-rest-spread": {
|
||||
"version": "6.13.0",
|
||||
"resolved": "https://registry.npmjs.org/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz",
|
||||
"integrity": "sha1-/WU28rzhODb/o6VFjEkDpZe7O/U=",
|
||||
"dev": true
|
||||
},
|
||||
"babel-plugin-syntax-trailing-function-commas": {
|
||||
"version": "6.22.0",
|
||||
"resolved": "https://registry.npmjs.org/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-6.22.0.tgz",
|
||||
"integrity": "sha1-ugNgk3+NBuQBgKQ/4NVhb/9TLPM=",
|
||||
"dev": true
|
||||
},
|
||||
"babel-plugin-transform-async-generator-functions": {
|
||||
"version": "6.24.1",
|
||||
"resolved": "https://registry.npmjs.org/babel-plugin-transform-async-generator-functions/-/babel-plugin-transform-async-generator-functions-6.24.1.tgz",
|
||||
"integrity": "sha1-8FiQAUX9PpkHpt3yjaWfIVJYpds=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"babel-helper-remap-async-to-generator": "6.24.1",
|
||||
"babel-plugin-syntax-async-generators": "6.13.0",
|
||||
"babel-runtime": "6.26.0"
|
||||
}
|
||||
},
|
||||
"babel-plugin-transform-async-to-generator": {
|
||||
"version": "6.24.1",
|
||||
"resolved": "https://registry.npmjs.org/babel-plugin-transform-async-to-generator/-/babel-plugin-transform-async-to-generator-6.24.1.tgz",
|
||||
|
@ -812,52 +724,6 @@
|
|||
"babel-runtime": "6.26.0"
|
||||
}
|
||||
},
|
||||
"babel-plugin-transform-class-constructor-call": {
|
||||
"version": "6.24.1",
|
||||
"resolved": "https://registry.npmjs.org/babel-plugin-transform-class-constructor-call/-/babel-plugin-transform-class-constructor-call-6.24.1.tgz",
|
||||
"integrity": "sha1-gNwoVQWsBn3LjWxl4vbxGrd2Xvk=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"babel-plugin-syntax-class-constructor-call": "6.18.0",
|
||||
"babel-runtime": "6.26.0",
|
||||
"babel-template": "6.26.0"
|
||||
}
|
||||
},
|
||||
"babel-plugin-transform-class-properties": {
|
||||
"version": "6.24.1",
|
||||
"resolved": "https://registry.npmjs.org/babel-plugin-transform-class-properties/-/babel-plugin-transform-class-properties-6.24.1.tgz",
|
||||
"integrity": "sha1-anl2PqYdM9NvN7YRqp3vgagbRqw=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"babel-helper-function-name": "6.24.1",
|
||||
"babel-plugin-syntax-class-properties": "6.13.0",
|
||||
"babel-runtime": "6.26.0",
|
||||
"babel-template": "6.26.0"
|
||||
}
|
||||
},
|
||||
"babel-plugin-transform-decorators": {
|
||||
"version": "6.24.1",
|
||||
"resolved": "https://registry.npmjs.org/babel-plugin-transform-decorators/-/babel-plugin-transform-decorators-6.24.1.tgz",
|
||||
"integrity": "sha1-eIAT2PjGtSIr33s0Q5Df13Vp4k0=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"babel-helper-explode-class": "6.24.1",
|
||||
"babel-plugin-syntax-decorators": "6.13.0",
|
||||
"babel-runtime": "6.26.0",
|
||||
"babel-template": "6.26.0",
|
||||
"babel-types": "6.26.0"
|
||||
}
|
||||
},
|
||||
"babel-plugin-transform-do-expressions": {
|
||||
"version": "6.22.0",
|
||||
"resolved": "https://registry.npmjs.org/babel-plugin-transform-do-expressions/-/babel-plugin-transform-do-expressions-6.22.0.tgz",
|
||||
"integrity": "sha1-KMyvkoEtlJws0SgfaQyP3EaK6bs=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"babel-plugin-syntax-do-expressions": "6.13.0",
|
||||
"babel-runtime": "6.26.0"
|
||||
}
|
||||
},
|
||||
"babel-plugin-transform-es2015-arrow-functions": {
|
||||
"version": "6.22.0",
|
||||
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-arrow-functions/-/babel-plugin-transform-es2015-arrow-functions-6.22.0.tgz",
|
||||
|
@ -1103,36 +969,6 @@
|
|||
"babel-runtime": "6.26.0"
|
||||
}
|
||||
},
|
||||
"babel-plugin-transform-export-extensions": {
|
||||
"version": "6.22.0",
|
||||
"resolved": "https://registry.npmjs.org/babel-plugin-transform-export-extensions/-/babel-plugin-transform-export-extensions-6.22.0.tgz",
|
||||
"integrity": "sha1-U3OLR+deghhYnuqUbLvTkQm75lM=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"babel-plugin-syntax-export-extensions": "6.13.0",
|
||||
"babel-runtime": "6.26.0"
|
||||
}
|
||||
},
|
||||
"babel-plugin-transform-function-bind": {
|
||||
"version": "6.22.0",
|
||||
"resolved": "https://registry.npmjs.org/babel-plugin-transform-function-bind/-/babel-plugin-transform-function-bind-6.22.0.tgz",
|
||||
"integrity": "sha1-xvuOlqwpajELjPjqQBRiQH3fapc=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"babel-plugin-syntax-function-bind": "6.13.0",
|
||||
"babel-runtime": "6.26.0"
|
||||
}
|
||||
},
|
||||
"babel-plugin-transform-object-rest-spread": {
|
||||
"version": "6.26.0",
|
||||
"resolved": "https://registry.npmjs.org/babel-plugin-transform-object-rest-spread/-/babel-plugin-transform-object-rest-spread-6.26.0.tgz",
|
||||
"integrity": "sha1-DzZpLVD+9rfi1LOsFHgTepY7ewY=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"babel-plugin-syntax-object-rest-spread": "6.13.0",
|
||||
"babel-runtime": "6.26.0"
|
||||
}
|
||||
},
|
||||
"babel-plugin-transform-regenerator": {
|
||||
"version": "6.26.0",
|
||||
"resolved": "https://registry.npmjs.org/babel-plugin-transform-regenerator/-/babel-plugin-transform-regenerator-6.26.0.tgz",
|
||||
|
@ -1142,15 +978,6 @@
|
|||
"regenerator-transform": "0.10.1"
|
||||
}
|
||||
},
|
||||
"babel-plugin-transform-runtime": {
|
||||
"version": "6.23.0",
|
||||
"resolved": "https://registry.npmjs.org/babel-plugin-transform-runtime/-/babel-plugin-transform-runtime-6.23.0.tgz",
|
||||
"integrity": "sha1-iEkNRGUC6puOfvsP4J7E2ZR5se4=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"babel-runtime": "6.26.0"
|
||||
}
|
||||
},
|
||||
"babel-plugin-transform-strict-mode": {
|
||||
"version": "6.24.1",
|
||||
"resolved": "https://registry.npmjs.org/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-6.24.1.tgz",
|
||||
|
@ -1216,85 +1043,6 @@
|
|||
"semver": "5.4.1"
|
||||
}
|
||||
},
|
||||
"babel-preset-es2015": {
|
||||
"version": "6.24.1",
|
||||
"resolved": "https://registry.npmjs.org/babel-preset-es2015/-/babel-preset-es2015-6.24.1.tgz",
|
||||
"integrity": "sha1-1EBQ1rwsn+6nAqrzjXJ6AhBTiTk=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"babel-plugin-check-es2015-constants": "6.22.0",
|
||||
"babel-plugin-transform-es2015-arrow-functions": "6.22.0",
|
||||
"babel-plugin-transform-es2015-block-scoped-functions": "6.22.0",
|
||||
"babel-plugin-transform-es2015-block-scoping": "6.26.0",
|
||||
"babel-plugin-transform-es2015-classes": "6.24.1",
|
||||
"babel-plugin-transform-es2015-computed-properties": "6.24.1",
|
||||
"babel-plugin-transform-es2015-destructuring": "6.23.0",
|
||||
"babel-plugin-transform-es2015-duplicate-keys": "6.24.1",
|
||||
"babel-plugin-transform-es2015-for-of": "6.23.0",
|
||||
"babel-plugin-transform-es2015-function-name": "6.24.1",
|
||||
"babel-plugin-transform-es2015-literals": "6.22.0",
|
||||
"babel-plugin-transform-es2015-modules-amd": "6.24.1",
|
||||
"babel-plugin-transform-es2015-modules-commonjs": "6.26.0",
|
||||
"babel-plugin-transform-es2015-modules-systemjs": "6.24.1",
|
||||
"babel-plugin-transform-es2015-modules-umd": "6.24.1",
|
||||
"babel-plugin-transform-es2015-object-super": "6.24.1",
|
||||
"babel-plugin-transform-es2015-parameters": "6.24.1",
|
||||
"babel-plugin-transform-es2015-shorthand-properties": "6.24.1",
|
||||
"babel-plugin-transform-es2015-spread": "6.22.0",
|
||||
"babel-plugin-transform-es2015-sticky-regex": "6.24.1",
|
||||
"babel-plugin-transform-es2015-template-literals": "6.22.0",
|
||||
"babel-plugin-transform-es2015-typeof-symbol": "6.23.0",
|
||||
"babel-plugin-transform-es2015-unicode-regex": "6.24.1",
|
||||
"babel-plugin-transform-regenerator": "6.26.0"
|
||||
}
|
||||
},
|
||||
"babel-preset-stage-0": {
|
||||
"version": "6.24.1",
|
||||
"resolved": "https://registry.npmjs.org/babel-preset-stage-0/-/babel-preset-stage-0-6.24.1.tgz",
|
||||
"integrity": "sha1-VkLRUEL5E4TX5a+LyIsduVsDnmo=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"babel-plugin-transform-do-expressions": "6.22.0",
|
||||
"babel-plugin-transform-function-bind": "6.22.0",
|
||||
"babel-preset-stage-1": "6.24.1"
|
||||
}
|
||||
},
|
||||
"babel-preset-stage-1": {
|
||||
"version": "6.24.1",
|
||||
"resolved": "https://registry.npmjs.org/babel-preset-stage-1/-/babel-preset-stage-1-6.24.1.tgz",
|
||||
"integrity": "sha1-dpLNfc1oSZB+auSgqFWJz7niv7A=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"babel-plugin-transform-class-constructor-call": "6.24.1",
|
||||
"babel-plugin-transform-export-extensions": "6.22.0",
|
||||
"babel-preset-stage-2": "6.24.1"
|
||||
}
|
||||
},
|
||||
"babel-preset-stage-2": {
|
||||
"version": "6.24.1",
|
||||
"resolved": "https://registry.npmjs.org/babel-preset-stage-2/-/babel-preset-stage-2-6.24.1.tgz",
|
||||
"integrity": "sha1-2eKWD7PXEYfw5k7sYrwHdnIZvcE=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"babel-plugin-syntax-dynamic-import": "6.18.0",
|
||||
"babel-plugin-transform-class-properties": "6.24.1",
|
||||
"babel-plugin-transform-decorators": "6.24.1",
|
||||
"babel-preset-stage-3": "6.24.1"
|
||||
}
|
||||
},
|
||||
"babel-preset-stage-3": {
|
||||
"version": "6.24.1",
|
||||
"resolved": "https://registry.npmjs.org/babel-preset-stage-3/-/babel-preset-stage-3-6.24.1.tgz",
|
||||
"integrity": "sha1-g2raCp56f6N8sTj7kyb4eTSkg5U=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"babel-plugin-syntax-trailing-function-commas": "6.22.0",
|
||||
"babel-plugin-transform-async-generator-functions": "6.24.1",
|
||||
"babel-plugin-transform-async-to-generator": "6.24.1",
|
||||
"babel-plugin-transform-exponentiation-operator": "6.24.1",
|
||||
"babel-plugin-transform-object-rest-spread": "6.26.0"
|
||||
}
|
||||
},
|
||||
"babel-register": {
|
||||
"version": "6.26.0",
|
||||
"resolved": "https://registry.npmjs.org/babel-register/-/babel-register-6.26.0.tgz",
|
||||
|
@ -1756,7 +1504,11 @@
|
|||
"integrity": "sha1-/TVGSkA/b5EXwt42Cez/nK4ABYg=",
|
||||
"dev": true
|
||||
},
|
||||
<<<<<<< HEAD
|
||||
"bzip-deflate": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/bzip-deflate/-/bzip-deflate-1.0.0.tgz",
|
||||
"integrity": "sha1-sC2wB+83vrzCk4Skssb08PTHlsk="
|
||||
},
|
||||
"cacache": {
|
||||
"version": "10.0.4",
|
||||
"resolved": "https://registry.npmjs.org/cacache/-/cacache-10.0.4.tgz",
|
||||
|
@ -1825,12 +1577,6 @@
|
|||
"union-value": "1.0.0",
|
||||
"unset-value": "1.0.0"
|
||||
}
|
||||
=======
|
||||
"bzip-deflate": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/bzip-deflate/-/bzip-deflate-1.0.0.tgz",
|
||||
"integrity": "sha1-sC2wB+83vrzCk4Skssb08PTHlsk="
|
||||
>>>>>>> aa3f781e18cbcae549538637573a807064f3c730
|
||||
},
|
||||
"caller-path": {
|
||||
"version": "0.1.0",
|
||||
|
@ -3178,24 +2924,15 @@
|
|||
}
|
||||
},
|
||||
"es6-promise": {
|
||||
<<<<<<< HEAD
|
||||
"version": "4.2.4",
|
||||
"resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.4.tgz",
|
||||
"integrity": "sha512-/NdNZVJg+uZgtm9eS3O6lrOLYmQag2DjdEXuPaHlZ6RuVqgqaVZfgYCepEIKsLqwdQArOPtC3XzRLqGGfT8KQQ==",
|
||||
"dev": true
|
||||
=======
|
||||
"version": "4.0.5",
|
||||
"resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.0.5.tgz",
|
||||
"integrity": "sha1-eILzCt3lskDM+n99eMVIMwlRrkI="
|
||||
>>>>>>> aa3f781e18cbcae549538637573a807064f3c730
|
||||
},
|
||||
"es6-promise-polyfill": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/es6-promise-polyfill/-/es6-promise-polyfill-1.2.0.tgz",
|
||||
"integrity": "sha1-84kl8jyz4+jObNqP93T867sJDN4="
|
||||
},
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
"es6-promisify": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz",
|
||||
|
@ -3204,42 +2941,6 @@
|
|||
"es6-promise": "4.0.5"
|
||||
}
|
||||
},
|
||||
"es6-set": {
|
||||
"version": "0.1.5",
|
||||
"resolved": "https://registry.npmjs.org/es6-set/-/es6-set-0.1.5.tgz",
|
||||
"integrity": "sha1-0rPsXU2ADO2BjbU40ol02wpzzLE=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"d": "1.0.0",
|
||||
"es5-ext": "0.10.37",
|
||||
"es6-iterator": "2.0.3",
|
||||
"es6-symbol": "3.1.1",
|
||||
"event-emitter": "0.3.5"
|
||||
}
|
||||
},
|
||||
"es6-symbol": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.1.tgz",
|
||||
"integrity": "sha1-vwDvT9q2uhtG7Le2KbTH7VcVzHc=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"d": "1.0.0",
|
||||
"es5-ext": "0.10.37"
|
||||
}
|
||||
},
|
||||
"es6-weak-map": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/es6-weak-map/-/es6-weak-map-2.0.2.tgz",
|
||||
"integrity": "sha1-XjqzIlH/0VOKH45f+hNXdy+S2W8=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"d": "1.0.0",
|
||||
"es5-ext": "0.10.37",
|
||||
"es6-iterator": "2.0.3",
|
||||
"es6-symbol": "3.1.1"
|
||||
}
|
||||
},
|
||||
>>>>>>> aa3f781e18cbcae549538637573a807064f3c730
|
||||
"escape-html": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
|
||||
|
@ -4272,11 +3973,7 @@
|
|||
"dev": true,
|
||||
"requires": {
|
||||
"commondir": "1.0.1",
|
||||
<<<<<<< HEAD
|
||||
"make-dir": "1.2.0",
|
||||
=======
|
||||
"make-dir": "1.1.0",
|
||||
>>>>>>> aa3f781e18cbcae549538637573a807064f3c730
|
||||
"pkg-dir": "2.0.0"
|
||||
}
|
||||
},
|
||||
|
@ -7917,15 +7614,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"make-dir": {
|
||||
<<<<<<< HEAD
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.2.0.tgz",
|
||||
"integrity": "sha512-aNUAa4UMg/UougV25bbrU4ZaaKNjJ/3/xnvg/twpmKROPdKZPZ9wGgI0opdZzO8q/zUFawoUuixuOv33eZ61Iw==",
|
||||
=======
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.1.0.tgz",
|
||||
"integrity": "sha512-0Pkui4wLJ7rxvmfUvs87skoEaxmu0hCUApF8nonzpl7q//FWp9zu8W61Scz4sd/kUiqDxvUhtoam2efDyiBzcA==",
|
||||
>>>>>>> aa3f781e18cbcae549538637573a807064f3c730
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"pify": "3.0.0"
|
||||
|
@ -8253,7 +7944,14 @@
|
|||
"moment": "2.20.1"
|
||||
}
|
||||
},
|
||||
<<<<<<< HEAD
|
||||
"more-entropy": {
|
||||
"version": "0.0.7",
|
||||
"resolved": "https://registry.npmjs.org/more-entropy/-/more-entropy-0.0.7.tgz",
|
||||
"integrity": "sha1-Z7/G96hvJvvDeqyD/UbYjGHRCbU=",
|
||||
"requires": {
|
||||
"iced-runtime": "1.0.3"
|
||||
}
|
||||
},
|
||||
"move-concurrently": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz",
|
||||
|
@ -8277,14 +7975,6 @@
|
|||
"glob": "7.0.6"
|
||||
}
|
||||
}
|
||||
=======
|
||||
"more-entropy": {
|
||||
"version": "0.0.7",
|
||||
"resolved": "https://registry.npmjs.org/more-entropy/-/more-entropy-0.0.7.tgz",
|
||||
"integrity": "sha1-Z7/G96hvJvvDeqyD/UbYjGHRCbU=",
|
||||
"requires": {
|
||||
"iced-runtime": "1.0.3"
|
||||
>>>>>>> aa3f781e18cbcae549538637573a807064f3c730
|
||||
}
|
||||
},
|
||||
"ms": {
|
||||
|
@ -9029,7 +8719,7 @@
|
|||
"integrity": "sha1-79ISpKOWbTZHaE6ouniFSb4q7+8=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"es6-promise": "4.2.4",
|
||||
"es6-promise": "4.0.5",
|
||||
"extract-zip": "1.6.6",
|
||||
"fs-extra": "1.0.0",
|
||||
"hasha": "2.2.0",
|
||||
|
@ -12085,8 +11775,6 @@
|
|||
"integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=",
|
||||
"dev": true
|
||||
},
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
"triplesec": {
|
||||
"version": "3.0.26",
|
||||
"resolved": "https://registry.npmjs.org/triplesec/-/triplesec-3.0.26.tgz",
|
||||
|
@ -12099,13 +11787,6 @@
|
|||
"progress": "1.1.8"
|
||||
}
|
||||
},
|
||||
"tryit": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/tryit/-/tryit-1.0.3.tgz",
|
||||
"integrity": "sha1-OTvnMKlEb9Hq1tpZoBQwjzbCics=",
|
||||
"dev": true
|
||||
},
|
||||
>>>>>>> aa3f781e18cbcae549538637573a807064f3c730
|
||||
"tty-browserify": {
|
||||
"version": "0.0.0",
|
||||
"resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz",
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
"devDependencies": {
|
||||
"babel-core": "^6.26.0",
|
||||
"babel-loader": "^7.1.3",
|
||||
"babel-polyfill": "^6.26.0",
|
||||
"babel-preset-env": "^1.6.1",
|
||||
"css-loader": "^0.28.10",
|
||||
"eslint": "^4.18.1",
|
||||
|
@ -40,10 +41,6 @@
|
|||
"file-loader": "^1.1.10",
|
||||
"grunt": ">=1.0.2",
|
||||
"grunt-accessibility": "~6.0.0",
|
||||
"babel-plugin-transform-runtime": "^6.23.0",
|
||||
"babel-polyfill": "^6.26.0",
|
||||
"babel-preset-es2015": "^6.24.1",
|
||||
"babel-preset-stage-0": "^6.24.1",
|
||||
"grunt-chmod": "~1.1.1",
|
||||
"grunt-concurrent": "^2.3.1",
|
||||
"grunt-contrib-clean": "~1.1.0",
|
||||
|
|
|
@ -114,6 +114,11 @@ const Categories = [
|
|||
"Hex to PEM",
|
||||
"Hex to Object Identifier",
|
||||
"Object Identifier to Hex",
|
||||
"Generate PGP Key Pair",
|
||||
"PGP Encrypt",
|
||||
"PGP Decrypt",
|
||||
"PGP Encrypt and Sign",
|
||||
"PGP Decrypt and Verify",
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
|
@ -4162,8 +4162,7 @@ const OperationConfig = {
|
|||
},
|
||||
"Generate PGP Key Pair": {
|
||||
module: "PGP",
|
||||
manualBake: true,
|
||||
description: "",
|
||||
description: "Generates a new public/private PGP key pair. Supports RSA and Eliptic Curve (EC) keys.",
|
||||
inputType: "string",
|
||||
outputType: "string",
|
||||
args: [
|
||||
|
@ -4172,11 +4171,6 @@ const OperationConfig = {
|
|||
type: "option",
|
||||
value: PGP.KEY_TYPES
|
||||
},
|
||||
{
|
||||
name: "Key size",
|
||||
type: "option",
|
||||
value: PGP.KEY_SIZES
|
||||
},
|
||||
{
|
||||
name: "Password (optional)",
|
||||
type: "string",
|
||||
|
@ -4196,7 +4190,6 @@ const OperationConfig = {
|
|||
},
|
||||
"PGP Encrypt": {
|
||||
module: "PGP",
|
||||
manualBake: true,
|
||||
description: [
|
||||
"Input: the message you want to encrypt.",
|
||||
"<br><br>",
|
||||
|
@ -4204,7 +4197,7 @@ const OperationConfig = {
|
|||
"<br><br>",
|
||||
"Pretty Good Privacy is an encryption standard (OpenPGP) used for encrypting, decrypting, and signing messages.",
|
||||
"<br><br>",
|
||||
"This function relies on kbpgp.js for the implementation of PGP.",
|
||||
"This function uses the Keybase implementation of PGP.",
|
||||
].join("\n"),
|
||||
inputType: "string",
|
||||
outputType: "string",
|
||||
|
@ -4218,7 +4211,6 @@ const OperationConfig = {
|
|||
},
|
||||
"PGP Decrypt": {
|
||||
module: "PGP",
|
||||
manualBake: true,
|
||||
description: [
|
||||
"Input: the ASCII-armoured PGP message you want to decrypt.",
|
||||
"<br><br>",
|
||||
|
@ -4227,7 +4219,7 @@ const OperationConfig = {
|
|||
"<br><br>",
|
||||
"Pretty Good Privacy is an encryption standard (OpenPGP) used for encrypting, decrypting, and signing messages.",
|
||||
"<br><br>",
|
||||
"This function relies on kbpgp.js for the implementation of PGP.",
|
||||
"This function uses the Keybase implementation of PGP.",
|
||||
].join("\n"),
|
||||
inputType: "string",
|
||||
outputType: "string",
|
||||
|
@ -4244,9 +4236,8 @@ const OperationConfig = {
|
|||
},
|
||||
]
|
||||
},
|
||||
"PGP Sign": {
|
||||
"PGP Encrypt and Sign": {
|
||||
module: "PGP",
|
||||
manualBake: true,
|
||||
description: [
|
||||
"Input: the cleartext you want to sign.",
|
||||
"<br><br>",
|
||||
|
@ -4257,7 +4248,7 @@ const OperationConfig = {
|
|||
"<br><br>",
|
||||
"Pretty Good Privacy is an encryption standard (OpenPGP) used for encrypting, decrypting, and signing messages.",
|
||||
"<br><br>",
|
||||
"This function relies on kbpgp.js for the implementation of PGP.",
|
||||
"This function uses the Keybase implementation of PGP.",
|
||||
].join("\n"),
|
||||
inputType: "string",
|
||||
outputType: "string",
|
||||
|
@ -4279,7 +4270,7 @@ const OperationConfig = {
|
|||
},
|
||||
]
|
||||
},
|
||||
"PGP Verify": {
|
||||
"PGP Decrypt and Verify": {
|
||||
module: "PGP",
|
||||
description: [
|
||||
"Input: the ASCII-armoured encrypted PGP message you want to verify.",
|
||||
|
@ -4291,7 +4282,7 @@ const OperationConfig = {
|
|||
"<br><br>",
|
||||
"Pretty Good Privacy is an encryption standard (OpenPGP) used for encrypting, decrypting, and signing messages.",
|
||||
"<br><br>",
|
||||
"This function relies on kbpgp.js for the implementation of PGP.",
|
||||
"This function uses the Keybase implementation of PGP.",
|
||||
].join("\n"),
|
||||
inputType: "string",
|
||||
outputType: "string",
|
||||
|
|
|
@ -15,11 +15,11 @@ import PGP from "../../operations/PGP.js";
|
|||
let OpModules = typeof self === "undefined" ? {} : self.OpModules || {};
|
||||
|
||||
OpModules.PGP = {
|
||||
"Generate PGP Key Pair": PGP.runGenerateKeyPair,
|
||||
"PGP Encrypt": PGP.runEncrypt,
|
||||
"PGP Decrypt": PGP.runDecrypt,
|
||||
"PGP Sign": PGP.runSign,
|
||||
"PGP Verify": PGP.runVerify,
|
||||
"Generate PGP Key Pair": PGP.runGenerateKeyPair,
|
||||
"PGP Encrypt": PGP.runEncrypt,
|
||||
"PGP Decrypt": PGP.runDecrypt,
|
||||
"PGP Encrypt and Sign": PGP.runSign,
|
||||
"PGP Decrypt and Verify": PGP.runVerify,
|
||||
};
|
||||
|
||||
export default OpModules;
|
||||
|
|
|
@ -1,58 +1,33 @@
|
|||
/*eslint camelcase: ["error", {properties: "never"}]*/
|
||||
import * as kbpgp from "kbpgp";
|
||||
import promisify from "es6-promisify";
|
||||
|
||||
const ECC_SIZES = ["256", "384"];
|
||||
const RSA_SIZES = ["1024", "2048", "4096"];
|
||||
const KEY_SIZES = RSA_SIZES.concat(ECC_SIZES);
|
||||
const KEY_TYPES = ["RSA", "ECC"];
|
||||
|
||||
/**
|
||||
* PGP operations.
|
||||
*
|
||||
* @author tlwr [toby@toby.codes]
|
||||
* @author Matt C [matt@artemisbot.uk]
|
||||
* @copyright Crown Copyright 2016
|
||||
* @author n1474335 [n1474335@gmail.com]
|
||||
* @copyright Crown Copyright 2017
|
||||
* @license Apache-2.0
|
||||
*
|
||||
* @namespace
|
||||
*/
|
||||
const PGP = {
|
||||
KEY_SIZES: KEY_SIZES,
|
||||
|
||||
/**
|
||||
* Validate PGP Key Size
|
||||
*
|
||||
* @private
|
||||
* @param {string} keySize
|
||||
* @returns {Integer}
|
||||
* @constant
|
||||
* @default
|
||||
*/
|
||||
_validateKeySize(keySize, keyType) {
|
||||
if (KEY_SIZES.indexOf(keySize) < 0) {
|
||||
throw `Invalid key size ${keySize}, must be in ${JSON.stringify(KEY_SIZES)}`;
|
||||
}
|
||||
KEY_TYPES: ["RSA-1024", "RSA-2048", "RSA-4096", "ECC-256", "ECC-384"],
|
||||
|
||||
if (keyType === "ecc") {
|
||||
if (ECC_SIZES.indexOf(keySize) >= 0) {
|
||||
return parseInt(keySize, 10);
|
||||
} else {
|
||||
throw `Invalid key size ${keySize}, must be in ${JSON.stringify(ECC_SIZES)} for ECC`;
|
||||
}
|
||||
} else {
|
||||
if (RSA_SIZES.indexOf(keySize) >= 0) {
|
||||
return parseInt(keySize, 10);
|
||||
} else {
|
||||
throw `Invalid key size ${keySize}, must be in ${JSON.stringify(RSA_SIZES)} for RSA`;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Get size of subkey
|
||||
*
|
||||
*
|
||||
* @private
|
||||
* @param {Integer} keySize
|
||||
* @returns {Integer}
|
||||
* @param {number} keySize
|
||||
* @returns {number}
|
||||
*/
|
||||
_getSubkeySize(keySize) {
|
||||
return {
|
||||
|
@ -65,29 +40,53 @@ const PGP = {
|
|||
},
|
||||
|
||||
|
||||
KEY_TYPES: KEY_TYPES,
|
||||
|
||||
/**
|
||||
* Validate PGP Key Type
|
||||
*
|
||||
* Progress callback
|
||||
*
|
||||
* @private
|
||||
* @param {string} keyType
|
||||
* @returns {string}
|
||||
*/
|
||||
_validateKeyType(keyType) {
|
||||
if (KEY_TYPES.indexOf(keyType) >= 0) return keyType.toLowerCase();
|
||||
throw `Invalid key type ${keyType}, must be in ${JSON.stringify(KEY_TYPES)}`;
|
||||
},
|
||||
_ASP: new kbpgp.ASP({
|
||||
"progress_hook": info => {
|
||||
let msg = "";
|
||||
|
||||
switch (info.what) {
|
||||
case "guess":
|
||||
msg = "Guessing a prime";
|
||||
break;
|
||||
case "fermat":
|
||||
msg = "Factoring prime using Fermat's factorization method";
|
||||
break;
|
||||
case "mr":
|
||||
msg = "Performing Miller-Rabin primality test";
|
||||
break;
|
||||
case "passed_mr":
|
||||
msg = "Passed Miller-Rabin primality test";
|
||||
break;
|
||||
case "failed_mr":
|
||||
msg = "Failed Miller-Rabin primality test";
|
||||
break;
|
||||
case "found":
|
||||
msg = "Prime found";
|
||||
break;
|
||||
default:
|
||||
msg = `Stage: ${info.what}`;
|
||||
}
|
||||
|
||||
if (ENVIRONMENT_IS_WORKER())
|
||||
self.sendStatusMessage(msg);
|
||||
}
|
||||
}),
|
||||
|
||||
|
||||
/**
|
||||
* Import private key and unlock if necessary
|
||||
*
|
||||
*
|
||||
* @private
|
||||
* @param {string} privateKey
|
||||
* @param {string} [passphrase]
|
||||
* @returns {Object}
|
||||
*/
|
||||
async _importPrivateKey (privateKey, passphrase) {
|
||||
async _importPrivateKey(privateKey, passphrase) {
|
||||
try {
|
||||
const key = await promisify(kbpgp.KeyManager.import_from_armored_pgp)({
|
||||
armored: privateKey,
|
||||
|
@ -107,9 +106,10 @@ const PGP = {
|
|||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Import public key
|
||||
*
|
||||
*
|
||||
* @private
|
||||
* @param {string} publicKey
|
||||
* @returns {Object}
|
||||
|
@ -125,6 +125,7 @@ const PGP = {
|
|||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Generate PGP Key Pair operation.
|
||||
*
|
||||
|
@ -133,43 +134,41 @@ const PGP = {
|
|||
* @returns {string}
|
||||
*/
|
||||
runGenerateKeyPair(input, args) {
|
||||
let keyType = args[0],
|
||||
keySize = args[1],
|
||||
password = args[2],
|
||||
name = args[3],
|
||||
email = args[4];
|
||||
let [keyType, keySize] = args[0].split("-"),
|
||||
password = args[1],
|
||||
name = args[2],
|
||||
email = args[3],
|
||||
userIdentifier = "";
|
||||
|
||||
keyType = PGP._validateKeyType(keyType);
|
||||
keySize = PGP._validateKeySize(keySize, keyType);
|
||||
|
||||
let userIdentifier = "";
|
||||
if (name) userIdentifier += name;
|
||||
if (email) userIdentifier += ` <${email}>`;
|
||||
|
||||
let flags = kbpgp.const.openpgp.certify_keys;
|
||||
flags = flags | kbpgp.const.openpgp.sign_data;
|
||||
flags = flags | kbpgp.const.openpgp.auth;
|
||||
flags = flags | kbpgp.const.openpgp.encrypt_comm;
|
||||
flags = flags | kbpgp.const.openpgp.encrypt_storage;
|
||||
flags |= kbpgp.const.openpgp.sign_data;
|
||||
flags |= kbpgp.const.openpgp.auth;
|
||||
flags |= kbpgp.const.openpgp.encrypt_comm;
|
||||
flags |= kbpgp.const.openpgp.encrypt_storage;
|
||||
|
||||
let keyGenerationOptions = {
|
||||
userid: userIdentifier,
|
||||
ecc: keyType === "ecc",
|
||||
primary: {
|
||||
nbits: keySize,
|
||||
flags: flags,
|
||||
expire_in: 0
|
||||
"nbits": keySize,
|
||||
"flags": flags,
|
||||
"expire_in": 0
|
||||
},
|
||||
subkeys: [{
|
||||
nbits: PGP._getSubkeySize(keySize),
|
||||
flags: kbpgp.const.openpgp.sign_data,
|
||||
expire_in: 86400 * 365 * 8
|
||||
"nbits": PGP._getSubkeySize(keySize),
|
||||
"flags": kbpgp.const.openpgp.sign_data,
|
||||
"expire_in": 86400 * 365 * 8
|
||||
}, {
|
||||
nbits: PGP._getSubkeySize(keySize),
|
||||
flags: kbpgp.const.openpgp.encrypt_comm | kbpgp.const.openpgp.encrypt_storage,
|
||||
expire_in: 86400 * 365 * 2
|
||||
"nbits": PGP._getSubkeySize(keySize),
|
||||
"flags": kbpgp.const.openpgp.encrypt_comm | kbpgp.const.openpgp.encrypt_storage,
|
||||
"expire_in": 86400 * 365 * 2
|
||||
}],
|
||||
asp: PGP._ASP
|
||||
};
|
||||
|
||||
return new Promise(async (resolve, reject) => {
|
||||
try {
|
||||
const unsignedKey = await promisify(kbpgp.KeyManager.generate)(keyGenerationOptions);
|
||||
|
@ -179,13 +178,14 @@ const PGP = {
|
|||
if (password) privateKeyExportOptions.passphrase = password;
|
||||
const privateKey = await promisify(signedKey.export_pgp_private, signedKey)(privateKeyExportOptions);
|
||||
const publicKey = await promisify(signedKey.export_pgp_public, signedKey)({});
|
||||
resolve(privateKey + "\n" + publicKey);
|
||||
resolve(privateKey + "\n" + publicKey.trim());
|
||||
} catch (err) {
|
||||
reject(`Error from kbpgp whilst generating key pair: ${err}`);
|
||||
reject(`Error whilst generating key pair: ${err}`);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* PGP Encrypt operation.
|
||||
*
|
||||
|
@ -195,9 +195,11 @@ const PGP = {
|
|||
*/
|
||||
async runEncrypt(input, args) {
|
||||
let plaintextMessage = input,
|
||||
plainPubKey = args[0];
|
||||
plainPubKey = args[0],
|
||||
key,
|
||||
encryptedMessage;
|
||||
|
||||
let key, encryptedMessage;
|
||||
if (!plainPubKey) return "Enter the public key of the recipient.";
|
||||
|
||||
try {
|
||||
key = await promisify(kbpgp.KeyManager.import_from_armored_pgp)({
|
||||
|
@ -209,8 +211,9 @@ const PGP = {
|
|||
|
||||
try {
|
||||
encryptedMessage = await promisify(kbpgp.box)({
|
||||
msg: plaintextMessage,
|
||||
encrypt_for: key,
|
||||
"msg": plaintextMessage,
|
||||
"encrypt_for": key,
|
||||
"asp": PGP._ASP
|
||||
});
|
||||
} catch (err) {
|
||||
throw `Couldn't encrypt message with provided public key: ${err}`;
|
||||
|
@ -219,6 +222,7 @@ const PGP = {
|
|||
return encryptedMessage.toString();
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* PGP Decrypt operation.
|
||||
*
|
||||
|
@ -228,11 +232,13 @@ const PGP = {
|
|||
*/
|
||||
async runDecrypt(input, args) {
|
||||
let encryptedMessage = input,
|
||||
privateKey = args[0],
|
||||
privateKey = args[0],
|
||||
passphrase = args[1],
|
||||
keyring = new kbpgp.keyring.KeyRing();
|
||||
keyring = new kbpgp.keyring.KeyRing(),
|
||||
plaintextMessage;
|
||||
|
||||
if (!privateKey) return "Enter the private key of the recipient.";
|
||||
|
||||
let plaintextMessage;
|
||||
const key = await PGP._importPrivateKey(privateKey, passphrase);
|
||||
keyring.add_key_manager(key);
|
||||
|
||||
|
@ -240,6 +246,7 @@ const PGP = {
|
|||
plaintextMessage = await promisify(kbpgp.unbox)({
|
||||
armored: encryptedMessage,
|
||||
keyfetch: keyring,
|
||||
asp: PGP._ASP
|
||||
});
|
||||
} catch (err) {
|
||||
throw `Couldn't decrypt message with provided private key: ${err}`;
|
||||
|
@ -248,6 +255,7 @@ const PGP = {
|
|||
return plaintextMessage.toString();
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* PGP Sign Message operation.
|
||||
*
|
||||
|
@ -257,19 +265,22 @@ const PGP = {
|
|||
*/
|
||||
async runSign(input, args) {
|
||||
let message = input,
|
||||
privateKey = args[0],
|
||||
privateKey = args[0],
|
||||
passphrase = args[1],
|
||||
publicKey = args[2];
|
||||
publicKey = args[2],
|
||||
signedMessage;
|
||||
|
||||
let signedMessage;
|
||||
if (!privateKey) return "Enter the private key of the signer.";
|
||||
if (!publicKey) return "Enter the public key of the recipient.";
|
||||
const privKey = await PGP._importPrivateKey(privateKey, passphrase);
|
||||
const pubKey = await PGP._importPublicKey(publicKey);
|
||||
|
||||
try {
|
||||
signedMessage = await promisify(kbpgp.box)({
|
||||
msg: message,
|
||||
encrypt_for: pubKey,
|
||||
sign_with: privKey
|
||||
"msg": message,
|
||||
"encrypt_for": pubKey,
|
||||
"sign_with": privKey,
|
||||
"asp": PGP._ASP
|
||||
});
|
||||
} catch (err) {
|
||||
throw `Couldn't sign message: ${err}`;
|
||||
|
@ -278,6 +289,7 @@ const PGP = {
|
|||
return signedMessage;
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* PGP Verify Message operation.
|
||||
*
|
||||
|
@ -287,12 +299,14 @@ const PGP = {
|
|||
*/
|
||||
async runVerify(input, args) {
|
||||
let signedMessage = input,
|
||||
publicKey = args[0],
|
||||
publicKey = args[0],
|
||||
privateKey = args[1],
|
||||
passphrase = args[2],
|
||||
keyring = new kbpgp.keyring.KeyRing();
|
||||
keyring = new kbpgp.keyring.KeyRing(),
|
||||
unboxedLiterals;
|
||||
|
||||
let unboxedLiterals;
|
||||
if (!publicKey) return "Enter the public key of the signer.";
|
||||
if (!privateKey) return "Enter the private key of the recipient.";
|
||||
const privKey = await PGP._importPrivateKey(privateKey, passphrase);
|
||||
const pubKey = await PGP._importPublicKey(publicKey);
|
||||
keyring.add_key_manager(privKey);
|
||||
|
@ -300,8 +314,9 @@ const PGP = {
|
|||
|
||||
try {
|
||||
unboxedLiterals = await promisify(kbpgp.unbox)({
|
||||
armored: signedMessage,
|
||||
keyfetch: keyring
|
||||
armored: signedMessage,
|
||||
keyfetch: keyring,
|
||||
asp: PGP._ASP
|
||||
});
|
||||
const ds = unboxedLiterals[0].get_data_signer();
|
||||
if (ds) {
|
||||
|
@ -328,10 +343,14 @@ const PGP = {
|
|||
].join("\n");
|
||||
text += unboxedLiterals.toString();
|
||||
return text.trim();
|
||||
} else {
|
||||
return "Could not identify a key manager.";
|
||||
}
|
||||
} else {
|
||||
return "The data does not appear to be signed.";
|
||||
}
|
||||
} catch (err) {
|
||||
throw `Couldn't verify message: ${err}`;
|
||||
return `Couldn't verify message: ${err}`;
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -109,7 +109,7 @@ module.exports = {
|
|||
chunks: false,
|
||||
modules: false,
|
||||
entrypoints: false,
|
||||
warningsFilter: /source-map/,
|
||||
warningsFilter: [/source-map/, /dependency is an expression/],
|
||||
},
|
||||
node: {
|
||||
fs: "empty"
|
||||
|
|
Loading…
Reference in a new issue