Commit 3e1c3c03 authored by Drew's avatar Drew

Update NaOH to 1.0.6.0

parent aeebbe24
Pipeline #513 passed with stage
Subproject commit 596da09ccb801cfb54c7a9757c764e9428b74e82
Subproject commit c8ae8e143b47ada9b83710dee4c4dc27e878a6c4
......@@ -77,7 +77,7 @@ private final class GetPublicIdentity : CLIKit.EasyCommand {
let name = "getPublicIdentity"
private func command(parseResult: ParseResult) {
let key = try! PublicKey(readFromFile: (parseResult[StringlyTyped.identityFile.rawValue].stringValue))
print("\(key.publicKey.base64)")
print("\(key.bytes.base64)")
}
}
......
......@@ -54,11 +54,11 @@ public struct FISAFile {
var identityToDescription : [String: String] = [:]
for identity in identities {
let cipher = try! payloadKey.encrypted(toPublicKey: identity.key, fromKey: authoringIdentity.secretKey!, appendNonce: true)
identityToPayloadKey[identity.key.publicKey.base64] = cipher.base64
identityToDescription[identity.key.publicKey.base64] = identity.description
identityToPayloadKey[identity.key.bytes.base64] = cipher.base64
identityToDescription[identity.key.bytes.base64] = identity.description
}
let finalFile = ["identityToPayloadKey":identityToPayloadKey, "payload":cipherData.base64,"version":FISAFile.version,"authoringIdentity":authoringIdentity.publicKey.base64, "identityToDescription":identityToDescription]
let finalFile = ["identityToPayloadKey":identityToPayloadKey, "payload":cipherData.base64,"version":FISAFile.version,"authoringIdentity":authoringIdentity.bytes.base64, "identityToDescription":identityToDescription]
let fileData = try! NSJSONSerialization.dataWithJSONObject(finalFile, options: NSJSONWritingOptions())
try fileData.writeToFile(file, options: NSDataWritingOptions())
}
......@@ -69,7 +69,7 @@ public struct FISAFile {
let json = try NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions())
guard let version = json["version"] as? Int, let payload = json["payload"] as? String, let identities = json["identityToPayloadKey"] as? [String:String], let authoringIdentity = json["authoringIdentity"] as? String, let identityToDescription = json["identityToDescription"] as? [String:String] else { throw FISAKitError.InvalidFISAFile(0) }
if version != 1 { print("Unknown version \(version)") }
guard let cipherPayloadKey = identities[identity.publicKey.base64] else { throw FISAKitError.IdentityCantOpenFile}
guard let cipherPayloadKey = identities[identity.bytes.base64] else { throw FISAKitError.IdentityCantOpenFile}
let cipherPayloadKeyBytes = Array<UInt8>.byteArrayWithBase64(cipherPayloadKey)
let authoringIdentityKey = PublicKey(publicKeyBytes: Array<UInt8>.byteArrayWithBase64(authoringIdentity))
......@@ -88,7 +88,7 @@ public struct FISAFile {
let identityBytes = Array<UInt8>.byteArrayWithBase64(i)
//look up description
guard let identityDescription = identityToDescription[i] else { throw FISAKitError.InvalidFISAFile(2) }
if identityBytes == identity.publicKey { //the authoring identity
if identityBytes == identity.bytes { //the authoring identity
let identityStruct = Identity(description: identityDescription, key: identity)
installIdentities.append(identityStruct)
}
......@@ -156,7 +156,7 @@ extension FISAFile : CustomStringConvertible {
var str = "FISA file contents:\n"
str += "Identities:\n"
for identity in identities {
str += "\(identity.description): \(identity.key.publicKey.base64)\n"
str += "\(identity.description): \(identity.key.bytes.base64)\n"
}
str += "\nSecrets:\n"
for secret in secrets {
......
......@@ -30,7 +30,7 @@ public func createIdentity(file: String) throws {
/**Gets the public portion of the identity, as base64 */
public func getPublicIdentity(file: String) throws -> String {
let identity = try PublicKey(readFromFile: file)
return identity.publicKey.base64
return identity.bytes.base64
}
enum FISAKitError : ErrorType {
......
......@@ -75,8 +75,8 @@ class FISAFileTests: XCTestCase {
let key1 = PublicKey()
let key2 = PublicKey()
f.addIdentity(key1.publicKey.base64, description: "one")
f.addIdentity(key2.publicKey.base64, description: "two")
f.addIdentity(key1.bytes.base64, description: "one")
f.addIdentity(key2.bytes.base64, description: "two")
XCTAssert(f.identities.count==2)
try! f.removeIdentity("two")
XCTAssert(f.identities.count==1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment