stop producing useless deprecated "note1" codes.

This commit is contained in:
fiatjaf
2026-04-09 11:37:30 -03:00
parent db6aead115
commit 798e746ec8
3 changed files with 3 additions and 11 deletions
+2 -5
View File
@@ -1,12 +1,12 @@
# NIP-19: Bech32-Encoded Entities
**Status in Wisp:** Implemented (npub/nsec/note)
**Status in Wisp:** Implemented (npub/nsec/nevent/naddr)
**File:** `Nip19.kt`
**Depends on:** NIP-01
## Overview
Human-readable encoding for Nostr entities using Bech32/Bech32m.
Human-readable encoding for Nostr entities using Bech32.
## Basic Types (Bech32)
@@ -14,7 +14,6 @@ Human-readable encoding for Nostr entities using Bech32/Bech32m.
|--------|---------|--------|---------|
| `npub` | Public key | 32 bytes | `npub1qqqq...` |
| `nsec` | Private key | 32 bytes | `nsec1qqqq...` |
| `note` | Event ID | 32 bytes | `note1qqqq...` |
### Encoding
@@ -36,7 +35,6 @@ Human-readable encoding for Nostr entities using Bech32/Bech32m.
| `nprofile` | Profile + hints | pubkey + relay URLs |
| `nevent` | Event + hints | event ID + relay URLs + author |
| `naddr` | Replaceable event | kind + pubkey + d-tag + relay URLs |
| `nrelay` | Relay URL | relay URL |
### TLV Format
@@ -72,7 +70,6 @@ TLV: [0x00][0x02][<d-tag-utf8>][0x01][0x18][wss://relay.example.com][0x02][0x20]
Currently implements basic types only:
- `Nip19.npubEncode(pubkey: ByteArray): String`
- `Nip19.nsecEncode(privkey: ByteArray): String`
- `Nip19.noteEncode(eventId: ByteArray): String`
- `Nip19.npubDecode(npub: String): ByteArray`
- `Nip19.nsecDecode(nsec: String): ByteArray`
@@ -16,11 +16,7 @@ object Nip18 {
}
fun appendNoteUri(content: String, eventIdHex: String, relayHints: List<String> = emptyList(), authorHex: String? = null): String {
val id = if (relayHints.isNotEmpty() || authorHex != null) {
Nip19.neventEncode(eventIdHex.hexToByteArray(), relayHints, authorHex?.hexToByteArray())
} else {
Nip19.noteEncode(eventIdHex.hexToByteArray())
}
Nip19.neventEncode(eventIdHex.hexToByteArray(), relayHints, authorHex?.hexToByteArray())
return "$content\nnostr:$id"
}
}
@@ -14,7 +14,6 @@ object Nip19 {
fun npubEncode(pubkey: ByteArray): String = bech32Encode("npub", pubkey)
fun nsecEncode(privkey: ByteArray): String = bech32Encode("nsec", privkey)
fun noteEncode(eventId: ByteArray): String = bech32Encode("note", eventId)
fun nprofileEncode(pubkeyHex: String, relays: List<String> = emptyList()): String {
val tlv = buildTlv {