Skip to content

Instantly share code, notes, and snippets.

@odudex
Last active July 4, 2025 16:12
Show Gist options
  • Select an option

  • Save odudex/2794a2598ea116a7c71007dadb95cd03 to your computer and use it in GitHub Desktop.

Select an option

Save odudex/2794a2598ea116a7c71007dadb95cd03 to your computer and use it in GitHub Desktop.
Encrypt and decrypt a Cashu token using Krux Android App

πŸ” Cashu Token Encryption & Decryption with Krux Android App

This guide explains how to encrypt and decrypt a Cashu token using Krux Android App and clipboard.


πŸ”’ Encrypting a Cashu Token with Krux Android App

  1. Start at Cashu.me
    Copy a Cashu token (a UTF-8 string).

  2. Copy to clipboard
    You now have the Cashu token as text on your clipboard.

  3. Paste into Krux Go to Tools -> Datum Tool -> Load from Clipboard.

    Krux receives the token as a UTF-8 encoded string.

  4. Convert the string to bytes
    Krux encodes the string using UTF-8, producing raw bytes.

    Convert Datum -> from utf8

  5. Encrypt the bytes Press Encrypt and type your key, confirm PBKDF2 key stretching iterations, choose an encryption mode(AES-GCM, AES-CBC, etc.), and choose an ID (public data that is visible at the decryption time).

    The byte data is encrypted using your selected encryption mode.

  6. Encode encrypted bytes to base64
    Now press to base64, or other text-like format (base43, base32, hex).

    The encrypted bytes are encoded into a base64 string, making them safe for text-based transfer.

    Press Done converting

  7. Copy the encrypted token to clipboard
    Press Export to Clipboard.

    You now have a base64-encoded, encrypted Cashu token string that can be shared securely.


πŸ”“ Decrypting the Cashu Token with Krux Android App

  1. Paste the base64 string into Krux
    Use the same or another Krux device to receive the encrypted cashu string.

    Tools -> Datum Tool -> Load from Clipboard

  2. Decode base64 string to bytes
    Datum Tool won't recognize it as a KEF yet, you must first decode the base64 string back into encrypted bytes. Convert Datum -> from base64 (or other text format you choose when encrypting)

  3. Decrypt the bytes
    Now Datum recognizes KEF encryption format and encrypted bytes can be decrypted using the matching encryption key.

  4. Convert bytes back to text
    Press to utf8, so the decrypted bytes are decoded using UTF-8 to recover the original Cashu token string.

  5. Copy the token to clipboard
    Press Done Converting -> Export to Clipboard.

    You now have the original token back in plaintext, ready to use at Cashu.me.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment