[git] GPGME - branch, javascript-binding, updated. gpgme-1.11.1-21-gcf07584
by Maximilian Krambach
cvs at cvs.gnupg.org
Fri May 4 12:56:51 CEST 2018
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GnuPG Made Easy".
The branch, javascript-binding has been updated
via cf075846fb48c8d71937100d2c45069d37d54a38 (commit)
from c755287ba845c4cbbf1d50e5aafecb2e687c7ac9 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit cf075846fb48c8d71937100d2c45069d37d54a38
Author: Maximilian Krambach <maximilian.krambach at intevation.de>
Date: Fri May 4 12:56:59 2018 +0200
js: fixing errors found by testing
--
* Key.js: Error code for wrong parameter in createKey should be
"PARAM_WRONG"
* Helpers.js: The property openpgpjs-like Objects were checked for in
toKeyIdArray was not defined.
* src/permittedOperations.js: updated more expectations and assumptions
for the native API
diff --git a/lang/js/src/Helpers.js b/lang/js/src/Helpers.js
index ea056ff..fd0e720 100644
--- a/lang/js/src/Helpers.js
+++ b/lang/js/src/Helpers.js
@@ -48,7 +48,7 @@ export function toKeyIdArray(input){
if (input[i] instanceof GPGME_Key){
fpr = input[i].fingerprint;
} else if (input[i].hasOwnProperty('primaryKey') &&
- input[i].primaryKey.hasOwnProperty(getFingerprint)){
+ input[i].primaryKey.hasOwnProperty('getFingerprint')){
fpr = input[i].primaryKey.getFingerprint();
}
if (isFingerprint(fpr) === true){
diff --git a/lang/js/src/Key.js b/lang/js/src/Key.js
index 6d3cf17..075a190 100644
--- a/lang/js/src/Key.js
+++ b/lang/js/src/Key.js
@@ -35,13 +35,15 @@ import { Connection } from './Connection';
export function createKey(fingerprint, parent){
if (!isFingerprint(fingerprint)){
- return gpgme_error('KEY_INVALID');
+ return gpgme_error('PARAM_WRONG');
}
if ( parent instanceof Connection){
return new GPGME_Key(fingerprint, parent);
} else if ( parent.hasOwnProperty('connection') &&
parent.connection instanceof Connection){
return new GPGME_Key(fingerprint, parent.connection);
+ } else {
+ return gpgme_error('PARAM_WRONG');
}
}
diff --git a/lang/js/src/permittedOperations.js b/lang/js/src/permittedOperations.js
index 274e037..59597aa 100644
--- a/lang/js/src/permittedOperations.js
+++ b/lang/js/src/permittedOperations.js
@@ -122,55 +122,96 @@ export const permittedOperations = {
type: ['plaintext'],
data: ['data'],
params: ['base64', 'mime'],
- infos: [] // pending. Info about signatures and validity
- //signature: [{Key Fingerprint, valid boolean}]
+ infos: [] // TODO pending. Info about signatures and validity
+ //{
+ //signatures: [{
+ //Key : <String>Fingerprint,
+ //valid: <Boolean>
+ // }]
}
},
- /**
- keyinfo: { // querying the Key's information.
- required: ['fingerprint'],
- anser: {
+ /** TBD: querying the Key's information (keyinfo)
+ TBD name: {
+ required: {
+ 'fingerprint': {
+ allowed: ['string']
+ },
+ },
+ answer: {
type: ['TBD'],
data: [],
- params: ['hasSecret', 'isRevoked', 'isExpired', 'armored',
- 'timestamp', 'expires', 'pubkey_algo'],
+ params: ['hasSecret','isRevoked','isExpired','armored',
+ 'timestamp','expires','pubkey_algo'],
infos: ['subkeys', 'userIds']
+ // {'hasSecret': <Boolean>,
+ // 'isRevoked': <Boolean>,
+ // 'isExpired': <Boolean>,
+ // 'armored': <String>, // armored public Key block
+ // 'timestamp': <Number>, //
+ // 'expires': <Number>,
+ // 'pubkey_algo': TBD // TBD (optional?),
+ // 'userIds': Array<String>,
+ // 'subkeys': Array<String> Fingerprints of Subkeys
+ // }
}*/
/**
listkeys:{
- optional: ['with-secret', 'pattern'],
+ required: {};
+ optional: {
+ 'with-secret':{
+ allowed: ['boolean']
+ },{
+ 'pattern': {
+ allowed: ['string']
+ }
+ },
answer: {
- type: ['TBD'], //Array of fingerprints?
- infos: ['TBD'] //the property with infos
+ type: ['TBD'],
+ infos: ['TBD']
+ // keys: Array<String> Fingerprints representing the results
},
*/
/**
importkey: {
- required: ['keyarmored'],
+ required: {
+ 'keyarmored': {
+ allowed: ['string']
+ }
+ },
answer: {
type: ['TBD'],
- infos: [''], // for each key if import was a success, if it was an update
+ infos: ['TBD'],
+ // for each key if import was a success,
+ // and if it was an update of preexisting key
}
},
*/
/**
deletekey: {
- required: ['fingerprint'],
+ pinentry: true,
+ required: {
+ 'fingerprint': {
+ allowed: ['string'],
+ // array_allowed: TBD Allow several Keys to be deleted at once?
+ },
+ optional: {
+ 'TBD' //Flag to delete secret Key ?
+ }
answer: {
type ['TBD'],
- infos: [''] //success:true? in gpgme, an error NO_ERROR is returned
+ infos: ['']
+ // TBD (optional) Some kind of 'ok' if delete was successful.
}
}
*/
/**
- *get armored secret different treatment from keyinfo!
- */
-
- /**
- * TBD key modification requests?
+ *TBD get armored secret different treatment from keyinfo!
+ * TBD key modification?
+ * encryptsign: TBD
+ * verify: TBD
*/
}
diff --git a/lang/js/unittests.js b/lang/js/unittests.js
index 0a1b4b4..6c0d189 100644
--- a/lang/js/unittests.js
+++ b/lang/js/unittests.js
@@ -109,7 +109,7 @@ function unittests (){
});
});
- describe('toKeyIdArray() (converting input to fingerprint', function(){
+ describe('toKeyIdArray() (converting input to fingerprint)', function(){
it('Correct fingerprint string', function(){
let test0 = toKeyIdArray(hp.validFingerprint);
-----------------------------------------------------------------------
Summary of changes:
lang/js/src/Helpers.js | 2 +-
lang/js/src/Key.js | 4 +-
lang/js/src/permittedOperations.js | 81 ++++++++++++++++++++++++++++----------
lang/js/unittests.js | 2 +-
4 files changed, 66 insertions(+), 23 deletions(-)
hooks/post-receive
--
GnuPG Made Easy
http://git.gnupg.org
More information about the Gnupg-commits
mailing list