Skip to content

Commit c11f017

Browse files
bitwarden/sdk-internal@07e1998 1.0.0-2871-07e1998 - [PM-26459] Implement data envelope (bitwarden/sdk-internal#336)
1 parent b8b1461 commit c11f017

File tree

6 files changed

+92
-40
lines changed

6 files changed

+92
-40
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-2829-0364659/BitwardenFFI-1.0.0-0364659.xcframework.zip",
34-
checksum: "a022b9b67b0184d71f4c51a903a032a865be3fdd8a143e8bece294638facc20a")
33+
url: "https://github.com/bitwarden/sdk-swift/releases/download/v1.0.0-2871-07e1998/BitwardenFFI-1.0.0-07e1998.xcframework.zip",
34+
checksum: "5f6df4002a0074f6dd1093f94a76a9fde488ccf7a43a69fd07a5e40041f108ce")
3535
]
3636
)

Sources/BitwardenSdk/BitwardenCore.swift

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

51415141
uniffiCallbackInitClientManagedTokens()
5142-
uniffiEnsureBitwardenEncodingInitialized()
51435142
uniffiEnsureBitwardenCryptoInitialized()
5143+
uniffiEnsureBitwardenEncodingInitialized()
51445144
return InitializationResult.ok
51455145
}()
51465146

Sources/BitwardenSdk/BitwardenCrypto.swift

Lines changed: 80 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,8 @@ public enum CryptoError: Swift.Error {
699699

700700
case MissingKeyId(message: String)
701701

702+
case KeyOperationNotSupported(message: String)
703+
702704
case ReadOnlyKeyStore(message: String)
703705

704706
case InsufficientKdfParameters(message: String)
@@ -779,59 +781,63 @@ public struct FfiConverterTypeCryptoError: FfiConverterRustBuffer {
779781
message: try FfiConverterString.read(from: &buf)
780782
)
781783

782-
case 10: return .ReadOnlyKeyStore(
784+
case 10: return .KeyOperationNotSupported(
783785
message: try FfiConverterString.read(from: &buf)
784786
)
785787

786-
case 11: return .InsufficientKdfParameters(
788+
case 11: return .ReadOnlyKeyStore(
787789
message: try FfiConverterString.read(from: &buf)
788790
)
789791

790-
case 12: return .EncString(
792+
case 12: return .InsufficientKdfParameters(
791793
message: try FfiConverterString.read(from: &buf)
792794
)
793795

794-
case 13: return .Rsa(
796+
case 13: return .EncString(
795797
message: try FfiConverterString.read(from: &buf)
796798
)
797799

798-
case 14: return .Fingerprint(
800+
case 14: return .Rsa(
799801
message: try FfiConverterString.read(from: &buf)
800802
)
801803

802-
case 15: return .Argon(
804+
case 15: return .Fingerprint(
803805
message: try FfiConverterString.read(from: &buf)
804806
)
805807

806-
case 16: return .ZeroNumber(
808+
case 16: return .Argon(
807809
message: try FfiConverterString.read(from: &buf)
808810
)
809811

810-
case 17: return .OperationNotSupported(
812+
case 17: return .ZeroNumber(
811813
message: try FfiConverterString.read(from: &buf)
812814
)
813815

814-
case 18: return .WrongKeyType(
816+
case 18: return .OperationNotSupported(
815817
message: try FfiConverterString.read(from: &buf)
816818
)
817819

818-
case 19: return .WrongCoseKeyId(
820+
case 19: return .WrongKeyType(
819821
message: try FfiConverterString.read(from: &buf)
820822
)
821823

822-
case 20: return .InvalidNonceLength(
824+
case 20: return .WrongCoseKeyId(
823825
message: try FfiConverterString.read(from: &buf)
824826
)
825827

826-
case 21: return .InvalidPadding(
828+
case 21: return .InvalidNonceLength(
827829
message: try FfiConverterString.read(from: &buf)
828830
)
829831

830-
case 22: return .Signature(
832+
case 22: return .InvalidPadding(
831833
message: try FfiConverterString.read(from: &buf)
832834
)
833835

834-
case 23: return .Encoding(
836+
case 23: return .Signature(
837+
message: try FfiConverterString.read(from: &buf)
838+
)
839+
840+
case 24: return .Encoding(
835841
message: try FfiConverterString.read(from: &buf)
836842
)
837843

@@ -864,34 +870,36 @@ public struct FfiConverterTypeCryptoError: FfiConverterRustBuffer {
864870
writeInt(&buf, Int32(8))
865871
case .MissingKeyId(_ /* message is ignored*/):
866872
writeInt(&buf, Int32(9))
867-
case .ReadOnlyKeyStore(_ /* message is ignored*/):
873+
case .KeyOperationNotSupported(_ /* message is ignored*/):
868874
writeInt(&buf, Int32(10))
869-
case .InsufficientKdfParameters(_ /* message is ignored*/):
875+
case .ReadOnlyKeyStore(_ /* message is ignored*/):
870876
writeInt(&buf, Int32(11))
871-
case .EncString(_ /* message is ignored*/):
877+
case .InsufficientKdfParameters(_ /* message is ignored*/):
872878
writeInt(&buf, Int32(12))
873-
case .Rsa(_ /* message is ignored*/):
879+
case .EncString(_ /* message is ignored*/):
874880
writeInt(&buf, Int32(13))
875-
case .Fingerprint(_ /* message is ignored*/):
881+
case .Rsa(_ /* message is ignored*/):
876882
writeInt(&buf, Int32(14))
877-
case .Argon(_ /* message is ignored*/):
883+
case .Fingerprint(_ /* message is ignored*/):
878884
writeInt(&buf, Int32(15))
879-
case .ZeroNumber(_ /* message is ignored*/):
885+
case .Argon(_ /* message is ignored*/):
880886
writeInt(&buf, Int32(16))
881-
case .OperationNotSupported(_ /* message is ignored*/):
887+
case .ZeroNumber(_ /* message is ignored*/):
882888
writeInt(&buf, Int32(17))
883-
case .WrongKeyType(_ /* message is ignored*/):
889+
case .OperationNotSupported(_ /* message is ignored*/):
884890
writeInt(&buf, Int32(18))
885-
case .WrongCoseKeyId(_ /* message is ignored*/):
891+
case .WrongKeyType(_ /* message is ignored*/):
886892
writeInt(&buf, Int32(19))
887-
case .InvalidNonceLength(_ /* message is ignored*/):
893+
case .WrongCoseKeyId(_ /* message is ignored*/):
888894
writeInt(&buf, Int32(20))
889-
case .InvalidPadding(_ /* message is ignored*/):
895+
case .InvalidNonceLength(_ /* message is ignored*/):
890896
writeInt(&buf, Int32(21))
891-
case .Signature(_ /* message is ignored*/):
897+
case .InvalidPadding(_ /* message is ignored*/):
892898
writeInt(&buf, Int32(22))
893-
case .Encoding(_ /* message is ignored*/):
899+
case .Signature(_ /* message is ignored*/):
894900
writeInt(&buf, Int32(23))
901+
case .Encoding(_ /* message is ignored*/):
902+
writeInt(&buf, Int32(24))
895903

896904

897905
}
@@ -1161,6 +1169,50 @@ extension SignatureAlgorithm: Equatable, Hashable {}
11611169

11621170

11631171

1172+
/**
1173+
* Typealias from the type name used in the UDL file to the builtin type. This
1174+
* is needed because the UDL type name is used in function/method signatures.
1175+
*/
1176+
public typealias DataEnvelope = String
1177+
1178+
#if swift(>=5.8)
1179+
@_documentation(visibility: private)
1180+
#endif
1181+
public struct FfiConverterTypeDataEnvelope: FfiConverter {
1182+
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> DataEnvelope {
1183+
return try FfiConverterString.read(from: &buf)
1184+
}
1185+
1186+
public static func write(_ value: DataEnvelope, into buf: inout [UInt8]) {
1187+
return FfiConverterString.write(value, into: &buf)
1188+
}
1189+
1190+
public static func lift(_ value: RustBuffer) throws -> DataEnvelope {
1191+
return try FfiConverterString.lift(value)
1192+
}
1193+
1194+
public static func lower(_ value: DataEnvelope) -> RustBuffer {
1195+
return FfiConverterString.lower(value)
1196+
}
1197+
}
1198+
1199+
1200+
#if swift(>=5.8)
1201+
@_documentation(visibility: private)
1202+
#endif
1203+
public func FfiConverterTypeDataEnvelope_lift(_ value: RustBuffer) throws -> DataEnvelope {
1204+
return try FfiConverterTypeDataEnvelope.lift(value)
1205+
}
1206+
1207+
#if swift(>=5.8)
1208+
@_documentation(visibility: private)
1209+
#endif
1210+
public func FfiConverterTypeDataEnvelope_lower(_ value: DataEnvelope) -> RustBuffer {
1211+
return FfiConverterTypeDataEnvelope.lower(value)
1212+
}
1213+
1214+
1215+
11641216
/**
11651217
* Typealias from the type name used in the UDL file to the builtin type. This
11661218
* is needed because the UDL type name is used in function/method signatures.

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-
uniffiEnsureBitwardenCryptoInitialized()
8180-
uniffiEnsureBitwardenSendInitialized()
8179+
uniffiEnsureBitwardenSshInitialized()
81818180
uniffiEnsureBitwardenCollectionsInitialized()
8182-
uniffiEnsureBitwardenExportersInitialized()
8181+
uniffiEnsureBitwardenSendInitialized()
8182+
uniffiEnsureBitwardenCoreInitialized()
8183+
uniffiEnsureBitwardenCryptoInitialized()
81838184
uniffiEnsureBitwardenGeneratorsInitialized()
8184-
uniffiEnsureBitwardenStateInitialized()
81858185
uniffiEnsureBitwardenFidoInitialized()
8186-
uniffiEnsureBitwardenEncodingInitialized()
81878186
uniffiEnsureBitwardenVaultInitialized()
8188-
uniffiEnsureBitwardenSshInitialized()
8189-
uniffiEnsureBitwardenCoreInitialized()
8187+
uniffiEnsureBitwardenStateInitialized()
8188+
uniffiEnsureBitwardenExportersInitialized()
8189+
uniffiEnsureBitwardenEncodingInitialized()
81908190
return InitializationResult.ok
81918191
}()
81928192

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-
uniffiEnsureBitwardenCryptoInitialized()
20352034
uniffiEnsureBitwardenCoreInitialized()
2035+
uniffiEnsureBitwardenCryptoInitialized()
20362036
return InitializationResult.ok
20372037
}()
20382038

Sources/BitwardenSdk/BitwardenVault.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8401,8 +8401,8 @@ private let initializationResult: InitializationResult = {
84018401
return InitializationResult.contractVersionMismatch
84028402
}
84038403

8404-
uniffiEnsureBitwardenCryptoInitialized()
84058404
uniffiEnsureBitwardenCollectionsInitialized()
8405+
uniffiEnsureBitwardenCryptoInitialized()
84068406
uniffiEnsureBitwardenCoreInitialized()
84078407
return InitializationResult.ok
84088408
}()

0 commit comments

Comments
 (0)