+2
-1
Cargo.toml
+2
-1
Cargo.toml
+7
-4
Dockerfile
+7
-4
Dockerfile
···
19
19
# Build all binaries in release mode
20
20
# This will build all binaries defined in the workspace:
21
21
# - atproto-identity: 4 binaries (resolve, key, sign, validate)
22
-
# - atproto-record: 2 binaries (sign, verify)
22
+
# - atproto-record: 2 binaries (sign, verify)
23
23
# - atproto-client: 3 binaries (auth, app-password, dpop)
24
24
# - atproto-oauth: 1 binary (service-token)
25
25
# - atproto-oauth-axum: 1 binary (oauth-tool)
26
26
# - atproto-jetstream: 1 binary (jetstream-consumer)
27
27
# - atproto-xrpcs-helloworld: 1 binary (xrpcs-helloworld)
28
-
# Note: atproto-identity-resolve requires hickory-dns feature
28
+
# - atproto-lexicon: 1 binary (lexicon-resolve)
29
+
# Note: atproto-identity-resolve and atproto-lexicon-resolve require hickory-dns feature
29
30
RUN cargo build --release --bins -F clap,hickory-dns,zeroize,tokio
30
31
31
32
# Runtime stage - use distroless for minimal attack surface
···
48
49
COPY --from=builder /usr/src/app/target/release/atproto-oauth-tool .
49
50
COPY --from=builder /usr/src/app/target/release/atproto-xrpcs-helloworld .
50
51
COPY --from=builder /usr/src/app/target/release/atproto-jetstream-consumer .
52
+
COPY --from=builder /usr/src/app/target/release/atproto-lexicon-resolve .
51
53
52
54
# Default to the main resolution tool
53
55
# Users can override with specific binary: docker run <image> atproto-identity-resolve --help
···
56
58
# docker run <image> atproto-record-sign --help
57
59
# docker run <image> atproto-client-auth --help
58
60
# docker run <image> atproto-oauth-service-token --help
59
-
# docker run <image> atproto-oauth-tool --help
61
+
# docker run <image> atproto-oauth-tool --help
60
62
# docker run <image> atproto-xrpcs-helloworld --help
61
63
# docker run <image> atproto-jetstream-consumer --help
64
+
# docker run <image> atproto-lexicon-resolve --help
62
65
CMD ["atproto-identity-resolve", "--help"]
63
66
64
67
# Add labels for documentation
···
70
73
LABEL org.opencontainers.image.licenses="MIT"
71
74
72
75
# Document available binaries
73
-
LABEL binaries="atproto-identity-resolve,atproto-identity-key,atproto-identity-sign,atproto-identity-validate,atproto-record-sign,atproto-record-verify,atproto-client-auth,atproto-client-app-password,atproto-client-dpop,atproto-oauth-service-token,atproto-oauth-tool,atproto-jetstream-consumer,atproto-xrpcs-helloworld"
76
+
LABEL binaries="atproto-identity-resolve,atproto-identity-key,atproto-identity-sign,atproto-identity-validate,atproto-record-sign,atproto-record-verify,atproto-client-auth,atproto-client-app-password,atproto-client-dpop,atproto-oauth-service-token,atproto-oauth-tool,atproto-jetstream-consumer,atproto-xrpcs-helloworld,atproto-lexicon-resolve"
+31
-6
README.md
+31
-6
README.md
···
6
6
7
7
## Components
8
8
9
-
This workspace contains 9 specialized crates that work together to provide complete AT Protocol application development capabilities:
9
+
This workspace contains 10 specialized crates that work together to provide complete AT Protocol application development capabilities:
10
10
11
11
### Identity & Cryptography
12
12
13
13
- **[`atproto-identity`](crates/atproto-identity/)** - Core identity management with multi-method DID resolution (plc, web, key), DNS/HTTP handle resolution, and P-256/P-384/K-256 cryptographic operations. *Includes 4 CLI tools.*
14
14
- **[`atproto-record`](crates/atproto-record/)** - Cryptographic signature operations for AT Protocol records using IPLD DAG-CBOR serialization with AT-URI parsing support. *Includes 2 CLI tools.*
15
+
- **[`atproto-lexicon`](crates/atproto-lexicon/)** - Lexicon schema resolution and validation for AT Protocol, supporting recursive resolution, NSID validation, and DNS-based lexicon discovery. *Includes 1 CLI tool.*
15
16
16
17
### Authentication & Authorization
17
18
···
37
38
[dependencies]
38
39
atproto-identity = "0.12.0"
39
40
atproto-record = "0.12.0"
41
+
atproto-lexicon = "0.12.0"
40
42
atproto-oauth = "0.12.0"
41
43
atproto-oauth-aip = "0.12.0"
42
44
atproto-client = "0.12.0"
···
60
62
}
61
63
```
62
64
65
+
### Lexicon Resolution
66
+
67
+
```rust
68
+
use atproto_lexicon::resolve::{DefaultLexiconResolver, LexiconResolver};
69
+
use atproto_identity::resolve::HickoryDnsResolver;
70
+
71
+
#[tokio::main]
72
+
async fn main() -> anyhow::Result<()> {
73
+
let http_client = reqwest::Client::new();
74
+
let dns_resolver = HickoryDnsResolver::create_resolver(&[]);
75
+
let resolver = DefaultLexiconResolver::new(http_client, dns_resolver);
76
+
77
+
// Resolve a lexicon schema
78
+
let lexicon = resolver.resolve("app.bsky.feed.post").await?;
79
+
println!("Lexicon schema: {}", serde_json::to_string_pretty(&lexicon)?);
80
+
81
+
Ok(())
82
+
}
83
+
```
84
+
63
85
### Record Signing
64
86
65
87
```rust
···
70
92
#[tokio::main]
71
93
async fn main() -> anyhow::Result<()> {
72
94
let signing_key = identify_key("did:key:zQ3shNzMp4oaaQ1gQRzCxMGXFrSW3NEM1M9T6KCY9eA7HhyEA")?;
73
-
95
+
74
96
let record = json!({
75
97
"$type": "app.bsky.feed.post",
76
98
"text": "Hello AT Protocol!",
77
99
"createdAt": "2024-01-01T00:00:00.000Z"
78
100
});
79
-
101
+
80
102
let signature_object = json!({
81
103
"issuer": "did:plc:issuer123",
82
104
"issuedAt": "2024-01-01T00:00:00.000Z"
83
105
});
84
-
106
+
85
107
let signed_record = signature::create(
86
108
&signing_key,
87
109
&record,
···
89
111
"app.bsky.feed.post",
90
112
signature_object,
91
113
).await?;
92
-
114
+
93
115
Ok(())
94
116
}
95
117
```
···
178
200
179
201
## Command Line Tools
180
202
181
-
The workspace includes 12 command-line tools across multiple crates, providing ready-to-use utilities for AT Protocol development and testing. All CLI tools require the `clap` feature:
203
+
The workspace includes 13 command-line tools across multiple crates, providing ready-to-use utilities for AT Protocol development and testing. All CLI tools require the `clap` feature:
182
204
183
205
```bash
184
206
# Build with CLI support
···
193
215
# Record operations (atproto-record crate)
194
216
cargo run --features clap --bin atproto-record-sign -- did:key:... did:plc:issuer record.json repository=did:plc:user collection=app.bsky.feed.post
195
217
cargo run --features clap --bin atproto-record-verify -- did:plc:issuer did:key:... signed_record.json repository=did:plc:user collection=app.bsky.feed.post
218
+
219
+
# Lexicon operations (atproto-lexicon crate)
220
+
cargo run --features clap,hickory-dns --bin atproto-lexicon-resolve -- app.bsky.feed.post
196
221
197
222
# Client operations (atproto-client crate)
198
223
cargo run --features clap --bin atproto-client-auth -- login alice.bsky.social password123