Skip to content

Commit

Permalink
Rename keypair -> secret
Browse files Browse the repository at this point in the history
  • Loading branch information
zorgiepoo committed Nov 21, 2023
1 parent d10da5e commit 645f446
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions generate_keys/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func findSecret(account: String) -> Data? {
exit(1)
}

func generateKeyPair() -> (publicEdKey: Data, seed: Data) {
func generatePublicKeyAndSeed() -> (publicEdKey: Data, seed: Data) {
var seed = Array<UInt8>(repeating: 0, count: 32)
var publicEdKey = Array<UInt8>(repeating: 0, count: 32)
var privateEdKey = Array<UInt8>(repeating: 0, count: 64)
Expand Down Expand Up @@ -270,7 +270,7 @@ struct GenerateKeys: ParsableCommand {
} else {
print("Generating a new signing key. This may take a moment, depending on your machine.")

let (pubKey, seed) = generateKeyPair()
let (pubKey, seed) = generatePublicKeyAndSeed()
// New keys that are generated only store the seed as the secret
// Old keys store private orlp/Ed25519 key + public key
storeSecret(account: account, publicEdKey: pubKey, secret: seed)
Expand Down
12 changes: 6 additions & 6 deletions sign_update/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,19 @@ func findKeysInKeychain(account: String) throws -> (Data, Data) {
throw ExitCode.failure
}

func findKeys(inFile keyPairFile: String) throws -> (Data, Data) {
let keyPair: String
if keyPairFile == "-" && !FileManager.default.fileExists(atPath: keyPairFile) {
func findKeys(inFile secretFile: String) throws -> (Data, Data) {
let secretString: String
if secretFile == "-" && !FileManager.default.fileExists(atPath: secretFile) {
if let line = readLine(strippingNewline: true) {
keyPair = line
secretString = line
} else {
print("ERROR! Unable to read EdDSA private key from standard input")
throw ExitCode(1)
}
} else {
keyPair = try String(contentsOfFile: keyPairFile)
secretString = try String(contentsOfFile: secretFile)
}
return try findKeys(inString: keyPair, allowNewFormat: true)
return try findKeys(inString: secretString, allowNewFormat: true)
}

func findKeys(inString secretBase64String: String, allowNewFormat: Bool) throws -> (Data, Data) {
Expand Down

0 comments on commit 645f446

Please sign in to comment.