1
0
mirror of git://jb55.com/damus synced 2024-09-29 00:10:43 +00:00

Remove private key leak warning

Remove the private key leak warning in the DMChatView and PostView since
they are no longer needed since nsec is automatically converted into
npub.

Changelog-Removed: Removed old nsec key warning, nsec automatically convert to npub when posting
Signed-off-by: kernelkind <kernelkind@gmail.com>
Reviewed-by: William Casarin <jb55@jb55.com>
Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
kernelkind 2023-12-18 13:22:00 -05:00 committed by William Casarin
parent 8a20e5845e
commit a2cac142c0
2 changed files with 2 additions and 28 deletions

View File

@ -11,7 +11,6 @@ import Combine
struct DMChatView: View, KeyboardReadable {
let damus_state: DamusState
@ObservedObject var dms: DirectMessageModel
@State var showPrivateKeyWarning: Bool = false
var pubkey: Pubkey {
dms.pubkey
@ -106,11 +105,7 @@ struct DMChatView: View, KeyboardReadable {
Button(
role: .none,
action: {
showPrivateKeyWarning = contentContainsPrivateKey(dms.draft)
if !showPrivateKeyWarning {
send_message()
}
send_message()
}
) {
Label("", image: "send")
@ -165,14 +160,6 @@ struct DMChatView: View, KeyboardReadable {
dms.draft = ""
}
}
.alert(NSLocalizedString("Note contains \"nsec1\" private key. Are you sure?", comment: "Alert user that they might be attempting to paste a private key and ask them to confirm."), isPresented: $showPrivateKeyWarning, actions: {
Button(NSLocalizedString("No", comment: "Button to cancel out of posting a note after being alerted that it looks like they might be posting a private key."), role: .cancel) {
showPrivateKeyWarning = false
}
Button(NSLocalizedString("Yes, Post with Private Key", comment: "Button to proceed with posting a note even though it looks like they might be posting a private key."), role: .destructive) {
send_message()
}
})
}
}

View File

@ -46,7 +46,6 @@ enum PostAction {
struct PostView: View {
@State var post: NSMutableAttributedString = NSMutableAttributedString()
@FocusState var focus: Bool
@State var showPrivateKeyWarning: Bool = false
@State var attach_media: Bool = false
@State var attach_camera: Bool = false
@State var error: String? = nil
@ -159,11 +158,7 @@ struct PostView: View {
var PostButton: some View {
Button(NSLocalizedString("Post", comment: "Button to post a note.")) {
showPrivateKeyWarning = contentContainsPrivateKey(self.post.string)
if !showPrivateKeyWarning {
self.send_post()
}
self.send_post()
}
.disabled(posting_disabled)
.opacity(posting_disabled ? 0.5 : 1.0)
@ -480,14 +475,6 @@ struct PostView: View {
clear_draft()
}
}
.alert(NSLocalizedString("Note contains \"nsec1\" private key. Are you sure?", comment: "Alert user that they might be attempting to paste a private key and ask them to confirm."), isPresented: $showPrivateKeyWarning, actions: {
Button(NSLocalizedString("No", comment: "Button to cancel out of posting a note after being alerted that it looks like they might be posting a private key."), role: .cancel) {
showPrivateKeyWarning = false
}
Button(NSLocalizedString("Yes, Post with Private Key", comment: "Button to proceed with posting a note even though it looks like they might be posting a private key."), role: .destructive) {
self.send_post()
}
})
}
}
}