Skip to content

eliasblume/privatebin-decrypt

Repository files navigation

privatebin-decrypt

npm version npm downloads bundle JSDocs License

A simple library to decrypt PrivateBin pastes for nodejs

Install

npm install privatebin-decrypt

Usage

import { decryptPrivateBin } from 'privatebin-decrypt'

// https://paste.to/?2f1ecdd195e92055#3evZwExja1XBjXY6gCPkpmodFy6LKNLre75VHCY9sz5f
const data = await (await fetch('https://paste.to/?2f1ecdd195e92055', {
  headers: {
    Accept: 'application/json, text/javascript, */*; q=0.01',
  },
})).json() as {
  ct: string
  adata: (string | number | (string | number)[])[]
}

const key = '3evZwExja1XBjXY6gCPkpmodFy6LKNLre75VHCY9sz5f'
const decrypted = await decryptPrivateBin({
  key,
  data: data.adata,
  cipherMessage: data.ct,
})

console.log(decrypted)
// Hello PrivateBin

License

MIT License © 2023-PRESENT Elias Blume

About

a js/ts lib to decrypt a content from privateBin

Resources

License

Stars

Watchers

Forks

Packages

No packages published