bitwarden_uniffi/auth/
registration.rs1use bitwarden_auth::{
2 AuthClientExt,
3 registration::{
4 JitMasterPasswordRegistrationRequest, JitMasterPasswordRegistrationResponse,
5 KeyConnectorRegistrationResult, TdeRegistrationRequest, TdeRegistrationResponse,
6 UserMasterPasswordRegistrationRequest, UserMasterPasswordRegistrationResponse,
7 },
8};
9
10use crate::error::BitwardenError;
11
12#[derive(uniffi::Object)]
13pub struct RegistrationClient(pub(crate) bitwarden_core::Client);
14
15#[uniffi::export(async_runtime = "tokio")]
16impl RegistrationClient {
17 pub async fn post_keys_for_tde_registration(
20 &self,
21 request: TdeRegistrationRequest,
22 ) -> Result<TdeRegistrationResponse, BitwardenError> {
23 Ok(self
24 .0
25 .auth_new()
26 .registration()
27 .post_keys_for_tde_registration(request)
28 .await?)
29 }
30
31 #[uniffi::method(default(accept_organization_invite = None))]
36 pub async fn post_keys_for_key_connector_registration(
37 &self,
38 key_connector_url: String,
39 sso_org_identifier: String,
40 accept_organization_invite: Option<bool>,
41 ) -> Result<KeyConnectorRegistrationResult, BitwardenError> {
42 Ok(self
43 .0
44 .auth_new()
45 .registration()
46 .post_keys_for_key_connector_registration(
47 key_connector_url,
48 sso_org_identifier,
49 accept_organization_invite,
50 )
51 .await?)
52 }
53
54 pub async fn post_keys_for_jit_password_registration(
57 &self,
58 request: JitMasterPasswordRegistrationRequest,
59 ) -> Result<JitMasterPasswordRegistrationResponse, BitwardenError> {
60 Ok(self
61 .0
62 .auth_new()
63 .registration()
64 .post_keys_for_jit_password_registration(request)
65 .await?)
66 }
67
68 pub async fn post_keys_for_user_password_registration(
71 &self,
72 request: UserMasterPasswordRegistrationRequest,
73 ) -> Result<UserMasterPasswordRegistrationResponse, BitwardenError> {
74 Ok(self
75 .0
76 .auth_new()
77 .registration()
78 .post_keys_for_user_password_registration(request)
79 .await?)
80 }
81}