realy

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2024 License: Unlicense Imports: 4 Imported by: 0

README

realy.lol

nostr relay built from a heavily modified fork of nbd-wtf/go-nostr and fiatjaf/relayer aimed at maximum performance, simplicity and memory efficiency.

includes:

  • a lot of other bits and pieces accumulated from nearly 8 years of working with Go, logging and run control, user data directories (windows, mac, linux, android)
  • a cleaned up and unified fork of the btcd/dcred BIP-340 signatures, including the use of bitcoin core's BIP-340 implementation (more than 4x faster than btcd)
  • AVX/AVX2 optimized SHA256 and SIMD hex encoder
  • a bespoke, mutable byte slice based hash/pubkey/signature encoding in memory and the fastest nostr binary codec that exists
  • custom badger based database with a garbage collector that prunes off data with least recent access
  • vanity npub generator that can mine a 5 letter prefix in around 15 minutes on a 6 core Ryzen 5 processor
  • reverse proxy tool with support for Go vanity imports and nip-05 npub DNS verification and own TLS certificates

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type B added in v1.0.0

type B = []byte

type Binary added in v1.0.0

type Binary interface {
	// MarshalBinary converts the data of the type into binary form, appending
	// it to the provided slice.
	MarshalBinary(dst B) (b B, err E)
	// UnmarshalBinary decodes a binary form of a type back into the runtime
	// form, and returns whatever remains after the type has been decoded out.
	UnmarshalBinary(b B) (r B, err E)
}

type Ctx added in v1.0.0

type Ctx = context.T

type E added in v1.0.0

type E = error

type Generator added in v1.0.0

type Generator interface {
	// Generate gathers entropy and derives pubkey bytes for matching, this returns the 33 byte
	// compressed form for checking the oddness of the Y coordinate.
	Generate() (pubBytes B, err E)
	// Negate flips the public key Y coordinate between odd and even.
	Negate()
	// KeyPairBytes returns the raw bytes of the secret and public key, this returns the 32 byte
	// X-only pubkey.
	KeyPairBytes() (secBytes, cmprPubBytes B)
}

Generator is an interface for nostr BIP-340 key generation.

type I added in v1.0.0

type I interface {
	Label() string
	Write(w io.Writer) (err E)
	JSON
}

type JSON added in v1.0.0

type JSON interface {
	// MarshalJSON converts the data of the type into JSON, appending it to the
	// provided slice and returning the extended slice.
	MarshalJSON(dst B) (b B, err E)
	// UnmarshalJSON decodes a JSON form of a type back into the runtime form,
	// and returns whatever remains after the type has been decoded out.
	UnmarshalJSON(b B) (r B, err E)
}

type N added in v1.0.0

type N = int

type S added in v1.0.0

type S = string

type Signer added in v1.0.0

type Signer interface {
	// Generate creates a fresh new key pair from system entropy, and ensures it is even (so
	// ECDH works).
	Generate() (err E)
	// InitSec initialises the secret (signing) key from the raw bytes, and also
	// derives the public key because it can.
	InitSec(sec B) (err E)
	// InitPub initializes the public (verification) key from raw bytes.
	InitPub(pub B) (err E)
	// Sec returns the secret key bytes.
	Sec() B
	// Pub returns the public key bytes (x-only schnorr pubkey).
	Pub() B
	// ECPub returns the public key bytes (33 byte ecdsa pubkey). The first byte is always 2 due
	// to ECDH and X-only keys.
	ECPub() B
	// Sign creates a signature using the stored secret key.
	Sign(msg B) (sig B, err E)
	// Verify checks a message hash and signature match the stored public key.
	Verify(msg, sig B) (valid bool, err E)
	// Zero wipes the secret key to prevent memory leaks.
	Zero()
	// ECDH returns a shared secret derived using Elliptic Curve Diffie Hellman on the Signer
	// secret and provided pubkey.
	ECDH(pub B) (secret B, err E)
	// Negate flips the the secret key to change between odd and even compressed public key.
	Negate()
}

Directories

Path Synopsis
Package atomic provides simple wrappers around numerics to enforce atomic access.
Package atomic provides simple wrappers around numerics to enforce atomic access.
internal/gen-atomicint
gen-atomicint generates an atomic wrapper around an integer type.
gen-atomicint generates an atomic wrapper around an integer type.
internal/gen-atomicwrapper
gen-atomicwrapper generates wrapper types around other atomic types.
gen-atomicwrapper generates wrapper types around other atomic types.
cmd
lerproxy
Command lerproxy implements https reverse proxy with automatic LetsEncrypt usage for multiple hostnames/backends, and URL rewriting capability.
Command lerproxy implements https reverse proxy with automatic LetsEncrypt usage for multiple hostnames/backends, and URL rewriting capability.
Package context is a set of shorter names for the very stuttery context library.
Package context is a set of shorter names for the very stuttery context library.
ec
Package btcec implements support for the elliptic curves needed for bitcoin.
Package btcec implements support for the elliptic curves needed for bitcoin.
base58
Package base58 provides an API for working with modified base58 and Base58Check encodings.
Package base58 provides an API for working with modified base58 and Base58Check encodings.
bech32
Package bech32 provides a Go implementation of the bech32 format specified in BIP 173.
Package bech32 provides a Go implementation of the bech32 format specified in BIP 173.
chainhash
Package chainhash provides abstracted hash functionality.
Package chainhash provides abstracted hash functionality.
ecdsa
Package ecdsa provides secp256k1-optimized ECDSA signing and verification.
Package ecdsa provides secp256k1-optimized ECDSA signing and verification.
hex
schnorr
Package schnorr provides custom Schnorr signing and verification via secp256k1.
Package schnorr provides custom Schnorr signing and verification via secp256k1.
secp256k1
Package secp256k1 implements optimized secp256k1 elliptic curve operations in pure Go.
Package secp256k1 implements optimized secp256k1 elliptic curve operations in pure Go.
gen
del
keys
Package keys is a composable framework for constructing badger keys from fields of events.
Package keys is a composable framework for constructing badger keys from fields of events.

Jump to

Keyboard shortcuts

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