i2pkeys

package module
v0.33.7 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: Unlicense Imports: 13 Imported by: 21

README

i2pkeys

Generates and displays the contents of files that are storing i2p keys in the incompatible format used for sam3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StringIsBase64 bool

If you set this to true, Addr will return a base64 String()

Functions

func Base32

func Base32(anything string) string

Makes any string into a *.b32.i2p human-readable I2P address. This makes no sense, unless "anything" is an I2P destination of some sort.

func StoreKeys

func StoreKeys(k I2PKeys, r string) error

func StoreKeysIncompat

func StoreKeysIncompat(k I2PKeys, w io.Writer) (err error)

store keys in non standard format

Types

type I2PAddr

type I2PAddr string

I2PAddr represents an I2P destination, almost equivalent to an IP address. This is the humongously huge base64 representation of such an address, which really is just a pair of public keys and also maybe a certificate. (I2P hides the details of exactly what it is. Read the I2P specifications for more info.)

func FiveHundredAs

func FiveHundredAs() I2PAddr

func Lookup

func Lookup(addr string) (*I2PAddr, error)

func NewI2PAddrFromBytes

func NewI2PAddrFromBytes(addr []byte) (I2PAddr, error)

Creates a new I2P address from a byte array. The inverse of ToBytes().

func NewI2PAddrFromString

func NewI2PAddrFromString(addr string) (I2PAddr, error)

Creates a new I2P address from a base64-encoded string. Checks if the address addr is in correct format. (If you know for sure it is, use I2PAddr(addr).)

func (I2PAddr) Base32

func (addr I2PAddr) Base32() (str string)

Returns the *.b32.i2p address of the I2P address. It is supposed to be a somewhat human-manageable 64 character long pseudo-domain name equivalent of the 516+ characters long default base64-address (the I2PAddr format). It is not possible to turn the base32-address back into a usable I2PAddr without performing a Lookup(). Lookup only works if you are using the I2PAddr from which the b32 address was generated.

func (I2PAddr) Base64

func (a I2PAddr) Base64() string

Returns the base64 representation of the I2PAddr

func (I2PAddr) Bytes

func (addr I2PAddr) Bytes() []byte

func (I2PAddr) DestHash

func (addr I2PAddr) DestHash() (h I2PDestHash)

func (I2PAddr) Network

func (a I2PAddr) Network() string

Returns "I2P"

func (I2PAddr) String

func (a I2PAddr) String() string

Returns the I2P destination (base32-encoded)

func (I2PAddr) ToBytes

func (addr I2PAddr) ToBytes() ([]byte, error)

Turns an I2P address to a byte array. The inverse of NewI2PAddrFromBytes().

type I2PDestHash

type I2PDestHash [32]byte

an i2p destination hash, the .b32.i2p address if you will

func DestHashFromBytes

func DestHashFromBytes(str []byte) (dhash I2PDestHash, err error)

create a desthash from a []byte array

func DestHashFromString

func DestHashFromString(str string) (dhash I2PDestHash, err error)

create a desthash from a string b32.i2p address

func (I2PDestHash) Hash

func (h I2PDestHash) Hash() string

get base64 representation of i2p dest sha256 hash(the 44-character one)

func (I2PDestHash) Network

func (h I2PDestHash) Network() string

Returns "I2P"

func (I2PDestHash) String

func (h I2PDestHash) String() string

get string representation of i2p dest hash(base32 version)

type I2PKeys

type I2PKeys struct {
	Address I2PAddr // only the public key
	Both    string  // both public and private keys
}

The public and private keys associated with an I2P destination. I2P hides the details of exactly what this is, so treat them as blobs, but generally: One pair of DSA keys, one pair of ElGamal keys, and sometimes (almost never) also a certificate. String() returns you the full content of I2PKeys and Addr() returns the public keys.

func LoadKeys

func LoadKeys(r string) (I2PKeys, error)

load keys from non-standard format by specifying a text file. If the file does not exist, generate keys, otherwise, fail closed.

func LoadKeysIncompat

func LoadKeysIncompat(r io.Reader) (k I2PKeys, err error)

load keys from non standard format

func NewDestination

func NewDestination() (*I2PKeys, error)

HELLO VERSION MIN=3.1 MAX=3.1 DEST GENERATE SIGNATURE_TYPE=7

func NewKeys

func NewKeys(addr I2PAddr, both string) I2PKeys

Creates I2PKeys from an I2PAddr and a public/private keypair string (as generated by String().)

func (I2PKeys) Addr

func (k I2PKeys) Addr() I2PAddr

Returns the public keys of the I2PKeys.

func (I2PKeys) Ed25519PrivateKey

func (k I2PKeys) Ed25519PrivateKey() *ed25519.PrivateKey

func (I2PKeys) HostnameEntry

func (k I2PKeys) HostnameEntry(hostname string, opts crypto.SignerOpts) (string, error)

func (I2PKeys) Network

func (k I2PKeys) Network() string

func (I2PKeys) Private

func (k I2PKeys) Private() []byte

func (I2PKeys) PrivateKey

func (k I2PKeys) PrivateKey() crypto.PrivateKey

func (I2PKeys) Public

func (k I2PKeys) Public() crypto.PublicKey

func (I2PKeys) SecretKey

func (k I2PKeys) SecretKey() SecretKey

func (I2PKeys) Sign

func (k I2PKeys) Sign(rand io.Reader, digest []byte, opts crypto.SignerOpts) (signature []byte, err error)

func (I2PKeys) String

func (k I2PKeys) String() string

Returns the keys (both public and private), in I2Ps base64 format. Use this when you create sessions.

type SecretKey

type SecretKey interface {
	Sign(rand io.Reader, digest []byte, opts crypto.SignerOpts) (signature []byte, err error)
}

Jump to

Keyboard shortcuts

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