JavaScript is disabled, refresh for a better experience. ambee/giterated

ambee/giterated

Git repository hosting, collaboration, and discovery for the Fediverse.

Fix types

Amber - ⁨2⁩ years ago

parent: tbd commit: ⁨7eb1974

Showing ⁨⁨3⁩ changed files⁩ with ⁨⁨6⁩ insertions⁩ and ⁨⁨33⁩ deletions⁩

giterated-models/src/authenticated.rs

View file
@@ -25,7 +25,7 @@ impl AsRef<str> for UserAuthenticationToken {
25 25 }
26 26
27 27 #[derive(Clone, Debug, Hash, PartialEq, Eq, Serialize, Deserialize)]
28 pub struct InstanceSignature(Vec<u8>);
28 pub struct InstanceSignature(pub Vec<u8>);
29 29
30 30 impl AsRef<[u8]> for InstanceSignature {
31 31 fn as_ref(&self) -> &[u8] {

giterated-protocol/src/lib.rs

View file
@@ -5,7 +5,10 @@ use std::fmt::Debug;
5 5 use std::str::FromStr;
6 6 use std::{fmt::Display, sync::Arc};
7 7
8 use giterated_stack::models::{Error, GiteratedObject, GiteratedOperation, Instance, User};
8 use giterated_stack::models::{
9 Error, GiteratedObject, GiteratedOperation, Instance, InstanceSignature, User,
10 UserAuthenticationToken,
11 };
9 12 use rsa::pkcs1::DecodeRsaPrivateKey;
10 13 use rsa::pkcs1v15::SigningKey;
11 14 use rsa::sha2::Sha256;
@@ -114,37 +117,6 @@ impl AuthenticationSourceProvider for InstanceAuthenticator {
114 117 }
115 118 }
116 119
117 #[repr(transparent)]
118 #[derive(Clone, Debug, Hash, PartialEq, Eq, Serialize, Deserialize)]
119 pub struct UserAuthenticationToken(String);
120
121 impl From<String> for UserAuthenticationToken {
122 fn from(value: String) -> Self {
123 Self(value)
124 }
125 }
126
127 impl ToString for UserAuthenticationToken {
128 fn to_string(&self) -> String {
129 self.0.clone()
130 }
131 }
132
133 impl AsRef<str> for UserAuthenticationToken {
134 fn as_ref(&self) -> &str {
135 &self.0
136 }
137 }
138
139 #[derive(Clone, Debug, Hash, PartialEq, Eq, Serialize, Deserialize)]
140 pub struct InstanceSignature(Vec<u8>);
141
142 impl AsRef<[u8]> for InstanceSignature {
143 fn as_ref(&self) -> &[u8] {
144 &self.0
145 }
146 }
147
148 120 #[derive(Clone, Debug, Hash, PartialEq, Eq, Serialize, Deserialize)]
149 121 pub enum AuthenticationSource {
150 122 User {

giterated-stack/src/lib.rs

View file
@@ -16,6 +16,7 @@ pub mod update;
16 16 // Temp pub use to figure out what's important
17 17 pub mod models {
18 18 pub use anyhow::Error;
19 pub use giterated_models::authenticated::*;
19 20 pub use giterated_models::error::{IntoInternalError, OperationError};
20 21 pub use giterated_models::instance::Instance;
21 22 pub use giterated_models::object::GiteratedObject;