From 1c444ab6892446b030cd0480bbbc9c770c485c1a Mon Sep 17 00:00:00 2001 From: Lita Date: Wed, 21 Nov 2018 17:37:20 -0600 Subject: [PATCH] 0.0.2 --- Sources/ReplicantSwift/Encryption.swift | 11 +++-------- Sources/ReplicantSwift/ReplicantSwift.swift | 13 ++++++------- Sources/ReplicantSwift/ToneBurst.swift | 2 +- 3 files changed, 10 insertions(+), 16 deletions(-) diff --git a/Sources/ReplicantSwift/Encryption.swift b/Sources/ReplicantSwift/Encryption.swift index fa18440..fd64701 100644 --- a/Sources/ReplicantSwift/Encryption.swift +++ b/Sources/ReplicantSwift/Encryption.swift @@ -13,7 +13,7 @@ let keySize = 64 let keyDataSize = keySize + 1 let aesOverheadSize = 81 -class Encryption: NSObject +public class Encryption: NSObject { let algorithm: SecKeyAlgorithm = .eciesEncryptionCofactorVariableIVX963SHA256AESGCM @@ -51,11 +51,6 @@ class Encryption: NSObject return alicePrivate } - /** - Generate a public key from the provided private key and encodes it as data. - - - Returns: optional, encoded key as SecKey - */ func generatePublicKey(usingPrivateKey privateKey: SecKey) -> SecKey? { guard let alicePublic = SecKeyCopyPublicKey(privateKey) @@ -137,7 +132,7 @@ class Encryption: NSObject } /// Encrypt payload - func encrypt(payload: Data, usingServerKey serverPublicKey: SecKey) -> Data? + public func encrypt(payload: Data, usingServerKey serverPublicKey: SecKey) -> Data? { var error: Unmanaged? @@ -154,7 +149,7 @@ class Encryption: NSObject /// Decrypt payload /// - Parameter payload: Data /// - Parameter privateKey: SecKey - func decrypt(payload: Data, usingPrivateKey privateKey: SecKey) -> Data? + public func decrypt(payload: Data, usingPrivateKey privateKey: SecKey) -> Data? { var error: Unmanaged? diff --git a/Sources/ReplicantSwift/ReplicantSwift.swift b/Sources/ReplicantSwift/ReplicantSwift.swift index e2a2223..c1022b4 100644 --- a/Sources/ReplicantSwift/ReplicantSwift.swift +++ b/Sources/ReplicantSwift/ReplicantSwift.swift @@ -4,14 +4,13 @@ import CommonCrypto public struct Replicant { - let encryptor = Encryption() + public let encryptor = Encryption() - var config: ReplicantConfig - var serverPublicKey: SecKey - var clientPublicKey: SecKey - var clientPrivateKey: SecKey - - var toneBurst: ToneBurst? + public var config: ReplicantConfig + public var serverPublicKey: SecKey + public var clientPublicKey: SecKey + public var clientPrivateKey: SecKey + public var toneBurst: ToneBurst? public init?(withConfig config: ReplicantConfig) { diff --git a/Sources/ReplicantSwift/ToneBurst.swift b/Sources/ReplicantSwift/ToneBurst.swift index e96b4ca..f8972a8 100644 --- a/Sources/ReplicantSwift/ToneBurst.swift +++ b/Sources/ReplicantSwift/ToneBurst.swift @@ -81,7 +81,7 @@ public class ToneBurst: NSObject } } - func generate() -> SendState + public func generate() -> SendState { guard addIndex < addSequences.count else