Skip to content

Commit 8266e16

Browse files
bitwarden/sdk-internal@fc75b90 1.0.0-2742-fc75b90 - [PM-24051] Init crypto and update kdf with MasterPasswordUnlock (bitwarden/sdk-internal#399)
1 parent 7333496 commit 8266e16

File tree

5 files changed

+44
-24
lines changed

5 files changed

+44
-24
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/v1.0.0-2733-8d5a4e7/BitwardenFFI-1.0.0-8d5a4e7.xcframework.zip",
34-
checksum: "1a3469852e62a0caef09926662d232b48bb8ed1eef77333d02eacb2d80da1273")
33+
url: "https://github.com/bitwarden/sdk-swift/releases/download/v1.0.0-2742-fc75b90/BitwardenFFI-1.0.0-fc75b90.xcframework.zip",
34+
checksum: "a781e7f84667247a95b4d65a629da91412b518ca15f743735f4c8c15e3a3b6f8")
3535
]
3636
)

Sources/BitwardenSdk/BitwardenCollections.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -998,8 +998,8 @@ private let initializationResult: InitializationResult = {
998998
return InitializationResult.contractVersionMismatch
999999
}
10001000

1001-
uniffiEnsureBitwardenCryptoInitialized()
10021001
uniffiEnsureBitwardenCoreInitialized()
1002+
uniffiEnsureBitwardenCryptoInitialized()
10031003
return InitializationResult.ok
10041004
}()
10051005

Sources/BitwardenSdk/BitwardenCore.swift

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4016,6 +4016,17 @@ public enum InitUserCryptoMethod {
40164016
* The user's encrypted symmetric crypto key
40174017
*/userKey: EncString
40184018
)
4019+
/**
4020+
* Master Password Unlock
4021+
*/
4022+
case masterPasswordUnlock(
4023+
/**
4024+
* The user's master password
4025+
*/password: String,
4026+
/**
4027+
* Contains the data needed to unlock with the master password
4028+
*/masterPasswordUnlock: MasterPasswordUnlockData
4029+
)
40194030
/**
40204031
* Never lock and/or biometric unlock
40214032
*/
@@ -4102,22 +4113,25 @@ public struct FfiConverterTypeInitUserCryptoMethod: FfiConverterRustBuffer {
41024113
case 1: return .password(password: try FfiConverterString.read(from: &buf), userKey: try FfiConverterTypeEncString.read(from: &buf)
41034114
)
41044115

4105-
case 2: return .decryptedKey(decryptedUserKey: try FfiConverterString.read(from: &buf)
4116+
case 2: return .masterPasswordUnlock(password: try FfiConverterString.read(from: &buf), masterPasswordUnlock: try FfiConverterTypeMasterPasswordUnlockData.read(from: &buf)
41064117
)
41074118

4108-
case 3: return .pin(pin: try FfiConverterString.read(from: &buf), pinProtectedUserKey: try FfiConverterTypeEncString.read(from: &buf)
4119+
case 3: return .decryptedKey(decryptedUserKey: try FfiConverterString.read(from: &buf)
41094120
)
41104121

4111-
case 4: return .pinEnvelope(pin: try FfiConverterString.read(from: &buf), pinProtectedUserKeyEnvelope: try FfiConverterTypePasswordProtectedKeyEnvelope.read(from: &buf)
4122+
case 4: return .pin(pin: try FfiConverterString.read(from: &buf), pinProtectedUserKey: try FfiConverterTypeEncString.read(from: &buf)
41124123
)
41134124

4114-
case 5: return .authRequest(requestPrivateKey: try FfiConverterTypeB64.read(from: &buf), method: try FfiConverterTypeAuthRequestMethod.read(from: &buf)
4125+
case 5: return .pinEnvelope(pin: try FfiConverterString.read(from: &buf), pinProtectedUserKeyEnvelope: try FfiConverterTypePasswordProtectedKeyEnvelope.read(from: &buf)
41154126
)
41164127

4117-
case 6: return .deviceKey(deviceKey: try FfiConverterString.read(from: &buf), protectedDevicePrivateKey: try FfiConverterTypeEncString.read(from: &buf), deviceProtectedUserKey: try FfiConverterTypeUnsignedSharedKey.read(from: &buf)
4128+
case 6: return .authRequest(requestPrivateKey: try FfiConverterTypeB64.read(from: &buf), method: try FfiConverterTypeAuthRequestMethod.read(from: &buf)
41184129
)
41194130

4120-
case 7: return .keyConnector(masterKey: try FfiConverterTypeB64.read(from: &buf), userKey: try FfiConverterTypeEncString.read(from: &buf)
4131+
case 7: return .deviceKey(deviceKey: try FfiConverterString.read(from: &buf), protectedDevicePrivateKey: try FfiConverterTypeEncString.read(from: &buf), deviceProtectedUserKey: try FfiConverterTypeUnsignedSharedKey.read(from: &buf)
4132+
)
4133+
4134+
case 8: return .keyConnector(masterKey: try FfiConverterTypeB64.read(from: &buf), userKey: try FfiConverterTypeEncString.read(from: &buf)
41214135
)
41224136

41234137
default: throw UniffiInternalError.unexpectedEnumCase
@@ -4134,38 +4148,44 @@ public struct FfiConverterTypeInitUserCryptoMethod: FfiConverterRustBuffer {
41344148
FfiConverterTypeEncString.write(userKey, into: &buf)
41354149

41364150

4137-
case let .decryptedKey(decryptedUserKey):
4151+
case let .masterPasswordUnlock(password,masterPasswordUnlock):
41384152
writeInt(&buf, Int32(2))
4153+
FfiConverterString.write(password, into: &buf)
4154+
FfiConverterTypeMasterPasswordUnlockData.write(masterPasswordUnlock, into: &buf)
4155+
4156+
4157+
case let .decryptedKey(decryptedUserKey):
4158+
writeInt(&buf, Int32(3))
41394159
FfiConverterString.write(decryptedUserKey, into: &buf)
41404160

41414161

41424162
case let .pin(pin,pinProtectedUserKey):
4143-
writeInt(&buf, Int32(3))
4163+
writeInt(&buf, Int32(4))
41444164
FfiConverterString.write(pin, into: &buf)
41454165
FfiConverterTypeEncString.write(pinProtectedUserKey, into: &buf)
41464166

41474167

41484168
case let .pinEnvelope(pin,pinProtectedUserKeyEnvelope):
4149-
writeInt(&buf, Int32(4))
4169+
writeInt(&buf, Int32(5))
41504170
FfiConverterString.write(pin, into: &buf)
41514171
FfiConverterTypePasswordProtectedKeyEnvelope.write(pinProtectedUserKeyEnvelope, into: &buf)
41524172

41534173

41544174
case let .authRequest(requestPrivateKey,method):
4155-
writeInt(&buf, Int32(5))
4175+
writeInt(&buf, Int32(6))
41564176
FfiConverterTypeB64.write(requestPrivateKey, into: &buf)
41574177
FfiConverterTypeAuthRequestMethod.write(method, into: &buf)
41584178

41594179

41604180
case let .deviceKey(deviceKey,protectedDevicePrivateKey,deviceProtectedUserKey):
4161-
writeInt(&buf, Int32(6))
4181+
writeInt(&buf, Int32(7))
41624182
FfiConverterString.write(deviceKey, into: &buf)
41634183
FfiConverterTypeEncString.write(protectedDevicePrivateKey, into: &buf)
41644184
FfiConverterTypeUnsignedSharedKey.write(deviceProtectedUserKey, into: &buf)
41654185

41664186

41674187
case let .keyConnector(masterKey,userKey):
4168-
writeInt(&buf, Int32(7))
4188+
writeInt(&buf, Int32(8))
41694189
FfiConverterTypeB64.write(masterKey, into: &buf)
41704190
FfiConverterTypeEncString.write(userKey, into: &buf)
41714191

@@ -5141,8 +5161,8 @@ private let initializationResult: InitializationResult = {
51415161
}
51425162

51435163
uniffiCallbackInitClientManagedTokens()
5144-
uniffiEnsureBitwardenEncodingInitialized()
51455164
uniffiEnsureBitwardenCryptoInitialized()
5165+
uniffiEnsureBitwardenEncodingInitialized()
51465166
return InitializationResult.ok
51475167
}()
51485168

Sources/BitwardenSdk/BitwardenSDK.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8176,17 +8176,17 @@ private let initializationResult: InitializationResult = {
81768176
uniffiCallbackInitFido2CredentialStore()
81778177
uniffiCallbackInitFido2UserInterface()
81788178
uniffiCallbackInitFolderRepository()
8179-
uniffiEnsureBitwardenStateInitialized()
8180-
uniffiEnsureBitwardenSendInitialized()
81818179
uniffiEnsureBitwardenCollectionsInitialized()
8182-
uniffiEnsureBitwardenVaultInitialized()
8183-
uniffiEnsureBitwardenSshInitialized()
8180+
uniffiEnsureBitwardenFidoInitialized()
81848181
uniffiEnsureBitwardenCryptoInitialized()
8182+
uniffiEnsureBitwardenGeneratorsInitialized()
81858183
uniffiEnsureBitwardenCoreInitialized()
8186-
uniffiEnsureBitwardenExportersInitialized()
8184+
uniffiEnsureBitwardenSshInitialized()
8185+
uniffiEnsureBitwardenSendInitialized()
81878186
uniffiEnsureBitwardenEncodingInitialized()
8188-
uniffiEnsureBitwardenGeneratorsInitialized()
8189-
uniffiEnsureBitwardenFidoInitialized()
8187+
uniffiEnsureBitwardenExportersInitialized()
8188+
uniffiEnsureBitwardenStateInitialized()
8189+
uniffiEnsureBitwardenVaultInitialized()
81908190
return InitializationResult.ok
81918191
}()
81928192

Sources/BitwardenSdk/BitwardenVault.swift

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

76647664
uniffiEnsureBitwardenCollectionsInitialized()
7665-
uniffiEnsureBitwardenCoreInitialized()
76667665
uniffiEnsureBitwardenCryptoInitialized()
7666+
uniffiEnsureBitwardenCoreInitialized()
76677667
return InitializationResult.ok
76687668
}()
76697669

0 commit comments

Comments
 (0)