From ba9d5414e3e3dfa6d6e6a69ff35b43621ee45c8b Mon Sep 17 00:00:00 2001 From: consuelita Date: Mon, 11 Oct 2021 17:09:30 -0500 Subject: [PATCH] Update DarkStar.swift --- Sources/ShadowSwift/DarkStar.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Sources/ShadowSwift/DarkStar.swift b/Sources/ShadowSwift/DarkStar.swift index 878f1da..c6eb9c2 100644 --- a/Sources/ShadowSwift/DarkStar.swift +++ b/Sources/ShadowSwift/DarkStar.swift @@ -16,8 +16,8 @@ let ConfirmationSize = 32 public struct DarkStar { - let encryptKey: SymmetricKey - let decryptKey: SymmetricKey + var encryptKey: SymmetricKey! + var decryptKey: SymmetricKey! public init?(serverPersistentPublicKey: P256.KeyAgreement.PublicKey, endpoint: NWEndpoint, connection: Connection) { @@ -36,8 +36,8 @@ public struct DarkStar guard let newEncryptKey = DarkStar.createEncryptKey(serverPersistentPublicKey: serverPersistentPublicKey, serverEphemeralPublicKey: serverEphemeralPublicKey, clientEphemeralPrivateKey: clientEphemeralPrivateKey, serverEndpoint: endpoint) else {return nil} encryptKey = newEncryptKey - guard let decryptKey = DarkStar.createDecryptKey(serverPersistentPublicKey: serverPersistentPublicKey, serverEphemeralPublicKey: serverEphemeralPublicKey, clientEphemeralPrivateKey: clientEphemeralPrivateKey, serverEndpoint: endpoint) else {return nil} - self.decryptKey = decryptKey + guard let newDecryptKey = DarkStar.createDecryptKey(serverPersistentPublicKey: serverPersistentPublicKey, serverEphemeralPublicKey: serverEphemeralPublicKey, clientEphemeralPrivateKey: clientEphemeralPrivateKey, serverEndpoint: endpoint) else {return nil} + decryptKey = newDecryptKey let clientConfirmationCode = DarkStar.generateConfirmationCode(endpoint: endpoint, serverEphemeralPublicKey: serverEphemeralPublicKey, clientEphemeralPublicKey: clientEphemeralPublicKey)