js: avoid async getters

--

* src/Key.js get armored was returning a promise on async keys.
  As getters should not do that, it returns an error in this case.
This commit is contained in:
Maximilian Krambach 2018-08-16 14:40:53 +02:00
parent 43cff51364
commit ea43158d40

View File

@ -303,7 +303,11 @@ export class GPGME_Key {
* @returns {String|GPGME_Error} The armored public Key block.
*/
get armored(){
return this.get('armored', true);
if (this.isAsync === true){
return gpgme_error('KEY_NO_INIT');
} else {
return this.get('armored');
}
}
}
@ -388,15 +392,6 @@ class GPGME_UserId {
setProperty(keys[i], data[keys[i]]);
}
/**
* Validates a subkey property against {@link validUserIdProperties} and
* sets it if validation is successful
* @param {String} property
* @param {*} value
* @param private
*/
/**
* Fetches information about the user
* @param {String} property Information to request