pub struct App {Show 17 fields
pub base: AppBase<ServerImpl<Details>>,
pub transcryptor_url: Url,
pub auths_url: Url,
pub global_client_url: Url,
pub hubs: Map<BasicInfo>,
pub master_enc_key_part: PrivateKey,
pub attr_id_secret: Box<[u8]>,
pub auth_token_secret: SealingKey,
pub auth_token_validity: Duration,
pub pp_nonce_secret: SealingKey,
pub pp_nonce_validity: Duration,
pub user_object_hmac_secret: Box<[u8]>,
pub quota: Quota,
pub card_pseud_validity: Duration,
pub broadcast: Sender<InterAppMsg>,
pub cached_hub_info: RefCell<CachedResponse<CachedHubInfoEP>>,
pub hub_cache_config: HubCacheConfig,
}Fields§
§base: AppBase<ServerImpl<Details>>§transcryptor_url: Url§auths_url: Url§global_client_url: Url§hubs: Map<BasicInfo>§master_enc_key_part: PrivateKey§attr_id_secret: Box<[u8]>§auth_token_secret: SealingKey§auth_token_validity: Duration§pp_nonce_secret: SealingKey§pp_nonce_validity: Duration§user_object_hmac_secret: Box<[u8]>§quota: Quota§card_pseud_validity: Duration§broadcast: Sender<InterAppMsg>channel for sending messages between apps
cached_hub_info: RefCell<CachedResponse<CachedHubInfoEP>>§hub_cache_config: HubCacheConfigImplementations§
Source§impl App
impl App
pub(super) async fn handle_hub_ticket( app: Rc<Self>, signed_req: Json<Signed<TicketReq>>, ) -> Result<TicketResp>
Sourcepub(super) async fn handle_hub_ping(
app: Rc<Self>,
signed_req: Json<TicketSigned<PingReq>>,
) -> Result<PingResp>
pub(super) async fn handle_hub_ping( app: Rc<Self>, signed_req: Json<TicketSigned<PingReq>>, ) -> Result<PingResp>
Implements api::server::HubPingEP.
Source§impl App
impl App
Sourceasync fn discovery_info_of(
&self,
name: Name,
url: &Url,
) -> Result<DiscoveryInfoResp>
async fn discovery_info_of( &self, name: Name, url: &Url, ) -> Result<DiscoveryInfoResp>
Obtains and checks api::DiscoveryInfoResp from the given server
Source§impl App
impl App
Sourcepub(super) fn cached_handle_user_welcome(app: &Self) -> Result<WelcomeResp>
pub(super) fn cached_handle_user_welcome(app: &Self) -> Result<WelcomeResp>
Implements WelcomeEP
Sourcepub(super) async fn handle_cached_hub_info(app: Data<Rc<App>>) -> impl Responder
pub(super) async fn handle_cached_hub_info(app: Data<Rc<App>>) -> impl Responder
Implements CachedHubInfoEP
Sourcepub(super) async fn handle_user_state(
app: Rc<Self>,
auth_token: Header<AuthToken>,
) -> Result<StateResp>
pub(super) async fn handle_user_state( app: Rc<Self>, auth_token: Header<AuthToken>, ) -> Result<StateResp>
Implements StateEP
Sourcepub(super) async fn handle_user_enter(
app: Rc<Self>,
req: Json<EnterReq>,
auth_token: Option<Header<AuthToken>>,
) -> Result<EnterResp>
pub(super) async fn handle_user_enter( app: Rc<Self>, req: Json<EnterReq>, auth_token: Option<Header<AuthToken>>, ) -> Result<EnterResp>
Implements EnterEP
Sourceasync fn precheck_attrs_for_registration(
&self,
attrs: &HashMap<Id, IdedAttr>,
attr_states: &mut HashMap<Id, (AttrState, UpdateVersion)>,
retrieved_attr_states: &mut bool,
register_only_with_unique_attrs: bool,
) -> Result<Option<EnterResp>>
async fn precheck_attrs_for_registration( &self, attrs: &HashMap<Id, IdedAttr>, attr_states: &mut HashMap<Id, (AttrState, UpdateVersion)>, retrieved_attr_states: &mut bool, register_only_with_unique_attrs: bool, ) -> Result<Option<EnterResp>>
Pre-checks whether the given attributes in attrs are suitable for
registering a new user.
Potential problems:
- None of the given attributes is bannable.
- One of the attributes is banned
- One of the attributes already identifies another user.
- One if the attributes already bans another user (if
register_only_with_unique_attrsis set
Might try to retrieve attribute states for attributes not already in attr_states,
and will add those to attr_states. If it did, will set retrieved_attr_states.
Returns Ok(None) when there are no issues.
The situation can, of course, change between the time of the check and the time of registration.
Sourcepub(super) async fn handle_user_refresh(
app: Rc<Self>,
auth_token: Header<AuthToken>,
) -> Result<RefreshResp>
pub(super) async fn handle_user_refresh( app: Rc<Self>, auth_token: Header<AuthToken>, ) -> Result<RefreshResp>
Implements RefreshEP
Sourcefn issue_auth_token(
&self,
user_state: &UserState,
) -> Result<Result<AuthTokenPackage, AuthTokenDeniedReason>>
fn issue_auth_token( &self, user_state: &UserState, ) -> Result<Result<AuthTokenPackage, AuthTokenDeniedReason>>
Issues auth token for given user, if allowed
Source§impl App
impl App
Sourcepub(super) fn open_auth_token_ext(
&self,
auth_token: AuthToken,
accept_expired: bool,
) -> Result<Id, Opaque>
pub(super) fn open_auth_token_ext( &self, auth_token: AuthToken, accept_expired: bool, ) -> Result<Id, Opaque>
Like Self::open_auth_token, but with the option to accept an expired auth token.
Sourcepub(super) async fn open_auth_token_and_get_user_state(
&self,
auth_token: AuthToken,
) -> Result<Result<(UserState, UpdateVersion), Opaque>>
pub(super) async fn open_auth_token_and_get_user_state( &self, auth_token: AuthToken, ) -> Result<Result<(UserState, UpdateVersion), Opaque>>
Sourcepub(super) async fn open_auth_token_and_get_user_state_ext(
&self,
auth_token: AuthToken,
accept_expired: bool,
) -> Result<Result<(UserState, UpdateVersion), Opaque>>
pub(super) async fn open_auth_token_and_get_user_state_ext( &self, auth_token: AuthToken, accept_expired: bool, ) -> Result<Result<(UserState, UpdateVersion), Opaque>>
Like Self::open_auth_token_and_get_user_state but with the option to accept an expired auth
token.
Source§impl App
impl App
Sourcepub async fn handle_user_card_pseud(
app: Rc<Self>,
auth_token: Header<AuthToken>,
) -> Result<CardPseudResp>
pub async fn handle_user_card_pseud( app: Rc<Self>, auth_token: Header<AuthToken>, ) -> Result<CardPseudResp>
Implements api::phc::user::CardPseudEP endpoint.
Source§impl App
impl App
Sourcepub(super) async fn handle_user_new_object(
app: Rc<Self>,
payload: Bytes,
path: Path<(Handle,)>,
__arg3: Header<AuthToken>,
) -> Result<StoreObjectResp>
pub(super) async fn handle_user_new_object( app: Rc<Self>, payload: Bytes, path: Path<(Handle,)>, __arg3: Header<AuthToken>, ) -> Result<StoreObjectResp>
Implements NewObjectEP
Sourcepub(super) async fn handle_user_overwrite_object(
app: Rc<Self>,
payload: Bytes,
path: Path<(Handle, Id)>,
__arg3: Header<AuthToken>,
) -> Result<StoreObjectResp>
pub(super) async fn handle_user_overwrite_object( app: Rc<Self>, payload: Bytes, path: Path<(Handle, Id)>, __arg3: Header<AuthToken>, ) -> Result<StoreObjectResp>
Implements api::phc::user::OverwriteObjectEP
Sourceasync fn handle_user_store_object(
&self,
payload: Bytes,
handle: Handle,
overwrite_hash: Option<Id>,
auth_token: AuthToken,
) -> Result<StoreObjectResp>
async fn handle_user_store_object( &self, payload: Bytes, handle: Handle, overwrite_hash: Option<Id>, auth_token: AuthToken, ) -> Result<StoreObjectResp>
Called by Self::handle_user_new_object and Self::handle_user_overwrite_object.
§Note on the implementation
To add a user object we:
(1) First add the UserObject to the object store, if its not there already;
(2) Add a reference to that object in UserState; and
(3) Delete the old UserObject object, if there is any.
This way, if the process fails between steps (1) and (2), the client will simply retry, and if the process fails between steps (2) and (3) we are only left with an orphaned object. (Which is not a big deal.)
Sourcepub(crate) async fn handle_user_get_object(
app: Rc<Self>,
path: Path<(Id, Id)>,
) -> Payload<Result<GetObjectResp>>
pub(crate) async fn handle_user_get_object( app: Rc<Self>, path: Path<(Id, Id)>, ) -> Payload<Result<GetObjectResp>>
Implements GetObjectEP.
Methods from Deref<Target = AppBase<ServerImpl<Details>>>§
Sourcepub async fn get_object<T>(
&self,
id: &T::Identifier,
) -> Result<Option<(T, UpdateVersion)>>where
T: ObjectDetails,
pub async fn get_object<T>(
&self,
id: &T::Identifier,
) -> Result<Option<(T, UpdateVersion)>>where
T: ObjectDetails,
Tries to retrieve an object of type T from this server’s object store with the given
id, returning Ok(None) if no such object exists.
Sourcepub async fn put_object<T>(
&self,
obj: &T,
update: Option<UpdateVersion>,
) -> Result<Option<UpdateVersion>>where
T: ObjectDetails,
pub async fn put_object<T>(
&self,
obj: &T,
update: Option<UpdateVersion>,
) -> Result<Option<UpdateVersion>>where
T: ObjectDetails,
Attempts to put an object of type T into the object store, only overwriting the object that
is already present when the version of the to-be-overwritten object is passed via update.
Returs Ok(None) when there is already an object present in the store with that id and
type, but its version was not specified in update.
Sourcepub async fn delete_object<T>(&self, id: T::Identifier) -> Result<bool>where
T: ObjectDetails,
pub async fn delete_object<T>(&self, id: T::Identifier) -> Result<bool>where
T: ObjectDetails,
Attempts to delete an object with the given Id; returns true when an object was
deleted, and false when no object with the given id was found.
Sourcepub fn running_state_or_please_retry(
&self,
) -> Result<&RunningState<S::ExtraRunningState>, ErrorCode>
pub fn running_state_or_please_retry( &self, ) -> Result<&RunningState<S::ExtraRunningState>, ErrorCode>
Returns the current RunningState of this server when available.
Otherwise returns api::ErrorCode::PleaseRetry.
Sourcepub fn running_state_or_internal_error(
&self,
) -> Result<&RunningState<S::ExtraRunningState>, ErrorCode>
pub fn running_state_or_internal_error( &self, ) -> Result<&RunningState<S::ExtraRunningState>, ErrorCode>
Returns the current RunningState of this server when available.
Otherwise returns api::ErrorCode::InternalError.
Trait Implementations§
Source§impl App<ServerImpl<Details>> for App
impl App<ServerImpl<Details>> for App
Source§fn configure_actix_app(self: &Rc<Self>, sc: &mut ServiceConfig)
fn configure_actix_app(self: &Rc<Self>, sc: &mut ServiceConfig)
App to add server-specific endpoints. Non-server specific endpoints are added by
AppBase::configure_actix_app.Source§fn check_constellation(&self, _constellation: &Constellation) -> bool
fn check_constellation(&self, _constellation: &Constellation) -> bool
Source§async fn discover(
self: &Rc<Self>,
_phc_di: DiscoveryInfoResp,
) -> Result<DiscoverVerdict>
async fn discover( self: &Rc<Self>, _phc_di: DiscoveryInfoResp, ) -> Result<DiscoverVerdict>
api::DiscoveryInfoResp already
obtained from Pubhubs Central. If the server is not PHC itself, the Constellation
in this api::DiscoveryInfoResp must be set. Read moreSource§fn master_enc_key_part(&self) -> Option<&PrivateKey>
fn master_enc_key_part(&self) -> Option<&PrivateKey>
Source§async fn local_task(weak: Weak<Self>)
async fn local_task(weak: Weak<Self>)
App that is created.Source§async fn global_task(app: Rc<Self>) -> Result<Infallible>
async fn global_task(app: Rc<Self>) -> Result<Infallible>
Auto Trait Implementations§
impl !Freeze for App
impl !RefUnwindSafe for App
impl !Send for App
impl !Sync for App
impl Unpin for App
impl UnsafeUnpin for App
impl !UnwindSafe for App
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more