Add example for key upload to readme

This commit is contained in:
Tankred Hase 2015-12-12 12:17:08 +07:00
parent 5b937a6712
commit e159fd77b4

View File

@ -55,7 +55,7 @@ openpgp.generateKeyPair(options).then(function(keypair) {
});
```
#### Public key lookup on HKP server
#### Lookup public key on HKP server
```js
var openpgp = require('openpgp');
var hkp = new openpgp.HKP('https://pgp.mit.edu');
@ -67,6 +67,20 @@ hkp.lookup({
});
```
#### Upload public key to HKP server
```js
var openpgp = require('openpgp');
var hkp = new openpgp.HKP('https://pgp.mit.edu');
var key = '-----BEGIN PGP PUBLIC KEY BLOCK ... END PGP PUBLIC KEY BLOCK-----';
hkp.upload(key).then(function() {
// success
}).catch(function(error) {
// failure
});
```
#### Encryption
```js
var openpgp = require('openpgp');