This commit is contained in:
Max Goedjen
2020-11-29 13:15:14 -08:00
committed by GitHub
parent dc91f61dba
commit 6c3748b6bf
2 changed files with 17 additions and 4 deletions

View File

@@ -13,8 +13,10 @@ public struct OpenSSHKeyWriter {
lengthAndData(of: secret.publicKey)
}
public func openSSHString<SecretType: Secret>(secret: SecretType) -> String {
"\(curveType(for: secret.algorithm, length: secret.keySize)) \(data(secret: secret).base64EncodedString())"
public func openSSHString<SecretType: Secret>(secret: SecretType, comment: String? = nil) -> String {
[curveType(for: secret.algorithm, length: secret.keySize), data(secret: secret).base64EncodedString(), comment]
.compactMap { $0 }
.joined(separator: " ")
}
public func openSSHFingerprint<SecretType: Secret>(secret: SecretType) -> String {