tangled
alpha
login
or
join now
vielle.dev
/
tangled-on-commit
5
fork
atom
Listen to git commits for a specific repo and run a shell command
5
fork
atom
overview
issues
pulls
pipelines
cargo fmt
vielle.dev
6 months ago
a7bb68a5
29c04a75
verified
This commit was signed with the committer's
known signature
.
vielle.dev
SSH Key Fingerprint:
SHA256:/4bvxqoEh9iMdjAPgcgAgXKZZQTROL3ULiPt6nH9RSs=
+15
-9
1 changed file
expand all
collapse all
unified
split
src
did.rs
+15
-9
src/did.rs
···
38
38
}
39
39
40
40
fn get_http_did(handle: &String) -> Result<String, ()> {
41
41
-
let res = match reqwest::blocking::get("https://".to_owned() + handle + "/.well-known/atproto-did") {
42
42
-
Ok(val) => val,
43
43
-
Err(_) => return Err(())
44
44
-
};
41
41
+
let res =
42
42
+
match reqwest::blocking::get("https://".to_owned() + handle + "/.well-known/atproto-did") {
43
43
+
Ok(val) => val,
44
44
+
Err(_) => return Err(()),
45
45
+
};
45
46
46
47
// as per spec, non 2xx code means failure
47
47
-
if !res.status().is_success() { return Err(()) }
48
48
+
if !res.status().is_success() {
49
49
+
return Err(());
50
50
+
}
48
51
49
52
let did_unparsed = match res.text() {
50
50
-
Ok(val) => val,
51
51
-
Err(_) => return Err(())
53
53
+
Ok(val) => val,
54
54
+
Err(_) => return Err(()),
52
55
};
53
56
54
57
let did = did_unparsed.trim();
55
58
56
56
-
if !did.starts_with("did:") { return Err(()) };
57
57
-
return Ok(String::from(did))
59
59
+
if !did.starts_with("did:") {
60
60
+
return Err(());
61
61
+
};
62
62
+
return Ok(String::from(did));
63
63
+
}
58
64
}
59
65
60
66
pub fn get_did(handle: String) -> Result<DidDoc, ()> {