@@ -13,12 +13,9 @@ use tracing_subscriber::{fmt, prelude::*};
13
13
pub use xmtp_api_grpc:: grpc_api_helper:: Client as TonicApiClient ;
14
14
use xmtp_cryptography:: signature:: ed25519_public_key_to_address;
15
15
use xmtp_id:: associations:: builder:: SignatureRequest ;
16
- use xmtp_id:: associations:: MemberIdentifier ;
17
- use xmtp_mls:: api:: ApiClientWrapper ;
18
16
use xmtp_mls:: builder:: ClientBuilder ;
19
17
use xmtp_mls:: groups:: scoped_client:: LocalScopedGroupClient ;
20
18
use xmtp_mls:: identity:: IdentityStrategy ;
21
- use xmtp_mls:: retry:: Retry ;
22
19
use xmtp_mls:: storage:: { EncryptedMessageStore , EncryptionKey , StorageOption } ;
23
20
use xmtp_mls:: Client as MlsClient ;
24
21
use xmtp_proto:: xmtp:: mls:: message_contents:: DeviceSyncKind ;
@@ -303,90 +300,4 @@ impl Client {
303
300
. map_err ( ErrorWrapper :: from) ?;
304
301
Ok ( state. into_iter ( ) . map ( Into :: into) . collect ( ) )
305
302
}
306
-
307
- #[ napi]
308
- pub async fn is_address_authorized ( & self , inbox_id : String , address : String ) -> Result < bool > {
309
- self
310
- . is_member_of_association_state ( & inbox_id, & MemberIdentifier :: Address ( address) )
311
- . await
312
- }
313
-
314
- #[ napi]
315
- pub async fn is_installation_authorized (
316
- & self ,
317
- inbox_id : String ,
318
- installation_id : Uint8Array ,
319
- ) -> Result < bool > {
320
- self
321
- . is_member_of_association_state (
322
- & inbox_id,
323
- & MemberIdentifier :: Installation ( installation_id. to_vec ( ) ) ,
324
- )
325
- . await
326
- }
327
-
328
- async fn is_member_of_association_state (
329
- & self ,
330
- inbox_id : & str ,
331
- identifier : & MemberIdentifier ,
332
- ) -> Result < bool > {
333
- let client = & self . inner_client ;
334
- let conn = self
335
- . inner_client
336
- . store ( )
337
- . conn ( )
338
- . map_err ( ErrorWrapper :: from) ?;
339
-
340
- let association_state = client
341
- . get_association_state ( & conn, inbox_id, None )
342
- . await
343
- . map_err ( ErrorWrapper :: from) ?;
344
-
345
- Ok ( association_state. get ( identifier) . is_some ( ) )
346
- }
347
- }
348
-
349
- #[ napi]
350
- pub async fn is_installation_authorized (
351
- host : String ,
352
- inbox_id : String ,
353
- installation_id : Uint8Array ,
354
- ) -> Result < bool > {
355
- is_member_of_association_state (
356
- & host,
357
- & inbox_id,
358
- & MemberIdentifier :: Installation ( installation_id. to_vec ( ) ) ,
359
- )
360
- . await
361
- }
362
-
363
- #[ napi]
364
- pub async fn is_address_authorized (
365
- host : String ,
366
- inbox_id : String ,
367
- address : String ,
368
- ) -> Result < bool > {
369
- is_member_of_association_state ( & host, & inbox_id, & MemberIdentifier :: Address ( address) ) . await
370
- }
371
-
372
- async fn is_member_of_association_state (
373
- host : & str ,
374
- inbox_id : & str ,
375
- identifier : & MemberIdentifier ,
376
- ) -> Result < bool > {
377
- let api_client = TonicApiClient :: create ( host, true )
378
- . await
379
- . map_err ( ErrorWrapper :: from) ?;
380
- let api_client = ApiClientWrapper :: new ( Arc :: new ( api_client) , Retry :: default ( ) ) ;
381
-
382
- let is_member = xmtp_mls:: identity_updates:: is_member_of_association_state (
383
- & api_client,
384
- inbox_id,
385
- identifier,
386
- None ,
387
- )
388
- . await
389
- . map_err ( ErrorWrapper :: from) ?;
390
-
391
- Ok ( is_member)
392
303
}
0 commit comments