Skip to content

Commit 659cc0f

Browse files
authored
Merge pull request #69 from spacesprotocol/releases
Releases
2 parents df615c3 + d7a0989 commit 659cc0f

29 files changed

Lines changed: 500 additions & 508 deletions

File tree

Cargo.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ authors = ["Buffrr <contact@buffrr.dev>"]
1313

1414
[workspace.dependencies]
1515
fabric-resolver = { path = "fabric", version = "0.1.4" }
16-
libveritas = { version = "0.1" }
17-
libveritas_testutil = { version = "0.1" }
16+
libveritas = { version = "0.2" }
17+
libveritas_testutil = { version = "0.2" }
1818

1919
spaces_client = { version = "0.1" }
2020
spaces_protocol = { version = "0.1" }

fabric/examples/go/main.go

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,29 @@ import (
1616
func exampleResolveIntro() error {
1717
// <doc:resolve-intro>
1818
f := fabric.New()
19-
resolved, err := f.Resolve("alice@bitcoin")
19+
zone, err := f.Resolve("alice@bitcoin")
2020
// </doc:resolve-intro>
2121
if err != nil {
2222
return err
2323
}
24-
_ = resolved
24+
_ = zone
2525
return nil
2626
}
2727

2828
/// Resolve a single handle
2929
func exampleResolve() error {
3030
// <doc:resolve>
3131
f := fabric.New()
32-
resolved, err := f.Resolve("alice@bitcoin")
32+
zone, err := f.Resolve("alice@bitcoin")
3333
if err != nil {
3434
return err
3535
}
36-
if resolved == nil {
36+
if zone == nil {
3737
fmt.Println("handle not found")
3838
return nil
3939
}
4040

41-
fmt.Printf("Handle found: %s\n", resolved.Zone.Handle)
41+
fmt.Printf("Handle found: %s\n", zone.Handle)
4242
// </doc:resolve>
4343

4444
return nil
@@ -51,12 +51,12 @@ func exampleTrustAndVerification() error {
5151
// <doc:verification>
5252
// Before pinning a trust id: resolve uses observed (peer) state
5353
// badge() returns Unverified
54-
resolved, err := f.Resolve("alice@bitcoin")
54+
zone, err := f.Resolve("alice@bitcoin")
5555
if err != nil {
5656
return err
5757
}
5858

59-
f.Badge(resolved) // Unverified
59+
f.Badge(*zone) // Unverified
6060

6161
// Pin trust from a QR scan
6262
qr := "veritas://scan?id=14ef902621df01bdeee0b23fedf67458563a20df600af8979a4748dcd9d1b9f9"
@@ -67,8 +67,8 @@ func exampleTrustAndVerification() error {
6767
}
6868

6969
// Does not require re-resolving, badge now checks
70-
// whether resolved was against a trusted root
71-
f.Badge(resolved) // Orange if handle is sovereign (final certificate)
70+
// whether zone was against a trusted root
71+
f.Badge(*zone) // Orange if handle is sovereign (final certificate)
7272

7373
// Or from a semi-trusted source (e.g. an explorer you trust with qr scanned over HTTPS)
7474
// .Badge() will not show Orange for roots in this trust pool,
@@ -94,13 +94,13 @@ func exampleTrustAndVerification() error {
9494
/// Unpack records from a resolved handle
9595
func exampleUnpackRecords() error {
9696
f := fabric.New()
97-
resolved, err := f.Resolve("alice@bitcoin")
97+
zone, err := f.Resolve("alice@bitcoin")
9898
if err != nil {
9999
return err
100100
}
101101

102102
// <doc:unpack-records>
103-
records, err := resolved.Zone.Records.Unpack()
103+
records, err := zone.Records.Unpack()
104104
if err != nil {
105105
return err
106106
}
@@ -123,12 +123,12 @@ func exampleResolveAll() error {
123123
f := fabric.New()
124124

125125
// <doc:resolve-all>
126-
batch, err := f.ResolveAll([]string{"alice@bitcoin", "bob@bitcoin"})
126+
zones, err := f.ResolveAll([]string{"alice@bitcoin", "bob@bitcoin"})
127127
if err != nil {
128128
return err
129129
}
130130

131-
for _, zone := range batch.Zones {
131+
for _, zone := range zones {
132132
fmt.Printf("%s: %s\n", zone.Handle, zone.Sovereignty)
133133
}
134134
// </doc:resolve-all>
@@ -195,16 +195,16 @@ func exampleResolveById() error {
195195
f := fabric.New()
196196

197197
// <doc:resolve-by-id>
198-
resolved, err := f.ResolveById("num1qx8dtlzq...")
198+
zone, err := f.ResolveById("num1qx8dtlzq...")
199199
if err != nil {
200200
return err
201201
}
202-
if resolved == nil {
202+
if zone == nil {
203203
fmt.Println("handle not found")
204204
return nil
205205
}
206206

207-
fmt.Printf("Handle found: %s\n", resolved.Zone.Handle)
207+
fmt.Printf("Handle found: %s\n", zone.Handle)
208208
// </doc:resolve-by-id>
209209

210210
return nil
@@ -215,12 +215,12 @@ func exampleSearchAddr() error {
215215
f := fabric.New()
216216

217217
// <doc:search-addr>
218-
batch, err := f.SearchAddr("nostr", "npub180cvv07tjdrrgpa0j7j7tmnyl2yr6yr7l8j4s3evf6u64th6gkwsyjh6w6")
218+
zones, err := f.SearchAddr("nostr", "npub180cvv07tjdrrgpa0j7j7tmnyl2yr6yr7l8j4s3evf6u64th6gkwsyjh6w6")
219219
if err != nil {
220220
return err
221221
}
222222

223-
for _, zone := range batch.Zones {
223+
for _, zone := range zones {
224224
fmt.Printf("%s: %s\n", zone.Handle, zone.Sovereignty)
225225
}
226226
// </doc:search-addr>

fabric/examples/js/index.mjs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,21 @@ import { signSchnorr } from "@spacesprotocol/fabric-web/signing";
88
async function exampleResolveIntro() {
99
// <doc:resolve-intro>
1010
const fabric = new Fabric();
11-
const resolved = await fabric.resolve("alice@bitcoin");
11+
const zone = await fabric.resolve("alice@bitcoin");
1212
// </doc:resolve-intro>
1313
}
1414

1515
/// Resolve a single handle
1616
async function exampleResolve() {
1717
// <doc:resolve>
1818
const fabric = new Fabric();
19-
const resolved = await fabric.resolve("alice@bitcoin");
20-
if (!resolved) {
19+
const zone = await fabric.resolve("alice@bitcoin");
20+
if (!zone) {
2121
console.log("handle not found");
2222
return;
2323
}
2424

25-
console.log(`Handle found: ${resolved.zone.handle}`);
25+
console.log(`Handle found: ${zone.handle}`);
2626
// </doc:resolve>
2727
}
2828

@@ -33,9 +33,9 @@ async function exampleTrustAndVerification() {
3333
// <doc:verification>
3434
// Before pinning a trust id: resolve uses observed (peer) state
3535
// badge() returns "unverified"
36-
const resolved = await fabric.resolve("alice@bitcoin");
36+
const zone = await fabric.resolve("alice@bitcoin");
3737

38-
fabric.badge(resolved); // "unverified"
38+
fabric.badge(zone); // "unverified"
3939

4040
// Pin trust from a QR scan
4141
const qr = "veritas://scan?id=14ef902621df01bdeee0b23fedf67458563a20df600af8979a4748dcd9d1b9f9";
@@ -44,8 +44,8 @@ async function exampleTrustAndVerification() {
4444
await fabric.trustFromQr(qr);
4545

4646
// Does not require re-resolving, badge now checks
47-
// whether resolved was against a trusted root
48-
fabric.badge(resolved); // "orange" if handle is sovereign (final certificate)
47+
// whether the zone's anchor_hash is in the trusted set
48+
fabric.badge(zone); // "orange" if handle is sovereign (final certificate)
4949

5050
// Or from a semi-trusted source (e.g. an explorer you trust with qr scanned over HTTPS)
5151
// .badge() will not show "orange" for roots in this trust pool,
@@ -65,10 +65,10 @@ async function exampleTrustAndVerification() {
6565
/// Unpack records from a resolved handle
6666
async function exampleUnpackRecords() {
6767
const fabric = new Fabric();
68-
const resolved = await fabric.resolve("alice@bitcoin");
68+
const zone = await fabric.resolve("alice@bitcoin");
6969

7070
// <doc:unpack-records>
71-
const json = resolved.zone.toJson();
71+
const json = zone.toJson();
7272

7373
for (const record of json.records) {
7474
if (record.type === "txt") {
@@ -85,9 +85,9 @@ async function exampleResolveAll() {
8585
const fabric = new Fabric();
8686

8787
// <doc:resolve-all>
88-
const batch = await fabric.resolveAll(["alice@bitcoin", "bob@bitcoin"]);
88+
const zones = await fabric.resolveAll(["alice@bitcoin", "bob@bitcoin"]);
8989

90-
for (const zone of batch.zones) {
90+
for (const zone of zones) {
9191
console.log(`${zone.handle}`);
9292
}
9393
// </doc:resolve-all>
@@ -134,13 +134,13 @@ async function exampleResolveById() {
134134
const fabric = new Fabric();
135135

136136
// <doc:resolve-by-id>
137-
const resolved = await fabric.resolveById("num1qx8dtlzq...");
138-
if (!resolved) {
137+
const zone = await fabric.resolveById("num1qx8dtlzq...");
138+
if (!zone) {
139139
console.log("handle not found");
140140
return;
141141
}
142142

143-
console.log(`Handle found: ${resolved.zone.handle}`);
143+
console.log(`Handle found: ${zone.handle}`);
144144
// </doc:resolve-by-id>
145145
}
146146

@@ -149,9 +149,9 @@ async function exampleSearchAddr() {
149149
const fabric = new Fabric();
150150

151151
// <doc:search-addr>
152-
const batch = await fabric.searchAddr("nostr", "npub180cvv07tjdrrgpa0j7j7tmnyl2yr6yr7l8j4s3evf6u64th6gkwsyjh6w6");
152+
const zones = await fabric.searchAddr("nostr", "npub180cvv07tjdrrgpa0j7j7tmnyl2yr6yr7l8j4s3evf6u64th6gkwsyjh6w6");
153153

154-
for (const zone of batch.zones) {
154+
for (const zone of zones) {
155155
console.log(`${zone.handle}`);
156156
}
157157
// </doc:search-addr>

fabric/examples/kotlin/Example.kt

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,21 @@ import org.spacesprotocol.fabric.SIG_PRIMARY_ZONE
2020
suspend fun exampleResolveIntro() {
2121
// <doc:resolve-intro>
2222
val fabric = Fabric()
23-
val resolved = fabric.resolve("alice@bitcoin")
23+
val zone = fabric.resolve("alice@bitcoin")
2424
// </doc:resolve-intro>
2525
}
2626

2727
/// Resolve a single handle
2828
suspend fun exampleResolve() {
2929
// <doc:resolve>
3030
val fabric = Fabric()
31-
val resolved = fabric.resolve("alice@bitcoin")
32-
if (resolved == null) {
31+
val zone = fabric.resolve("alice@bitcoin")
32+
if (zone == null) {
3333
println("handle not found")
3434
return
3535
}
3636

37-
println("Handle found: ${resolved.zone.handle}")
37+
println("Handle found: ${zone.handle}")
3838
// </doc:resolve>
3939
}
4040

@@ -45,10 +45,10 @@ suspend fun exampleTrustAndVerification() {
4545
// <doc:verification>
4646
// Before pinning a trust id: resolve uses observed (peer) state
4747
// badge() returns Unverified
48-
val resolved = fabric.resolve("alice@bitcoin")
48+
val zone = fabric.resolve("alice@bitcoin")
4949
?: throw IllegalStateException("handle exists")
5050

51-
fabric.badge(resolved) // Unverified
51+
fabric.badge(zone) // Unverified
5252

5353
// Pin trust from a QR scan
5454
val qr = "veritas://scan?id=14ef902621df01bdeee0b23fedf67458563a20df600af8979a4748dcd9d1b9f9"
@@ -57,8 +57,8 @@ suspend fun exampleTrustAndVerification() {
5757
fabric.trustFromQr(qr)
5858

5959
// Does not require re-resolving, badge now checks
60-
// whether resolved was against a trusted root
61-
fabric.badge(resolved) // Orange if handle is sovereign (final certificate)
60+
// whether zone was against a trusted root
61+
fabric.badge(zone) // Orange if handle is sovereign (final certificate)
6262

6363
// Or from a semi-trusted source (e.g. an explorer you trust with qr scanned over HTTPS)
6464
// .badge() will not show Orange for roots in this trust pool,
@@ -80,11 +80,11 @@ suspend fun exampleTrustAndVerification() {
8080
/// Unpack records from a resolved handle
8181
suspend fun exampleUnpackRecords() {
8282
val fabric = Fabric()
83-
val resolved = fabric.resolve("alice@bitcoin")
83+
val zone = fabric.resolve("alice@bitcoin")
8484
?: throw IllegalStateException("handle exists")
8585

8686
// <doc:unpack-records>
87-
val records = resolved.zone.records.unpack()
87+
val records = zone.records.unpack()
8888

8989
for (record in records) {
9090
when (record) {
@@ -101,9 +101,9 @@ suspend fun exampleResolveAll() {
101101
val fabric = Fabric()
102102

103103
// <doc:resolve-all>
104-
val batch = fabric.resolveAll(listOf("alice@bitcoin", "bob@bitcoin"))
104+
val zones = fabric.resolveAll(listOf("alice@bitcoin", "bob@bitcoin"))
105105

106-
for (zone in batch.zones) {
106+
for (zone in zones) {
107107
println("${zone.handle}: ${zone.sovereignty}")
108108
}
109109
// </doc:resolve-all>
@@ -147,13 +147,13 @@ suspend fun exampleResolveById() {
147147
val fabric = Fabric()
148148

149149
// <doc:resolve-by-id>
150-
val resolved = fabric.resolveById("num1qx8dtlzq...")
151-
if (resolved == null) {
150+
val zone = fabric.resolveById("num1qx8dtlzq...")
151+
if (zone == null) {
152152
println("handle not found")
153153
return
154154
}
155155

156-
println("Handle found: ${resolved.zone.handle}")
156+
println("Handle found: ${zone.handle}")
157157
// </doc:resolve-by-id>
158158
}
159159

@@ -162,9 +162,9 @@ suspend fun exampleSearchAddr() {
162162
val fabric = Fabric()
163163

164164
// <doc:search-addr>
165-
val batch = fabric.searchAddr("nostr", "npub180cvv07tjdrrgpa0j7j7tmnyl2yr6yr7l8j4s3evf6u64th6gkwsyjh6w6")
165+
val zones = fabric.searchAddr("nostr", "npub180cvv07tjdrrgpa0j7j7tmnyl2yr6yr7l8j4s3evf6u64th6gkwsyjh6w6")
166166

167-
for (zone in batch.zones) {
167+
for (zone in zones) {
168168
println("${zone.handle}: ${zone.sovereignty}")
169169
}
170170
// </doc:search-addr>

0 commit comments

Comments
 (0)