nip26

package
v0.2.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 21, 2026 License: Unlicense Imports: 8 Imported by: 0

Documentation

Overview

Package nip26 implements NIP-26: Delegated Event Signing, letting an issuer authorize a delegate pubkey to sign events on its behalf within caller-defined conditions (event kind, creation-time window).

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidPubkey    = errors.New("nip26: invalid pubkey")
	ErrInvalidSignature = errors.New("nip26: invalid delegation signature")
	ErrInvalidCondition = errors.New("nip26: malformed condition")
	ErrConditionNotMet  = errors.New("nip26: event does not satisfy delegation condition")
)

Failure modes for VerifyDelegationToken/ValidateConditions, for callers that need to distinguish them (e.g. via errors.Is) rather than match on message text.

Functions

func SignDelegationToken added in v0.2.2

func SignDelegationToken(privkey, delegatePubkey, conditions string) (string, error)

SignDelegationToken signs a delegation token for a delegate pubkey and conditions. privkey: Issuer's private key (hex) delegatePubkey: Delegate's public key (hex) conditions: Delegation conditions (e.g., "kind=25521")

func ValidateConditions

func ValidateConditions(conditions string, kind int, createdAt uint64) error

ValidateConditions checks if an event satisfies the delegation conditions.

func VerifyDelegationToken

func VerifyDelegationToken(issuerPubkey, delegatePubkey, conditions, sigHex string) error

VerifyDelegationToken verifies a delegation token signature.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL