js: add option "subkey-algo" to generateKey
-- * The option was recently added to gpgme-json; this reflects this on javascript side
This commit is contained in:
parent
91c2362550
commit
d77a1c887d
@ -366,14 +366,16 @@ export class GPGME_Keyring {
|
|||||||
* @param {String} userId The user Id, e.g. 'Foo Bar <foo@bar.baz>'
|
* @param {String} userId The user Id, e.g. 'Foo Bar <foo@bar.baz>'
|
||||||
* @param {String} algo (optional) algorithm (and optionally key size)
|
* @param {String} algo (optional) algorithm (and optionally key size)
|
||||||
* to be used. See {@link supportedKeyAlgos} below for supported
|
* to be used. See {@link supportedKeyAlgos} below for supported
|
||||||
* values.
|
* values. If ommitted, 'default' is used.
|
||||||
* @param {Date} expires (optional) Expiration date. If not set,
|
* @param {Date} expires (optional) Expiration date. If not set,
|
||||||
* expiration will be set to 'never'
|
* expiration will be set to 'never'
|
||||||
|
* @param {String} subkey_algo (optional) algorithm of the encryption
|
||||||
|
* subkey. If ommited the same as algo is used.
|
||||||
*
|
*
|
||||||
* @return {Promise<Key|GPGME_Error>}
|
* @return {Promise<Key|GPGME_Error>}
|
||||||
* @async
|
* @async
|
||||||
*/
|
*/
|
||||||
generateKey (userId, algo = 'default', expires){
|
generateKey (userId, algo = 'default', expires, subkey_algo){
|
||||||
if (
|
if (
|
||||||
typeof (userId) !== 'string' ||
|
typeof (userId) !== 'string' ||
|
||||||
// eslint-disable-next-line no-use-before-define
|
// eslint-disable-next-line no-use-before-define
|
||||||
@ -382,11 +384,18 @@ export class GPGME_Keyring {
|
|||||||
){
|
){
|
||||||
return Promise.reject(gpgme_error('PARAM_WRONG'));
|
return Promise.reject(gpgme_error('PARAM_WRONG'));
|
||||||
}
|
}
|
||||||
|
// eslint-disable-next-line no-use-before-define
|
||||||
|
if (subkey_algo && supportedKeyAlgos.indexOf(subkey_algo) < 0 ){
|
||||||
|
return Promise.reject(gpgme_error('PARAM_WRONG'));
|
||||||
|
}
|
||||||
let me = this;
|
let me = this;
|
||||||
return new Promise(function (resolve, reject){
|
return new Promise(function (resolve, reject){
|
||||||
let msg = createMessage('createkey');
|
let msg = createMessage('createkey');
|
||||||
msg.setParameter('userid', userId);
|
msg.setParameter('userid', userId);
|
||||||
msg.setParameter('algo', algo );
|
msg.setParameter('algo', algo );
|
||||||
|
if (subkey_algo) {
|
||||||
|
msg.setParameter('subkey-algo', subkey_algo );
|
||||||
|
}
|
||||||
if (expires){
|
if (expires){
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
msg.setParameter('expires',
|
msg.setParameter('expires',
|
||||||
|
@ -331,6 +331,9 @@ export const permittedOperations = {
|
|||||||
algo: {
|
algo: {
|
||||||
allowed: ['string']
|
allowed: ['string']
|
||||||
},
|
},
|
||||||
|
'subkey-algo': {
|
||||||
|
allowed: ['string']
|
||||||
|
},
|
||||||
expires: {
|
expires: {
|
||||||
allowed: ['number'],
|
allowed: ['number'],
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user