Git repository hosting, collaboration, and discovery for the Fediverse.
Many things
parent: tbd commit: d782588
1 | use ; |
2 | |
3 | use ; |
4 | use ; |
5 | use |
6 | , | CreateRepositoryRequest
7 | |
8 | , | Instance
9 | , |
10 | , | User
11 | , |
12 | ; |
13 | use ; |
14 | use ; |
15 | // use jwt::SignWithKey; |
16 | |
17 | |
18 | extern crate tracing; |
19 | |
20 | |
21 | async |
22 | ; | init
23 | // info!( |
24 | // "Response from Daemon: {:?}", |
25 | // GiteratedApi::repository_info(Repository { |
26 | // name: String::from("foo"), |
27 | // instance: Instance { |
28 | // url: String::from("127.0.0.1:8080") |
29 | // } |
30 | // }) |
31 | // .await |
32 | // ); |
33 | |
34 | // let encoding_key = |
35 | // EncodingKey::from_rsa_pem(include_bytes!("example_keys/giterated.key")).unwrap(); |
36 | |
37 | // let claims = UserTokenMetadata { |
38 | // user: User { |
39 | // username: String::from("ambee"), |
40 | // instance: Instance { |
41 | // url: String::from("giterated.dev"), |
42 | // }, |
43 | // }, |
44 | // generated_for: Instance { |
45 | // url: String::from("giterated.dev"), |
46 | // }, |
47 | // exp: SystemTime::UNIX_EPOCH.elapsed().unwrap().as_secs(), |
48 | // }; |
49 | |
50 | // let token = encode( |
51 | // &jsonwebtoken::Header::new(Algorithm::RS256), |
52 | // &claims, |
53 | // &encoding_key, |
54 | // ) |
55 | // .unwrap(); |
56 | |
57 | let mut api = from_local |
58 | .unwrap |
59 | .private_key |
60 | .public_key |
61 | .build |
62 | .await |
63 | .unwrap; |
64 | |
65 | info!; |
66 | |
67 | let response = api |
68 | .register |
69 | String from, |
70 | None, |
71 | String from, |
72 | |
73 | .await; |
74 | |
75 | info!; |
76 | |
77 | let token = api |
78 | .authentication_token |
79 | String from, |
80 | String from, |
81 | String from, |
82 | |
83 | .await |
84 | .unwrap; |
85 | |
86 | println!; |
87 | |
88 | let public_key = api.public_key .await; |
89 | |
90 | println!; |
91 | let verification_key = from_rsa_pem .unwrap; |
92 | let data: = decode |
93 | &token, |
94 | &verification_key, |
95 | & new, |
96 | |
97 | .unwrap; |
98 | |
99 | println!; |
100 | |
101 | info!; |
102 | |
103 | let new_token = api |
104 | .extend_token |
105 | .await |
106 | .unwrap; |
107 | info!; |
108 | |
109 | info!; |
110 | |
111 | let repository = api |
112 | .create_repository |
113 | new_token.unwrap, |
114 | String from, |
115 | None, |
116 | , | Public
117 | String from, |
118 | unwrap, | from_str .
119 | |
120 | .await |
121 | .unwrap; |
122 | |
123 | assert!; |
124 | |
125 | info!; |
126 | |
127 | let view = api |
128 | .repository_info |
129 | &token, |
130 | unwrap, | from_str .
131 | |
132 | .await |
133 | .unwrap; |
134 | |
135 | info!; |
136 | |
137 | |
138 | |
139 | |
140 | user: User, |
141 | generated_for: Instance, |
142 | exp: u64, |
143 | |
144 |