Skip to content

Commit

Permalink
0.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
consuelita committed Nov 21, 2018
1 parent ca44491 commit 1c444ab
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 16 deletions.
11 changes: 3 additions & 8 deletions Sources/ReplicantSwift/Encryption.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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<CFError>?

Expand All @@ -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<CFError>?

Expand Down
13 changes: 6 additions & 7 deletions Sources/ReplicantSwift/ReplicantSwift.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion Sources/ReplicantSwift/ToneBurst.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public class ToneBurst: NSObject
}
}

func generate() -> SendState
public func generate() -> SendState
{
guard addIndex < addSequences.count
else
Expand Down

0 comments on commit 1c444ab

Please sign in to comment.