How to use the openpgp.HKP function in openpgp

To help you get started, we’ve selected a few openpgp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github isomorphic-git / isomorphic-git / src / models / PGP.js View on Github external
import * as openpgp from 'openpgp'

openpgp.config.aead_protect = false
openpgp.config.prefer_hash_algorithm = 2 // SHA1
var hkp = new openpgp.HKP('https://pgp.mit.edu')
var hkp2 = new openpgp.HKP('http://keys.gnupg.net')
var keyring = new openpgp.Keyring()

// Print a key
function printKey () {
  const keyid = printKeyid(this.primaryKey.getKeyId())
  const userid = printUser(this.getPrimaryUser().user)
  return keyid + ' ' + userid
}
// openpgp.key.toString = printKey

function printKeyid (keyid) {
  return keyid.toHex()
}
// openpgp.Keyid.prototype.toString = openpgp.Keyid.prototype.toHex

function printUser (user) {
github isomorphic-git / isomorphic-git / src / models / PGP.js View on Github external
import * as openpgp from 'openpgp'

openpgp.config.aead_protect = false
openpgp.config.prefer_hash_algorithm = 2 // SHA1
var hkp = new openpgp.HKP('https://pgp.mit.edu')
var hkp2 = new openpgp.HKP('http://keys.gnupg.net')
var keyring = new openpgp.Keyring()

// Print a key
function printKey () {
  const keyid = printKeyid(this.primaryKey.getKeyId())
  const userid = printUser(this.getPrimaryUser().user)
  return keyid + ' ' + userid
}
// openpgp.key.toString = printKey

function printKeyid (keyid) {
  return keyid.toHex()
}
// openpgp.Keyid.prototype.toString = openpgp.Keyid.prototype.toHex
github eluzgin / eos-wallet-keychain / src / components / KeychainForm / index.js View on Github external
import { connect } from "react-redux";
import { withRouter } from "react-router-dom";
import KeychainForm from "./KeychainForm";
import { doTransfer } from "../../thunks/transfer";

let openpgp = require('openpgp');
openpgp.initWorker({ path:'openpgp.worker.js' });
openpgp.config.aead_protect = true;
let hkp = new openpgp.HKP('https://pgp.mit.edu');


const mapDispatchToProps = dispatch => ({
    callAPI(values) {
        let keyRecord = { name: values.keyname, pubkey: values.pubkey, prikey: values.prikey };
        values.prikey = values.prikey.replace(/\w/g,'*');
        values.pubkey = values.pubkey.replace(/\w/g,'*');
        let record = JSON.stringify(keyRecord);
        if(values.guardian) {
            let findOptions = {
                query: values.guardian
            };
            // Lookup Guardian's public key and encrypt record with it:
            hkp.lookup(findOptions).then(function(pubkey) {
                let encryptOptions = {
                    data: record,
github QTGate / QTGate-Desktop-Client / app / encrypt.ts View on Github external
export const checkKey = ( keyID: string, CallBack ) => {
	const hkp = new openpgp.HKP( keyServer )
	const options = {
		query: keyID
	}
	
	hkp.lookup ( options ).then ( key => {
		if ( key ) {
			return CallBack ( null, key )
		}
		return CallBack ( null, null )
	}).catch ( err => {
		CallBack ( err )
	})
}