no message

This commit is contained in:
Peter Iakovlev
2018-04-03 15:25:45 +04:00
parent a3168cc1ce
commit 42890de382
23 changed files with 1054 additions and 1298 deletions

View File

@@ -307,6 +307,18 @@
D053B41C1F18DEF500E2D58A /* TelegramMediaExpiredContent.swift in Sources */ = {isa = PBXBuildFile; fileRef = D053B41A1F18DEF500E2D58A /* TelegramMediaExpiredContent.swift */; };
D05452071E7B5093006EEF19 /* LoadedStickerPack.swift in Sources */ = {isa = PBXBuildFile; fileRef = D05452061E7B5093006EEF19 /* LoadedStickerPack.swift */; };
D05452081E7B5093006EEF19 /* LoadedStickerPack.swift in Sources */ = {isa = PBXBuildFile; fileRef = D05452061E7B5093006EEF19 /* LoadedStickerPack.swift */; };
D054648B2073854A002ECC1E /* SecureIdPersonalDetailsValue.swift in Sources */ = {isa = PBXBuildFile; fileRef = D054648A2073854A002ECC1E /* SecureIdPersonalDetailsValue.swift */; };
D054648C2073854A002ECC1E /* SecureIdPersonalDetailsValue.swift in Sources */ = {isa = PBXBuildFile; fileRef = D054648A2073854A002ECC1E /* SecureIdPersonalDetailsValue.swift */; };
D054648E20738626002ECC1E /* SecureIdDriversLicenseValue.swift in Sources */ = {isa = PBXBuildFile; fileRef = D054648D20738626002ECC1E /* SecureIdDriversLicenseValue.swift */; };
D054648F20738626002ECC1E /* SecureIdDriversLicenseValue.swift in Sources */ = {isa = PBXBuildFile; fileRef = D054648D20738626002ECC1E /* SecureIdDriversLicenseValue.swift */; };
D054649120738653002ECC1E /* SecureIdIDCardValue.swift in Sources */ = {isa = PBXBuildFile; fileRef = D054649020738653002ECC1E /* SecureIdIDCardValue.swift */; };
D054649220738653002ECC1E /* SecureIdIDCardValue.swift in Sources */ = {isa = PBXBuildFile; fileRef = D054649020738653002ECC1E /* SecureIdIDCardValue.swift */; };
D0546494207386D7002ECC1E /* SecureIdUtilityBillValue.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0546493207386D7002ECC1E /* SecureIdUtilityBillValue.swift */; };
D0546495207386D7002ECC1E /* SecureIdUtilityBillValue.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0546493207386D7002ECC1E /* SecureIdUtilityBillValue.swift */; };
D05464972073872C002ECC1E /* SecureIdBankStatementValue.swift in Sources */ = {isa = PBXBuildFile; fileRef = D05464962073872C002ECC1E /* SecureIdBankStatementValue.swift */; };
D05464982073872C002ECC1E /* SecureIdBankStatementValue.swift in Sources */ = {isa = PBXBuildFile; fileRef = D05464962073872C002ECC1E /* SecureIdBankStatementValue.swift */; };
D054649A20738760002ECC1E /* SecureIdRentalAgreementValue.swift in Sources */ = {isa = PBXBuildFile; fileRef = D054649920738760002ECC1E /* SecureIdRentalAgreementValue.swift */; };
D054649B20738760002ECC1E /* SecureIdRentalAgreementValue.swift in Sources */ = {isa = PBXBuildFile; fileRef = D054649920738760002ECC1E /* SecureIdRentalAgreementValue.swift */; };
D0561DE31E5737FC00E6B9E9 /* UpdatePeerInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0561DE21E5737FC00E6B9E9 /* UpdatePeerInfo.swift */; };
D0561DE41E5737FC00E6B9E9 /* UpdatePeerInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0561DE21E5737FC00E6B9E9 /* UpdatePeerInfo.swift */; };
D0561DEA1E5754FA00E6B9E9 /* ChannelAdmins.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0561DE91E5754FA00E6B9E9 /* ChannelAdmins.swift */; };
@@ -371,8 +383,6 @@
D08F4A671E79CC4A00A2AA15 /* SynchronizeInstalledStickerPacksOperations.swift in Sources */ = {isa = PBXBuildFile; fileRef = D08F4A651E79CC4A00A2AA15 /* SynchronizeInstalledStickerPacksOperations.swift */; };
D08F4A691E79CECB00A2AA15 /* ManagedSynchronizeInstalledStickerPacksOperations.swift in Sources */ = {isa = PBXBuildFile; fileRef = D08F4A681E79CECB00A2AA15 /* ManagedSynchronizeInstalledStickerPacksOperations.swift */; };
D08F4A6A1E79CECB00A2AA15 /* ManagedSynchronizeInstalledStickerPacksOperations.swift in Sources */ = {isa = PBXBuildFile; fileRef = D08F4A681E79CECB00A2AA15 /* ManagedSynchronizeInstalledStickerPacksOperations.swift */; };
D093D7EB206413C900BC3599 /* SecureIdIdentityValue.swift in Sources */ = {isa = PBXBuildFile; fileRef = D093D7EA206413C900BC3599 /* SecureIdIdentityValue.swift */; };
D093D7EC206413C900BC3599 /* SecureIdIdentityValue.swift in Sources */ = {isa = PBXBuildFile; fileRef = D093D7EA206413C900BC3599 /* SecureIdIdentityValue.swift */; };
D093D7EE206413F600BC3599 /* SecureIdDataTypes.swift in Sources */ = {isa = PBXBuildFile; fileRef = D093D7ED206413F600BC3599 /* SecureIdDataTypes.swift */; };
D093D7EF206413F600BC3599 /* SecureIdDataTypes.swift in Sources */ = {isa = PBXBuildFile; fileRef = D093D7ED206413F600BC3599 /* SecureIdDataTypes.swift */; };
D093D7F520641A4900BC3599 /* SecureIdPhoneValue.swift in Sources */ = {isa = PBXBuildFile; fileRef = D093D7F420641A4900BC3599 /* SecureIdPhoneValue.swift */; };
@@ -549,6 +559,8 @@
D0C48F3D1E8142EF0075317D /* LoadedPeerFromMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0C48F3B1E8142EF0075317D /* LoadedPeerFromMessage.swift */; };
D0C50E341E93A86600F62E39 /* CallSessionManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0C50E331E93A86600F62E39 /* CallSessionManager.swift */; };
D0C50E351E93A86600F62E39 /* CallSessionManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0C50E331E93A86600F62E39 /* CallSessionManager.swift */; };
D0CA3F84207391560042D2B6 /* SecureIdPadding.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0CA3F83207391560042D2B6 /* SecureIdPadding.swift */; };
D0CA3F85207391560042D2B6 /* SecureIdPadding.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0CA3F83207391560042D2B6 /* SecureIdPadding.swift */; };
D0CAF2EA1D75EC600011F558 /* MtProtoKitDynamic.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0CAF2E91D75EC600011F558 /* MtProtoKitDynamic.framework */; };
D0D748021E7AE98B00F4B1F6 /* StickerPackInteractiveOperations.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0D748011E7AE98B00F4B1F6 /* StickerPackInteractiveOperations.swift */; };
D0D748031E7AE98B00F4B1F6 /* StickerPackInteractiveOperations.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0D748011E7AE98B00F4B1F6 /* StickerPackInteractiveOperations.swift */; };
@@ -594,16 +606,10 @@
D0E412EB206AD18E00BEE4A2 /* DecryptedResourceData.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0E412E9206AD18E00BEE4A2 /* DecryptedResourceData.swift */; };
D0E412EE206AF65500BEE4A2 /* GrantSecureIdAccess.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0E412ED206AF65500BEE4A2 /* GrantSecureIdAccess.swift */; };
D0E412EF206AF65500BEE4A2 /* GrantSecureIdAccess.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0E412ED206AF65500BEE4A2 /* GrantSecureIdAccess.swift */; };
D0E412F1206B9BB700BEE4A2 /* SecureIdIdentityPassportValue.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0E412F0206B9BB700BEE4A2 /* SecureIdIdentityPassportValue.swift */; };
D0E412F2206B9BB700BEE4A2 /* SecureIdIdentityPassportValue.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0E412F0206B9BB700BEE4A2 /* SecureIdIdentityPassportValue.swift */; };
D0E412F1206B9BB700BEE4A2 /* SecureIdPassportValue.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0E412F0206B9BB700BEE4A2 /* SecureIdPassportValue.swift */; };
D0E412F2206B9BB700BEE4A2 /* SecureIdPassportValue.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0E412F0206B9BB700BEE4A2 /* SecureIdPassportValue.swift */; };
D0E412F4206B9BDC00BEE4A2 /* SecureIdVerificationDocumentReference.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0E412F3206B9BDC00BEE4A2 /* SecureIdVerificationDocumentReference.swift */; };
D0E412F5206B9BDC00BEE4A2 /* SecureIdVerificationDocumentReference.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0E412F3206B9BDC00BEE4A2 /* SecureIdVerificationDocumentReference.swift */; };
D0E412F7206B9D2F00BEE4A2 /* SecureIdIdentityInternationalPassportValue.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0E412F6206B9D2F00BEE4A2 /* SecureIdIdentityInternationalPassportValue.swift */; };
D0E412F8206B9D2F00BEE4A2 /* SecureIdIdentityInternationalPassportValue.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0E412F6206B9D2F00BEE4A2 /* SecureIdIdentityInternationalPassportValue.swift */; };
D0E412FA206B9D6900BEE4A2 /* SecureIdIdentityDriversLicenseValue.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0E412F9206B9D6900BEE4A2 /* SecureIdIdentityDriversLicenseValue.swift */; };
D0E412FB206B9D6900BEE4A2 /* SecureIdIdentityDriversLicenseValue.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0E412F9206B9D6900BEE4A2 /* SecureIdIdentityDriversLicenseValue.swift */; };
D0E412FD206B9D8F00BEE4A2 /* SecureIdIdentityIDCardValue.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0E412FC206B9D8F00BEE4A2 /* SecureIdIdentityIDCardValue.swift */; };
D0E412FE206B9D8F00BEE4A2 /* SecureIdIdentityIDCardValue.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0E412FC206B9D8F00BEE4A2 /* SecureIdIdentityIDCardValue.swift */; };
D0E41301206B9E6E00BEE4A2 /* SecureIdAddressValue.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0E41300206B9E6E00BEE4A2 /* SecureIdAddressValue.swift */; };
D0E41302206B9E6E00BEE4A2 /* SecureIdAddressValue.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0E41300206B9E6E00BEE4A2 /* SecureIdAddressValue.swift */; };
D0E6521F1E3A364A004EEA91 /* UpdateAccountPeerName.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0E6521E1E3A364A004EEA91 /* UpdateAccountPeerName.swift */; };
@@ -852,6 +858,12 @@
D053B4171F18DE4F00E2D58A /* AuthorSignatureMessageAttribute.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AuthorSignatureMessageAttribute.swift; sourceTree = "<group>"; };
D053B41A1F18DEF500E2D58A /* TelegramMediaExpiredContent.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TelegramMediaExpiredContent.swift; sourceTree = "<group>"; };
D05452061E7B5093006EEF19 /* LoadedStickerPack.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoadedStickerPack.swift; sourceTree = "<group>"; };
D054648A2073854A002ECC1E /* SecureIdPersonalDetailsValue.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureIdPersonalDetailsValue.swift; sourceTree = "<group>"; };
D054648D20738626002ECC1E /* SecureIdDriversLicenseValue.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureIdDriversLicenseValue.swift; sourceTree = "<group>"; };
D054649020738653002ECC1E /* SecureIdIDCardValue.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureIdIDCardValue.swift; sourceTree = "<group>"; };
D0546493207386D7002ECC1E /* SecureIdUtilityBillValue.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureIdUtilityBillValue.swift; sourceTree = "<group>"; };
D05464962073872C002ECC1E /* SecureIdBankStatementValue.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureIdBankStatementValue.swift; sourceTree = "<group>"; };
D054649920738760002ECC1E /* SecureIdRentalAgreementValue.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureIdRentalAgreementValue.swift; sourceTree = "<group>"; };
D0561DE21E5737FC00E6B9E9 /* UpdatePeerInfo.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UpdatePeerInfo.swift; sourceTree = "<group>"; };
D0561DE91E5754FA00E6B9E9 /* ChannelAdmins.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChannelAdmins.swift; sourceTree = "<group>"; };
D0575AF01E9FFA5D006F2541 /* SynchronizeSavedGifsOperation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SynchronizeSavedGifsOperation.swift; sourceTree = "<group>"; };
@@ -887,7 +899,6 @@
D08CAA8B1ED81EDF0000FDA8 /* Localizations.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Localizations.swift; sourceTree = "<group>"; };
D08F4A651E79CC4A00A2AA15 /* SynchronizeInstalledStickerPacksOperations.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SynchronizeInstalledStickerPacksOperations.swift; sourceTree = "<group>"; };
D08F4A681E79CECB00A2AA15 /* ManagedSynchronizeInstalledStickerPacksOperations.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ManagedSynchronizeInstalledStickerPacksOperations.swift; sourceTree = "<group>"; };
D093D7EA206413C900BC3599 /* SecureIdIdentityValue.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureIdIdentityValue.swift; sourceTree = "<group>"; };
D093D7ED206413F600BC3599 /* SecureIdDataTypes.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureIdDataTypes.swift; sourceTree = "<group>"; };
D093D7F420641A4900BC3599 /* SecureIdPhoneValue.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureIdPhoneValue.swift; sourceTree = "<group>"; };
D093D7F820641AA500BC3599 /* SecureIdEmailValue.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureIdEmailValue.swift; sourceTree = "<group>"; };
@@ -990,6 +1001,7 @@
D0C48F381E8138DF0075317D /* ArchivedStickerPacksInfo.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArchivedStickerPacksInfo.swift; sourceTree = "<group>"; };
D0C48F3B1E8142EF0075317D /* LoadedPeerFromMessage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoadedPeerFromMessage.swift; sourceTree = "<group>"; };
D0C50E331E93A86600F62E39 /* CallSessionManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CallSessionManager.swift; sourceTree = "<group>"; };
D0CA3F83207391560042D2B6 /* SecureIdPadding.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureIdPadding.swift; sourceTree = "<group>"; };
D0CAF2E91D75EC600011F558 /* MtProtoKitDynamic.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = MtProtoKitDynamic.framework; sourceTree = BUILT_PRODUCTS_DIR; };
D0D748011E7AE98B00F4B1F6 /* StickerPackInteractiveOperations.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StickerPackInteractiveOperations.swift; sourceTree = "<group>"; };
D0DA1D311F7043D50034E892 /* ManagedPendingPeerNotificationSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ManagedPendingPeerNotificationSettings.swift; sourceTree = "<group>"; };
@@ -1015,11 +1027,8 @@
D0E412E6206ABC7500BEE4A2 /* EncryptedMediaResource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EncryptedMediaResource.swift; sourceTree = "<group>"; };
D0E412E9206AD18E00BEE4A2 /* DecryptedResourceData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DecryptedResourceData.swift; sourceTree = "<group>"; };
D0E412ED206AF65500BEE4A2 /* GrantSecureIdAccess.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GrantSecureIdAccess.swift; sourceTree = "<group>"; };
D0E412F0206B9BB700BEE4A2 /* SecureIdIdentityPassportValue.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureIdIdentityPassportValue.swift; sourceTree = "<group>"; };
D0E412F0206B9BB700BEE4A2 /* SecureIdPassportValue.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureIdPassportValue.swift; sourceTree = "<group>"; };
D0E412F3206B9BDC00BEE4A2 /* SecureIdVerificationDocumentReference.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureIdVerificationDocumentReference.swift; sourceTree = "<group>"; };
D0E412F6206B9D2F00BEE4A2 /* SecureIdIdentityInternationalPassportValue.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureIdIdentityInternationalPassportValue.swift; sourceTree = "<group>"; };
D0E412F9206B9D6900BEE4A2 /* SecureIdIdentityDriversLicenseValue.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureIdIdentityDriversLicenseValue.swift; sourceTree = "<group>"; };
D0E412FC206B9D8F00BEE4A2 /* SecureIdIdentityIDCardValue.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureIdIdentityIDCardValue.swift; sourceTree = "<group>"; };
D0E41300206B9E6E00BEE4A2 /* SecureIdAddressValue.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureIdAddressValue.swift; sourceTree = "<group>"; };
D0E6521E1E3A364A004EEA91 /* UpdateAccountPeerName.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UpdateAccountPeerName.swift; sourceTree = "<group>"; };
D0E817482010E7E300B82BBB /* ChannelAdminEventLogContext.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChannelAdminEventLogContext.swift; sourceTree = "<group>"; };
@@ -1555,32 +1564,18 @@
D0E412DB206A99AE00BEE4A2 /* SecureIdValueAccessContext.swift */,
D093D7ED206413F600BC3599 /* SecureIdDataTypes.swift */,
D0E412F3206B9BDC00BEE4A2 /* SecureIdVerificationDocumentReference.swift */,
D093D7E92064135A00BC3599 /* Identity */,
D0E412FF206B9E5F00BEE4A2 /* Address */,
D093D7F320641A3F00BC3599 /* Other */,
);
name = Values;
sourceTree = "<group>";
};
D093D7E92064135A00BC3599 /* Identity */ = {
isa = PBXGroup;
children = (
D093D7EA206413C900BC3599 /* SecureIdIdentityValue.swift */,
D0E412F0206B9BB700BEE4A2 /* SecureIdIdentityPassportValue.swift */,
D0E412F6206B9D2F00BEE4A2 /* SecureIdIdentityInternationalPassportValue.swift */,
D0E412F9206B9D6900BEE4A2 /* SecureIdIdentityDriversLicenseValue.swift */,
D0E412FC206B9D8F00BEE4A2 /* SecureIdIdentityIDCardValue.swift */,
);
name = Identity;
sourceTree = "<group>";
};
D093D7F320641A3F00BC3599 /* Other */ = {
isa = PBXGroup;
children = (
D054648A2073854A002ECC1E /* SecureIdPersonalDetailsValue.swift */,
D0E412F0206B9BB700BEE4A2 /* SecureIdPassportValue.swift */,
D054648D20738626002ECC1E /* SecureIdDriversLicenseValue.swift */,
D054649020738653002ECC1E /* SecureIdIDCardValue.swift */,
D0E41300206B9E6E00BEE4A2 /* SecureIdAddressValue.swift */,
D0546493207386D7002ECC1E /* SecureIdUtilityBillValue.swift */,
D05464962073872C002ECC1E /* SecureIdBankStatementValue.swift */,
D054649920738760002ECC1E /* SecureIdRentalAgreementValue.swift */,
D093D7F420641A4900BC3599 /* SecureIdPhoneValue.swift */,
D093D7F820641AA500BC3599 /* SecureIdEmailValue.swift */,
);
name = Other;
name = Values;
sourceTree = "<group>";
};
D09D8BF71D4FAB1D0081DBEC = {
@@ -1671,6 +1666,7 @@
D0BE303820619E9E00FBE6D8 /* Secure ID */ = {
isa = PBXGroup;
children = (
D0CA3F82207391450042D2B6 /* Utils */,
D0BE303C2061A29100FBE6D8 /* RequestSecureIdForm.swift */,
D0BE304A20627D9800FBE6D8 /* AccessSecureId.swift */,
D0BE303920619EE800FBE6D8 /* SecureIdForm.swift */,
@@ -1692,6 +1688,14 @@
name = Calls;
sourceTree = "<group>";
};
D0CA3F82207391450042D2B6 /* Utils */ = {
isa = PBXGroup;
children = (
D0CA3F83207391560042D2B6 /* SecureIdPadding.swift */,
);
name = Utils;
sourceTree = "<group>";
};
D0DF0C881D819C5F008AEB01 /* Peers */ = {
isa = PBXGroup;
children = (
@@ -1747,14 +1751,6 @@
name = Peers;
sourceTree = "<group>";
};
D0E412FF206B9E5F00BEE4A2 /* Address */ = {
isa = PBXGroup;
children = (
D0E41300206B9E6E00BEE4A2 /* SecureIdAddressValue.swift */,
);
name = Address;
sourceTree = "<group>";
};
D0FA8B961E1E952D001E855B /* Secret Chats */ = {
isa = PBXGroup;
children = (
@@ -1972,7 +1968,6 @@
D050F2511E4A59C200988324 /* JoinLink.swift in Sources */,
D07827C91E02F59C00071108 /* InstantPage.swift in Sources */,
D0458C881E69B4AB00FB34C1 /* OutgoingContentInfoMessageAttribute.swift in Sources */,
D0E412FD206B9D8F00BEE4A2 /* SecureIdIdentityIDCardValue.swift in Sources */,
D07827CB1E02F5B200071108 /* RichText.swift in Sources */,
D0613FD71E606B3B00202CDB /* ConvertGroupToSupergroup.swift in Sources */,
D0E412F4206B9BDC00BEE4A2 /* SecureIdVerificationDocumentReference.swift in Sources */,
@@ -1994,13 +1989,14 @@
D0F3A89F1E82C65400B4C64C /* SynchronizeChatInputStateOperation.swift in Sources */,
D01AC9231DD5E9A200E8160F /* ApplyUpdateMessage.swift in Sources */,
D0E8B8B32044706300605593 /* ForwardGame.swift in Sources */,
D0E412F7206B9D2F00BEE4A2 /* SecureIdIdentityInternationalPassportValue.swift in Sources */,
D0BE303D2061A29100FBE6D8 /* RequestSecureIdForm.swift in Sources */,
D01A21AC1F38D10E00DDA104 /* SavedStickerItem.swift in Sources */,
D0642EF91F3E05D700792790 /* EarliestUnseenPersonalMentionMessage.swift in Sources */,
D03B0CF71D62250800955575 /* TelegramMediaImage.swift in Sources */,
D054648E20738626002ECC1E /* SecureIdDriversLicenseValue.swift in Sources */,
C210DD621FBDB90800F673D8 /* SourceReferenceMessageAttribute.swift in Sources */,
D0E23DDF1E8082A400B9B6D2 /* ArchivedStickerPacks.swift in Sources */,
D0546494207386D7002ECC1E /* SecureIdUtilityBillValue.swift in Sources */,
D0BC386E1E3FDAB70044D6FE /* CreateGroup.swift in Sources */,
D0FA8BB31E201B02001E855B /* ProcessSecretChatIncomingEncryptedOperations.swift in Sources */,
D0FC19582020CC4B00FEDBB2 /* TelegramPeerGroupState.swift in Sources */,
@@ -2079,6 +2075,7 @@
D099D7491EEF418D00A3128C /* HistoryViewChannelStateValidation.swift in Sources */,
C23BC3871E9BE3CA00D79F92 /* ImportContact.swift in Sources */,
D03B0D0A1D62255C00955575 /* Holes.swift in Sources */,
D05464972073872C002ECC1E /* SecureIdBankStatementValue.swift in Sources */,
D0B843CB1DA7FF30005F29E1 /* NBPhoneNumberUtil.m in Sources */,
D03B0D5E1D631A6900955575 /* Network.swift in Sources */,
D0B8438E1DA7D296005F29E1 /* CachedGroupParticipants.swift in Sources */,
@@ -2116,7 +2113,6 @@
D0F7AB2C1DCE889D009AD9A1 /* EditedMessageAttribute.swift in Sources */,
D0FA8BAA1E1FB76E001E855B /* ManagedSecretChatOutgoingOperations.swift in Sources */,
D00D97C71E32901700E5C2B6 /* PeerInputActivity.swift in Sources */,
D093D7EB206413C900BC3599 /* SecureIdIdentityValue.swift in Sources */,
D0FA8BAD1E1FD6E2001E855B /* MemoryBufferExtensions.swift in Sources */,
D03B0CBF1D62234A00955575 /* Log.swift in Sources */,
C2FD33E41E687BF1008D13D4 /* PeerPhotoUpdater.swift in Sources */,
@@ -2178,13 +2174,12 @@
D093D806206539D000BC3599 /* SaveSecureIdValue.swift in Sources */,
C239BE9C1E630CA700C2C453 /* UpdatePinnedMessage.swift in Sources */,
D08CAA7D1ED77EE90000FDA8 /* LocalizationSettings.swift in Sources */,
D0E412FA206B9D6900BEE4A2 /* SecureIdIdentityDriversLicenseValue.swift in Sources */,
D0B844531DAC0773005F29E1 /* TelegramUserPresence.swift in Sources */,
D08F4A661E79CC4A00A2AA15 /* SynchronizeInstalledStickerPacksOperations.swift in Sources */,
D05A32E71E6F0B5C002760B4 /* RecentAccountSession.swift in Sources */,
D0E41301206B9E6E00BEE4A2 /* SecureIdAddressValue.swift in Sources */,
D0B843871DA6F705005F29E1 /* UpdateCachedPeerData.swift in Sources */,
D0E412F1206B9BB700BEE4A2 /* SecureIdIdentityPassportValue.swift in Sources */,
D0E412F1206B9BB700BEE4A2 /* SecureIdPassportValue.swift in Sources */,
D03B0D6D1D631AA300955575 /* ContactManagement.swift in Sources */,
D03B0D0F1D62255C00955575 /* UpdateMessageService.swift in Sources */,
D03B0CF61D62250800955575 /* TelegramMediaFile.swift in Sources */,
@@ -2207,11 +2202,13 @@
D0AAD1AA1E32638500D5B9DE /* ApplyMaxReadIndexInteractively.swift in Sources */,
D03B0D5C1D631A6900955575 /* Download.swift in Sources */,
D0C27B421F4B58C000A4E170 /* PeerSpecificStickerPack.swift in Sources */,
D054648B2073854A002ECC1E /* SecureIdPersonalDetailsValue.swift in Sources */,
D01749591E1092BC0057C89A /* RequestStartBot.swift in Sources */,
D03DC9101F82E344001D584C /* AccountStateReset.swift in Sources */,
D01B27A21E394D8B0022A4C0 /* PrivacySettings.swift in Sources */,
D0223A9B1EA5654D00211D94 /* TelegramMediaResource.swift in Sources */,
D017495E1E118F790057C89A /* AccountStateManager.swift in Sources */,
D0CA3F84207391560042D2B6 /* SecureIdPadding.swift in Sources */,
D0FA8BB61E223C16001E855B /* SecretApiLayer8.swift in Sources */,
D0B843C71DA7FF30005F29E1 /* NBPhoneNumberDefines.m in Sources */,
D049EAF51E44DF3300A2CD3A /* AccountState.swift in Sources */,
@@ -2223,6 +2220,7 @@
D05A32E41E6F0B2E002760B4 /* RecentAccountSessions.swift in Sources */,
D01A21A61F38CDC700DDA104 /* SynchronizeSavedStickersOperation.swift in Sources */,
D03E5E0C1E55E02D0029569A /* LoggedOutAccountAttribute.swift in Sources */,
D054649120738653002ECC1E /* SecureIdIDCardValue.swift in Sources */,
D018EE052045E95000CBB130 /* CkeckPeerChatServiceActions.swift in Sources */,
D0F3A8A51E82C94C00B4C64C /* SynchronizeableChatInputState.swift in Sources */,
D03B0CD71D62245300955575 /* TelegramGroup.swift in Sources */,
@@ -2266,6 +2264,7 @@
D0B417C11D7DCEEF004562A4 /* ApiGroupOrChannel.swift in Sources */,
D041E3F51E535464008C24B4 /* AddPeerMember.swift in Sources */,
D0AF32311FACEDEC0097362B /* CoreSettings.swift in Sources */,
D054649A20738760002ECC1E /* SecureIdRentalAgreementValue.swift in Sources */,
D0B843BF1DA7FF30005F29E1 /* NBNumberFormat.m in Sources */,
D0E305A71E5B5CBE00D7A3A2 /* PeerAdmins.swift in Sources */,
D0B843C51DA7FF30005F29E1 /* NBPhoneNumber.m in Sources */,
@@ -2311,7 +2310,6 @@
D0458C891E69B4AB00FB34C1 /* OutgoingContentInfoMessageAttribute.swift in Sources */,
D050F26C1E4A5B6D00988324 /* UpdatePeers.swift in Sources */,
D050F26D1E4A5B6D00988324 /* CreateGroup.swift in Sources */,
D0E412FE206B9D8F00BEE4A2 /* SecureIdIdentityIDCardValue.swift in Sources */,
D0575AF51E9FFDDE006F2541 /* ManagedSynchronizeSavedGifsOperations.swift in Sources */,
D00D34461E6EDD420057B307 /* SynchronizeConsumeMessageContentsOperation.swift in Sources */,
D0E412E8206ABC7500BEE4A2 /* EncryptedMediaResource.swift in Sources */,
@@ -2390,7 +2388,7 @@
D0FA8BA81E1FA6DF001E855B /* TelegramSecretChat.swift in Sources */,
C23BC3881E9BE3CB00D79F92 /* ImportContact.swift in Sources */,
D0B85AC61F6B2B9400B8B5CE /* RecentlyUsedHashtags.swift in Sources */,
D0E412F2206B9BB700BEE4A2 /* SecureIdIdentityPassportValue.swift in Sources */,
D0E412F2206B9BB700BEE4A2 /* SecureIdPassportValue.swift in Sources */,
D001F3EB1E128A1C007A8C60 /* EnqueueMessage.swift in Sources */,
D01A21A71F38CDC700DDA104 /* SynchronizeSavedStickersOperation.swift in Sources */,
D00C7CEC1E37A8540080C3D5 /* SetSecretChatMessageAutoremoveTimeoutInteractively.swift in Sources */,
@@ -2401,6 +2399,7 @@
D0FA8B991E1E955C001E855B /* SecretChatOutgoingOperation.swift in Sources */,
D001F3F01E128A1C007A8C60 /* AccountStateManagementUtils.swift in Sources */,
D0BEAF611E54ACF900BD963D /* AccountManager.swift in Sources */,
D0CA3F85207391560042D2B6 /* SecureIdPadding.swift in Sources */,
D0F3CC791DDE2859008148FA /* SearchMessages.swift in Sources */,
D0B8442B1DAB91E0005F29E1 /* NBMetadataCore.m in Sources */,
D093D7EF206413F600BC3599 /* SecureIdDataTypes.swift in Sources */,
@@ -2451,7 +2450,6 @@
D049EAD91E43DAD200A2CD3A /* ManagedRecentStickers.swift in Sources */,
D0B418A61D7E0592004562A4 /* CloudFileMediaResource.swift in Sources */,
D073CEA51DCBF3F5007511FD /* StickerManagement.swift in Sources */,
D0E412F8206B9D2F00BEE4A2 /* SecureIdIdentityInternationalPassportValue.swift in Sources */,
D03C536D1DAD5CA9004C17B3 /* ApiGroupOrChannel.swift in Sources */,
D01C06B81FBBA269001561AB /* CanSendMessagesToPeer.swift in Sources */,
D0E35A151DE4C6A200BC6096 /* OutgoingMessageWithChatContextResult.swift in Sources */,
@@ -2482,7 +2480,6 @@
D0F7AB301DCF507E009AD9A1 /* ReplyMarkupMessageAttribute.swift in Sources */,
D0F02CE61E9926C50065DEE2 /* ManagedConfigurationUpdates.swift in Sources */,
D073CE6D1DCBCF17007511FD /* InlineBotMessageAttribute.swift in Sources */,
D0E412FB206B9D6900BEE4A2 /* SecureIdIdentityDriversLicenseValue.swift in Sources */,
D033FEB71E61F3F900644997 /* BlockedPeers.swift in Sources */,
D0448C9A1E268F9A005A61A7 /* SecretApiLayer46.swift in Sources */,
D0E412D8206A866B00BEE4A2 /* UploadSecureIdFile.swift in Sources */,
@@ -2513,6 +2510,7 @@
D0FA8BB11E1FEC7E001E855B /* SecretChatEncryptionConfig.swift in Sources */,
D0B418AA1D7E0597004562A4 /* Download.swift in Sources */,
D001F3F41E128A1C007A8C60 /* UpdatesApiUtils.swift in Sources */,
D05464982073872C002ECC1E /* SecureIdBankStatementValue.swift in Sources */,
D0B4188E1D7E0578004562A4 /* StoreMessage_Telegram.swift in Sources */,
D0B844461DAB91FD005F29E1 /* RecentPeers.swift in Sources */,
D0E412E2206AB24700BEE4A2 /* SecureFileMediaResource.swift in Sources */,
@@ -2524,6 +2522,7 @@
D0DFD5E01FCDBCFD0039B3B1 /* CachedSentMediaReferences.swift in Sources */,
D0B418991D7E0580004562A4 /* TelegramMediaMap.swift in Sources */,
D0E8174A2010E7E300B82BBB /* ChannelAdminEventLogContext.swift in Sources */,
D054649B20738760002ECC1E /* SecureIdRentalAgreementValue.swift in Sources */,
D0561DEB1E5754FA00E6B9E9 /* ChannelAdmins.swift in Sources */,
D0AD02E41FFFA14800C1DCFF /* PeerLiveLocationsContext.swift in Sources */,
D0613FCB1E60440600202CDB /* InvitationLinks.swift in Sources */,
@@ -2545,6 +2544,7 @@
C27982511E72C97800262BFD /* MacosLegacy.swift in Sources */,
D0B418AB1D7E0597004562A4 /* MultipartFetch.swift in Sources */,
D01A21AA1F38CDDC00DDA104 /* ManagedSynchronizeSavedStickersOperations.swift in Sources */,
D0546495207386D7002ECC1E /* SecureIdUtilityBillValue.swift in Sources */,
D03C53741DAD5CA9004C17B3 /* CachedChannelData.swift in Sources */,
D0B418861D7E056D004562A4 /* Namespaces.swift in Sources */,
D05A32E51E6F0B2E002760B4 /* RecentAccountSessions.swift in Sources */,
@@ -2553,11 +2553,11 @@
D03E5E0D1E55E02D0029569A /* LoggedOutAccountAttribute.swift in Sources */,
D0B418AD1D7E0597004562A4 /* Serialization.swift in Sources */,
C28725431EF967E700613564 /* NotificationInfoMessageAttribute.swift in Sources */,
D054648C2073854A002ECC1E /* SecureIdPersonalDetailsValue.swift in Sources */,
D0F8C3A12017AF2700236FC5 /* GlobalTelegramCoreConfiguration.swift in Sources */,
D099D7471EEF0C2700A3128C /* ChannelMessageStateVersionAttribute.swift in Sources */,
D058E0D21E8AD65C00A442DE /* StandaloneSendMessage.swift in Sources */,
D03C536F1DAD5CA9004C17B3 /* BotInfo.swift in Sources */,
D093D7EC206413C900BC3599 /* SecureIdIdentityValue.swift in Sources */,
D0FA8BBA1E2240B4001E855B /* SecretChatIncomingDecryptedOperation.swift in Sources */,
D033FEB41E61F3C000644997 /* ReportPeer.swift in Sources */,
D0FA8BAE1E1FD6E2001E855B /* MemoryBufferExtensions.swift in Sources */,
@@ -2565,6 +2565,7 @@
D0F3A8A31E82C65E00B4C64C /* ManagedSynchronizeChatInputStateOperations.swift in Sources */,
D0448CA61E29215A005A61A7 /* MediaResourceApiUtils.swift in Sources */,
D001F3F11E128A1C007A8C60 /* SynchronizePeerReadState.swift in Sources */,
D054648F20738626002ECC1E /* SecureIdDriversLicenseValue.swift in Sources */,
D050F2641E4A5AEB00988324 /* ManagedSynchronizePinnedChatsOperations.swift in Sources */,
D0575AF21E9FFA5D006F2541 /* SynchronizeSavedGifsOperation.swift in Sources */,
D0528E661E65C82400E2FEF5 /* UpdateContactName.swift in Sources */,
@@ -2599,6 +2600,7 @@
D073CE6F1DCBCF17007511FD /* OutgoingMessageInfoAttribute.swift in Sources */,
D0B844431DAB91FD005F29E1 /* Account.swift in Sources */,
D08CAA7E1ED77EE90000FDA8 /* LocalizationSettings.swift in Sources */,
D054649220738653002ECC1E /* SecureIdIDCardValue.swift in Sources */,
D0448CA01E27F5EB005A61A7 /* Random.swift in Sources */,
C251D7441E65E50500283EDE /* StickerSetInstallation.swift in Sources */,
D053B41C1F18DEF500E2D58A /* TelegramMediaExpiredContent.swift in Sources */,

View File

@@ -340,17 +340,15 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-714643696] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionParticipantToggleAdmin($0) }
dict[-1312568665] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionChangeStickerSet($0) }
dict[1599903217] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionTogglePreHistoryHidden($0) }
dict[747528674] = { return Api.SecureValueVerified.parse_secureValueVerified($0) }
dict[-543777747] = { return Api.auth.ExportedAuthorization.parse_exportedAuthorization($0) }
dict[2103482845] = { return Api.SecurePlainData.parse_securePlainPhone($0) }
dict[569137759] = { return Api.SecurePlainData.parse_securePlainEmail($0) }
dict[-1269012015] = { return Api.messages.AffectedHistory.parse_affectedHistory($0) }
dict[570402317] = { return Api.account.PasswordInputSettings.parse_passwordInputSettings($0) }
dict[649453030] = { return Api.messages.MessageEditData.parse_messageEditData($0) }
dict[-886477832] = { return Api.LabeledPrice.parse_labeledPrice($0) }
dict[-438840932] = { return Api.messages.ChatFull.parse_chatFull($0) }
dict[156214875] = { return Api.InputSecureValue.parse_inputSecureValueIdentity($0) }
dict[-1771531435] = { return Api.InputSecureValue.parse_inputSecureValueAddress($0) }
dict[-1654506090] = { return Api.InputSecureValue.parse_inputSecureValuePhone($0) }
dict[-1635232935] = { return Api.InputSecureValue.parse_inputSecureValueEmail($0) }
dict[-1059442448] = { return Api.InputSecureValue.parse_inputSecureValue($0) }
dict[-313079300] = { return Api.account.WebAuthorizations.parse_webAuthorizations($0) }
dict[-236044656] = { return Api.help.TermsOfService.parse_termsOfService($0) }
dict[1490799288] = { return Api.ReportReason.parse_inputReportReasonSpam($0) }
@@ -362,7 +360,6 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-40996577] = { return Api.DraftMessage.parse_draftMessage($0) }
dict[1568467877] = { return Api.ChannelAdminRights.parse_channelAdminRights($0) }
dict[682713915] = { return Api.account.SentEmailCode.parse_sentEmailCode($0) }
dict[-921407415] = { return Api.SecureValueSaved.parse_secureValueSaved($0) }
dict[-1038136962] = { return Api.EncryptedFile.parse_encryptedFileEmpty($0) }
dict[1248893260] = { return Api.EncryptedFile.parse_encryptedFile($0) }
dict[1489977929] = { return Api.ChannelBannedRights.parse_channelBannedRights($0) }
@@ -381,10 +378,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[1493171408] = { return Api.HighScore.parse_highScore($0) }
dict[-305282981] = { return Api.TopPeer.parse_topPeer($0) }
dict[986597452] = { return Api.contacts.Link.parse_link($0) }
dict[368997026] = { return Api.SecureValue.parse_secureValueIdentity($0) }
dict[-2012177543] = { return Api.SecureValue.parse_secureValueAddress($0) }
dict[-476811073] = { return Api.SecureValue.parse_secureValuePhone($0) }
dict[903349453] = { return Api.SecureValue.parse_secureValueEmail($0) }
dict[-331270968] = { return Api.SecureValue.parse_secureValue($0) }
dict[-316748368] = { return Api.SecureValueHash.parse_secureValueHash($0) }
dict[1444661369] = { return Api.ContactBlocked.parse_contactBlocked($0) }
dict[-2128698738] = { return Api.auth.CheckedPhone.parse_checkedPhone($0) }
@@ -551,15 +545,21 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-209768682] = { return Api.messages.FavedStickers.parse_favedStickers($0) }
dict[1776236393] = { return Api.ExportedChatInvite.parse_chatInviteEmpty($0) }
dict[-64092740] = { return Api.ExportedChatInvite.parse_chatInviteExported($0) }
dict[1286400196] = { return Api.account.AuthorizationForm.parse_authorizationForm($0) }
dict[-1177300496] = { return Api.account.AuthorizationForm.parse_authorizationForm($0) }
dict[2079516406] = { return Api.Authorization.parse_authorization($0) }
dict[-1361650766] = { return Api.MaskCoords.parse_maskCoords($0) }
dict[-395967805] = { return Api.messages.AllStickers.parse_allStickersNotModified($0) }
dict[-302170017] = { return Api.messages.AllStickers.parse_allStickers($0) }
dict[-1655957568] = { return Api.PhoneConnection.parse_phoneConnection($0) }
dict[-1194283041] = { return Api.AccountDaysTTL.parse_accountDaysTTL($0) }
dict[937056458] = { return Api.SecureValueType.parse_secureValueTypeIdentity($0) }
dict[-1658158621] = { return Api.SecureValueType.parse_secureValueTypePersonalDetails($0) }
dict[1034709504] = { return Api.SecureValueType.parse_secureValueTypePassport($0) }
dict[115615172] = { return Api.SecureValueType.parse_secureValueTypeDriverLicense($0) }
dict[-1596951477] = { return Api.SecureValueType.parse_secureValueTypeIdentityCard($0) }
dict[-874308058] = { return Api.SecureValueType.parse_secureValueTypeAddress($0) }
dict[-63531698] = { return Api.SecureValueType.parse_secureValueTypeUtilityBill($0) }
dict[-1995211763] = { return Api.SecureValueType.parse_secureValueTypeBankStatement($0) }
dict[-1954007928] = { return Api.SecureValueType.parse_secureValueTypeRentalAgreement($0) }
dict[-1289704741] = { return Api.SecureValueType.parse_secureValueTypePhone($0) }
dict[-1908627474] = { return Api.SecureValueType.parse_secureValueTypeEmail($0) }
dict[1587643126] = { return Api.account.Password.parse_noPassword($0) }
@@ -876,10 +876,10 @@ public struct Api {
_1.serialize(buffer, boxed)
case let _1 as Api.ChannelAdminLogEventAction:
_1.serialize(buffer, boxed)
case let _1 as Api.SecureValueVerified:
_1.serialize(buffer, boxed)
case let _1 as Api.auth.ExportedAuthorization:
_1.serialize(buffer, boxed)
case let _1 as Api.SecurePlainData:
_1.serialize(buffer, boxed)
case let _1 as Api.messages.AffectedHistory:
_1.serialize(buffer, boxed)
case let _1 as Api.account.PasswordInputSettings:
@@ -906,8 +906,6 @@ public struct Api {
_1.serialize(buffer, boxed)
case let _1 as Api.account.SentEmailCode:
_1.serialize(buffer, boxed)
case let _1 as Api.SecureValueSaved:
_1.serialize(buffer, boxed)
case let _1 as Api.EncryptedFile:
_1.serialize(buffer, boxed)
case let _1 as Api.ChannelBannedRights:
@@ -9663,25 +9661,43 @@ public struct Api {
}
public enum SecureValueVerified {
case secureValueVerified(date: Int32)
public enum SecurePlainData {
case securePlainPhone(phone: String)
case securePlainEmail(email: String)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .secureValueVerified(let date):
case .securePlainPhone(let phone):
if boxed {
buffer.appendInt32(747528674)
buffer.appendInt32(2103482845)
}
serializeInt32(date, buffer: buffer, boxed: false)
serializeString(phone, buffer: buffer, boxed: false)
break
case .securePlainEmail(let email):
if boxed {
buffer.appendInt32(569137759)
}
serializeString(email, buffer: buffer, boxed: false)
break
}
}
fileprivate static func parse_secureValueVerified(_ reader: BufferReader) -> SecureValueVerified? {
var _1: Int32?
_1 = reader.readInt32()
fileprivate static func parse_securePlainPhone(_ reader: BufferReader) -> SecurePlainData? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
if _c1 {
return Api.SecureValueVerified.secureValueVerified(date: _1!)
return Api.SecurePlainData.securePlainPhone(phone: _1!)
}
else {
return nil
}
}
fileprivate static func parse_securePlainEmail(_ reader: BufferReader) -> SecurePlainData? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
if _c1 {
return Api.SecurePlainData.securePlainEmail(email: _1!)
}
else {
return nil
@@ -9724,102 +9740,58 @@ public struct Api {
}
public enum InputSecureValue {
case inputSecureValueIdentity(data: Api.SecureData, files: [Api.InputSecureFile])
case inputSecureValueAddress(data: Api.SecureData, files: [Api.InputSecureFile])
case inputSecureValuePhone(phone: String)
case inputSecureValueEmail(email: String)
case inputSecureValue(flags: Int32, type: Api.SecureValueType, data: Api.SecureData?, files: [Api.InputSecureFile]?, plainData: Api.SecurePlainData?, selfie: Api.InputSecureFile?)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .inputSecureValueIdentity(let data, let files):
case .inputSecureValue(let flags, let type, let data, let files, let plainData, let selfie):
if boxed {
buffer.appendInt32(156214875)
buffer.appendInt32(-1059442448)
}
data.serialize(buffer, true)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(files.count))
for item in files {
serializeInt32(flags, buffer: buffer, boxed: false)
type.serialize(buffer, true)
if Int(flags) & Int(1 << 0) != 0 {data!.serialize(buffer, true)}
if Int(flags) & Int(1 << 1) != 0 {buffer.appendInt32(481674261)
buffer.appendInt32(Int32(files!.count))
for item in files! {
item.serialize(buffer, true)
}
break
case .inputSecureValueAddress(let data, let files):
if boxed {
buffer.appendInt32(-1771531435)
}
data.serialize(buffer, true)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(files.count))
for item in files {
item.serialize(buffer, true)
}
break
case .inputSecureValuePhone(let phone):
if boxed {
buffer.appendInt32(-1654506090)
}
serializeString(phone, buffer: buffer, boxed: false)
break
case .inputSecureValueEmail(let email):
if boxed {
buffer.appendInt32(-1635232935)
}
serializeString(email, buffer: buffer, boxed: false)
}}
if Int(flags) & Int(1 << 2) != 0 {plainData!.serialize(buffer, true)}
if Int(flags) & Int(1 << 3) != 0 {selfie!.serialize(buffer, true)}
break
}
}
fileprivate static func parse_inputSecureValueIdentity(_ reader: BufferReader) -> InputSecureValue? {
var _1: Api.SecureData?
fileprivate static func parse_inputSecureValue(_ reader: BufferReader) -> InputSecureValue? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Api.SecureValueType?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.SecureData
}
var _2: [Api.InputSecureFile]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.InputSecureFile.self)
_2 = Api.parse(reader, signature: signature) as? Api.SecureValueType
}
var _3: Api.SecureData?
if Int(_1!) & Int(1 << 0) != 0 {if let signature = reader.readInt32() {
_3 = Api.parse(reader, signature: signature) as? Api.SecureData
} }
var _4: [Api.InputSecureFile]?
if Int(_1!) & Int(1 << 1) != 0 {if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.InputSecureFile.self)
} }
var _5: Api.SecurePlainData?
if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() {
_5 = Api.parse(reader, signature: signature) as? Api.SecurePlainData
} }
var _6: Api.InputSecureFile?
if Int(_1!) & Int(1 << 3) != 0 {if let signature = reader.readInt32() {
_6 = Api.parse(reader, signature: signature) as? Api.InputSecureFile
} }
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.InputSecureValue.inputSecureValueIdentity(data: _1!, files: _2!)
}
else {
return nil
}
}
fileprivate static func parse_inputSecureValueAddress(_ reader: BufferReader) -> InputSecureValue? {
var _1: Api.SecureData?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.SecureData
}
var _2: [Api.InputSecureFile]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.InputSecureFile.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.InputSecureValue.inputSecureValueAddress(data: _1!, files: _2!)
}
else {
return nil
}
}
fileprivate static func parse_inputSecureValuePhone(_ reader: BufferReader) -> InputSecureValue? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
if _c1 {
return Api.InputSecureValue.inputSecureValuePhone(phone: _1!)
}
else {
return nil
}
}
fileprivate static func parse_inputSecureValueEmail(_ reader: BufferReader) -> InputSecureValue? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
if _c1 {
return Api.InputSecureValue.inputSecureValueEmail(email: _1!)
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 2) == 0) || _5 != nil
let _c6 = (Int(_1!) & Int(1 << 3) == 0) || _6 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
return Api.InputSecureValue.inputSecureValue(flags: _1!, type: _2!, data: _3, files: _4, plainData: _5, selfie: _6)
}
else {
return nil
@@ -10013,40 +9985,6 @@ public struct Api {
}
}
public enum SecureValueSaved {
case secureValueSaved(files: [Api.SecureFile])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .secureValueSaved(let files):
if boxed {
buffer.appendInt32(-921407415)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(files.count))
for item in files {
item.serialize(buffer, true)
}
break
}
}
fileprivate static func parse_secureValueSaved(_ reader: BufferReader) -> SecureValueSaved? {
var _1: [Api.SecureFile]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.SecureFile.self)
}
let _c1 = _1 != nil
if _c1 {
return Api.SecureValueSaved.secureValueSaved(files: _1!)
}
else {
return nil
}
}
}
public enum EncryptedFile {
@@ -10404,142 +10342,62 @@ public struct Api {
}
public enum SecureValue {
case secureValueIdentity(flags: Int32, data: Api.SecureData, files: [Api.SecureFile], verified: Api.SecureValueVerified?)
case secureValueAddress(flags: Int32, data: Api.SecureData, files: [Api.SecureFile], verified: Api.SecureValueVerified?)
case secureValuePhone(flags: Int32, phone: String, verified: Api.SecureValueVerified?)
case secureValueEmail(flags: Int32, email: String, verified: Api.SecureValueVerified?)
case secureValue(flags: Int32, type: Api.SecureValueType, data: Api.SecureData?, files: [Api.SecureFile]?, plainData: Api.SecurePlainData?, selfie: Api.SecureFile?, hash: Buffer)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .secureValueIdentity(let flags, let data, let files, let verified):
case .secureValue(let flags, let type, let data, let files, let plainData, let selfie, let hash):
if boxed {
buffer.appendInt32(368997026)
buffer.appendInt32(-331270968)
}
serializeInt32(flags, buffer: buffer, boxed: false)
data.serialize(buffer, true)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(files.count))
for item in files {
type.serialize(buffer, true)
if Int(flags) & Int(1 << 0) != 0 {data!.serialize(buffer, true)}
if Int(flags) & Int(1 << 1) != 0 {buffer.appendInt32(481674261)
buffer.appendInt32(Int32(files!.count))
for item in files! {
item.serialize(buffer, true)
}
if Int(flags) & Int(1 << 0) != 0 {verified!.serialize(buffer, true)}
break
case .secureValueAddress(let flags, let data, let files, let verified):
if boxed {
buffer.appendInt32(-2012177543)
}
serializeInt32(flags, buffer: buffer, boxed: false)
data.serialize(buffer, true)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(files.count))
for item in files {
item.serialize(buffer, true)
}
if Int(flags) & Int(1 << 0) != 0 {verified!.serialize(buffer, true)}
break
case .secureValuePhone(let flags, let phone, let verified):
if boxed {
buffer.appendInt32(-476811073)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeString(phone, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {verified!.serialize(buffer, true)}
break
case .secureValueEmail(let flags, let email, let verified):
if boxed {
buffer.appendInt32(903349453)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeString(email, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {verified!.serialize(buffer, true)}
}}
if Int(flags) & Int(1 << 2) != 0 {plainData!.serialize(buffer, true)}
if Int(flags) & Int(1 << 3) != 0 {selfie!.serialize(buffer, true)}
serializeBytes(hash, buffer: buffer, boxed: false)
break
}
}
fileprivate static func parse_secureValueIdentity(_ reader: BufferReader) -> SecureValue? {
fileprivate static func parse_secureValue(_ reader: BufferReader) -> SecureValue? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Api.SecureData?
var _2: Api.SecureValueType?
if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.SecureData
_2 = Api.parse(reader, signature: signature) as? Api.SecureValueType
}
var _3: [Api.SecureFile]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.SecureFile.self)
}
var _4: Api.SecureValueVerified?
var _3: Api.SecureData?
if Int(_1!) & Int(1 << 0) != 0 {if let signature = reader.readInt32() {
_4 = Api.parse(reader, signature: signature) as? Api.SecureValueVerified
_3 = Api.parse(reader, signature: signature) as? Api.SecureData
} }
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.SecureValue.secureValueIdentity(flags: _1!, data: _2!, files: _3!, verified: _4)
}
else {
return nil
}
}
fileprivate static func parse_secureValueAddress(_ reader: BufferReader) -> SecureValue? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Api.SecureData?
if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.SecureData
}
var _3: [Api.SecureFile]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.SecureFile.self)
}
var _4: Api.SecureValueVerified?
if Int(_1!) & Int(1 << 0) != 0 {if let signature = reader.readInt32() {
_4 = Api.parse(reader, signature: signature) as? Api.SecureValueVerified
var _4: [Api.SecureFile]?
if Int(_1!) & Int(1 << 1) != 0 {if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.SecureFile.self)
} }
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.SecureValue.secureValueAddress(flags: _1!, data: _2!, files: _3!, verified: _4)
}
else {
return nil
}
}
fileprivate static func parse_secureValuePhone(_ reader: BufferReader) -> SecureValue? {
var _1: Int32?
_1 = reader.readInt32()
var _2: String?
_2 = parseString(reader)
var _3: Api.SecureValueVerified?
if Int(_1!) & Int(1 << 0) != 0 {if let signature = reader.readInt32() {
_3 = Api.parse(reader, signature: signature) as? Api.SecureValueVerified
var _5: Api.SecurePlainData?
if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() {
_5 = Api.parse(reader, signature: signature) as? Api.SecurePlainData
} }
var _6: Api.SecureFile?
if Int(_1!) & Int(1 << 3) != 0 {if let signature = reader.readInt32() {
_6 = Api.parse(reader, signature: signature) as? Api.SecureFile
} }
var _7: Buffer?
_7 = parseBytes(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
if _c1 && _c2 && _c3 {
return Api.SecureValue.secureValuePhone(flags: _1!, phone: _2!, verified: _3)
}
else {
return nil
}
}
fileprivate static func parse_secureValueEmail(_ reader: BufferReader) -> SecureValue? {
var _1: Int32?
_1 = reader.readInt32()
var _2: String?
_2 = parseString(reader)
var _3: Api.SecureValueVerified?
if Int(_1!) & Int(1 << 0) != 0 {if let signature = reader.readInt32() {
_3 = Api.parse(reader, signature: signature) as? Api.SecureValueVerified
} }
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
if _c1 && _c2 && _c3 {
return Api.SecureValue.secureValueEmail(flags: _1!, email: _2!, verified: _3)
let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 2) == 0) || _5 != nil
let _c6 = (Int(_1!) & Int(1 << 3) == 0) || _6 != nil
let _c7 = _7 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
return Api.SecureValue.secureValue(flags: _1!, type: _2!, data: _3, files: _4, plainData: _5, selfie: _6, hash: _7!)
}
else {
return nil
@@ -14584,16 +14442,40 @@ public struct Api {
}
public enum SecureValueType {
case secureValueTypeIdentity
case secureValueTypePersonalDetails
case secureValueTypePassport
case secureValueTypeDriverLicense
case secureValueTypeIdentityCard
case secureValueTypeAddress
case secureValueTypeUtilityBill
case secureValueTypeBankStatement
case secureValueTypeRentalAgreement
case secureValueTypePhone
case secureValueTypeEmail
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .secureValueTypeIdentity:
case .secureValueTypePersonalDetails:
if boxed {
buffer.appendInt32(937056458)
buffer.appendInt32(-1658158621)
}
break
case .secureValueTypePassport:
if boxed {
buffer.appendInt32(1034709504)
}
break
case .secureValueTypeDriverLicense:
if boxed {
buffer.appendInt32(115615172)
}
break
case .secureValueTypeIdentityCard:
if boxed {
buffer.appendInt32(-1596951477)
}
break
@@ -14602,6 +14484,24 @@ public struct Api {
buffer.appendInt32(-874308058)
}
break
case .secureValueTypeUtilityBill:
if boxed {
buffer.appendInt32(-63531698)
}
break
case .secureValueTypeBankStatement:
if boxed {
buffer.appendInt32(-1995211763)
}
break
case .secureValueTypeRentalAgreement:
if boxed {
buffer.appendInt32(-1954007928)
}
break
case .secureValueTypePhone:
if boxed {
@@ -14617,12 +14517,30 @@ public struct Api {
break
}
}
fileprivate static func parse_secureValueTypeIdentity(_ reader: BufferReader) -> SecureValueType? {
return Api.SecureValueType.secureValueTypeIdentity
fileprivate static func parse_secureValueTypePersonalDetails(_ reader: BufferReader) -> SecureValueType? {
return Api.SecureValueType.secureValueTypePersonalDetails
}
fileprivate static func parse_secureValueTypePassport(_ reader: BufferReader) -> SecureValueType? {
return Api.SecureValueType.secureValueTypePassport
}
fileprivate static func parse_secureValueTypeDriverLicense(_ reader: BufferReader) -> SecureValueType? {
return Api.SecureValueType.secureValueTypeDriverLicense
}
fileprivate static func parse_secureValueTypeIdentityCard(_ reader: BufferReader) -> SecureValueType? {
return Api.SecureValueType.secureValueTypeIdentityCard
}
fileprivate static func parse_secureValueTypeAddress(_ reader: BufferReader) -> SecureValueType? {
return Api.SecureValueType.secureValueTypeAddress
}
fileprivate static func parse_secureValueTypeUtilityBill(_ reader: BufferReader) -> SecureValueType? {
return Api.SecureValueType.secureValueTypeUtilityBill
}
fileprivate static func parse_secureValueTypeBankStatement(_ reader: BufferReader) -> SecureValueType? {
return Api.SecureValueType.secureValueTypeBankStatement
}
fileprivate static func parse_secureValueTypeRentalAgreement(_ reader: BufferReader) -> SecureValueType? {
return Api.SecureValueType.secureValueTypeRentalAgreement
}
fileprivate static func parse_secureValueTypePhone(_ reader: BufferReader) -> SecureValueType? {
return Api.SecureValueType.secureValueTypePhone
}
@@ -19097,14 +19015,15 @@ public struct Api {
}
public enum AuthorizationForm {
case authorizationForm(requiredTypes: [Api.SecureValueType], values: [Api.SecureValue], users: [Api.User])
case authorizationForm(flags: Int32, requiredTypes: [Api.SecureValueType], values: [Api.SecureValue], users: [Api.User], privacyPolicyUrl: String?)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .authorizationForm(let requiredTypes, let values, let users):
case .authorizationForm(let flags, let requiredTypes, let values, let users, let privacyPolicyUrl):
if boxed {
buffer.appendInt32(1286400196)
buffer.appendInt32(-1177300496)
}
serializeInt32(flags, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(requiredTypes.count))
for item in requiredTypes {
@@ -19120,27 +19039,34 @@ public struct Api {
for item in users {
item.serialize(buffer, true)
}
if Int(flags) & Int(1 << 0) != 0 {serializeString(privacyPolicyUrl!, buffer: buffer, boxed: false)}
break
}
}
fileprivate static func parse_authorizationForm(_ reader: BufferReader) -> AuthorizationForm? {
var _1: [Api.SecureValueType]?
var _1: Int32?
_1 = reader.readInt32()
var _2: [Api.SecureValueType]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.SecureValueType.self)
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.SecureValueType.self)
}
var _2: [Api.SecureValue]?
var _3: [Api.SecureValue]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.SecureValue.self)
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.SecureValue.self)
}
var _3: [Api.User]?
var _4: [Api.User]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
var _5: String?
if Int(_1!) & Int(1 << 0) != 0 {_5 = parseString(reader) }
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.account.AuthorizationForm.authorizationForm(requiredTypes: _1!, values: _2!, users: _3!)
let _c4 = _4 != nil
let _c5 = (Int(_1!) & Int(1 << 0) == 0) || _5 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 {
return Api.account.AuthorizationForm.authorizationForm(flags: _1!, requiredTypes: _2!, values: _3!, users: _4!, privacyPolicyUrl: _5)
}
else {
return nil
@@ -19445,6 +19371,7 @@ public struct Api {
}
}
public struct functions {
public struct messages {
public static func getDialogs(flags: Int32, offsetDate: Int32, offsetId: Int32, offsetPeer: Api.InputPeer, limit: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.Dialogs?) {
@@ -23073,16 +23000,15 @@ public struct Api {
})
}
public static func getSecureValue(userId: Api.InputUser, types: [Api.SecureValueType]) -> (CustomStringConvertible, Buffer, (Buffer) -> [Api.SecureValue]?) {
public static func getSecureValue(types: [Api.SecureValueType]) -> (CustomStringConvertible, Buffer, (Buffer) -> [Api.SecureValue]?) {
let buffer = Buffer()
buffer.appendInt32(-646023221)
userId.serialize(buffer, true)
buffer.appendInt32(1936088002)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(types.count))
for item in types {
item.serialize(buffer, true)
}
return (FunctionDescription({return "(account.getSecureValue userId: \(userId), types: \(types))"}), buffer, { (buffer: Buffer) -> [Api.SecureValue]? in
return (FunctionDescription({return "(account.getSecureValue types: \(types))"}), buffer, { (buffer: Buffer) -> [Api.SecureValue]? in
let reader = BufferReader(buffer)
var result: [Api.SecureValue]?
if let _ = reader.readInt32() {
@@ -23092,16 +23018,16 @@ public struct Api {
})
}
public static func saveSecureValue(value: Api.InputSecureValue, secureSecretId: Int64) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.SecureValueSaved?) {
public static func saveSecureValue(value: Api.InputSecureValue, secureSecretId: Int64) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.SecureValue?) {
let buffer = Buffer()
buffer.appendInt32(2023136523)
buffer.appendInt32(-1986010339)
value.serialize(buffer, true)
serializeInt64(secureSecretId, buffer: buffer, boxed: false)
return (FunctionDescription({return "(account.saveSecureValue value: \(value), secureSecretId: \(secureSecretId))"}), buffer, { (buffer: Buffer) -> Api.SecureValueSaved? in
return (FunctionDescription({return "(account.saveSecureValue value: \(value), secureSecretId: \(secureSecretId))"}), buffer, { (buffer: Buffer) -> Api.SecureValue? in
let reader = BufferReader(buffer)
var result: Api.SecureValueSaved?
var result: Api.SecureValue?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.SecureValueSaved
result = Api.parse(reader, signature: signature) as? Api.SecureValue
}
return result
})

View File

@@ -9,47 +9,85 @@ import Foundation
import SwiftSignalKit
#endif
func apiSecureValueType(value: SecureIdValue) -> Api.SecureValueType {
let type: Api.SecureValueType
switch value {
case .personalDetails:
type = .secureValueTypePersonalDetails
case .passport:
type = .secureValueTypePassport
case .driversLicense:
type = .secureValueTypeDriverLicense
case .idCard:
type = .secureValueTypeIdentityCard
case .address:
type = .secureValueTypeAddress
case .bankStatement:
type = .secureValueTypeBankStatement
case .utilityBill:
type = .secureValueTypeUtilityBill
case .rentalAgreement:
type = .secureValueTypeRentalAgreement
case .phone:
type = .secureValueTypePhone
case .email:
type = .secureValueTypeEmail
}
return type
}
private func credentialsValueTypeName(value: SecureIdValue) -> String {
switch value {
case .personalDetails:
return "personal_details"
case .passport:
return "passport"
case .driversLicense:
return "driver_license"
case .idCard:
return "identity_card"
case .address:
return "address"
case .bankStatement:
return "bank_statement"
case .utilityBill:
return "utility_bill"
case .rentalAgreement:
return "rental_agreement"
case .phone:
return "phone"
case .email:
return "email"
}
}
private func generateCredentials(values: [SecureIdValueWithContext], opaquePayload: Data) -> Data? {
var dict: [String: Any] = [:]
var secureData: [String: Any] = [:]
for value in values {
switch value.value {
case .identity:
guard let encryptedMetadata = value.encryptedMetadata else {
return nil
}
var identity: [String: Any] = [:]
identity["data"] = ["data_hash": encryptedMetadata.valueDataHash.base64EncodedString()] as [String: Any]
if !encryptedMetadata.fileHashes.isEmpty {
var files: [[String: Any]] = []
for fileHash in encryptedMetadata.fileHashes {
files.append(["file_hash": fileHash.base64EncodedString()])
}
identity["files"] = files
}
identity["secret"] = encryptedMetadata.valueSecret.base64EncodedString()
dict["identity"] = identity
case .address:
guard let encryptedMetadata = value.encryptedMetadata else {
return nil
}
var identity: [String: Any] = [:]
identity["data"] = ["data_hash": encryptedMetadata.valueDataHash.base64EncodedString()] as [String: Any]
if !encryptedMetadata.fileHashes.isEmpty {
var files: [[String: Any]] = []
for fileHash in encryptedMetadata.fileHashes {
files.append(["file_hash": fileHash.base64EncodedString()])
}
identity["files"] = files
}
identity["secret"] = encryptedMetadata.valueSecret.base64EncodedString()
dict["address"] = identity
case .email, .phone:
guard value.encryptedMetadata == nil else {
return nil
if let encryptedMetadata = value.encryptedMetadata {
var valueDict: [String: Any] = [:]
valueDict["data"] = [
"data_hash": encryptedMetadata.valueDataHash.base64EncodedString(),
"secret": encryptedMetadata.decryptedSecret.base64EncodedString()
] as [String: Any]
if !encryptedMetadata.files.isEmpty {
valueDict["files"] = encryptedMetadata.files.map { file -> [String: Any] in
return [
"file_hash": file.hash.base64EncodedString(),
"secret": file.secret.base64EncodedString()
]
}
}
secureData[credentialsValueTypeName(value: value.value)] = valueDict
}
}
var dict: [String: Any] = [:]
dict["secure_data"] = secureData
if !opaquePayload.isEmpty, let opaquePayload = String(data: opaquePayload, encoding: .utf8) {
dict["payload"] = opaquePayload
}
@@ -73,69 +111,6 @@ private func encryptedCredentialsData(data: Data, secretData: Data) -> (data: Da
return (encryptedData, hash)
}
private func valueHash(_ value: SecureIdValueWithContext) -> Api.SecureValueHash? {
switch value.value {
case let .identity(identity):
guard let encryptedMetadata = value.encryptedMetadata else {
return nil
}
guard let files = identity.serialize()?.1 else {
return nil
}
var hashData = Data()
hashData.append(encryptedMetadata.valueDataHash)
hashData.append(encryptedMetadata.encryptedSecret)
for file in files {
switch file {
case let .remote(file):
hashData.append(file.fileHash)
hashData.append(file.encryptedSecret)
case let .uploaded(file):
hashData.append(file.fileHash)
hashData.append(file.encryptedSecret)
}
}
let hash = sha256Digest(hashData)
return .secureValueHash(type: .secureValueTypeIdentity, hash: Buffer(data: hash))
case let .address(address):
guard let encryptedMetadata = value.encryptedMetadata else {
return nil
}
guard let files = address.serialize()?.1 else {
return nil
}
var hashData = Data()
hashData.append(encryptedMetadata.valueDataHash)
hashData.append(encryptedMetadata.encryptedSecret)
for file in files {
switch file {
case let .remote(file):
hashData.append(file.fileHash)
hashData.append(file.encryptedSecret)
case let .uploaded(file):
hashData.append(file.fileHash)
hashData.append(file.encryptedSecret)
}
}
let hash = sha256Digest(hashData)
return .secureValueHash(type: .secureValueTypeAddress, hash: Buffer(data: hash))
case let .phone(phone):
guard let phoneData = phone.phone.data(using: .utf8) else {
return nil
}
return .secureValueHash(type: .secureValueTypePhone, hash: Buffer(data: sha256Digest(phoneData)))
case let .email(email):
guard let emailData = email.email.data(using: .utf8) else {
return nil
}
return .secureValueHash(type: .secureValueTypeEmail, hash: Buffer(data: sha256Digest(emailData)))
}
}
public enum GrantSecureIdAccessError {
case generic
}
@@ -159,10 +134,7 @@ public func grantSecureIdAccess(network: Network, peerId: PeerId, publicKey: Str
var valueHashes: [Api.SecureValueHash] = []
for value in values {
guard let hash = valueHash(value) else {
return .fail(.generic)
}
valueHashes.append(hash)
valueHashes.append(.secureValueHash(type: apiSecureValueType(value: value.value), hash: Buffer(data: value.opaqueHash)))
}
return network.request(Api.functions.account.acceptAuthorization(botId: peerId.id, scope: scope, publicKey: publicKey, valueHashes: valueHashes, credentials: .secureCredentialsEncrypted(data: Buffer(data: encryptedCredentialsData), hash: Buffer(data: decryptedCredentialsHash), secret: Buffer(data: encryptedSecretData))))

View File

@@ -13,12 +13,24 @@ public enum RequestSecureIdFormError {
case generic
}
private func parseSecureValueType(_ type: Api.SecureValueType) -> SecureIdRequestedFormField {
private func parseSecureValueType(_ type: Api.SecureValueType, selfie: Bool) -> SecureIdRequestedFormField {
switch type {
case .secureValueTypeIdentity:
return .identity
case .secureValueTypePersonalDetails:
return .personalDetails
case .secureValueTypePassport:
return .passport(selfie: selfie)
case .secureValueTypeDriverLicense:
return .driversLicense(selfie: selfie)
case .secureValueTypeIdentityCard:
return .idCard(selfie: selfie)
case .secureValueTypeAddress:
return .address
case .secureValueTypeUtilityBill:
return .utilityBill
case .secureValueTypeBankStatement:
return .bankStatement
case .secureValueTypeRentalAgreement:
return .rentalAgreement
case .secureValueTypePhone:
return .phone
case .secureValueTypeEmail:
@@ -39,60 +51,137 @@ struct ParsedSecureValue {
func parseSecureValue(context: SecureIdAccessContext, value: Api.SecureValue) -> ParsedSecureValue? {
switch value {
case let .secureValueIdentity(_, data, files, verified):
let (encryptedData, decryptedHash, encryptedSecret) = parseSecureData(data)
guard let valueContext = decryptedSecureValueAccessContext(context: context, encryptedSecret: encryptedSecret, decryptedDataHash: decryptedHash) else {
return nil
}
let parsedFileReferences = files.map(SecureIdFileReference.init).flatMap({ $0 })
let parsedFileHashes = parsedFileReferences.map { $0.fileHash }
case let .secureValue(_, type, data, files, plainData, selfie, hash):
let parsedFileReferences = files.flatMap { $0.compactMap(SecureIdFileReference.init) } ?? []
let parsedFiles = parsedFileReferences.map(SecureIdVerificationDocumentReference.remote)
let parsedSelfie = selfie.flatMap(SecureIdFileReference.init).flatMap(SecureIdVerificationDocumentReference.remote)
guard let decryptedData = decryptedSecureValueData(context: valueContext, encryptedData: encryptedData, decryptedDataHash: decryptedHash) else {
return nil
}
guard let value = SecureIdIdentityValue(data: decryptedData, fileReferences: parsedFiles) else {
return nil
}
return ParsedSecureValue(valueWithContext: SecureIdValueWithContext(value: .identity(value), context: valueContext, encryptedMetadata: SecureIdEncryptedValueMetadata(valueDataHash: decryptedHash, fileHashes: parsedFileHashes, valueSecret: valueContext.secret, encryptedSecret: encryptedSecret)))
case let .secureValueAddress(_, data, files, verified):
let (encryptedData, decryptedHash, encryptedSecret) = parseSecureData(data)
guard let valueContext = decryptedSecureValueAccessContext(context: context, encryptedSecret: encryptedSecret, decryptedDataHash: decryptedHash) else {
return nil
let decryptedData: Data?
let encryptedMetadata: SecureIdEncryptedValueMetadata?
if let data = data {
let (encryptedData, decryptedHash, encryptedSecret) = parseSecureData(data)
guard let valueContext = decryptedSecureValueAccessContext(context: context, encryptedSecret: encryptedSecret, decryptedDataHash: decryptedHash) else {
return nil
}
decryptedData = decryptedSecureValueData(context: valueContext, encryptedData: encryptedData, decryptedDataHash: decryptedHash)
if decryptedData == nil {
return nil
}
var parsedFileMetadata: [SecureIdEncryptedValueFileMetadata] = []
for file in parsedFileReferences {
guard let fileSecret = decryptedSecureIdFileSecret(context: context, fileHash: file.fileHash, encryptedSecret: file.encryptedSecret) else {
return nil
}
parsedFileMetadata.append(SecureIdEncryptedValueFileMetadata(hash: file.fileHash, secret: fileSecret))
}
encryptedMetadata = SecureIdEncryptedValueMetadata(valueDataHash: decryptedHash, decryptedSecret: valueContext.secret, files: parsedFileMetadata)
} else {
decryptedData = nil
encryptedMetadata = nil
}
let parsedFileReferences = files.map(SecureIdFileReference.init).flatMap({ $0 })
let parsedFileHashes = parsedFileReferences.map { $0.fileHash }
let parsedFiles = parsedFileReferences.map(SecureIdVerificationDocumentReference.remote)
let value: SecureIdValue
guard let decryptedData = decryptedSecureValueData(context: valueContext, encryptedData: encryptedData, decryptedDataHash: decryptedHash) else {
return nil
switch type {
case .secureValueTypePersonalDetails:
guard let dict = (try? JSONSerialization.jsonObject(with: decryptedData ?? Data(), options: [])) as? [String: Any] else {
return nil
}
guard let personalDetails = SecureIdPersonalDetailsValue(dict: dict, fileReferences: parsedFiles) else {
return nil
}
value = .personalDetails(personalDetails)
case .secureValueTypePassport:
guard let dict = (try? JSONSerialization.jsonObject(with: decryptedData ?? Data(), options: [])) as? [String: Any] else {
return nil
}
guard let passport = SecureIdPassportValue(dict: dict, fileReferences: parsedFiles, selfieDocument: parsedSelfie) else {
return nil
}
value = .passport(passport)
case .secureValueTypeDriverLicense:
guard let dict = (try? JSONSerialization.jsonObject(with: decryptedData ?? Data(), options: [])) as? [String: Any] else {
return nil
}
guard let driversLicense = SecureIdDriversLicenseValue(dict: dict, fileReferences: parsedFiles, selfieDocument: parsedSelfie) else {
return nil
}
value = .driversLicense(driversLicense)
case .secureValueTypeIdentityCard:
guard let dict = (try? JSONSerialization.jsonObject(with: decryptedData ?? Data(), options: [])) as? [String: Any] else {
return nil
}
guard let idCard = SecureIdIDCardValue(dict: dict, fileReferences: parsedFiles, selfieDocument: parsedSelfie) else {
return nil
}
value = .idCard(idCard)
case .secureValueTypeAddress:
guard let dict = (try? JSONSerialization.jsonObject(with: decryptedData ?? Data(), options: [])) as? [String: Any] else {
return nil
}
guard let address = SecureIdAddressValue(dict: dict, fileReferences: parsedFiles) else {
return nil
}
value = .address(address)
case .secureValueTypeUtilityBill:
guard let dict = (try? JSONSerialization.jsonObject(with: decryptedData ?? Data(), options: [])) as? [String: Any] else {
return nil
}
guard let utilityBill = SecureIdUtilityBillValue(dict: dict, fileReferences: parsedFiles) else {
return nil
}
value = .utilityBill(utilityBill)
case .secureValueTypeBankStatement:
guard let dict = (try? JSONSerialization.jsonObject(with: decryptedData ?? Data(), options: [])) as? [String: Any] else {
return nil
}
guard let bankStatement = SecureIdBankStatementValue(dict: dict, fileReferences: parsedFiles) else {
return nil
}
value = .bankStatement(bankStatement)
case .secureValueTypeRentalAgreement:
guard let dict = (try? JSONSerialization.jsonObject(with: decryptedData ?? Data(), options: [])) as? [String: Any] else {
return nil
}
guard let rentalAgreement = SecureIdRentalAgreementValue(dict: dict, fileReferences: parsedFiles) else {
return nil
}
value = .rentalAgreement(rentalAgreement)
case .secureValueTypePhone:
guard let publicData = plainData else {
return nil
}
switch publicData {
case let .securePlainPhone(phone):
value = .phone(SecureIdPhoneValue(phone: phone))
default:
return nil
}
case .secureValueTypeEmail:
guard let publicData = plainData else {
return nil
}
switch publicData {
case let .securePlainEmail(email):
value = .email(SecureIdEmailValue(email: email))
default:
return nil
}
}
guard let value = SecureIdAddressValue(data: decryptedData, fileReferences: parsedFiles) else {
return nil
}
return ParsedSecureValue(valueWithContext: SecureIdValueWithContext(value: .address(value), context: valueContext, encryptedMetadata: SecureIdEncryptedValueMetadata(valueDataHash: decryptedHash, fileHashes: parsedFileHashes, valueSecret: valueContext.secret, encryptedSecret: encryptedSecret)))
case let .secureValuePhone(_, phone, verified):
guard let phoneData = phone.data(using: .utf8) else {
return nil
}
return ParsedSecureValue(valueWithContext: SecureIdValueWithContext(value: .phone(SecureIdPhoneValue(phone: phone)), context: SecureIdValueAccessContext(secret: Data(), id: 0), encryptedMetadata: nil))
case let .secureValueEmail(_, email, verified):
guard let emailData = email.data(using: .utf8) else {
return nil
}
return ParsedSecureValue(valueWithContext: SecureIdValueWithContext(value: .email(SecureIdEmailValue(email: email)), context: SecureIdValueAccessContext(secret: Data(), id: 0), encryptedMetadata: nil))
return ParsedSecureValue(valueWithContext: SecureIdValueWithContext(value: value, encryptedMetadata: encryptedMetadata, opaqueHash: hash.makeData()))
}
}
private func parseSecureValues(context: SecureIdAccessContext, values: [Api.SecureValue]) -> [SecureIdValueWithContext] {
return values.map({ parseSecureValue(context: context, value: $0) }).flatMap({ $0?.valueWithContext })
return values.map({ parseSecureValue(context: context, value: $0) }).compactMap({ $0?.valueWithContext })
}
public struct EncryptedSecureIdForm {
public let peerId: PeerId
public let requestedFields: [SecureIdRequestedFormField]
public let termsUrl: String?
let encryptedValues: [Api.SecureValue]
}
@@ -108,7 +197,7 @@ public func requestSecureIdForm(postbox: Postbox, network: Network, peerId: Peer
|> mapToSignal { result -> Signal<EncryptedSecureIdForm, RequestSecureIdFormError> in
return postbox.modify { modifier -> EncryptedSecureIdForm in
switch result {
case let .authorizationForm(requiredTypes, values, users):
case let .authorizationForm(flags, requiredTypes, values, users, termsUrl):
var peers: [Peer] = []
for user in users {
let parsed = TelegramUser(user: user)
@@ -118,7 +207,9 @@ public func requestSecureIdForm(postbox: Postbox, network: Network, peerId: Peer
return updated
})
return EncryptedSecureIdForm(peerId: peerId, requestedFields: requiredTypes.map(parseSecureValueType), encryptedValues: values)
return EncryptedSecureIdForm(peerId: peerId, requestedFields: requiredTypes.map {
return parseSecureValueType($0, selfie: (flags & 1 << 1) != 0)
}, termsUrl: termsUrl, encryptedValues: values)
}
} |> mapError { _ in return RequestSecureIdFormError.generic }
}

View File

@@ -14,39 +14,13 @@ public enum SaveSecureIdValueError {
case verificationRequired
}
func paddedSecureIdData(_ data: Data) -> Data {
var paddingCount = Int(47 + arc4random_uniform(255 - 47))
paddingCount -= ((data.count + paddingCount) % 16)
var result = Data(count: paddingCount + data.count)
result.withUnsafeMutableBytes { (bytes: UnsafeMutablePointer<UInt8>) -> Void in
bytes.advanced(by: 0).pointee = UInt8(paddingCount)
arc4random_buf(bytes.advanced(by: 1), paddingCount - 1)
data.withUnsafeBytes { (source: UnsafePointer<UInt8>) -> Void in
memcpy(bytes.advanced(by: paddingCount), source, data.count)
}
}
return result
}
func unpaddedSecureIdData(_ data: Data) -> Data? {
var paddingCount: UInt8 = 0
data.copyBytes(to: &paddingCount, count: 1)
if paddingCount < 0 || paddingCount > data.count {
return nil
}
return data.subdata(in: Int(paddingCount) ..< data.count)
}
struct EncryptedSecureData {
let data: Data
let dataHash: Data
let hash: Data
let encryptedSecret: Data
}
func encryptedSecureValueData(context: SecureIdAccessContext, valueContext: SecureIdValueAccessContext, data: Data, files: [SecureIdVerificationDocumentReference]) -> EncryptedSecureData? {
func encryptedSecureValueData(context: SecureIdAccessContext, valueContext: SecureIdValueAccessContext, data: Data) -> EncryptedSecureData? {
let valueData = paddedSecureIdData(data)
let valueHash = sha256Digest(valueData)
@@ -66,20 +40,7 @@ func encryptedSecureValueData(context: SecureIdAccessContext, valueContext: Secu
return nil
}
var hashData = valueHash + encryptedValueSecret
for file in files {
switch file {
case let .remote(file):
hashData.append(file.fileHash)
hashData.append(file.encryptedSecret)
case let .uploaded(file):
hashData.append(file.fileHash)
hashData.append(file.encryptedSecret)
}
}
let hash = sha256Digest(hashData)
return EncryptedSecureData(data: encryptedValueData, dataHash: valueHash, hash: hash, encryptedSecret: encryptedValueSecret)
return EncryptedSecureData(data: encryptedValueData, dataHash: valueHash, encryptedSecret: encryptedValueSecret)
}
func decryptedSecureValueAccessContext(context: SecureIdAccessContext, encryptedSecret: Data, decryptedDataHash: Data) -> SecureIdValueAccessContext? {
@@ -126,122 +87,140 @@ func decryptedSecureValueData(context: SecureIdValueAccessContext, encryptedData
return unpaddedValueData
}
private func makeInputSecureValue(context: SecureIdAccessContext, valueContext: SecureIdValueAccessContext, value: SecureIdValue) -> Api.InputSecureValue? {
switch value {
case .identity:
guard let (decryptedData, fileReferences) = value.serialize() else {
return nil
}
guard let encryptedData = encryptedSecureValueData(context: context, valueContext: valueContext, data: decryptedData, files: fileReferences) else {
return nil
}
guard let checkValueContext = decryptedSecureValueAccessContext(context: context, encryptedSecret: encryptedData.encryptedSecret, decryptedDataHash: encryptedData.dataHash) else {
return nil
}
if checkValueContext != valueContext {
return nil
}
if let checkData = decryptedSecureValueData(context: checkValueContext, encryptedData: encryptedData.data, decryptedDataHash: encryptedData.dataHash) {
if checkData != decryptedData {
return nil
}
} else {
return nil
}
let files = fileReferences.map { file -> Api.InputSecureFile in
switch file {
case let .remote(file):
return Api.InputSecureFile.inputSecureFile(id: file.id, accessHash: file.accessHash)
case let .uploaded(file):
return Api.InputSecureFile.inputSecureFileUploaded(id: file.id, parts: file.parts, md5Checksum: file.md5Checksum, fileHash: Buffer(data: file.fileHash), secret: Buffer(data: file.encryptedSecret))
}
}
return Api.InputSecureValue.inputSecureValueIdentity(data: Api.SecureData.secureData(data: Buffer(data: encryptedData.data), dataHash: Buffer(data: encryptedData.dataHash), secret: Buffer(data: encryptedData.encryptedSecret)), files: files)
case .address:
guard let (decryptedData, fileReferences) = value.serialize() else {
return nil
}
guard let encryptedData = encryptedSecureValueData(context: context, valueContext: valueContext, data: decryptedData, files: fileReferences) else {
return nil
}
guard let checkValueContext = decryptedSecureValueAccessContext(context: context, encryptedSecret: encryptedData.encryptedSecret, decryptedDataHash: encryptedData.dataHash) else {
return nil
}
if checkValueContext != valueContext {
return nil
}
if let checkData = decryptedSecureValueData(context: checkValueContext, encryptedData: encryptedData.data, decryptedDataHash: encryptedData.dataHash) {
if checkData != decryptedData {
return nil
}
} else {
return nil
}
let files = fileReferences.map { file -> Api.InputSecureFile in
switch file {
case let .remote(file):
return Api.InputSecureFile.inputSecureFile(id: file.id, accessHash: file.accessHash)
case let .uploaded(file):
return Api.InputSecureFile.inputSecureFileUploaded(id: file.id, parts: file.parts, md5Checksum: file.md5Checksum, fileHash: Buffer(data: file.fileHash), secret: Buffer(data: file.encryptedSecret))
}
}
return Api.InputSecureValue.inputSecureValueAddress(data: Api.SecureData.secureData(data: Buffer(data: encryptedData.data), dataHash: Buffer(data: encryptedData.dataHash), secret: Buffer(data: encryptedData.encryptedSecret)), files: files)
case let .phone(value):
return Api.InputSecureValue.inputSecureValuePhone(phone: value.phone)
case let .email(value):
return Api.InputSecureValue.inputSecureValueEmail(email: value.email)
private func apiInputSecretFile(_ file: SecureIdVerificationDocumentReference) -> Api.InputSecureFile {
switch file {
case let .remote(file):
return Api.InputSecureFile.inputSecureFile(id: file.id, accessHash: file.accessHash)
case let .uploaded(file):
return Api.InputSecureFile.inputSecureFileUploaded(id: file.id, parts: file.parts, md5Checksum: file.md5Checksum, fileHash: Buffer(data: file.fileHash), secret: Buffer(data: file.encryptedSecret))
}
}
private func inputSecureValueType(_ value: SecureIdValue) -> Api.SecureValueType {
private struct InputSecureIdValueData {
let type: Api.SecureValueType
let dict: [String: Any]?
let fileReferences: [SecureIdVerificationDocumentReference]
let selfieReference: SecureIdVerificationDocumentReference?
let publicData: Api.SecurePlainData?
}
private func inputSecureIdValueData(value: SecureIdValue) -> InputSecureIdValueData {
switch value {
case .identity:
return .secureValueTypeIdentity
case .address:
return .secureValueTypeAddress
case .phone:
return .secureValueTypePhone
case .email:
return .secureValueTypeEmail
case let .personalDetails(personalDetails):
let (dict, fileReferences) = personalDetails.serialize()
return InputSecureIdValueData(type: .secureValueTypePersonalDetails, dict: dict, fileReferences: fileReferences, selfieReference: nil, publicData: nil)
case let .passport(passport):
let (dict, fileReferences, selfieReference) = passport.serialize()
return InputSecureIdValueData(type: .secureValueTypePassport, dict: dict, fileReferences: fileReferences, selfieReference: selfieReference, publicData: nil)
case let .driversLicense(driversLicense):
let (dict, fileReferences, selfieReference) = driversLicense.serialize()
return InputSecureIdValueData(type: .secureValueTypeDriverLicense, dict: dict, fileReferences: fileReferences, selfieReference: selfieReference, publicData: nil)
case let .idCard(idCard):
let (dict, fileReferences, selfieReference) = idCard.serialize()
return InputSecureIdValueData(type: .secureValueTypeIdentityCard, dict: dict, fileReferences: fileReferences, selfieReference: selfieReference, publicData: nil)
case let .address(address):
let (dict, fileReferences) = address.serialize()
return InputSecureIdValueData(type: .secureValueTypeAddress, dict: dict, fileReferences: fileReferences, selfieReference: nil, publicData: nil)
case let .utilityBill(utilityBill):
let (dict, fileReferences) = utilityBill.serialize()
return InputSecureIdValueData(type: .secureValueTypeUtilityBill, dict: dict, fileReferences: fileReferences, selfieReference: nil, publicData: nil)
case let .bankStatement(bankStatement):
let (dict, fileReferences) = bankStatement.serialize()
return InputSecureIdValueData(type: .secureValueTypeBankStatement, dict: dict, fileReferences: fileReferences, selfieReference: nil, publicData: nil)
case let .rentalAgreement(rentalAgreement):
let (dict, fileReferences) = rentalAgreement.serialize()
return InputSecureIdValueData(type: .secureValueTypeRentalAgreement, dict: dict, fileReferences: fileReferences, selfieReference: nil, publicData: nil)
case let .phone(phone):
return InputSecureIdValueData(type: .secureValueTypePhone, dict: nil, fileReferences: [], selfieReference: nil, publicData: .securePlainPhone(phone: phone.phone))
case let .email(email):
return InputSecureIdValueData(type: .secureValueTypeEmail, dict: nil, fileReferences: [], selfieReference: nil, publicData: .securePlainEmail(email: email.email))
}
}
private func makeInputSecureValue(context: SecureIdAccessContext, value: SecureIdValue) -> Api.InputSecureValue? {
let inputData = inputSecureIdValueData(value: value)
var secureData: Api.SecureData?
if let dict = inputData.dict {
guard let decryptedData = try? JSONSerialization.data(withJSONObject: dict, options: []) else {
return nil
}
guard let valueContext = generateSecureIdValueAccessContext() else {
return nil
}
guard let encryptedData = encryptedSecureValueData(context: context, valueContext: valueContext, data: decryptedData) else {
return nil
}
guard let checkValueContext = decryptedSecureValueAccessContext(context: context, encryptedSecret: encryptedData.encryptedSecret, decryptedDataHash: encryptedData.dataHash) else {
return nil
}
if checkValueContext != valueContext {
return nil
}
if let checkData = decryptedSecureValueData(context: checkValueContext, encryptedData: encryptedData.data, decryptedDataHash: encryptedData.dataHash) {
if checkData != decryptedData {
return nil
}
} else {
return nil
}
secureData = .secureData(data: Buffer(data: encryptedData.data), dataHash: Buffer(data: encryptedData.dataHash), secret: Buffer(data: encryptedData.encryptedSecret))
}
var flags: Int32 = 0
let files = inputData.fileReferences.map(apiInputSecretFile)
if secureData != nil {
flags |= 1 << 0
}
if !files.isEmpty {
flags |= 1 << 1
}
if inputData.publicData != nil {
flags |= 1 << 2
}
if inputData.selfieReference != nil {
flags |= 1 << 3
}
return Api.InputSecureValue.inputSecureValue(flags: flags, type: inputData.type, data: secureData, files: files, plainData: inputData.publicData, selfie: inputData.selfieReference.flatMap(apiInputSecretFile))
}
public func saveSecureIdValue(network: Network, context: SecureIdAccessContext, valueContext: SecureIdValueAccessContext, value: SecureIdValue) -> Signal<SecureIdValueWithContext, SaveSecureIdValueError> {
guard let inputValue = makeInputSecureValue(context: context, valueContext: valueContext, value: value) else {
let delete = deleteSecureIdValue(network: network, value: value)
|> mapError { _ -> SaveSecureIdValueError in
return .generic
}
|> mapToSignal { _ -> Signal<SecureIdValueWithContext, SaveSecureIdValueError> in
return .complete()
}
|> `catch` { _ -> Signal<SecureIdValueWithContext, SaveSecureIdValueError> in
return .complete()
}
guard let inputValue = makeInputSecureValue(context: context, value: value) else {
return .fail(.generic)
}
return network.request(Api.functions.account.saveSecureValue(value: inputValue, secureSecretId: context.id))
let save = network.request(Api.functions.account.saveSecureValue(value: inputValue, secureSecretId: context.id))
|> mapError { error -> SaveSecureIdValueError in
if error.errorDescription == "PHONE_VERIFICATION_NEEDED" || error.errorDescription == "EMAIL_VERIFICATION_NEEDED" {
return .verificationRequired
}
return .generic
}
|> mapToSignal { _ -> Signal<SecureIdValueWithContext, SaveSecureIdValueError> in
return network.request(Api.functions.account.getSecureValue(userId: .inputUserSelf, types: [inputSecureValueType(value)]))
|> mapError { _ -> SaveSecureIdValueError in
return .generic
|> mapToSignal { result -> Signal<SecureIdValueWithContext, SaveSecureIdValueError> in
guard let parsedValue = parseSecureValue(context: context, value: result) else {
return .fail(.generic)
}
|> mapToSignal { result -> Signal<SecureIdValueWithContext, SaveSecureIdValueError> in
guard let firstValue = result.first else {
return .fail(.generic)
}
guard let parsedValue = parseSecureValue(context: context, value: firstValue) else {
return .fail(.generic)
}
guard parsedValue.valueWithContext.context == valueContext else {
return .fail(.generic)
}
return .single(parsedValue.valueWithContext)
guard parsedValue.valueWithContext.value == value else {
return .fail(.generic)
}
return .single(parsedValue.valueWithContext)
}
return delete |> then(save)
}
public enum DeleteSecureIdValueError {
@@ -249,18 +228,7 @@ public enum DeleteSecureIdValueError {
}
public func deleteSecureIdValue(network: Network, value: SecureIdValue) -> Signal<Void, DeleteSecureIdValueError> {
let type: Api.SecureValueType
switch value {
case .identity:
type = .secureValueTypeIdentity
case .address:
type = .secureValueTypeAddress
case .phone:
type = .secureValueTypePhone
case .email:
type = .secureValueTypeEmail
}
return network.request(Api.functions.account.deleteSecureValue(types: [type]))
return network.request(Api.functions.account.deleteSecureValue(types: [apiSecureValueType(value: value)]))
|> mapError { _ -> DeleteSecureIdValueError in
return .generic
}

View File

@@ -1,31 +1,20 @@
import Foundation
public enum SecureIdAddressValueType {
case passportRegistration
case utilityBill
case bankStatement
case rentalAgreement
}
public struct SecureIdAddressValue: Equatable {
public var type: SecureIdAddressValueType
public var street1: String
public var street2: String
public var city: String
public var region: String
public var countryCode: String
public var postcode: String
public var verificationDocuments: [SecureIdVerificationDocumentReference]
public init(type: SecureIdAddressValueType, street1: String, street2: String, city: String, region: String, countryCode: String, postcode: String, verificationDocuments: [SecureIdVerificationDocumentReference]) {
self.type = type
public init(street1: String, street2: String, city: String, region: String, countryCode: String, postcode: String) {
self.street1 = street1
self.street2 = street2
self.city = city
self.region = region
self.countryCode = countryCode
self.postcode = postcode
self.verificationDocuments = verificationDocuments
}
public static func ==(lhs: SecureIdAddressValue, rhs: SecureIdAddressValue) -> Bool {
@@ -47,52 +36,12 @@ public struct SecureIdAddressValue: Equatable {
if lhs.postcode != rhs.postcode {
return false
}
if lhs.verificationDocuments != rhs.verificationDocuments {
return false
}
return true
}
}
private extension SecureIdAddressValueType {
init?(serializedString: String) {
switch serializedString {
case "passport_registration":
self = .passportRegistration
case "utility_bill":
self = .utilityBill
case "bank_statement":
self = .bankStatement
case "rental_agreement":
self = .rentalAgreement
default:
return nil
}
}
func serialize() -> String {
switch self {
case .passportRegistration:
return "passport_registration"
case .utilityBill:
return "utility_bill"
case .bankStatement:
return "bank_statement"
case .rentalAgreement:
return "rental_agreement"
}
}
}
extension SecureIdAddressValue {
init?(data: Data, fileReferences: [SecureIdVerificationDocumentReference]) {
guard let dict = (try? JSONSerialization.jsonObject(with: data, options: [])) as? [String: Any] else {
return nil
}
guard let documentTypeString = dict["document_type"] as? String, let type = SecureIdAddressValueType(serializedString: documentTypeString) else {
return nil
}
init?(dict: [String: Any], fileReferences: [SecureIdVerificationDocumentReference]) {
guard let street1 = dict["street_line1"] as? String else {
return nil
}
@@ -110,14 +59,11 @@ extension SecureIdAddressValue {
return nil
}
let verificationDocuments: [SecureIdVerificationDocumentReference] = fileReferences
self.init(type: type, street1: street1, street2: street2, city: city, region: region, countryCode: countryCode, postcode: postcode, verificationDocuments: verificationDocuments)
self.init(street1: street1, street2: street2, city: city, region: region, countryCode: countryCode, postcode: postcode)
}
func serialize() -> (Data, [SecureIdVerificationDocumentReference])? {
func serialize() -> ([String: Any], [SecureIdVerificationDocumentReference]) {
var dict: [String: Any] = [:]
dict["document_type"] = self.type.serialize()
dict["street_line1"] = self.street1
if !self.street2.isEmpty {
dict["street_line2"] = self.street2
@@ -127,9 +73,6 @@ extension SecureIdAddressValue {
dict["country_iso2"] = self.countryCode
dict["post_code"] = self.postcode
guard let data = try? JSONSerialization.data(withJSONObject: dict, options: []) else {
return nil
}
return (data, self.verificationDocuments)
return (dict, [])
}
}

View File

@@ -0,0 +1,30 @@
import Foundation
public struct SecureIdBankStatementValue: Equatable {
public var verificationDocuments: [SecureIdVerificationDocumentReference]
public init(verificationDocuments: [SecureIdVerificationDocumentReference]) {
self.verificationDocuments = verificationDocuments
}
public static func ==(lhs: SecureIdBankStatementValue, rhs: SecureIdBankStatementValue) -> Bool {
if lhs.verificationDocuments != rhs.verificationDocuments {
return false
}
return true
}
}
extension SecureIdBankStatementValue {
init?(dict: [String: Any], fileReferences: [SecureIdVerificationDocumentReference]) {
let verificationDocuments: [SecureIdVerificationDocumentReference] = fileReferences
self.init(verificationDocuments: verificationDocuments)
}
func serialize() -> ([String: Any], [SecureIdVerificationDocumentReference]) {
var dict: [String: Any] = [:]
return (dict, self.verificationDocuments)
}
}

View File

@@ -0,0 +1,63 @@
import Foundation
public struct SecureIdDriversLicenseValue: Equatable {
public var identifier: String
public var issueDate: SecureIdDate
public var expiryDate: SecureIdDate?
public var verificationDocuments: [SecureIdVerificationDocumentReference]
public var selfieDocument: SecureIdVerificationDocumentReference?
public init(identifier: String, issueDate: SecureIdDate, expiryDate: SecureIdDate?, verificationDocuments: [SecureIdVerificationDocumentReference], selfieDocument: SecureIdVerificationDocumentReference?) {
self.identifier = identifier
self.issueDate = issueDate
self.expiryDate = expiryDate
self.verificationDocuments = verificationDocuments
self.selfieDocument = selfieDocument
}
public static func ==(lhs: SecureIdDriversLicenseValue, rhs: SecureIdDriversLicenseValue) -> Bool {
if lhs.identifier != rhs.identifier {
return false
}
if lhs.issueDate != rhs.issueDate {
return false
}
if lhs.expiryDate != rhs.expiryDate {
return false
}
if lhs.verificationDocuments != rhs.verificationDocuments {
return false
}
if lhs.selfieDocument != rhs.selfieDocument {
return false
}
return true
}
}
extension SecureIdDriversLicenseValue {
init?(dict: [String: Any], fileReferences: [SecureIdVerificationDocumentReference], selfieDocument: SecureIdVerificationDocumentReference?) {
guard let identifier = dict["document_no"] as? String else {
return nil
}
guard let issueDate = (dict["issue_date"] as? String).flatMap(SecureIdDate.init) else {
return nil
}
let expiryDate = (dict["expiry_date"] as? String).flatMap(SecureIdDate.init)
let verificationDocuments: [SecureIdVerificationDocumentReference] = fileReferences
self.init(identifier: identifier, issueDate: issueDate, expiryDate: expiryDate, verificationDocuments: verificationDocuments, selfieDocument: selfieDocument)
}
func serialize() -> ([String: Any], [SecureIdVerificationDocumentReference], SecureIdVerificationDocumentReference?) {
var dict: [String: Any] = [:]
dict["document_no"] = self.identifier
dict["issue_date"] = self.issueDate.serialize()
if let expiryDate = self.expiryDate {
dict["expiry_date"] = expiryDate.serialize()
}
return (dict, self.verificationDocuments, self.selfieDocument)
}
}

View File

@@ -5,9 +5,15 @@ import Foundation
import Postbox
#endif
public enum SecureIdRequestedFormField {
case identity
public enum SecureIdRequestedFormField: Equatable {
case personalDetails
case passport(selfie: Bool)
case driversLicense(selfie: Bool)
case idCard(selfie: Bool)
case address
case utilityBill
case bankStatement
case rentalAgreement
case phone
case email
}

View File

@@ -0,0 +1,63 @@
import Foundation
public struct SecureIdIDCardValue: Equatable {
public var identifier: String
public var issueDate: SecureIdDate
public var expiryDate: SecureIdDate?
public var verificationDocuments: [SecureIdVerificationDocumentReference]
public var selfieDocument: SecureIdVerificationDocumentReference?
public init(identifier: String, issueDate: SecureIdDate, expiryDate: SecureIdDate?, verificationDocuments: [SecureIdVerificationDocumentReference], selfieDocument: SecureIdVerificationDocumentReference?) {
self.identifier = identifier
self.issueDate = issueDate
self.expiryDate = expiryDate
self.verificationDocuments = verificationDocuments
self.selfieDocument = selfieDocument
}
public static func ==(lhs: SecureIdIDCardValue, rhs: SecureIdIDCardValue) -> Bool {
if lhs.identifier != rhs.identifier {
return false
}
if lhs.issueDate != rhs.issueDate {
return false
}
if lhs.expiryDate != rhs.expiryDate {
return false
}
if lhs.verificationDocuments != rhs.verificationDocuments {
return false
}
if lhs.selfieDocument != rhs.selfieDocument {
return false
}
return true
}
}
extension SecureIdIDCardValue {
init?(dict: [String: Any], fileReferences: [SecureIdVerificationDocumentReference], selfieDocument: SecureIdVerificationDocumentReference?) {
guard let identifier = dict["document_no"] as? String else {
return nil
}
guard let issueDate = (dict["issue_date"] as? String).flatMap(SecureIdDate.init) else {
return nil
}
let expiryDate = (dict["expiry_date"] as? String).flatMap(SecureIdDate.init)
let verificationDocuments: [SecureIdVerificationDocumentReference] = fileReferences
self.init(identifier: identifier, issueDate: issueDate, expiryDate: expiryDate, verificationDocuments: verificationDocuments, selfieDocument: selfieDocument)
}
func serialize() -> ([String: Any], [SecureIdVerificationDocumentReference], SecureIdVerificationDocumentReference?) {
var dict: [String: Any] = [:]
dict["document_no"] = self.identifier
dict["issue_date"] = self.issueDate.serialize()
if let expiryDate = self.expiryDate {
dict["expiry_date"] = expiryDate.serialize()
}
return (dict, self.verificationDocuments, self.selfieDocument)
}
}

View File

@@ -1,104 +0,0 @@
import Foundation
public struct SecureIdIdentityDriversLicenseValue: Equatable {
public var identifier: String
public var firstName: String
public var lastName: String
public var birthdate: SecureIdDate
public var countryCode: String
public var gender: SecureIdGender
public var issueDate: SecureIdDate
public var expiryDate: SecureIdDate?
public var verificationDocuments: [SecureIdVerificationDocumentReference]
public init(identifier: String, firstName: String, lastName: String, birthdate: SecureIdDate, countryCode: String, gender: SecureIdGender, issueDate: SecureIdDate, expiryDate: SecureIdDate?, verificationDocuments: [SecureIdVerificationDocumentReference]) {
self.identifier = identifier
self.firstName = firstName
self.lastName = lastName
self.birthdate = birthdate
self.countryCode = countryCode
self.gender = gender
self.issueDate = issueDate
self.expiryDate = expiryDate
self.verificationDocuments = verificationDocuments
}
public static func ==(lhs: SecureIdIdentityDriversLicenseValue, rhs: SecureIdIdentityDriversLicenseValue) -> Bool {
if lhs.identifier != rhs.identifier {
return false
}
if lhs.firstName != rhs.firstName {
return false
}
if lhs.lastName != rhs.lastName {
return false
}
if lhs.birthdate != rhs.birthdate {
return false
}
if lhs.countryCode != rhs.countryCode {
return false
}
if lhs.gender != rhs.gender {
return false
}
if lhs.issueDate != rhs.issueDate {
return false
}
if lhs.expiryDate != rhs.expiryDate {
return false
}
if lhs.verificationDocuments != rhs.verificationDocuments {
return false
}
return true
}
}
extension SecureIdIdentityDriversLicenseValue {
init?(dict: [String: Any], fileReferences: [SecureIdVerificationDocumentReference]) {
guard let identifier = dict["document_no"] as? String else {
return nil
}
guard let firstName = dict["first_name"] as? String else {
return nil
}
guard let lastName = dict["last_name"] as? String else {
return nil
}
guard let birthdate = (dict["birth_date"] as? String).flatMap(SecureIdDate.init) else {
return nil
}
guard let gender = (dict["gender"] as? String).flatMap(SecureIdGender.init) else {
return nil
}
guard let countryCode = dict["country_iso2"] as? String else {
return nil
}
guard let issueDate = (dict["issue_date"] as? String).flatMap(SecureIdDate.init) else {
return nil
}
let expiryDate = (dict["expiry_date"] as? String).flatMap(SecureIdDate.init)
let verificationDocuments: [SecureIdVerificationDocumentReference] = fileReferences
self.init(identifier: identifier, firstName: firstName, lastName: lastName, birthdate: birthdate, countryCode: countryCode, gender: gender, issueDate: issueDate, expiryDate: expiryDate, verificationDocuments: verificationDocuments)
}
func serialize() -> ([String: Any], [SecureIdVerificationDocumentReference]) {
var dict: [String: Any] = [:]
dict["document_no"] = self.identifier
dict["first_name"] = self.firstName
dict["last_name"] = self.lastName
dict["birth_date"] = self.birthdate.serialize()
dict["gender"] = self.gender.serialize()
dict["country_iso2"] = self.countryCode
dict["issue_date"] = self.issueDate.serialize()
if let expiryDate = self.expiryDate {
dict["expiry_date"] = expiryDate.serialize()
}
return (dict, self.verificationDocuments)
}
}

View File

@@ -1,104 +0,0 @@
import Foundation
public struct SecureIdIdentityIDCardValue: Equatable {
public var identifier: String
public var firstName: String
public var lastName: String
public var birthdate: SecureIdDate
public var countryCode: String
public var gender: SecureIdGender
public var issueDate: SecureIdDate
public var expiryDate: SecureIdDate?
public var verificationDocuments: [SecureIdVerificationDocumentReference]
public init(identifier: String, firstName: String, lastName: String, birthdate: SecureIdDate, countryCode: String, gender: SecureIdGender, issueDate: SecureIdDate, expiryDate: SecureIdDate?, verificationDocuments: [SecureIdVerificationDocumentReference]) {
self.identifier = identifier
self.firstName = firstName
self.lastName = lastName
self.birthdate = birthdate
self.countryCode = countryCode
self.gender = gender
self.issueDate = issueDate
self.expiryDate = expiryDate
self.verificationDocuments = verificationDocuments
}
public static func ==(lhs: SecureIdIdentityIDCardValue, rhs: SecureIdIdentityIDCardValue) -> Bool {
if lhs.identifier != rhs.identifier {
return false
}
if lhs.firstName != rhs.firstName {
return false
}
if lhs.lastName != rhs.lastName {
return false
}
if lhs.birthdate != rhs.birthdate {
return false
}
if lhs.countryCode != rhs.countryCode {
return false
}
if lhs.gender != rhs.gender {
return false
}
if lhs.issueDate != rhs.issueDate {
return false
}
if lhs.expiryDate != rhs.expiryDate {
return false
}
if lhs.verificationDocuments != rhs.verificationDocuments {
return false
}
return true
}
}
extension SecureIdIdentityIDCardValue {
init?(dict: [String: Any], fileReferences: [SecureIdVerificationDocumentReference]) {
guard let identifier = dict["document_no"] as? String else {
return nil
}
guard let firstName = dict["first_name"] as? String else {
return nil
}
guard let lastName = dict["last_name"] as? String else {
return nil
}
guard let birthdate = (dict["birth_date"] as? String).flatMap(SecureIdDate.init) else {
return nil
}
guard let gender = (dict["gender"] as? String).flatMap(SecureIdGender.init) else {
return nil
}
guard let countryCode = dict["country_iso2"] as? String else {
return nil
}
guard let issueDate = (dict["issue_date"] as? String).flatMap(SecureIdDate.init) else {
return nil
}
let expiryDate = (dict["expiry_date"] as? String).flatMap(SecureIdDate.init)
let verificationDocuments: [SecureIdVerificationDocumentReference] = fileReferences
self.init(identifier: identifier, firstName: firstName, lastName: lastName, birthdate: birthdate, countryCode: countryCode, gender: gender, issueDate: issueDate, expiryDate: expiryDate, verificationDocuments: verificationDocuments)
}
func serialize() -> ([String: Any], [SecureIdVerificationDocumentReference]) {
var dict: [String: Any] = [:]
dict["document_no"] = self.identifier
dict["first_name"] = self.firstName
dict["last_name"] = self.lastName
dict["birth_date"] = self.birthdate.serialize()
dict["gender"] = self.gender.serialize()
dict["country_iso2"] = self.countryCode
dict["issue_date"] = self.issueDate.serialize()
if let expiryDate = self.expiryDate {
dict["expiry_date"] = expiryDate.serialize()
}
return (dict, self.verificationDocuments)
}
}

View File

@@ -1,103 +0,0 @@
import Foundation
public struct SecureIdIdentityInternationalPassportValue: Equatable {
public var identifier: String
public var firstName: String
public var lastName: String
public var birthdate: SecureIdDate
public var countryCode: String
public var gender: SecureIdGender
public var issueDate: SecureIdDate
public var expiryDate: SecureIdDate?
public var verificationDocuments: [SecureIdVerificationDocumentReference]
public init(identifier: String, firstName: String, lastName: String, birthdate: SecureIdDate, countryCode: String, gender: SecureIdGender, issueDate: SecureIdDate, expiryDate: SecureIdDate?, verificationDocuments: [SecureIdVerificationDocumentReference]) {
self.identifier = identifier
self.firstName = firstName
self.lastName = lastName
self.birthdate = birthdate
self.countryCode = countryCode
self.gender = gender
self.issueDate = issueDate
self.expiryDate = expiryDate
self.verificationDocuments = verificationDocuments
}
public static func ==(lhs: SecureIdIdentityInternationalPassportValue, rhs: SecureIdIdentityInternationalPassportValue) -> Bool {
if lhs.identifier != rhs.identifier {
return false
}
if lhs.firstName != rhs.firstName {
return false
}
if lhs.lastName != rhs.lastName {
return false
}
if lhs.birthdate != rhs.birthdate {
return false
}
if lhs.countryCode != rhs.countryCode {
return false
}
if lhs.gender != rhs.gender {
return false
}
if lhs.issueDate != rhs.issueDate {
return false
}
if lhs.expiryDate != rhs.expiryDate {
return false
}
if lhs.verificationDocuments != rhs.verificationDocuments {
return false
}
return true
}
}
extension SecureIdIdentityInternationalPassportValue {
init?(dict: [String: Any], fileReferences: [SecureIdVerificationDocumentReference]) {
guard let identifier = dict["document_no"] as? String else {
return nil
}
guard let firstName = dict["first_name"] as? String else {
return nil
}
guard let lastName = dict["last_name"] as? String else {
return nil
}
guard let birthdate = (dict["birth_date"] as? String).flatMap(SecureIdDate.init) else {
return nil
}
guard let gender = (dict["gender"] as? String).flatMap(SecureIdGender.init) else {
return nil
}
guard let countryCode = dict["country_iso2"] as? String else {
return nil
}
guard let issueDate = (dict["issue_date"] as? String).flatMap(SecureIdDate.init) else {
return nil
}
let expiryDate = (dict["expiry_date"] as? String).flatMap(SecureIdDate.init)
let verificationDocuments: [SecureIdVerificationDocumentReference] = fileReferences
self.init(identifier: identifier, firstName: firstName, lastName: lastName, birthdate: birthdate, countryCode: countryCode, gender: gender, issueDate: issueDate, expiryDate: expiryDate, verificationDocuments: verificationDocuments)
}
func serialize() -> ([String: Any], [SecureIdVerificationDocumentReference]) {
var dict: [String: Any] = [:]
dict["document_no"] = self.identifier
dict["first_name"] = self.firstName
dict["last_name"] = self.lastName
dict["birth_date"] = self.birthdate.serialize()
dict["gender"] = self.gender.serialize()
dict["country_iso2"] = self.countryCode
dict["issue_date"] = self.issueDate.serialize()
if let expiryDate = self.expiryDate {
dict["expiry_date"] = expiryDate.serialize()
}
return (dict, self.verificationDocuments)
}
}

View File

@@ -1,103 +0,0 @@
import Foundation
public struct SecureIdIdentityPassportValue: Equatable {
public var identifier: String
public var firstName: String
public var lastName: String
public var birthdate: SecureIdDate
public var countryCode: String
public var gender: SecureIdGender
public var issueDate: SecureIdDate
public var expiryDate: SecureIdDate?
public var verificationDocuments: [SecureIdVerificationDocumentReference]
public init(identifier: String, firstName: String, lastName: String, birthdate: SecureIdDate, countryCode: String, gender: SecureIdGender, issueDate: SecureIdDate, expiryDate: SecureIdDate?, verificationDocuments: [SecureIdVerificationDocumentReference]) {
self.identifier = identifier
self.firstName = firstName
self.lastName = lastName
self.birthdate = birthdate
self.countryCode = countryCode
self.gender = gender
self.issueDate = issueDate
self.expiryDate = expiryDate
self.verificationDocuments = verificationDocuments
}
public static func ==(lhs: SecureIdIdentityPassportValue, rhs: SecureIdIdentityPassportValue) -> Bool {
if lhs.identifier != rhs.identifier {
return false
}
if lhs.firstName != rhs.firstName {
return false
}
if lhs.lastName != rhs.lastName {
return false
}
if lhs.birthdate != rhs.birthdate {
return false
}
if lhs.countryCode != rhs.countryCode {
return false
}
if lhs.gender != rhs.gender {
return false
}
if lhs.issueDate != rhs.issueDate {
return false
}
if lhs.expiryDate != rhs.expiryDate {
return false
}
if lhs.verificationDocuments != rhs.verificationDocuments {
return false
}
return true
}
}
extension SecureIdIdentityPassportValue {
init?(dict: [String: Any], fileReferences: [SecureIdVerificationDocumentReference]) {
guard let identifier = dict["document_no"] as? String else {
return nil
}
guard let firstName = dict["first_name"] as? String else {
return nil
}
guard let lastName = dict["last_name"] as? String else {
return nil
}
guard let birthdate = (dict["birth_date"] as? String).flatMap(SecureIdDate.init) else {
return nil
}
guard let gender = (dict["gender"] as? String).flatMap(SecureIdGender.init) else {
return nil
}
guard let countryCode = dict["country_iso2"] as? String else {
return nil
}
guard let issueDate = (dict["issue_date"] as? String).flatMap(SecureIdDate.init) else {
return nil
}
let expiryDate = (dict["expiry_date"] as? String).flatMap(SecureIdDate.init)
let verificationDocuments: [SecureIdVerificationDocumentReference] = fileReferences
self.init(identifier: identifier, firstName: firstName, lastName: lastName, birthdate: birthdate, countryCode: countryCode, gender: gender, issueDate: issueDate, expiryDate: expiryDate, verificationDocuments: verificationDocuments)
}
func serialize() -> ([String: Any], [SecureIdVerificationDocumentReference]) {
var dict: [String: Any] = [:]
dict["document_no"] = self.identifier
dict["first_name"] = self.firstName
dict["last_name"] = self.lastName
dict["birth_date"] = self.birthdate.serialize()
dict["gender"] = self.gender.serialize()
dict["country_iso2"] = self.countryCode
dict["issue_date"] = self.issueDate.serialize()
if let expiryDate = self.expiryDate {
dict["expiry_date"] = expiryDate.serialize()
}
return (dict, self.verificationDocuments)
}
}

View File

@@ -1,108 +0,0 @@
import Foundation
public enum SecureIdIdentityValue: Equatable {
case passport(SecureIdIdentityPassportValue)
case internationalPassport(SecureIdIdentityInternationalPassportValue)
case driversLicense(SecureIdIdentityDriversLicenseValue)
case idCard(SecureIdIdentityIDCardValue)
public static func ==(lhs: SecureIdIdentityValue, rhs: SecureIdIdentityValue) -> Bool {
switch lhs {
case let .passport(value):
if case .passport(value) = rhs {
return true
} else {
return false
}
case let .internationalPassport(value):
if case .internationalPassport(value) = rhs {
return true
} else {
return false
}
case let .driversLicense(value):
if case .driversLicense(value) = rhs {
return true
} else {
return false
}
case let .idCard(value):
if case .idCard(value) = rhs {
return true
} else {
return false
}
}
}
}
extension SecureIdIdentityValue {
init?(data: Data, fileReferences: [SecureIdVerificationDocumentReference]) {
guard let dict = (try? JSONSerialization.jsonObject(with: data, options: [])) as? [String: Any] else {
return nil
}
guard let documentType = dict["document_type"] as? String else {
return nil
}
switch documentType {
case "passport":
if let passport = SecureIdIdentityPassportValue(dict: dict, fileReferences: fileReferences) {
self = .passport(passport)
} else {
return nil
}
case "international_passport":
if let internationalPassport = SecureIdIdentityInternationalPassportValue(dict: dict, fileReferences: fileReferences) {
self = .internationalPassport(internationalPassport)
} else {
return nil
}
case "driver_license":
if let driversLicense = SecureIdIdentityDriversLicenseValue(dict: dict, fileReferences: fileReferences) {
self = .driversLicense(driversLicense)
} else {
return nil
}
case "identity_card":
if let idCard = SecureIdIdentityIDCardValue(dict: dict, fileReferences: fileReferences) {
self = .idCard(idCard)
} else {
return nil
}
default:
return nil
}
}
func serialize() -> (Data, [SecureIdVerificationDocumentReference])? {
var dict: [String: Any] = [:]
let fileReferences: [SecureIdVerificationDocumentReference]
switch self {
case let .passport(value):
dict["document_type"] = "passport"
let (valueDict, references) = value.serialize()
dict.merge(valueDict, uniquingKeysWith: { lhs, _ in return lhs })
fileReferences = references
case let .internationalPassport(value):
dict["document_type"] = "international_passport"
let (valueDict, references) = value.serialize()
dict.merge(valueDict, uniquingKeysWith: { lhs, _ in return lhs })
fileReferences = references
case let .driversLicense(value):
dict["document_type"] = "driver_license"
let (valueDict, references) = value.serialize()
dict.merge(valueDict, uniquingKeysWith: { lhs, _ in return lhs })
fileReferences = references
case let .idCard(value):
dict["document_type"] = "identity_card"
let (valueDict, references) = value.serialize()
dict.merge(valueDict, uniquingKeysWith: { lhs, _ in return lhs })
fileReferences = references
}
guard let data = try? JSONSerialization.data(withJSONObject: dict, options: []) else {
return nil
}
return (data, fileReferences)
}
}

View File

@@ -0,0 +1,26 @@
import Foundation
func paddedSecureIdData(_ data: Data) -> Data {
var paddingCount = Int(47 + arc4random_uniform(255 - 47))
paddingCount -= ((data.count + paddingCount) % 16)
var result = Data(count: paddingCount + data.count)
result.withUnsafeMutableBytes { (bytes: UnsafeMutablePointer<UInt8>) -> Void in
bytes.advanced(by: 0).pointee = UInt8(paddingCount)
arc4random_buf(bytes.advanced(by: 1), paddingCount - 1)
data.withUnsafeBytes { (source: UnsafePointer<UInt8>) -> Void in
memcpy(bytes.advanced(by: paddingCount), source, data.count)
}
}
return result
}
func unpaddedSecureIdData(_ data: Data) -> Data? {
var paddingCount: UInt8 = 0
data.copyBytes(to: &paddingCount, count: 1)
if paddingCount < 0 || paddingCount > data.count {
return nil
}
return data.subdata(in: Int(paddingCount) ..< data.count)
}

View File

@@ -0,0 +1,63 @@
import Foundation
public struct SecureIdPassportValue: Equatable {
public var identifier: String
public var issueDate: SecureIdDate
public var expiryDate: SecureIdDate?
public var verificationDocuments: [SecureIdVerificationDocumentReference]
public var selfieDocument: SecureIdVerificationDocumentReference?
public init(identifier: String, issueDate: SecureIdDate, expiryDate: SecureIdDate?, verificationDocuments: [SecureIdVerificationDocumentReference], selfieDocument: SecureIdVerificationDocumentReference?) {
self.identifier = identifier
self.issueDate = issueDate
self.expiryDate = expiryDate
self.verificationDocuments = verificationDocuments
self.selfieDocument = selfieDocument
}
public static func ==(lhs: SecureIdPassportValue, rhs: SecureIdPassportValue) -> Bool {
if lhs.identifier != rhs.identifier {
return false
}
if lhs.issueDate != rhs.issueDate {
return false
}
if lhs.expiryDate != rhs.expiryDate {
return false
}
if lhs.verificationDocuments != rhs.verificationDocuments {
return false
}
if lhs.selfieDocument != rhs.selfieDocument {
return false
}
return true
}
}
extension SecureIdPassportValue {
init?(dict: [String: Any], fileReferences: [SecureIdVerificationDocumentReference], selfieDocument: SecureIdVerificationDocumentReference?) {
guard let identifier = dict["document_no"] as? String else {
return nil
}
guard let issueDate = (dict["issue_date"] as? String).flatMap(SecureIdDate.init) else {
return nil
}
let expiryDate = (dict["expiry_date"] as? String).flatMap(SecureIdDate.init)
let verificationDocuments: [SecureIdVerificationDocumentReference] = fileReferences
self.init(identifier: identifier, issueDate: issueDate, expiryDate: expiryDate, verificationDocuments: verificationDocuments, selfieDocument: selfieDocument)
}
func serialize() -> ([String: Any], [SecureIdVerificationDocumentReference], SecureIdVerificationDocumentReference?) {
var dict: [String: Any] = [:]
dict["document_no"] = self.identifier
dict["issue_date"] = self.issueDate.serialize()
if let expiryDate = self.expiryDate {
dict["expiry_date"] = expiryDate.serialize()
}
return (dict, self.verificationDocuments, self.selfieDocument)
}
}

View File

@@ -0,0 +1,69 @@
import Foundation
public struct SecureIdPersonalDetailsValue: Equatable {
public var firstName: String
public var lastName: String
public var birthdate: SecureIdDate
public var countryCode: String
public var gender: SecureIdGender
public init(firstName: String, lastName: String, birthdate: SecureIdDate, countryCode: String, gender: SecureIdGender) {
self.firstName = firstName
self.lastName = lastName
self.birthdate = birthdate
self.countryCode = countryCode
self.gender = gender
}
public static func ==(lhs: SecureIdPersonalDetailsValue, rhs: SecureIdPersonalDetailsValue) -> Bool {
if lhs.firstName != rhs.firstName {
return false
}
if lhs.lastName != rhs.lastName {
return false
}
if lhs.birthdate != rhs.birthdate {
return false
}
if lhs.countryCode != rhs.countryCode {
return false
}
if lhs.gender != rhs.gender {
return false
}
return true
}
}
extension SecureIdPersonalDetailsValue {
init?(dict: [String: Any], fileReferences: [SecureIdVerificationDocumentReference]) {
guard let firstName = dict["first_name"] as? String else {
return nil
}
guard let lastName = dict["last_name"] as? String else {
return nil
}
guard let birthdate = (dict["birth_date"] as? String).flatMap(SecureIdDate.init) else {
return nil
}
guard let gender = (dict["gender"] as? String).flatMap(SecureIdGender.init) else {
return nil
}
guard let countryCode = dict["country_iso2"] as? String else {
return nil
}
self.init(firstName: firstName, lastName: lastName, birthdate: birthdate, countryCode: countryCode, gender: gender)
}
func serialize() -> ([String: Any], [SecureIdVerificationDocumentReference]) {
var dict: [String: Any] = [:]
dict["first_name"] = self.firstName
dict["last_name"] = self.lastName
dict["birth_date"] = self.birthdate.serialize()
dict["gender"] = self.gender.serialize()
dict["country_iso2"] = self.countryCode
return (dict, [])
}
}

View File

@@ -0,0 +1,30 @@
import Foundation
public struct SecureIdRentalAgreementValue: Equatable {
public var verificationDocuments: [SecureIdVerificationDocumentReference]
public init(verificationDocuments: [SecureIdVerificationDocumentReference]) {
self.verificationDocuments = verificationDocuments
}
public static func ==(lhs: SecureIdRentalAgreementValue, rhs: SecureIdRentalAgreementValue) -> Bool {
if lhs.verificationDocuments != rhs.verificationDocuments {
return false
}
return true
}
}
extension SecureIdRentalAgreementValue {
init?(dict: [String: Any], fileReferences: [SecureIdVerificationDocumentReference]) {
let verificationDocuments: [SecureIdVerificationDocumentReference] = fileReferences
self.init(verificationDocuments: verificationDocuments)
}
func serialize() -> ([String: Any], [SecureIdVerificationDocumentReference]) {
var dict: [String: Any] = [:]
return (dict, self.verificationDocuments)
}
}

View File

@@ -0,0 +1,30 @@
import Foundation
public struct SecureIdUtilityBillValue: Equatable {
public var verificationDocuments: [SecureIdVerificationDocumentReference]
public init(verificationDocuments: [SecureIdVerificationDocumentReference]) {
self.verificationDocuments = verificationDocuments
}
public static func ==(lhs: SecureIdUtilityBillValue, rhs: SecureIdUtilityBillValue) -> Bool {
if lhs.verificationDocuments != rhs.verificationDocuments {
return false
}
return true
}
}
extension SecureIdUtilityBillValue {
init?(dict: [String: Any], fileReferences: [SecureIdVerificationDocumentReference]) {
let verificationDocuments: [SecureIdVerificationDocumentReference] = fileReferences
self.init(verificationDocuments: verificationDocuments)
}
func serialize() -> ([String: Any], [SecureIdVerificationDocumentReference]) {
var dict: [String: Any] = [:]
return (dict, self.verificationDocuments)
}
}

View File

@@ -1,93 +1,67 @@
import Foundation
public enum SecureIdValue: Equatable {
case identity(SecureIdIdentityValue)
case personalDetails(SecureIdPersonalDetailsValue)
case passport(SecureIdPassportValue)
case driversLicense(SecureIdDriversLicenseValue)
case idCard(SecureIdIDCardValue)
case address(SecureIdAddressValue)
case utilityBill(SecureIdUtilityBillValue)
case bankStatement(SecureIdBankStatementValue)
case rentalAgreement(SecureIdRentalAgreementValue)
case phone(SecureIdPhoneValue)
case email(SecureIdEmailValue)
public static func ==(lhs: SecureIdValue, rhs: SecureIdValue) -> Bool {
switch lhs {
case let .identity(value):
if case .identity(value) = rhs {
return true
} else {
return false
}
case let .address(value):
if case .address(value) = rhs {
return true
} else {
return false
}
case let .phone(value):
if case .phone(value) = rhs {
return true
} else {
return false
}
case let .email(value):
if case .email(value) = rhs {
return true
} else {
return false
}
}
}
func serialize() -> (Data, [SecureIdVerificationDocumentReference])? {
func serialize() -> ([String: Any], [SecureIdVerificationDocumentReference], SecureIdVerificationDocumentReference?)? {
switch self {
case let .identity(value):
return value.serialize()
case let .address(value):
return value.serialize()
case .phone, .email:
case let .personalDetails(personalDetails):
let (dict, files) = personalDetails.serialize()
return (dict, files, nil)
case let .passport(passport):
return passport.serialize()
case let .driversLicense(driversLicense):
return driversLicense.serialize()
case let .idCard(idCard):
return idCard.serialize()
case let .address(address):
let (dict, files) = address.serialize()
return (dict, files, nil)
case let .utilityBill(utilityBill):
let (dict, files) = utilityBill.serialize()
return (dict, files, nil)
case let .bankStatement(bankStatement):
let (dict, files) = bankStatement.serialize()
return (dict, files, nil)
case let .rentalAgreement(rentalAgreement):
let (dict, files) = rentalAgreement.serialize()
return (dict, files, nil)
case .phone:
return nil
case .email:
return nil
}
}
}
struct SecureIdEncryptedValueFileMetadata: Equatable {
let hash: Data
let secret: Data
}
struct SecureIdEncryptedValueMetadata: Equatable {
let valueDataHash: Data
let fileHashes: [Data]
let valueSecret: Data
let encryptedSecret: Data
static func ==(lhs: SecureIdEncryptedValueMetadata, rhs: SecureIdEncryptedValueMetadata) -> Bool {
if lhs.valueDataHash != rhs.valueDataHash {
return false
}
if lhs.fileHashes != rhs.fileHashes {
return false
}
if lhs.valueSecret != rhs.valueSecret {
return false
}
if lhs.encryptedSecret != rhs.encryptedSecret {
return false
}
return true
}
let decryptedSecret: Data
let files: [SecureIdEncryptedValueFileMetadata]
}
public struct SecureIdValueWithContext: Equatable {
public let value: SecureIdValue
public let context: SecureIdValueAccessContext
let encryptedMetadata: SecureIdEncryptedValueMetadata?
let opaqueHash: Data
init(value: SecureIdValue, context: SecureIdValueAccessContext, encryptedMetadata: SecureIdEncryptedValueMetadata?) {
init(value: SecureIdValue, encryptedMetadata: SecureIdEncryptedValueMetadata?, opaqueHash: Data) {
self.value = value
self.context = context
self.encryptedMetadata = encryptedMetadata
}
public static func ==(lhs: SecureIdValueWithContext, rhs: SecureIdValueWithContext) -> Bool {
if lhs.value != rhs.value {
return false
}
if lhs.context != rhs.context {
return false
}
return true
self.opaqueHash = opaqueHash
}
}

View File

@@ -13,10 +13,16 @@ public enum PhoneCallDiscardReason: Int32 {
}
public enum SentSecureValueType: Int32 {
case identity = 0
case address = 1
case phone = 2
case email = 3
case personalDetails = 0
case passport = 1
case driversLicense = 2
case idCard = 3
case address = 4
case bankStatement = 5
case utilityBill = 6
case rentalAgreement = 7
case phone = 8
case email = 9
}
public enum TelegramMediaActionType: PostboxCoding, Equatable {
@@ -83,7 +89,7 @@ public enum TelegramMediaActionType: PostboxCoding, Equatable {
self = .botDomainAccessGranted(domain: decoder.decodeStringForKey("do", orElse: ""))
case 18:
self = .botSentSecureValues(types: decoder.decodeInt32ArrayForKey("ty").map { value -> SentSecureValueType in
return SentSecureValueType(rawValue: value) ?? .identity
return SentSecureValueType(rawValue: value) ?? .personalDetails
})
default:
self = .unknown
@@ -405,10 +411,22 @@ extension PhoneCallDiscardReason {
extension SentSecureValueType {
init(apiType: Api.SecureValueType) {
switch apiType {
case .secureValueTypeIdentity:
self = .identity
case .secureValueTypePersonalDetails:
self = .personalDetails
case .secureValueTypePassport:
self = .passport
case .secureValueTypeDriverLicense:
self = .driversLicense
case .secureValueTypeIdentityCard:
self = .idCard
case .secureValueTypeAddress:
self = .address
case .secureValueTypeBankStatement:
self = .bankStatement
case .secureValueTypeUtilityBill:
self = .utilityBill
case .secureValueTypeRentalAgreement:
self = .rentalAgreement
case .secureValueTypePhone:
self = .phone
case .secureValueTypeEmail:

View File

@@ -94,9 +94,10 @@ public func secureIdPrepareEmailVerification(network: Network, value: SecureIdEm
public enum SecureIdCommitEmailVerificationError {
case generic
case flood
case invalid
}
public func secureIdCommitEmailVerification(network: Network, payload: SecureIdPrepareEmailVerificationPayload, code: String) -> Signal<Void, SecureIdCommitEmailVerificationError> {
public func secureIdCommitEmailVerification(network: Network, context: SecureIdAccessContext, payload: SecureIdPrepareEmailVerificationPayload, code: String) -> Signal<SecureIdValueWithContext, SecureIdCommitEmailVerificationError> {
return network.request(Api.functions.account.verifyEmail(email: payload.email, code: code), automaticFloodWait: false)
|> mapError { error -> SecureIdCommitEmailVerificationError in
if error.errorDescription.hasPrefix("FLOOD_WAIT") {
@@ -104,7 +105,10 @@ public func secureIdCommitEmailVerification(network: Network, payload: SecureIdP
}
return .generic
}
|> mapToSignal { _ -> Signal<Void, SecureIdCommitEmailVerificationError> in
return .complete()
|> mapToSignal { _ -> Signal<SecureIdValueWithContext, SecureIdCommitEmailVerificationError> in
return saveSecureIdValue(network: network, context: context, valueContext: generateSecureIdValueEmptyAccessContext()!, value: .email(SecureIdEmailValue(email: payload.email)))
|> mapError { _ -> SecureIdCommitEmailVerificationError in
return .generic
}
}
}