Skip to content

Commit d13d2cc

Browse files
committed
cargo fmt
1 parent 2a8aaba commit d13d2cc

File tree

5 files changed

+36
-24
lines changed

5 files changed

+36
-24
lines changed

rsky-pds/src/apis/com/atproto/server/create_account.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,23 @@ use crate::apis::com::atproto::server::{
55
};
66
use crate::apis::ApiError;
77
use crate::auth_verifier::UserDidAuthOptional;
8+
use crate::common::env::env_str;
89
use crate::config::ServerConfig;
910
use crate::db::DbConn;
1011
use crate::handle::{normalize_and_validate_handle, HandleValidationContext, HandleValidationOpts};
1112
use crate::plc::operations::{create_op, CreateAtprotoOpInput};
1213
use crate::plc::types::{CompatibleOpOrTombstone, OpOrTombstone, Operation};
1314
use crate::repo::aws::s3::S3BlobStore;
1415
use crate::repo::ActorStore;
15-
use crate::{plc, SharedIdResolver};
1616
use crate::SharedSequencer;
17+
use crate::{plc, SharedIdResolver};
1718
use aws_config::SdkConfig;
1819
use email_address::*;
1920
use rocket::serde::json::Json;
2021
use rocket::State;
2122
use rsky_lexicon::com::atproto::server::{CreateAccountInput, CreateAccountOutput};
2223
use secp256k1::{Keypair, Secp256k1, SecretKey};
2324
use std::env;
24-
use crate::common::env::env_str;
2525

2626
#[derive(Debug, Deserialize, Serialize, Clone)]
2727
pub struct TransformedCreateAccountInput {
@@ -68,7 +68,8 @@ pub async fn server_create_account(
6868
} = validate_inputs_for_local_pds(cfg, id_resolver, body.into_inner(), requester).await?;
6969

7070
// Create new actor repo TODO: Proper rollback
71-
let mut actor_store = ActorStore::new(did.clone(), S3BlobStore::new(did.clone(), s3_config), db);
71+
let mut actor_store =
72+
ActorStore::new(did.clone(), S3BlobStore::new(did.clone(), s3_config), db);
7273
let commit = match actor_store.create_repo(signing_key, Vec::new()).await {
7374
Ok(commit) => commit,
7475
Err(error) => {
@@ -84,7 +85,10 @@ pub async fn server_create_account(
8485
Some(op) => {
8586
let plc_url = env_str("PDS_DID_PLC_URL").unwrap_or("https://plc.directory".to_owned());
8687
let plc_client = plc::Client::new(plc_url);
87-
match plc_client.send_operation(&did, &OpOrTombstone::Operation(op)).await {
88+
match plc_client
89+
.send_operation(&did, &OpOrTombstone::Operation(op))
90+
.await
91+
{
8892
Ok(_) => {
8993
tracing::info!("Succesfully sent PLC Operation")
9094
}
@@ -119,7 +123,7 @@ pub async fn server_create_account(
119123
invite_code,
120124
deactivated: Some(deactivated),
121125
})
122-
.await
126+
.await
123127
{
124128
Ok(res) => {
125129
(access_jwt, refresh_jwt) = res;
@@ -272,7 +276,7 @@ pub async fn validate_inputs_for_local_pds(
272276
// Check password exists
273277
match input.password {
274278
None => return Err(ApiError::InvalidPassword),
275-
Some(ref pass) => password = pass.clone()
279+
Some(ref pass) => password = pass.clone(),
276280
};
277281

278282
// Get Signing Key

rsky-pds/src/apis/mod.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ impl<'r, 'o: 'r> ::rocket::response::Responder<'r, 'o> for ApiError {
351351
)));
352352
res.set_status(Status { code: 400u16 });
353353
Ok(res)
354-
},
354+
}
355355
ApiError::WellKnownNotFound => {
356356
let body = Json(ErrorBody {
357357
error: "WellKnownNotFound".to_string(),
@@ -366,7 +366,7 @@ impl<'r, 'o: 'r> ::rocket::response::Responder<'r, 'o> for ApiError {
366366
)));
367367
res.set_status(Status { code: 404u16 });
368368
Ok(res)
369-
},
369+
}
370370
ApiError::BadRequest(error, message) => {
371371
let body = Json(ErrorBody { error, message });
372372
let mut res =
@@ -378,9 +378,12 @@ impl<'r, 'o: 'r> ::rocket::response::Responder<'r, 'o> for ApiError {
378378
)));
379379
res.set_status(Status { code: 400u16 });
380380
Ok(res)
381-
},
381+
}
382382
ApiError::AuthRequiredError(message) => {
383-
let body = Json(ErrorBody { error: "AuthRequiredError".to_string(), message });
383+
let body = Json(ErrorBody {
384+
error: "AuthRequiredError".to_string(),
385+
message,
386+
});
384387
let mut res =
385388
<Json<ErrorBody> as ::rocket::response::Responder>::respond_to(body, __req)?;
386389
res.set_header(ContentType(::rocket::http::MediaType::const_new(
@@ -390,7 +393,7 @@ impl<'r, 'o: 'r> ::rocket::response::Responder<'r, 'o> for ApiError {
390393
)));
391394
res.set_status(Status { code: 401u16 });
392395
Ok(res)
393-
},
396+
}
394397
ApiError::RecordNotFound => {
395398
let body = Json(ErrorBody {
396399
error: "RecordNotFound".to_string(),

rsky-pds/src/common/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,8 @@ pub fn get_notif_endpoint(doc: DidDocument) -> Option<String> {
154154
pub fn get_service_endpoint(doc: DidDocument, opts: GetServiceEndpointOpts) -> Option<String> {
155155
tracing::info!(
156156
"@LOG: common::get_service_endpoint() doc: {:?}; opts: {:?}",
157-
doc, opts
157+
doc,
158+
opts
158159
);
159160
let did = get_did(&doc);
160161
match doc.service {

rsky-pds/src/plc/operations.rs

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ use crate::common::ipld::cid_for_cbor;
22
use crate::common::sign::atproto_sign;
33
use crate::plc::types::{CompatibleOp, CompatibleOpOrTombstone, Operation, Service, Tombstone};
44
use anyhow::Result;
5+
use data_encoding::BASE32;
56
use indexmap::IndexMap;
67
use libipld::Cid;
78
use secp256k1::SecretKey;
89
use serde_json::{Value as JsonValue, Value};
9-
use std::collections::BTreeMap;
10-
use data_encoding::BASE32;
1110
use sha2::{Digest, Sha256};
11+
use std::collections::BTreeMap;
1212

1313
#[derive(Debug, Clone)]
1414
pub struct CreateAtprotoUpdateOpOpts {
@@ -26,7 +26,10 @@ pub struct CreateAtprotoOpInput {
2626
pub rotation_keys: Vec<String>,
2727
}
2828

29-
pub async fn create_op(opts: CreateAtprotoOpInput, secret_key: SecretKey) -> Result<(String, Operation)> {
29+
pub async fn create_op(
30+
opts: CreateAtprotoOpInput,
31+
secret_key: SecretKey,
32+
) -> Result<(String, Operation)> {
3033
//Build Operation
3134
let mut create_op = Operation {
3235
r#type: "plc_operation".to_string(),
@@ -72,7 +75,7 @@ pub async fn update_atproto_key_op(
7275
rotation_keys: None,
7376
},
7477
)
75-
.await
78+
.await
7679
}
7780

7881
pub async fn update_handle_op(
@@ -90,7 +93,7 @@ pub async fn update_handle_op(
9093
rotation_keys: None,
9194
},
9295
)
93-
.await
96+
.await
9497
}
9598

9699
pub async fn update_pds_op(
@@ -108,7 +111,7 @@ pub async fn update_pds_op(
108111
rotation_keys: None,
109112
},
110113
)
111-
.await
114+
.await
112115
}
113116

114117
pub async fn update_rotation_keys_op(
@@ -126,7 +129,7 @@ pub async fn update_rotation_keys_op(
126129
rotation_keys: Some(rotation_keys),
127130
},
128131
)
129-
.await
132+
.await
130133
}
131134

132135
pub async fn create_atproto_update_op(
@@ -158,7 +161,7 @@ pub async fn create_atproto_update_op(
158161
[formatted].as_slice(),
159162
&normalized.also_known_as[handle_i + 1..],
160163
]
161-
.concat()
164+
.concat()
162165
}
163166
}
164167
}
@@ -177,7 +180,7 @@ pub async fn create_atproto_update_op(
177180
}
178181
updated
179182
})
180-
.await
183+
.await
181184
}
182185

183186
pub async fn create_update_op<G>(
@@ -213,7 +216,7 @@ pub async fn tombstone_op(prev: Cid, key: &SecretKey) -> Result<Tombstone> {
213216
}),
214217
key,
215218
)
216-
.await?
219+
.await?
217220
{
218221
CompatibleOpOrTombstone::Tombstone(op) => Ok(op),
219222
_ => panic!("Enum type changed"),
@@ -280,4 +283,4 @@ fn sign(mut op: Operation, private_key: &SecretKey) -> Operation {
280283
// Base 64 encode signature bytes
281284
op.sig = Some(base64_url::encode(&op_sig).replace("=", ""));
282285
op
283-
}
286+
}

rsky-pds/src/repo/preference/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ impl PreferenceReader {
7070
if not_in_scope.len() > 0 {
7171
tracing::info!(
7272
"@LOG: PreferenceReader::put_preferences() debug scope: {:?}, values: {:?}",
73-
scope, values
73+
scope,
74+
values
7475
);
7576
bail!("Do not have authorization to set preferences.");
7677
}

0 commit comments

Comments
 (0)