Tabnine Logo For Javascript
openpgp
Code IndexAdd Tabnine to your IDE (free)

How to use openpgp

Best JavaScript code snippets using openpgp(Showing top 2 results out of 315)

origin: teamdfir/sift-cli

const validateSignature = async (version, filename) => {
 console.log(`> validating signature for ${filename}`)

 const filepath = `${cachePath}/${version}/${filename}`

 const ctMessage = await fs.readFileAsync(`${filepath}`, 'utf8')
 const ctSignature = await fs.readFileAsync(`${filepath}.asc`, 'utf8')
 const ctPubKey = pubKey

 const options = {
  message: await openpgp.cleartext.readArmored(ctSignature),
  publicKeys: (await openpgp.key.readArmored(ctPubKey)).keys
 }

 const valid = await openpgp.verify(options)

 if (typeof valid.signatures === 'undefined' && typeof valid.signatures[0] === 'undefined') {
  throw new Error('Invalid Signature')
 }

 if (valid.signatures[0].valid === false) {
  throw new Error('PGP Signature is not valid')
 }
}
origin: redhat-developer-tooling/developer-platform-install

return Promise.resolve().then(()=>{
 let options = {
  message: openpgp.cleartext.readArmored(armoredText), // parse armored message
  publicKeys: openpgp.key.readArmored(keyText).keys   // for verification
 };
 return openpgp.verify(options).then((verified)=>{
  return {options, verified};
 });
 return {
  text: options.message.text,
  valid: verified.signatures[0].valid,
  error
 };
openpgp(npm)

Most used openpgp functions

  • VerifyResult.signatures
  • cleartext
  • key
  • readArmored
  • verify

Popular in JavaScript

  • ms
    Tiny millisecond conversion utility
  • yargs
    yargs the modern, pirate-themed, successor to optimist.
  • readable-stream
    Streams3, a user-land copy of the stream library from Node.js
  • node-fetch
    A light-weight module that brings window.fetch to node.js
  • q
    A library for promises (CommonJS/Promises/A,B,D)
  • through2
    A tiny wrapper around Node.js streams.Transform (Streams2/3) to avoid explicit subclassing noise
  • winston
    A logger for just about everything.
  • superagent
    elegant & feature rich browser / node HTTP with a fluent API
  • commander
    the complete solution for node.js command-line programs
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJavascript Code Index
Get Tabnine for your IDE now