|
|
|
@@ -42,8 +42,12 @@ struct cntrlUser: RouteCollection { |
|
|
|
guard let dataQuery = req.parameters.get("credentials") else{ |
|
|
|
throw Abort(.badRequest) |
|
|
|
} |
|
|
|
let base64Key = "rv0ywT7Ygwh01jP1dQWBP39ogjq5ladO+EoNUGcBVq0=" // Replace with your actual key |
|
|
|
guard let keyData = Data(base64Encoded: base64Key) else { |
|
|
|
fatalError("Invalid Base64 key data") |
|
|
|
} |
|
|
|
let data = Data(base64Encoded: dataQuery) |
|
|
|
let encryptionKey = SymmetricKey(data: "254595778216A74E21211ABCA7AC9".data(using: .utf8)!) |
|
|
|
let encryptionKey = SymmetricKey(data: keyData) |
|
|
|
let sealedBox = try AES.GCM.SealedBox(combined: data!) |
|
|
|
let decryptedData = try AES.GCM.open(sealedBox, using: encryptionKey) |
|
|
|
guard let decryptedString = String(data: decryptedData, encoding: .utf8) else{ |
|
|
|
|