wip
This commit is contained in:
parent
fad7112d69
commit
4399b81ec8
|
@ -39,16 +39,6 @@ final class AESGSMEngine: AES_GCM_Engine {
|
||||||
}
|
}
|
||||||
|
|
||||||
let decryptedData = try AES.GCM.open(sealedBox, using: symmetricKey)
|
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 {
|
if let output = output {
|
||||||
output.pointee = decryptedData
|
output.pointee = decryptedData
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,21 +39,13 @@ extension String {
|
||||||
extension String {
|
extension String {
|
||||||
var attachmentType: AttachmentType {
|
var attachmentType: AttachmentType {
|
||||||
let ext = (self as NSString).pathExtension.lowercased()
|
let ext = (self as NSString).pathExtension.lowercased()
|
||||||
|
if ext.contains("jpeg") || ext.contains("jpg") || ext.contains("png") || ext.contains("gif") {
|
||||||
switch ext {
|
|
||||||
case "mov", "mp4", "avi":
|
|
||||||
return .video
|
|
||||||
|
|
||||||
case "jpg", "png", "gif":
|
|
||||||
return .image
|
return .image
|
||||||
|
} else if ext.contains("mov") || ext.contains("mp4") || ext.contains("avi") {
|
||||||
case "mp3", "wav", "m4a":
|
return .video
|
||||||
|
} else if ext.contains("mp3") || ext.contains("wav") || ext.contains("m4a") {
|
||||||
return .audio
|
return .audio
|
||||||
|
} else {
|
||||||
case "txt", "doc", "pdf":
|
|
||||||
return .file
|
|
||||||
|
|
||||||
default:
|
|
||||||
return .file
|
return .file
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue