diff options
author | Maximilian Krambach <[email protected]> | 2018-08-22 17:07:05 +0000 |
---|---|---|
committer | Maximilian Krambach <[email protected]> | 2018-08-22 17:07:05 +0000 |
commit | 24a00058652233775cbe51446cba337b70cefdf1 (patch) | |
tree | 49fea48a6334bc19f835cd5057c786ee49b6109c /lang/js/src/Connection.js | |
parent | js: make method parameters objects (diff) | |
download | gpgme-24a00058652233775cbe51446cba337b70cefdf1.tar.gz gpgme-24a00058652233775cbe51446cba337b70cefdf1.zip |
js: add decrypt result options
--
* As a decrypt result cannot be known beforehand, the decrypt operation
may add an 'expect' property, taking either 'uint8' or 'base64',
which will return the decrypted data in the appropiate formats.
the return property 'format' will give a feedback on which option
was taken.
A test was added to reflect these changes.
Diffstat (limited to 'lang/js/src/Connection.js')
-rw-r--r-- | lang/js/src/Connection.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lang/js/src/Connection.js b/lang/js/src/Connection.js index 8756cce1..3fd1810d 100644 --- a/lang/js/src/Connection.js +++ b/lang/js/src/Connection.js @@ -266,13 +266,16 @@ class Answer{ if (_decodedResponse.base64 === true && poa.data[key] === 'string' ) { - if (this.expected === 'binary'){ + if (this.expected === 'uint8'){ _response[key] = atobArray(_decodedResponse[key]); - _response.binary = true; + _response.format = 'uint8'; + } else if (this.expected === 'base64'){ + _response[key] = _decodedResponse[key]; + _response.format = 'base64'; } else { _response[key] = Utf8ArrayToStr( atobArray(_decodedResponse[key])); - _response.binary = false; + _response.format = 'string'; } } else { _response[key] = decode(_decodedResponse[key]); |