How to use the paseto.js.V2 function in paseto

To help you get started, we’ve selected a few paseto 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 stefanvanherwijnen / quasar-auth-starter / backend / console / configure.js View on Github external
const generateNewKey = async () => {
  try {
    let sk = new SymmetricKey(new encoder)
    sk.generate().then(() => {
      let b64 = sk.encode() 
      env.PASETO_KEY = b64
      let output = envfile.stringifySync(env)
      fs.writeFileSync(sourcePath, output)
      console.log('New PASETO key has been sucessfully generated.')
    });
  } catch (err) {
    throw err
  }
}
github stefanvanherwijnen / quasar-auth-starter / backend / src / api / helpers / paseto-auth.ts View on Github external
public async getSharedKey(): Promise {
    const sharedKey  = new Paseto.SymmetricKey(new Paseto.V2())

    return sharedKey.base64(process.env.PASETO_KEY).then((): Paseto.SymmetricKey => {
      return sharedKey
    })
  }

paseto

PASETO for Node.js with no dependencies

MIT
Latest version published 1 year ago

Package Health Score

62 / 100
Full package analysis