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 pub async fn post_keys_for_key_connector_registration(
34 &self,
35 key_connector_url: String,
36 sso_org_identifier: String,
37 ) -> Result<KeyConnectorRegistrationResult, BitwardenError> {
38 Ok(self
39 .0
40 .auth_new()
41 .registration()
42 .post_keys_for_key_connector_registration(key_connector_url, sso_org_identifier)
43 .await?)
44 }
45
46 pub async fn post_keys_for_jit_password_registration(
49 &self,
50 request: JitMasterPasswordRegistrationRequest,
51 ) -> Result<JitMasterPasswordRegistrationResponse, BitwardenError> {
52 Ok(self
53 .0
54 .auth_new()
55 .registration()
56 .post_keys_for_jit_password_registration(request)
57 .await?)
58 }
59
60 pub async fn post_keys_for_user_password_registration(
63 &self,
64 request: UserMasterPasswordRegistrationRequest,
65 ) -> Result<UserMasterPasswordRegistrationResponse, BitwardenError> {
66 Ok(self
67 .0
68 .auth_new()
69 .registration()
70 .post_keys_for_user_password_registration(request)
71 .await?)
72 }
73}