Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@stellarguard/secret-memo

stellarguard12MIT3.0.1TypeScript support: included

Create secret memos for Stellar transactions.

readme

@stellarguard/secret-memo

Create secret memos for Stellar transactions in NodeJS.

Uses AES-256 with a random initialization vector to encrypt and decrypt memos.

Use this if you want to place data in Stellar memos that you don't want other to be able to read. Also, because of the random initilization vector used when encrypting the memo, the result will be different even when run with the same data. This makes it perfect to use when you want to protect your users from data leakage that could allow someone to link two accounts together, such as when reusing the same id for exchange deposits.

Combine that with a federation server that is used to generate the memo and you all of a sudden have a convenient, safe, and private deposit experience.

Note: Because of the randomness added when encrypting, Secret memos can only be 23 characters long.

Installation

npm

npm install --save @stellarguard/anoymous-memo

yarn

yarn add @stellarguard/anonymous-memo

Requires stellar-sdk as an peer dependency.

Usage

import { SecretMemo } from '@stellarguard/secret-memo';
// or const { SecretMemo } = require('@stellarguard/secret-memo');

const secretKey = 'its a secret to everybody'; // keep it secret, keep it safe
const secretMemo = new SecretMemo(secretKey);

// create the secret and add to a transaction
const transaction = new TransactionBuilder(sourceAccount)
  .addMemo(secretMemo.toMemo('drink more ovaltine'))
  .addOperation(operation)
  .build();

// read the secret from the transaction
const mySecret = secretMemo.fromMemo(transaction.memo); // drink more ovaltine

See a working example for more details.

changelog

Change Log

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.

3.0.1 (2021-05-29)

3.0.0 (2020-11-23)

Features

  • package.json: require stellar-sdk ^7.0.0 (e689ea3)

BREAKING CHANGES

  • 🧨 Now requires peer dependency of stellar-sdk >= 7.0.0

2.0.1 (2020-11-23)

Bug Fixes

  • make sure hash is below 64 characters to avoid error (b082b6c), closes #1

2.0.0 (2020-05-18)

Features

  • 🎸 Upgrade to stellar-sdk v5.0.0 (60f6815)

BREAKING CHANGES

  • 🧨 Now requires peer dependency of stellar-sdk >= 5.0.0

1.0.1 (2018-07-02)

Bug Fixes

  • Remove randombytes from dependencies (d6dd005)

1.0.0 (2018-07-02)

0.1.0 (2018-07-02)

Features

  • Add fromMemoHash method in case you have a string instead of a buffer. Rename to SecretMemo. (74f0df2)
  • Add initial working version of code (6117151)
  • Increase max size to 23 characters. (343b6ad)