Commit b0ab75b3 authored by Drew's avatar Drew

Fix getPublicIdentity

parent a97822c3
Pipeline #2862 passed with stages
in 4 minutes and 27 seconds
......@@ -71,8 +71,8 @@ private final class GetPublicIdentity : CLIKit.EasyCommand {
fileprivate let shortHelp = "Get the public portion of your identity"
let name = "getPublicIdentity"
fileprivate func command(_ parseResult: ParseResult) {
let key = try! CryptoBoxPublicKey(readFromFile: (parseResult[StringlyTyped.identityFile.rawValue].stringValue))
print("\(key.bytes.base64)")
let key = try! FISA.getPublicIdentity(parseResult[StringlyTyped.identityFile.rawValue].stringValue)
print("\(key)")
}
}
......
......@@ -164,7 +164,7 @@ extension FISA.File {
if identityPath == FISA.DefaultIdentityPath, let env = getenv("FISA_IDENTITY") {
let identity = String(cString: env)
var bytes = Array<UInt8>.byteArrayWithBase64(identity)
key = try CryptoBoxSecretKey(bytes: &bytes)
key = CryptoBoxSecretKey(bytes: &bytes)
}
else {
key = try CryptoBoxSecretKey(readFromFile: identityPath)
......
......@@ -29,7 +29,8 @@ extension FISA {
/**Gets the public portion of the identity, as base64 */
public static func getPublicIdentity(_ file: String) throws -> String {
let identity = try CryptoBoxPublicKey(readFromFile: file)
let k = try CryptoBoxSecretKey(readFromFile: file)
let identity = CryptoBoxPublicKey(secretKey: k)
return identity.bytes.base64
}
}
......
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