mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-05 15:27:05 +00:00
Merge pull request #33410 from errietta/hkp-types
openpgp.js: Add HKP types
This commit is contained in:
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
export class HKP {
|
||||
constructor(keyServerUrl?: string);
|
||||
lookup(options: {keyId?: string, query?: string }): Promise<string>;
|
||||
upload(publicKeyArmored: string): Promise<Response>;
|
||||
}
|
||||
Vendored
+3
-1
@@ -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 <https://blog.lacasa.fr>
|
||||
// Errietta Kostala <https://github.com/errietta>
|
||||
@@ -10,6 +10,8 @@
|
||||
|
||||
export as namespace openpgp;
|
||||
|
||||
export * from './common';
|
||||
|
||||
export interface UserId {
|
||||
name?: string,
|
||||
email?: string,
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
Vendored
+3
-1
@@ -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 <https://blog.lacasa.fr>
|
||||
// Errietta Kostala <https://github.com/errietta>
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
export as namespace openpgp;
|
||||
|
||||
export * from '../common';
|
||||
|
||||
export interface UserId {
|
||||
name?: string,
|
||||
email?: string,
|
||||
|
||||
Reference in New Issue
Block a user