V0.6.5.d Arroyo Toad

This commit is contained in:
Vincenzo Pio Florio 2024-12-16 09:50:00 +00:00
parent 5bebbf311c
commit 5449c3e83d

View File

@ -36,7 +36,6 @@ public func fetchPrivateP256Key(deviceID: UInt) async throws -> P256.Signing.Pri
// Do nothing
}
<<<<<<< HEAD
let key = createPrivateP256Key()
@ -58,31 +57,6 @@ public func fetchPrivateP256Key(deviceID: UInt) async throws -> P256.Signing.Pri
let _ = try await URLSession.shared.upload(for: httpRequest, from: data)
return key
=======
do {
let key = createPrivateP256Key()
let publicKey = key.publicKey.pemRepresentation
try privateP256_2_pem(privateKey: key).write(to: URL(filePath: keyFilePath), atomically: true, encoding: String.Encoding.utf8)
// UGLY: hardcoded
var httpRequest = URLRequest(url: URL(string: "http://public-key-db.internal/key")!)
httpRequest.setValue("application/json", forHTTPHeaderField: "Content-Type")
httpRequest.httpMethod = "POST"
let message = PublicKeyMessage(deviceID: deviceID, publicKey: publicKey)
let encoder = JSONEncoder()
let data = try encoder.encode(message)
httpRequest.httpBody = data
let _ = try await URLSession.shared.upload(for: httpRequest, from: data)
return key
} catch {
throw ParsingError.ImpossibleToWriteKeyToFileSystem
}
>>>>>>> 5d78c9be5855d5541dd07b24d8331c018ddd2c70