Skip to content

Commit

Permalink
Adding option to copy the private key from the repository
Browse files Browse the repository at this point in the history
  • Loading branch information
Sn0wfreezeDev committed Jun 1, 2022
1 parent 9829d6c commit 6b3196e
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ struct AccessoryListEntry: View {
}
Divider()
Button("Mark as \(accessory.isDeployed ? "deployable" : "deployed")", action: { accessory.isDeployed.toggle() })

Button("Copy private Key B64", action: { copyPrivateKey(accessory: accessory) })
}
}

Expand Down Expand Up @@ -188,6 +190,15 @@ struct AccessoryListEntry: View {
assert(false)
}
}

func copyPrivateKey(accessory: Accessory) {
let privateKey = accessory.privateKey
let keyB64 = privateKey.base64EncodedString()

let pasteboard = NSPasteboard.general
pasteboard.prepareForNewContents(with: .currentHostOnly)
pasteboard.setString(keyB64, forType: .string)
}

struct AccessoryListEntry_Previews: PreviewProvider {
@StateObject static var accessory = PreviewData.accessories.first!
Expand Down

0 comments on commit 6b3196e

Please sign in to comment.