简介
利用 Unicode 变体选择器在 emoji 中隐藏/提取 Cashu 代币或任意文本,适合隐私转账与趣味通信
原始描述
Encode and decode Cashu tokens that are hidden inside emojis using Unicode variation selectors.
中文使用说明 来自收录源
核心用法
cashu-emoji 是一款基于 Unicode 变体选择器(VS1-VS256)的隐写工具,允许用户在 emoji 字符中嵌入或提取隐藏的 Cashu 代币(cashuA.../cashuB... 格式)或任意 UTF-8 文本。工具提供完整的 CLI 接口,支持编码(encode)、解码(decode)及元数据提取(--metadata)三种核心模式。
编码流程:选择载体 emoji(推荐使用 🥜),将目标字符串转换为变体选择器序列附加其后,生成视觉上与原始 emoji 完全相同的字符串。解码流程:从任意消息文本中扫描变体选择器字节流,还原嵌入的原始内容。解码器支持自动识别 Cashu 代币格式,并可调用 @cashu/cashu-ts 库本地解析代币面值、单位及铸币厂信息,无需联网验证。
显著优点
- 零视觉痕迹:隐藏内容完全不可见,兼容绝大多数支持 Unicode 的聊天应用
- 本地解析安全:元数据提取仅做本地格式解析,不触发网络请求,避免代币被意外标记或追踪
- 程序化友好:支持
--json结构化输出,便于自动化代理集成 - 轻量依赖:纯 TypeScript/Node.js 实现,无复杂运行时依赖
潜在局限与风险
- 传输脆弱性:许多即时通讯工具会对 Unicode 文本进行规范化、截断或转义处理,导致变体选择器丢失,代币无法恢复。Telegram 等平台的代码块(monospace)格式可提升可靠性
- 无有效性验证:工具仅提取代币字符串,无法验证代币是否已花费或铸币厂是否在线
- Bearer 资产风险:提取出的 Cashu 代币等同于现金,一旦泄露即可能被第三方兑换
- 格式识别盲区:非 Cashu 格式的隐藏文本会被原样返回,需调用方自行判断用途
适合人群
- 追求隐私的比特币/Lightning 用户,需通过公开频道传递小额价值
- 开发者构建基于 emoji 的隐写通信或趣味交互场景
- 自动化代理需解析链下支付凭证的工作流
常规风险
代币传输过程中的字符截断、复制粘贴时的编码转换、以及接收方环境对 Unicode 的非标准处理,均可能导致隐写失效。建议始终附加普通文本于 emoji 代币之后,并在关键场景要求发送方通过备用渠道确认完整性。
技能正文
name: cashu-emoji description: Encode and decode Cashu tokens that are hidden inside emojis using Unicode variation selectors. metadata: openclaw: emoji: "🥜" examples: - "Decode an emoji token from a full chat message" - "Encode a Cashu token into an emoji for sending"
Cashu Emoji Tokens (Variation Selector encoding)
This skill helps agents decode Cashu tokens received as emoji (and encode tokens for sending), and it also supports general hidden messages inside emojis.
If the decoded text starts with cashu, it’s likely a Cashu token. Otherwise treat it as a plain hidden message.
Why this exists
Some services embed a cashu... token into an emoji using Unicode variation selectors (VS1..VS256). Chat apps often display only the emoji, but preserve the hidden selector characters.
Important: many messengers can truncate or normalize Unicode. If the variation selectors are lost, the embedded token cannot be recovered.
Quickstart (copy/paste)
git clone https://github.com/robwoodgate/cashu-emoji.git
cd cashu-emoji
npm ci
# decode a whole message (recommended)
node ./bin/cashu-emoji.js decode "<paste message>"
# decode and print mint/unit/amount if it’s a cashu token
node ./bin/cashu-emoji.js decode "<paste message>" --metadata
# decode as structured JSON (agent-friendly)
node ./bin/cashu-emoji.js decode "<paste message>" --metadata --json
# encode a hidden message
node ./bin/cashu-emoji.js encode "🥜" "hello from inside an emoji"
# encode a cashu token
node ./bin/cashu-emoji.js encode "🥜" "cashuB..."
What you can do
1) Decode
- Input: entire message text (may include other text/emojis)
- Output: the embedded UTF‑8 text, usually a
cashuA.../cashuB...token
node ./bin/cashu-emoji.js decode "<paste entire message>"
Decode semantics (important): the decoder ignores normal characters until it finds the first variation-selector byte, then collects bytes until the first normal character after that payload begins.
2) Encode
- Input: a carrier emoji (recommend
🥜) and a token string - Output: an emoji string that visually looks like the emoji but contains the hidden token
node ./bin/cashu-emoji.js encode "🥜" "cashuB..."
Tip: some messengers are less likely to deliver a truncated/corrupted emoji-token if any normal text follows it (even a single character). It’s not required, just a delivery reliability trick.
Tip (Telegram): sending the emoji-token inside a code block / “monospace” formatting can help preserve the hidden characters and makes it easier to tap-to-copy.
Optional metadata
To sanity-check the decoded token without redeeming it, you can request metadata.
For programmatic/agent use, prefer JSON output:
node ./bin/cashu-emoji.js decode "<message>" --metadata --json
Example JSON response (Cashu token):
{
"text": "cashuB...",
"isCashu": true,
"metadata": {
"mint": "https://mint.example",
"unit": "sat",
"amount": 21
},
"metadataError": null
}
Example JSON response (plain hidden message):
{
"text": "hello from inside an emoji",
"isCashu": false
}
node ./bin/cashu-emoji.js decode "<message>" --metadata
This prints mint/unit/amount using @cashu/cashu-ts getTokenMetadata() (no mint calls).
Cashu gotchas for new agents
- A decoded
cashu...token is a bearer asset. Treat it like cash. --metadatais a local parse. It can’t prove the token is unspent/valid.- If decode returns a partial token or nonsense, the messenger likely munged the variation selectors; ask for the token to be re-sent (often with some trailing normal text after the emoji token).
Files
src/emoji-encoder.ts: core encode/decodebin/cashu-emoji.js: CLI wrapperexamples/: test vectors
Safety
This tool only encodes/decodes text. It does not spend funds.
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。