@@ -382,27 +382,6 @@ fileprivate class UniffiHandleMap<T> {
382
382
// Public interface members begin here.
383
383
384
384
385
- fileprivate struct FfiConverterBool : FfiConverter {
386
- typealias FfiType = Int8
387
- typealias SwiftType = Bool
388
-
389
- public static func lift( _ value: Int8 ) throws -> Bool {
390
- return value != 0
391
- }
392
-
393
- public static func lower( _ value: Bool ) -> Int8 {
394
- return value ? 1 : 0
395
- }
396
-
397
- public static func read( from buf: inout ( data: Data , offset: Data . Index ) ) throws -> Bool {
398
- return try lift ( readInt ( & buf) )
399
- }
400
-
401
- public static func write( _ value: Bool , into buf: inout [ UInt8 ] ) {
402
- writeInt ( & buf, lower ( value) )
403
- }
404
- }
405
-
406
385
fileprivate struct FfiConverterString : FfiConverter {
407
386
typealias SwiftType = String
408
387
typealias FfiType = RustBuffer
@@ -513,39 +492,42 @@ public func FfiConverterTypeDecryptionSettings_lower(_ value: DecryptionSettings
513
492
public enum CollectStrategy {
514
493
515
494
/**
516
- * Device based sharing strategy .
495
+ * Share with all (unblacklisted) devices .
517
496
*/
518
- case deviceBasedStrategy(
519
- /**
520
- * If `true`, devices that are not trusted will be excluded from the
521
- * conversation. A device is trusted if any of the following is true:
522
- * - It was manually marked as trusted.
523
- * - It was marked as verified via interactive verification.
524
- * - It is signed by its owner identity, and this identity has been
525
- * trusted via interactive verification.
526
- * - It is the current own device of the user.
527
- */onlyAllowTrustedDevices: Bool ,
528
- /**
529
- * If `true`, and a verified user has an unsigned device, key sharing
530
- * will fail with a
531
- * [`SessionRecipientCollectionError::VerifiedUserHasUnsignedDevice`].
532
- *
533
- * If `true`, and a verified user has replaced their identity, key
534
- * sharing will fail with a
535
- * [`SessionRecipientCollectionError::VerifiedUserChangedIdentity`].
536
- *
537
- * Otherwise, keys are shared with unsigned devices as normal.
538
- *
539
- * Once the problematic devices are blacklisted or whitelisted the
540
- * caller can retry to share a second time.
541
- */errorOnVerifiedUserProblem: Bool
542
- )
497
+ case allDevices
498
+ /**
499
+ * Share with all devices, except errors for *verified* users cause sharing
500
+ * to fail with an error.
501
+ *
502
+ * In this strategy, if a verified user has an unsigned device,
503
+ * key sharing will fail with a
504
+ * [`SessionRecipientCollectionError::VerifiedUserHasUnsignedDevice`].
505
+ * If a verified user has replaced their identity, key
506
+ * sharing will fail with a
507
+ * [`SessionRecipientCollectionError::VerifiedUserChangedIdentity`].
508
+ *
509
+ * Otherwise, keys are shared with unsigned devices as normal.
510
+ *
511
+ * Once the problematic devices are blacklisted or whitelisted the
512
+ * caller can retry to share a second time.
513
+ */
514
+ case errorOnVerifiedUserProblem
543
515
/**
544
516
* Share based on identity. Only distribute to devices signed by their
545
517
* owner. If a user has no published identity he will not receive
546
518
* any room keys.
547
519
*/
548
520
case identityBasedStrategy
521
+ /**
522
+ * Only share keys with devices that we "trust". A device is trusted if any
523
+ * of the following is true:
524
+ * - It was manually marked as trusted.
525
+ * - It was marked as verified via interactive verification.
526
+ * - It is signed by its owner identity, and this identity has been
527
+ * trusted via interactive verification.
528
+ * - It is the current own device of the user.
529
+ */
530
+ case onlyTrustedDevices
549
531
}
550
532
551
533
@@ -556,10 +538,13 @@ public struct FfiConverterTypeCollectStrategy: FfiConverterRustBuffer {
556
538
let variant : Int32 = try readInt ( & buf)
557
539
switch variant {
558
540
559
- case 1 : return . deviceBasedStrategy( onlyAllowTrustedDevices: try FfiConverterBool . read ( from: & buf) , errorOnVerifiedUserProblem: try FfiConverterBool . read ( from: & buf)
560
- )
541
+ case 1 : return . allDevices
561
542
562
- case 2 : return . identityBasedStrategy
543
+ case 2 : return . errorOnVerifiedUserProblem
544
+
545
+ case 3 : return . identityBasedStrategy
546
+
547
+ case 4 : return . onlyTrustedDevices
563
548
564
549
default : throw UniffiInternalError . unexpectedEnumCase
565
550
}
@@ -569,15 +554,21 @@ public struct FfiConverterTypeCollectStrategy: FfiConverterRustBuffer {
569
554
switch value {
570
555
571
556
572
- case let . deviceBasedStrategy ( onlyAllowTrustedDevices , errorOnVerifiedUserProblem ) :
557
+ case . allDevices :
573
558
writeInt ( & buf, Int32 ( 1 ) )
574
- FfiConverterBool . write ( onlyAllowTrustedDevices, into: & buf)
575
- FfiConverterBool . write ( errorOnVerifiedUserProblem, into: & buf)
576
-
577
559
578
- case . identityBasedStrategy:
560
+
561
+ case . errorOnVerifiedUserProblem:
579
562
writeInt ( & buf, Int32 ( 2 ) )
580
563
564
+
565
+ case . identityBasedStrategy:
566
+ writeInt ( & buf, Int32 ( 3 ) )
567
+
568
+
569
+ case . onlyTrustedDevices:
570
+ writeInt ( & buf, Int32 ( 4 ) )
571
+
581
572
}
582
573
}
583
574
}
0 commit comments