Supported NIPs
Sovran supports NIP-04, NIP-05, NIP-06, NIP-17, NIP-19, NIP-44, and NIP-59.NIP-04: Encrypted Direct Messages (Legacy)
Legacy encrypted direct message support using NIP-04 encryption.NIP-05: DNS-Based Verification
NIP-05 provides DNS-based verification for Nostr identities (Lightning addresses). User Interface (components/blocks/contacts/SearchResult.tsx):
- Profile search with NIP-05 validation
- Search by npub, NIP-05 identifier, or display name
- Verification badge display
NIP-06: Deterministic Key Derivation
NIP-06 enables deterministic key derivation from BIP-39 seed phrases. Implementation (helper/keyDerivation.ts:14-31):
m/44'/1237'/<accountIndex>'/0/0
Key Types Derived:
npub: Bech32-encoded public key (shareable)nsec: Bech32-encoded private key (secret)pubkey: Hex public key (for protocol usage)privateKey: Raw private key bytes (for signing)
providers/NostrKeysProvider.tsx:243-365):
The NostrKeysProvider manages key derivation with caching:
- Single seed phrase for both Bitcoin and Nostr
- Deterministic identity recovery
- Multi-account support
- Cross-platform compatibility
NIP-17: Private Direct Messages
NIP-17 provides gift-wrapped direct messages with enhanced metadata privacy. Implementation (utils/nip17.ts):
NIP-17 uses a three-layer gift-wrapping protocol:
- Rumor (kind 14): Unsigned event containing the actual message
- Seal (kind 13): Encrypts the rumor with NIP-44, signed by sender
- Wrap (kind 1059): Encrypts the seal with a random throwaway key
Creating Gift-Wrapped Messages
Single Recipient (utils/nip17.ts:127-151):
utils/nip17.ts:162-190):
For sender to retrieve their own sent messages:
Unwrapping Received Messages
Decryption (utils/nip17.ts:221-258):
- Random timestamps (within last 2 days) for metadata obfuscation
- Throwaway keys prevent sender correlation
- Seal verification ensures message authenticity
Messaging Interface
UI Components (components/screens/UserMessagesScreen.tsx):
- NIP-17 DM conversation screen
- Send/receive encrypted messages
- Inline Cashu token messages
- Inline payment request messages
hooks/useNostrDirectMessage.ts):
- NIP-17 DM creation with NIP-44 encryption
- Gift wrap generation (recipient + sender copy)
- Relay publishing
NIP-19: Bech32 Encoding
NIP-19 defines bech32-encoded entities for Nostr. Supported Entity Types:npub: Public key (user identity)nsec: Private key (secret)note: Note ID (event reference)nprofile: Profile with relay hintsnevent: Event with relay hints
helper/nostrClient.ts:7-17):
helper/nostrClient.ts:19-27):
hooks/coco/useProcessPaymentString.ts:52-75):
Sovran handles both npub1... and nostr:npub1... formats:
hooks/coco/useProcessPaymentString.ts:387-398):
Scanning an npub navigates to the user’s profile:
NIP-44: Encrypted Payloads
NIP-44 provides versioned encryption for Nostr messages (improved NIP-04). Implementation (utils/nip17.ts:34-44):
- Encrypts rumor in seal (kind 13)
- Encrypts seal in gift wrap (kind 1059)
- Uses conversation keys for sender/recipient pairs
- Forward secrecy (each message uses unique keys)
- Authentication (verifiable sender identity)
- Confidentiality (only recipient can decrypt)
NIP-59: Gift Wrap
NIP-59 defines the gift wrap protocol structure used by NIP-17. Event Kinds:- Kind 13: Seal (encrypted rumor)
- Kind 1059: Gift wrap (encrypted seal)
utils/nip17.ts:56-70):
utils/nip17.ts:78-93):
utils/nip17.ts:101-114):
Social Features
User Profiles
Profile Viewer (app/(user-flow)/profile.tsx):
- Banner and avatar display
- Follower/following counts
- Top followers (social proof)
- Reputation score
- Follow/unfollow actions
hooks/useNostrProfile.ts):
- Profile metadata (kind 0)
- Follower/following counts
- Top followers list
- User ranking
Mint Recommendations
Kind 38000: Cashu mint recommendation events Validation (helper/nostrClient.ts:64-67):
hooks/coco/useNostrDiscoveredMints.ts):
- Discovers mints from Nostr kind 38000 events
- Filters by k tag (38172 = Cashu mint)
- Extracts mint URLs from u tags
Dependencies
Sovran uses
nostr-tools for core Nostr operations and @nostr-dev-kit/ndk-mobile for mobile-optimized Nostr features including relay pool management.Reference Implementation
- NIP-06 Derivation:
helper/keyDerivation.ts:14-31 - NIP-17 Gift Wrap:
utils/nip17.ts - NIP-19 Decoding:
helper/nostrClient.ts:7-27 - NIP-44 Encryption:
utils/nip17.ts:34-44 - Nostr Keys Provider:
providers/NostrKeysProvider.tsx - Direct Messaging:
hooks/useNostrDirectMessage.ts - Profile Management:
hooks/useNostrProfile.ts
Learn More
BIP Standards
Learn about BIP-39 seed phrase derivation
Payment Requests
NUT-18 Nostr-based payment requests
Nostr Protocol
Official Nostr NIPs repository
Security
Secure key storage with expo-secure-store