OpenPay (1 crate, 2174 LOC, 14 tests)
op-payouts Multi-rail payout engine. Visa Direct, Mastercard Send,
ACH credits (NACHA), Fedwire + SWIFT MT103 + ISO 20022
pacs.008, SEPA SCT + SCT Inst (mod-97 IBAN), UK FPS,
FedNow, RTP, PayPal, Wise. Crypto: USDC/USDT on
ETH/Polygon/Base/Solana + BTC + Lightning with real
ERC-20 transfer(address,uint256) calldata. Offline-pure
drivers (emit wire payloads — operators transmit).
Smart Byte (1 crate, 2605 LOC, 38 tests)
smart-byte-nostr Nostr adapter. NIP-01 canonical event id + BIP-340
Schnorr sign/verify; from-scratch bech32 + NIP-19 TLV
(npub/nsec/note/nprofile/nevent/nrelay); NIP-04 legacy
AES-256-CBC DMs; NIP-44 v2 HKDF-SHA256→ChaCha20+HMAC
with bucketed padding; NIP-17 gift-wrap (kind 1059) +
seal (kind 13) + rumor (kind 14); NIP-05/11/13/26/65.
Relay client message vocabulary (REQ/EVENT/CLOSE/AUTH/
EOSE/OK/NOTICE/CLOSED) + in-memory router.
EOC (1 crate, 2024 LOC, 30 tests)
eoc-streaming Token-by-token + tool-call streaming primitives.
SSE framing (data: lines); Anthropic event mapper
(message_start/content_block_*/message_delta/stop/ping);
OpenAI delta mapper; Vercel AI SDK mapper. Bounded-channel
backpressure with watermarks; CancelToken propagation;
Last-Event-ID resumable streams; per-stream joule meter.
Co-Authored-By: Claude Opus 4.7 <[email protected]>
39 lines
1.3 KiB
Rust
39 lines
1.3 KiB
Rust
//! Integration test: NIP-17 gift-wrapped private DM.
|
|
|
|
use smart_byte_nostr::nip17::{KIND_GIFT_WRAP, Rumor, unwrap, wrap};
|
|
use smart_byte_nostr::NostrSecretKey;
|
|
|
|
#[test]
|
|
fn dm_roundtrip_via_gift_wrap() {
|
|
let alice = NostrSecretKey::generate();
|
|
let bob = NostrSecretKey::generate();
|
|
let rumor = Rumor::new(
|
|
&alice.public_key(),
|
|
&bob.public_key(),
|
|
"private hello",
|
|
1_700_000_000,
|
|
);
|
|
let wrapped = wrap(&alice, &bob.public_key(), &rumor, 1_700_000_000).expect("wrap");
|
|
assert_eq!(wrapped.kind, KIND_GIFT_WRAP);
|
|
// The wrap event is signed by an ephemeral key, NOT Alice's key.
|
|
assert_ne!(wrapped.pubkey, alice.public_key().to_hex());
|
|
|
|
let recovered = unwrap(&bob, &wrapped).expect("unwrap");
|
|
assert_eq!(recovered.pubkey, alice.public_key().to_hex());
|
|
assert_eq!(recovered.content, "private hello");
|
|
}
|
|
|
|
#[test]
|
|
fn third_party_cannot_unwrap() {
|
|
let alice = NostrSecretKey::generate();
|
|
let bob = NostrSecretKey::generate();
|
|
let eve = NostrSecretKey::generate();
|
|
let rumor = Rumor::new(
|
|
&alice.public_key(),
|
|
&bob.public_key(),
|
|
"for bob only",
|
|
1_700_000_000,
|
|
);
|
|
let wrapped = wrap(&alice, &bob.public_key(), &rumor, 1_700_000_000).expect("wrap");
|
|
assert!(unwrap(&eve, &wrapped).is_err());
|
|
}
|