diff --git a/types/openpgp/common/index.d.ts b/types/openpgp/common/index.d.ts new file mode 100644 index 0000000000..88796dea9d --- /dev/null +++ b/types/openpgp/common/index.d.ts @@ -0,0 +1,5 @@ +export class HKP { + constructor(keyServerUrl?: string); + lookup(options: {keyId?: string, query?: string }): Promise; + upload(publicKeyArmored: string): Promise; +} diff --git a/types/openpgp/index.d.ts b/types/openpgp/index.d.ts index d564c6df6d..628663a9ec 100644 --- a/types/openpgp/index.d.ts +++ b/types/openpgp/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for openpgp 4.0.1 +// Type definitions for openpgp 4.4.8 // Project: http://openpgpjs.org/ // Definitions by: Guillaume Lacasa // Errietta Kostala @@ -10,6 +10,8 @@ export as namespace openpgp; +export * from './common'; + export interface UserId { name?: string, email?: string, diff --git a/types/openpgp/openpgp-tests.ts b/types/openpgp/openpgp-tests.ts index 19e305cb26..100941074a 100644 --- a/types/openpgp/openpgp-tests.ts +++ b/types/openpgp/openpgp-tests.ts @@ -135,6 +135,23 @@ openpgp.initWorker({ path:'openpgp.worker.js' }); return verified.signatures[0].valid; })(); +async () => { + let hkp = new openpgp.HKP(); + + const hkpOptions = { + query: 'alice@example.com' + }; + + const armoredPubkey = await hkp.lookup(hkpOptions); + await openpgp.key.readArmored(armoredPubkey); + + hkp = new openpgp.HKP('https://pgp.mit.edu'); + + const pubkey = '-----BEGIN PGP PUBLIC KEY BLOCK ... END PGP PUBLIC KEY BLOCK-----'; + + await hkp.upload(pubkey); +} + // Open PGP Tests diff --git a/types/openpgp/ts3.2/index.d.ts b/types/openpgp/ts3.2/index.d.ts index 428f785dbe..e7f8cdd714 100644 --- a/types/openpgp/ts3.2/index.d.ts +++ b/types/openpgp/ts3.2/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for openpgp 4.0.1 +// Type definitions for openpgp 4.4.8 // Project: http://openpgpjs.org/ // Definitions by: Guillaume Lacasa // Errietta Kostala @@ -9,6 +9,8 @@ export as namespace openpgp; +export * from '../common'; + export interface UserId { name?: string, email?: string,