mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-09-18 03:22:22 +02:00
error aware Keyer.GetPublicKey
This commit is contained in:
@@ -16,18 +16,21 @@ type EncryptedKeySigner struct {
|
||||
callback func(context.Context) string
|
||||
}
|
||||
|
||||
func (es *EncryptedKeySigner) GetPublicKey(ctx context.Context) string {
|
||||
func (es *EncryptedKeySigner) GetPublicKey(ctx context.Context) (string, error) {
|
||||
if es.pk != "" {
|
||||
return es.pk
|
||||
return es.pk, nil
|
||||
}
|
||||
password := es.callback(ctx)
|
||||
key, err := nip49.Decrypt(es.ncryptsec, password)
|
||||
if err != nil {
|
||||
return ""
|
||||
return "", err
|
||||
}
|
||||
pk, err := nostr.GetPublicKey(key)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
pk, _ := nostr.GetPublicKey(key)
|
||||
es.pk = pk
|
||||
return pk
|
||||
return pk, nil
|
||||
}
|
||||
|
||||
func (es *EncryptedKeySigner) SignEvent(ctx context.Context, evt *nostr.Event) error {
|
||||
|
Reference in New Issue
Block a user