mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
18 lines
697 B
Swift
18 lines
697 B
Swift
import Foundation
|
|
import Postbox
|
|
import TelegramApi
|
|
|
|
|
|
extension SecureFileMediaResource: TelegramCloudMediaResource, TelegramMultipartFetchableResource, EncryptedMediaResource {
|
|
func apiInputLocation(fileReference: Data?) -> Api.InputFileLocation? {
|
|
return Api.InputFileLocation.inputSecureFileLocation(id: self.file.id, accessHash: self.file.accessHash)
|
|
}
|
|
|
|
public func decrypt(data: Data, params: Any) -> Data? {
|
|
guard let context = params as? SecureIdAccessContext else {
|
|
return nil
|
|
}
|
|
return decryptedSecureIdFile(context: context, encryptedData: data, fileHash: self.file.fileHash, encryptedSecret: self.file.encryptedSecret)
|
|
}
|
|
}
|