diff options
author | Maximilian Krambach <[email protected]> | 2018-05-07 16:27:25 +0000 |
---|---|---|
committer | Maximilian Krambach <[email protected]> | 2018-05-07 16:27:25 +0000 |
commit | 8f3d83e5f0903323ec92f588f60dcecb0ae96de4 (patch) | |
tree | 65620180493539aacb6f5368a06f3ba63da19d96 /lang/js/src/Message.js | |
parent | js: fixing errors found by testing (diff) | |
download | gpgme-8f3d83e5f0903323ec92f588f60dcecb0ae96de4.tar.gz gpgme-8f3d83e5f0903323ec92f588f60dcecb0ae96de4.zip |
js: fixing errors found by testing: encrypt/decrypt
--
* 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
* new Problems:
- There seems to be a message size limit of about 21 MB for
nativeMessaging, much lower than the documented 4GB.
- Some bytes are lost with random data in an encrypt-decrypt
roundtrip. The culprit is unclear.
Diffstat (limited to '')
-rw-r--r-- | lang/js/src/Message.js | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/lang/js/src/Message.js b/lang/js/src/Message.js index c42480f2..6a59c3e0 100644 --- a/lang/js/src/Message.js +++ b/lang/js/src/Message.js @@ -84,9 +84,22 @@ export class GPGME_Message { let checktype = function(val){ switch(typeof(val)){ case 'string': + if (poparam.allowed.indexOf(typeof(val)) >= 0 + && val.length > 0) { + return true; + } + return gpgme_error('PARAM_WRONG'); + break; case 'number': + if ( + poparam.allowed.indexOf('number') >= 0 + && isNaN(value) === false){ + return true; + } + return gpgme_error('PARAM_WRONG'); + break; case 'boolean': - if (poparam.allowed.indexOf(typeof(val)) >= 0){ + if (poparam.allowed.indexOf('boolean') >= 0){ return true; } return gpgme_error('PARAM_WRONG'); @@ -102,7 +115,9 @@ export class GPGME_Message { return res; } } - return true; + if (val.length > 0) { + return true; + } } else if (val instanceof Uint8Array){ if (poparam.allowed.indexOf('Uint8Array') >= 0){ return true; |