error aware Keyer.GetPublicKey

This commit is contained in:
1l0
2024-09-19 17:47:18 +09:00
committed by fiatjaf_
parent e1cdb71d6f
commit 0b2b69529b
6 changed files with 35 additions and 17 deletions

View File

@@ -10,7 +10,7 @@ import (
// It can be used when an app for some reason wants to ask the user to manually provide a signed event
// by copy-and-paste, for example.
type ManualSigner struct {
ManualGetPublicKey func(context.Context) string
ManualGetPublicKey func(context.Context) (string, error)
ManualSignEvent func(context.Context, *nostr.Event) error
ManualEncrypt func(ctx context.Context, plaintext string, recipientPublicKey string) (base64ciphertext string, err error)
ManualDecrypt func(ctx context.Context, base64ciphertext string, senderPublicKey string) (plaintext string, err error)
@@ -20,7 +20,7 @@ func (ms ManualSigner) SignEvent(ctx context.Context, evt *nostr.Event) error {
return ms.ManualSignEvent(ctx, evt)
}
func (ms ManualSigner) GetPublicKey(ctx context.Context) string {
func (ms ManualSigner) GetPublicKey(ctx context.Context) (string, error) {
return ms.ManualGetPublicKey(ctx)
}