Skip to content

Commit

Permalink
138e1dde027338358a8da19ff8592b7369494534
Browse files Browse the repository at this point in the history
  • Loading branch information
toberndo committed Aug 24, 2018
1 parent 9aaf28c commit 540cd48
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 2 deletions.
1 change: 1 addition & 0 deletions .babelrc
@@ -0,0 +1 @@
{ "presets": ["es2015"] }
49 changes: 49 additions & 0 deletions .eslintrc.json
@@ -0,0 +1,49 @@
{
"env": {
"browser": true,
"es6": true
},
"extends": "eslint:recommended",
"parserOptions": {
"sourceType": "module"
},
"rules": {
"indent": [
"warn",
4
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"single"
],
"semi": [
"error",
"always"
],
"no-var": [
"warn"
],
"max-len": 1,
"default-case": 2,
"no-invalid-this": 2,
"no-lone-blocks": 1,
"no-self-compare": 2,
"radix": 2,
"no-use-before-define": ["error", {
"functions": false,
"classes": false,
"variables": true
}],
"no-useless-constructor": 1,
"space-before-function-paren": ["error", "always"],
"keyword-spacing": 2,
"spaced-comment": 1,
"space-unary-ops": 2,
"object-curly-spacing": ["error", "always"],
"array-bracket-spacing": ["error", "never"]
}
}
3 changes: 2 additions & 1 deletion src/Keyring.js
Expand Up @@ -185,7 +185,8 @@ export class GPGME_Keyring {
&& resp.option.value.length === 1
&& resp.option.value[0].hasOwnProperty('string')
&& typeof (resp.option.value[0].string) === 'string'){
me.getKeys(resp.option.value[0].string, true).then(
me.getKeys({ pattern: resp.option.value[0].string,
prepare_sync: true }).then(
function (keys){
if (keys.length === 1){
resolve(keys[0]);
Expand Down
8 changes: 7 additions & 1 deletion src/gpgmejs.js
Expand Up @@ -128,14 +128,17 @@ export class GpgME {
* block.
* @param {Boolean} options.wildcard (optional) If true, recipient
* information will not be added to the message.
* @param {Boolean} always_trust (optional, default true) This assumes that
* used keys are fully trusted. If set to false, encryption to a key not
* fully trusted in gnupg will fail
* @param {Object} additional use additional valid gpg options as
* defined in {@link permittedOperations}
* @returns {Promise<encrypt_result>} Object containing the encrypted
* message and additional info.
* @async
*/
encrypt ({ data, publicKeys, secretKeys, base64 = false, armor = true,
wildcard, additional = {} }){
wildcard, always_trust = true, additional = {} }){
if (!data || !publicKeys){
return Promise.reject(gpgme_error('MSG_INCOMPLETE'));
}
Expand All @@ -148,6 +151,9 @@ export class GpgME {
if (base64 === true) {
msg.setParameter('base64', true);
}
if (always_trust === true) {
msg.setParameter('always-trust', true);
}
let pubkeys = toKeyIdArray(publicKeys);
if (!pubkeys.length) {
return Promise.reject(gpgme_error('MSG_NO_KEYS'));
Expand Down
6 changes: 6 additions & 0 deletions src/permittedOperations.js
Expand Up @@ -94,6 +94,12 @@ export const permittedOperations = {
},
'wrap': {
allowed: ['boolean']
},
'sender': {
allowed: ['string']
},
'file_name': {
allowed: ['string']
}
},
answer: {
Expand Down

0 comments on commit 540cd48

Please sign in to comment.