
Product
Introducing Repository Access Permissions and Custom Roles
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.
bfp-encrypt
Advanced tools
Node.js library to encrypt and decrypt data using the Bitcoin File Protocol on Bitcoin Cash
Javascript library to encrypt and decrypt data and write that data to the Bitcoin Cash blockchain using the Bitcoin Files Protocol (BFP).
Uses Elliptic Curve Integrated Encryption Scheme (ECIES) and is compatible with the following Javascript libraries:
npm install bfp-encrypt
Below is an example of sending a text message from one address (sender WIF) to the P2PKH address associated with the recipient's public key. It uses the most recent UTXO in the sender's address and, if the UTXO amount is inadequate, will give an error saying the minimum satoshis necessary to send the data.
const BfpEncrypt = require('bfp-encrypt');
const senderWif = 'L2UzaFZxz6ATgo4zTiNXmR9ioHbtdcyhG89cLdSZGFwdMamDV14u'; // Address = bitcoincash:qpjvzz50gscheeh0fk6mnpr70zrf8lzccu2fu7lr3p
const recipientPublicKey = Buffer.from('02551b0063575007fe4e757f37cda5f03144d207bc19404ea1a37c1f1cceb12a3b', 'hex'); // Address = bitcoincash:qqcrlpjfkjwaep56c42fnlhj3uancz8wsgr36ajq2z
const data = Buffer.from('You can put whatever kind of data or message you want right here as a buffer');
const fileName = 'EncryptedData';
const fileExt = '.txt';
(async function(){
try {
let bfpEnc = new BfpEncrypt();
let bfpUri = await bfpEnc.sendData(data, senderWif, recipientPublicKey, fileName, fileExt);
console.log('BFP File ID:', bfpUri);
} catch (e) {
console.error(e)
}
})();
Below is an example of downloading and decrypting a text message sent to the recipient's address
const BfpEncrypt = require('bfp-encrypt');
const recipientWif = 'KwR6LVssEsTNV238wDCqhAbtvRquNWg8425AkujYDe5pRrMg1LjE'; // Address = bitcoincash:qqcrlpjfkjwaep56c42fnlhj3uancz8wsgr36ajq2z
const bfpUri = 'bitcoinfile:afe0cacba2635eb0696f353f31eabf01232695c092fc24f2da98eaf2ba355b87';
(async function(){
let bfpEnc = new BfpEncrypt();
let fileBuf = await bfpEnc.fetchEncryptedData(bfpUri, recipientWif);
console.log('Decrypted message:', fileBuf.toString('utf-8'));
})();
FAQs
Node.js library to encrypt and decrypt data using the Bitcoin File Protocol on Bitcoin Cash
We found that bfp-encrypt demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.

Product
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.