-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eab1b7e
commit ca44491
Showing
8 changed files
with
345 additions
and
372 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// | ||
// SequenceModel.swift | ||
// ReplicantSwift | ||
// | ||
// Created by Adelita Schule on 11/15/18. | ||
// | ||
|
||
import Foundation | ||
|
||
public struct SequenceModel | ||
{ | ||
/// Byte Sequence. | ||
var sequence: Data | ||
|
||
/// Target sequence Length. | ||
var length: UInt | ||
|
||
init?(sequence: Data, length: UInt) | ||
{ | ||
///FIXME: Is this still correct? Length must be no larger than 1440 bytes | ||
if length == 0 || length > 65535 | ||
{ | ||
print("\nSequenceModel initialization failed: target length was either 0 or larger than 65535\n") | ||
return nil | ||
} | ||
|
||
self.sequence = sequence | ||
self.length = length | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// | ||
// ReplicantConfig.swift | ||
// ReplicantSwift | ||
// | ||
// Created by Adelita Schule on 11/14/18. | ||
// | ||
|
||
import Foundation | ||
|
||
public struct ReplicantConfig | ||
{ | ||
var serverPublicKey: SecKey | ||
var chunkSize: Int | ||
var chunkTimeout: Int | ||
var addSequences: [SequenceModel]? | ||
var removeSequences: [SequenceModel]? | ||
|
||
|
||
public init?(serverPublicKey: SecKey, chunkSize: Int, chunkTimeout: Int, addSequences: [SequenceModel]?, removeSequences: [SequenceModel]?) | ||
{ | ||
guard chunkSize >= keySize + aesOverheadSize | ||
else | ||
{ | ||
print("\nUnable to initialize ReplicantConfig: chunkSize (\(chunkSize)) cannot be smaller than keySize + aesOverheadSize (\(keySize + aesOverheadSize))\n") | ||
return nil | ||
} | ||
self.serverPublicKey = serverPublicKey | ||
self.chunkSize = chunkSize | ||
self.chunkTimeout = chunkTimeout | ||
self.addSequences = addSequences | ||
self.removeSequences = removeSequences | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.