This commit is contained in:
fmodf 2024-09-08 18:27:08 +02:00
parent fad7112d69
commit 4399b81ec8
2 changed files with 5 additions and 23 deletions

View file

@ -39,16 +39,6 @@ final class AESGSMEngine: AES_GCM_Engine {
}
let decryptedData = try AES.GCM.open(sealedBox, using: symmetricKey)
// var payload = encoded
//
// var tag = tag
// if tag == nil {
// tag = payload.subdata(in: (payload.count - 16) ..< payload.count)
// encoded = payload.subdata(in: 0 ..< (payload.count - 16))
// }
// let sealedBox = try AES.GCM.SealedBox(nonce: AES.GCM.Nonce(data: iv), ciphertext: encoded, tag: tag)
// let decryptedData = try AES.GCM.open(sealedBox, using: symmetricKey)
//
if let output = output {
output.pointee = decryptedData
}

View file

@ -39,21 +39,13 @@ extension String {
extension String {
var attachmentType: AttachmentType {
let ext = (self as NSString).pathExtension.lowercased()
switch ext {
case "mov", "mp4", "avi":
return .video
case "jpg", "png", "gif":
if ext.contains("jpeg") || ext.contains("jpg") || ext.contains("png") || ext.contains("gif") {
return .image
case "mp3", "wav", "m4a":
} else if ext.contains("mov") || ext.contains("mp4") || ext.contains("avi") {
return .video
} else if ext.contains("mp3") || ext.contains("wav") || ext.contains("m4a") {
return .audio
case "txt", "doc", "pdf":
return .file
default:
} else {
return .file
}
}