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:
committed by
William Casarin
parent
8a20e5845e
commit
a2cac142c0
@@ -11,7 +11,6 @@ import Combine
|
|||||||
struct DMChatView: View, KeyboardReadable {
|
struct DMChatView: View, KeyboardReadable {
|
||||||
let damus_state: DamusState
|
let damus_state: DamusState
|
||||||
@ObservedObject var dms: DirectMessageModel
|
@ObservedObject var dms: DirectMessageModel
|
||||||
@State var showPrivateKeyWarning: Bool = false
|
|
||||||
|
|
||||||
var pubkey: Pubkey {
|
var pubkey: Pubkey {
|
||||||
dms.pubkey
|
dms.pubkey
|
||||||
@@ -106,11 +105,7 @@ struct DMChatView: View, KeyboardReadable {
|
|||||||
Button(
|
Button(
|
||||||
role: .none,
|
role: .none,
|
||||||
action: {
|
action: {
|
||||||
showPrivateKeyWarning = contentContainsPrivateKey(dms.draft)
|
send_message()
|
||||||
|
|
||||||
if !showPrivateKeyWarning {
|
|
||||||
send_message()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
Label("", image: "send")
|
Label("", image: "send")
|
||||||
@@ -165,14 +160,6 @@ struct DMChatView: View, KeyboardReadable {
|
|||||||
dms.draft = ""
|
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()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ enum PostAction {
|
|||||||
struct PostView: View {
|
struct PostView: View {
|
||||||
@State var post: NSMutableAttributedString = NSMutableAttributedString()
|
@State var post: NSMutableAttributedString = NSMutableAttributedString()
|
||||||
@FocusState var focus: Bool
|
@FocusState var focus: Bool
|
||||||
@State var showPrivateKeyWarning: Bool = false
|
|
||||||
@State var attach_media: Bool = false
|
@State var attach_media: Bool = false
|
||||||
@State var attach_camera: Bool = false
|
@State var attach_camera: Bool = false
|
||||||
@State var error: String? = nil
|
@State var error: String? = nil
|
||||||
@@ -159,11 +158,7 @@ struct PostView: View {
|
|||||||
|
|
||||||
var PostButton: some View {
|
var PostButton: some View {
|
||||||
Button(NSLocalizedString("Post", comment: "Button to post a note.")) {
|
Button(NSLocalizedString("Post", comment: "Button to post a note.")) {
|
||||||
showPrivateKeyWarning = contentContainsPrivateKey(self.post.string)
|
self.send_post()
|
||||||
|
|
||||||
if !showPrivateKeyWarning {
|
|
||||||
self.send_post()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
.disabled(posting_disabled)
|
.disabled(posting_disabled)
|
||||||
.opacity(posting_disabled ? 0.5 : 1.0)
|
.opacity(posting_disabled ? 0.5 : 1.0)
|
||||||
@@ -480,14 +475,6 @@ struct PostView: View {
|
|||||||
clear_draft()
|
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()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user