Skip to content

Commit

Permalink
Chunk Size Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
consuelita committed Dec 28, 2018
1 parent 4c91f60 commit 49c78ae
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 14 deletions.
12 changes: 4 additions & 8 deletions Sources/ReplicantSwift/Polish/PolishController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,8 @@ public struct PolishController

func generateKeyAttributesDictionary() -> CFDictionary
{
let access = SecAccessControlCreateWithFlags(kCFAllocatorDefault,
kSecAttrAccessibleAlwaysThisDeviceOnly,
.privateKeyUsage,
nil)!
//FIXME: Secure Enclave
//let access = SecAccessControlCreateWithFlags(kCFAllocatorDefault, kSecAttrAccessibleAlwaysThisDeviceOnly, .privateKeyUsage, nil)!

let privateKeyAttributes: [String: Any] = [
kSecAttrIsPermanent as String: true,
Expand All @@ -152,10 +150,8 @@ public struct PolishController

func generateServerKeyAttributesDictionary() -> CFDictionary
{
let access = SecAccessControlCreateWithFlags(kCFAllocatorDefault,
kSecAttrAccessibleAlwaysThisDeviceOnly,
.privateKeyUsage,
nil)!
//FIXME: Secure Enclave
// let access = SecAccessControlCreateWithFlags(kCFAllocatorDefault, kSecAttrAccessibleAlwaysThisDeviceOnly, .privateKeyUsage, nil)!

let privateKeyAttributes: [String: Any] = [
kSecAttrIsPermanent as String: true,
Expand Down
4 changes: 2 additions & 2 deletions Sources/ReplicantSwift/ReplicantConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import Foundation
public struct ReplicantConfig: Codable
{
public var serverPublicKey: Data
public var chunkSize: Int
public var chunkSize: UInt16
public var chunkTimeout: Int
public var addSequences: [SequenceModel]?
public var removeSequences: [SequenceModel]?

public init?(serverPublicKey: Data, chunkSize: Int, chunkTimeout: Int, addSequences: [SequenceModel]?, removeSequences: [SequenceModel]?)
public init?(serverPublicKey: Data, chunkSize: UInt16, chunkTimeout: Int, addSequences: [SequenceModel]?, removeSequences: [SequenceModel]?)
{
guard chunkSize >= keySize + aesOverheadSize
else
Expand Down
4 changes: 2 additions & 2 deletions Sources/ReplicantSwift/ReplicantConfigTemplate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import Foundation

public struct ReplicantConfigTemplate: Codable
{
public var chunkSize: Int
public var chunkSize: UInt16
public var chunkTimeout: Int
public var addSequences: [SequenceModel]?
public var removeSequences: [SequenceModel]?


public init?(chunkSize: Int, chunkTimeout: Int, addSequences: [SequenceModel]?, removeSequences: [SequenceModel]?)
public init?(chunkSize: UInt16, chunkTimeout: Int, addSequences: [SequenceModel]?, removeSequences: [SequenceModel]?)
{
guard chunkSize >= keySize + aesOverheadSize
else
Expand Down
4 changes: 2 additions & 2 deletions Sources/ReplicantSwift/ReplicantServerConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import Foundation

public struct ReplicantServerConfig: Codable
{
public var chunkSize: Int
public var chunkSize: UInt16
public var chunkTimeout: Int
public var addSequences: [SequenceModel]?
public var removeSequences: [SequenceModel]?

public init?(serverPublicKey: SecKey, chunkSize: Int, chunkTimeout: Int, addSequences: [SequenceModel]?, removeSequences: [SequenceModel]?)
public init?(serverPublicKey: SecKey, chunkSize: UInt16, chunkTimeout: Int, addSequences: [SequenceModel]?, removeSequences: [SequenceModel]?)
{
guard chunkSize >= keySize + aesOverheadSize
else
Expand Down

0 comments on commit 49c78ae

Please sign in to comment.