mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-04-01 00:18:12 +02:00
nip46: add nip04_encrypt and nip04_decrypt to client.
This commit is contained in:
parent
9d1a6fab68
commit
243343f0c5
@ -193,6 +193,22 @@ func (bunker *BunkerClient) NIP44Decrypt(
|
||||
return bunker.RPC(ctx, "nip44_decrypt", []string{targetPublicKey, ciphertext})
|
||||
}
|
||||
|
||||
func (bunker *BunkerClient) NIP04Encrypt(
|
||||
ctx context.Context,
|
||||
targetPublicKey string,
|
||||
plaintext string,
|
||||
) (string, error) {
|
||||
return bunker.RPC(ctx, "nip04_encrypt", []string{targetPublicKey, plaintext})
|
||||
}
|
||||
|
||||
func (bunker *BunkerClient) NIP04Decrypt(
|
||||
ctx context.Context,
|
||||
targetPublicKey string,
|
||||
ciphertext string,
|
||||
) (string, error) {
|
||||
return bunker.RPC(ctx, "nip04_decrypt", []string{targetPublicKey, ciphertext})
|
||||
}
|
||||
|
||||
func (bunker *BunkerClient) RPC(ctx context.Context, method string, params []string) (string, error) {
|
||||
id := bunker.idPrefix + "-" + strconv.FormatUint(bunker.serial.Add(1), 10)
|
||||
req, err := json.Marshal(Request{
|
||||
|
Loading…
x
Reference in New Issue
Block a user