Skip to content

Commit ffa5f32

Browse files
authored
chore: release atrium-oauth (#299)
* Rename and move, add README * Update docs * Fix errors * Ready to release
1 parent 0263982 commit ffa5f32

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+197
-21
lines changed

.github/workflows/oauth-client.yml renamed to .github/workflows/oauth.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: OAuth Client
1+
name: OAuth
22

33
on:
44
push:
@@ -16,8 +16,8 @@ jobs:
1616
- uses: actions/checkout@v4
1717
- name: Build
1818
run: |
19-
cargo build -p atrium-oauth-client --verbose
19+
cargo build -p atrium-oauth --verbose
2020
- name: Run tests
2121
run: |
22-
cargo test -p atrium-oauth-client --lib
23-
cargo test -p atrium-oauth-client --lib --no-default-features
22+
cargo test -p atrium-oauth --lib
23+
cargo test -p atrium-oauth --lib --no-default-features

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ members = [
77
"atrium-xrpc",
88
"atrium-xrpc-client",
99
"atrium-identity",
10-
"atrium-oauth/oauth-client",
10+
"atrium-oauth",
1111
"bsky-cli",
1212
"bsky-sdk",
1313
"examples/concurrent",

atrium-oauth/oauth-client/Cargo.toml renamed to atrium-oauth/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "atrium-oauth-client"
2+
name = "atrium-oauth"
33
version = "0.1.0"
44
authors = ["sugyan <[email protected]>"]
55
edition.workspace = true

atrium-oauth/README.md

Lines changed: 159 additions & 0 deletions

atrium-oauth/oauth-client/examples/main.rs renamed to atrium-oauth/examples/main.rs

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
use atrium_api::agent::Agent;
2-
use atrium_identity::did::{CommonDidResolver, CommonDidResolverConfig, DEFAULT_PLC_DIRECTORY_URL};
3-
use atrium_identity::handle::{AtprotoHandleResolver, AtprotoHandleResolverConfig, DnsTxtResolver};
4-
use atrium_oauth_client::store::session::MemorySessionStore;
5-
use atrium_oauth_client::store::state::MemoryStateStore;
6-
use atrium_oauth_client::{
2+
use atrium_identity::{
3+
did::{CommonDidResolver, CommonDidResolverConfig, DEFAULT_PLC_DIRECTORY_URL},
4+
handle::{AtprotoHandleResolver, AtprotoHandleResolverConfig, DnsTxtResolver},
5+
};
6+
use atrium_oauth::{
7+
store::session::MemorySessionStore, store::state::MemoryStateStore,
78
AtprotoLocalhostClientMetadata, AuthorizeOptions, DefaultHttpClient, KnownScope, OAuthClient,
89
OAuthClientConfig, OAuthResolverConfig, Scope,
910
};
1011
use atrium_xrpc::http::Uri;
1112
use hickory_resolver::TokioAsyncResolver;
12-
use std::io::{stdin, stdout, BufRead, Write};
13-
use std::sync::Arc;
13+
use std::{
14+
error::Error,
15+
io::{stdin, stdout, BufRead, Write},
16+
sync::Arc,
17+
};
1418

1519
struct HickoryDnsTxtResolver {
1620
resolver: TokioAsyncResolver,
@@ -29,13 +33,13 @@ impl DnsTxtResolver for HickoryDnsTxtResolver {
2933
async fn resolve(
3034
&self,
3135
query: &str,
32-
) -> core::result::Result<Vec<String>, Box<dyn std::error::Error + Send + Sync + 'static>> {
36+
) -> core::result::Result<Vec<String>, Box<dyn Error + Send + Sync + 'static>> {
3337
Ok(self.resolver.txt_lookup(query).await?.iter().map(|txt| txt.to_string()).collect())
3438
}
3539
}
3640

3741
#[tokio::main]
38-
async fn main() -> Result<(), Box<dyn std::error::Error>> {
42+
async fn main() -> Result<(), Box<dyn Error>> {
3943
let http_client = Arc::new(DefaultHttpClient::default());
4044
let config = OAuthClientConfig {
4145
client_metadata: AtprotoLocalhostClientMetadata {
@@ -49,11 +53,11 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
4953
resolver: OAuthResolverConfig {
5054
did_resolver: CommonDidResolver::new(CommonDidResolverConfig {
5155
plc_directory_url: DEFAULT_PLC_DIRECTORY_URL.to_string(),
52-
http_client: http_client.clone(),
56+
http_client: Arc::clone(&http_client),
5357
}),
5458
handle_resolver: AtprotoHandleResolver::new(AtprotoHandleResolverConfig {
5559
dns_txt_resolver: HickoryDnsTxtResolver::default(),
56-
http_client: http_client.clone(),
60+
http_client: Arc::clone(&http_client),
5761
}),
5862
authorization_server_metadata: Default::default(),
5963
protected_resource_metadata: Default::default(),

atrium-oauth/oauth-client/src/store.rs

Lines changed: 0 additions & 3 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)