Skip to content

Commit e46cb89

Browse files
bitwarden/sdk-internal@b444e59 2.0.0-3463-b444e59 - [PM-29825] Add prepare_ciphers_for_bulk_share method for mobile clients (bitwarden/sdk-internal#613)
1 parent 58b9e80 commit e46cb89

File tree

6 files changed

+91
-13
lines changed

6 files changed

+91
-13
lines changed

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ let package = Package(
3030
dependencies: ["BitwardenSdk"]),
3131
.binaryTarget(
3232
name: "BitwardenFFI",
33-
url: "https://github.com/bitwarden/sdk-swift/releases/download/v2.0.0-3460-5bf6322/BitwardenFFI-2.0.0-5bf6322.xcframework.zip",
34-
checksum: "a5f4875472fd655c83d3b206bc4635de37c36d9dbbc8b9c11e288cdcb6b35233")
33+
url: "https://github.com/bitwarden/sdk-swift/releases/download/v2.0.0-3463-b444e59/BitwardenFFI-2.0.0-b444e59.xcframework.zip",
34+
checksum: "ac3d81c642a9e8258466da8e3090885ab7e9842a2e913ed878a5320b733788b9")
3535
]
3636
)

Sources/BitwardenSdk/BitwardenCore.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5325,8 +5325,8 @@ private let initializationResult: InitializationResult = {
53255325
}
53265326

53275327
uniffiCallbackInitClientManagedTokens()
5328-
uniffiEnsureBitwardenCryptoInitialized()
53295328
uniffiEnsureBitwardenEncodingInitialized()
5329+
uniffiEnsureBitwardenCryptoInitialized()
53305330
return InitializationResult.ok
53315331
}()
53325332

Sources/BitwardenSdk/BitwardenFido.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3376,8 +3376,8 @@ private let initializationResult: InitializationResult = {
33763376
return InitializationResult.contractVersionMismatch
33773377
}
33783378

3379-
uniffiEnsureBitwardenCoreInitialized()
33803379
uniffiEnsureBitwardenVaultInitialized()
3380+
uniffiEnsureBitwardenCoreInitialized()
33813381
return InitializationResult.ok
33823382
}()
33833383

Sources/BitwardenSdk/BitwardenSDK.swift

Lines changed: 85 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1578,6 +1578,11 @@ public protocol CiphersClientProtocol: AnyObject, Sendable {
15781578
*/
15791579
func moveToOrganization(cipher: CipherView, organizationId: OrganizationId) throws -> CipherView
15801580

1581+
/**
1582+
* Prepare ciphers for bulk share to an organization
1583+
*/
1584+
func prepareCiphersForBulkShare(ciphers: [CipherView], organizationId: OrganizationId, collectionIds: [CollectionId]) async throws -> [EncryptionContext]
1585+
15811586
}
15821587
open class CiphersClient: CiphersClientProtocol, @unchecked Sendable {
15831588
fileprivate let handle: UInt64
@@ -1698,6 +1703,26 @@ open func moveToOrganization(cipher: CipherView, organizationId: OrganizationId)
16981703
})
16991704
}
17001705

1706+
/**
1707+
* Prepare ciphers for bulk share to an organization
1708+
*/
1709+
open func prepareCiphersForBulkShare(ciphers: [CipherView], organizationId: OrganizationId, collectionIds: [CollectionId])async throws -> [EncryptionContext] {
1710+
return
1711+
try await uniffiRustCallAsync(
1712+
rustFutureFunc: {
1713+
uniffi_bitwarden_uniffi_fn_method_ciphersclient_prepare_ciphers_for_bulk_share(
1714+
self.uniffiCloneHandle(),
1715+
FfiConverterSequenceTypeCipherView.lower(ciphers),FfiConverterTypeOrganizationId_lower(organizationId),FfiConverterSequenceTypeCollectionId.lower(collectionIds)
1716+
)
1717+
},
1718+
pollFunc: ffi_bitwarden_uniffi_rust_future_poll_rust_buffer,
1719+
completeFunc: ffi_bitwarden_uniffi_rust_future_complete_rust_buffer,
1720+
freeFunc: ffi_bitwarden_uniffi_rust_future_free_rust_buffer,
1721+
liftFunc: FfiConverterSequenceTypeEncryptionContext.lift,
1722+
errorHandler: FfiConverterTypeBitwardenError_lift
1723+
)
1724+
}
1725+
17011726
}
17021727

17031728

@@ -7527,6 +7552,31 @@ fileprivate struct FfiConverterSequenceTypeCipherView: FfiConverterRustBuffer {
75277552
}
75287553
}
75297554

7555+
#if swift(>=5.8)
7556+
@_documentation(visibility: private)
7557+
#endif
7558+
fileprivate struct FfiConverterSequenceTypeEncryptionContext: FfiConverterRustBuffer {
7559+
typealias SwiftType = [EncryptionContext]
7560+
7561+
public static func write(_ value: [EncryptionContext], into buf: inout [UInt8]) {
7562+
let len = Int32(value.count)
7563+
writeInt(&buf, len)
7564+
for item in value {
7565+
FfiConverterTypeEncryptionContext.write(item, into: &buf)
7566+
}
7567+
}
7568+
7569+
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [EncryptionContext] {
7570+
let len: Int32 = try readInt(&buf)
7571+
var seq = [EncryptionContext]()
7572+
seq.reserveCapacity(Int(len))
7573+
for _ in 0 ..< len {
7574+
seq.append(try FfiConverterTypeEncryptionContext.read(from: &buf))
7575+
}
7576+
return seq
7577+
}
7578+
}
7579+
75307580
#if swift(>=5.8)
75317581
@_documentation(visibility: private)
75327582
#endif
@@ -7652,6 +7702,31 @@ fileprivate struct FfiConverterSequenceTypePasswordHistoryView: FfiConverterRust
76527702
}
76537703
}
76547704

7705+
#if swift(>=5.8)
7706+
@_documentation(visibility: private)
7707+
#endif
7708+
fileprivate struct FfiConverterSequenceTypeCollectionId: FfiConverterRustBuffer {
7709+
typealias SwiftType = [CollectionId]
7710+
7711+
public static func write(_ value: [CollectionId], into buf: inout [UInt8]) {
7712+
let len = Int32(value.count)
7713+
writeInt(&buf, len)
7714+
for item in value {
7715+
FfiConverterTypeCollectionId.write(item, into: &buf)
7716+
}
7717+
}
7718+
7719+
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [CollectionId] {
7720+
let len: Int32 = try readInt(&buf)
7721+
var seq = [CollectionId]()
7722+
seq.reserveCapacity(Int(len))
7723+
for _ in 0 ..< len {
7724+
seq.append(try FfiConverterTypeCollectionId.read(from: &buf))
7725+
}
7726+
return seq
7727+
}
7728+
}
7729+
76557730
#if swift(>=5.8)
76567731
@_documentation(visibility: private)
76577732
#endif
@@ -7893,6 +7968,9 @@ private let initializationResult: InitializationResult = {
78937968
if (uniffi_bitwarden_uniffi_checksum_method_ciphersclient_move_to_organization() != 57722) {
78947969
return InitializationResult.apiChecksumMismatch
78957970
}
7971+
if (uniffi_bitwarden_uniffi_checksum_method_ciphersclient_prepare_ciphers_for_bulk_share() != 63676) {
7972+
return InitializationResult.apiChecksumMismatch
7973+
}
78967974
if (uniffi_bitwarden_uniffi_checksum_method_client_auth() != 4128) {
78977975
return InitializationResult.apiChecksumMismatch
78987976
}
@@ -8168,17 +8246,17 @@ private let initializationResult: InitializationResult = {
81688246
uniffiCallbackInitFido2CredentialStore()
81698247
uniffiCallbackInitFido2UserInterface()
81708248
uniffiCallbackInitFolderRepository()
8171-
uniffiEnsureBitwardenCryptoInitialized()
8172-
uniffiEnsureBitwardenEncodingInitialized()
8173-
uniffiEnsureBitwardenStateInitialized()
81748249
uniffiEnsureBitwardenSendInitialized()
8175-
uniffiEnsureBitwardenGeneratorsInitialized()
81768250
uniffiEnsureBitwardenCollectionsInitialized()
8177-
uniffiEnsureBitwardenFidoInitialized()
8178-
uniffiEnsureBitwardenVaultInitialized()
8179-
uniffiEnsureBitwardenExportersInitialized()
81808251
uniffiEnsureBitwardenSshInitialized()
8252+
uniffiEnsureBitwardenExportersInitialized()
8253+
uniffiEnsureBitwardenCryptoInitialized()
8254+
uniffiEnsureBitwardenGeneratorsInitialized()
8255+
uniffiEnsureBitwardenEncodingInitialized()
81818256
uniffiEnsureBitwardenCoreInitialized()
8257+
uniffiEnsureBitwardenFidoInitialized()
8258+
uniffiEnsureBitwardenVaultInitialized()
8259+
uniffiEnsureBitwardenStateInitialized()
81828260
return InitializationResult.ok
81838261
}()
81848262

Sources/BitwardenSdk/BitwardenSend.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2031,8 +2031,8 @@ private let initializationResult: InitializationResult = {
20312031
return InitializationResult.contractVersionMismatch
20322032
}
20332033

2034-
uniffiEnsureBitwardenCoreInitialized()
20352034
uniffiEnsureBitwardenCryptoInitialized()
2035+
uniffiEnsureBitwardenCoreInitialized()
20362036
return InitializationResult.ok
20372037
}()
20382038

Sources/BitwardenSdk/BitwardenVault.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9142,9 +9142,9 @@ private let initializationResult: InitializationResult = {
91429142
return InitializationResult.contractVersionMismatch
91439143
}
91449144

9145+
uniffiEnsureBitwardenCollectionsInitialized()
91459146
uniffiEnsureBitwardenCoreInitialized()
91469147
uniffiEnsureBitwardenCryptoInitialized()
9147-
uniffiEnsureBitwardenCollectionsInitialized()
91489148
return InitializationResult.ok
91499149
}()
91509150

0 commit comments

Comments
 (0)