Noncommital Premarital Mischief
    Have ideas to improve npm?Join in the discussion! »

    @f0c1s/generate-keys

    2021.1.25 • Public • Published

    node-generate-keys

    Predefined keys generated for given passphrase; returns {privateKey, publicKey}

    Encrypt and decrypt example #1

    const generateKeys = require('@f0c1s/generate-keys')
    const {publicEncrypt, privateDecrypt} = require('crypto')
    const passphrase = 'nani?'
    const message = `it's over 9000!!!`
    const {publicKey, privateKey, options, generatePrivateKey, generatePublicKey} = generateKeys(passphrase)
    const encrypted = publicEncrypt(publicKey, Buffer.from(message))
    const decrypted = privateDecrypt(generatePrivateKey(Buffer.from(privateKey.toString()), passphrase), encrypted)

    Encrypt and decrypt example #2

    const generateKeys = require('@f0c1s/generate-keys')
    const {publicEncrypt, privateDecrypt} = require('crypto')
    const passphrase = 'nani?'
    const message = `it's over 9000!!!`
    const {publicKey, privateKey, options, generatePrivateKey, generatePublicKey} = generateKeys(passphrase)
    const generatedPublicKey = generatePublicKey(publicKey.toString())
    const encrypted = publicEncrypt(generatedPublicKey, Buffer.from(message))
    const decrypted = privateDecrypt(generatePrivateKey(Buffer.from(privateKey.toString()), passphrase), encrypted)

    Install

    npm i @f0c1s/generate-keys

    DownloadsWeekly Downloads

    22

    Version

    2021.1.25

    License

    MIT

    Unpacked Size

    5.67 kB

    Total Files

    6

    Last publish

    Collaborators

    • avatar
    • avatar