Skip to content

Commit 1055b46

Browse files
committed
Bump version to 1.5.0
1 parent 427628b commit 1055b46

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed

README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,34 @@ segwit_addr.addr
100100
=> 'bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4'
101101
```
102102

103+
### Silent payment address
104+
105+
Decode silent payment address.
106+
107+
```ruby
108+
addr = Bech32::SilentPaymentAddr.parse('sp1qqgste7k9hx0qftg6qmwlkqtwuy6cycyavzmzj85c6qdfhjdpdjtdgqjuexzk6murw56suy3e0rd2cgqvycxttddwsvgxe2usfpxumr70xc9pkqwv')
109+
110+
# sp version
111+
addr.version
112+
=> 0
113+
# scan public key
114+
addr.scan_key
115+
=> '0220bcfac5b99e04ad1a06ddfb016ee13582609d60b6291e98d01a9bc9a16c96d4'
116+
# spend public key
117+
addr.spend_key
118+
=> '025cc9856d6f8375350e123978daac200c260cb5b5ae83106cab90484dcd8fcf36'
119+
```
120+
121+
Encode sp address.
122+
123+
```ruby
124+
addr = Bech32::SilentPaymentAddr.new('sp', 0, '0220bcfac5b99e04ad1a06ddfb016ee13582609d60b6291e98d01a9bc9a16c96d4', '025cc9856d6f8375350e123978daac200c260cb5b5ae83106cab90484dcd8fcf36')
125+
126+
# sp address
127+
addr.to_s
128+
=> 'sp1qqgste7k9hx0qftg6qmwlkqtwuy6cycyavzmzj85c6qdfhjdpdjtdgqjuexzk6murw56suy3e0rd2cgqvycxttddwsvgxe2usfpxumr70xc9pkqwv'
129+
```
130+
103131
### Nostr
104132

105133
Supports encoding/decoding of Nostr's [NIP-19](https://github.com/nostr-protocol/nips/blob/master/19.md) entities.
@@ -178,6 +206,16 @@ If bech32 string has NIP-19 hrp, it will also output NIP-19 entry:
178206
relay: wss://r.x.com
179207
relay: wss://djbas.sadkb.com
180208

209+
If sp address, it will also output scan/spend public key:
210+
211+
$ bech32 decode sp1qqgste7k9hx0qftg6qmwlkqtwuy6cycyavzmzj85c6qdfhjdpdjtdgqjuexzk6murw56suy3e0rd2cgqvycxttddwsvgxe2usfpxumr70xc9pkqwv
212+
HRP: sp
213+
DATA: 000008100b191e160517060f00090b081a001b0e1f16000b0e1c041a180418041d0c021b02120714181a000d0917120d010d120b0d0800121c190602161a1b1c030e141a101c0411190f030d0a1808000c0418060b0b0d0d0e100c0806190a1c100901061c1b031e0f0618
214+
TYPE: bech32m
215+
version: 0
216+
scan public key: 0220bcfac5b99e04ad1a06ddfb016ee13582609d60b6291e98d01a9bc9a16c96d4
217+
spend public key: 025cc9856d6f8375350e123978daac200c260cb5b5ae83106cab90484dcd8fcf36
218+
181219
Note: `DATA` is data without bit conversion. When used, the `DATA` must be converted from 5-bit to 8-bit and padded as necessary.
182220

183221
## License

lib/bech32/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module Bech32
4-
VERSION = '1.4.2'
4+
VERSION = '1.5.0'
55
end

0 commit comments

Comments
 (0)