key

package
v0.1.16 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Private = KeyStyle("Private")
	Public  = KeyStyle("Public")
)

Variables

This section is empty.

Functions

func FromText

func FromText(pkstr string, id string) (*PrivateKey, *PublicKey, error)

Types

type JsonKeyType

type JsonKeyType struct {
	Id    string
	Style KeyStyle
	Raw   string
}

type KeyStyle

type KeyStyle string

type KeyType

type KeyType struct {
	Id    string
	Style KeyStyle
	Raw   RawKey
}

func ToKeyType

func ToKeyType(jsk JsonKeyType) (*KeyType, error)

func (*KeyType) AsJSON

func (k *KeyType) AsJSON() *JsonKeyType

type PrivateKey

type PrivateKey struct {
	Key KeyType
}

func MakePrivateKey

func MakePrivateKey(key *RawKey, ids ...string) *PrivateKey

func NewPrivateKey

func NewPrivateKey(pk ...*PrivateKey) (*PrivateKey, error)

NewPrivateKey generates a new curve25519 secret key. It conforms to the format described on https://cr.yp.to/ecdh.html.

func (*PrivateKey) Marshal

func (k *PrivateKey) Marshal() string

MarshalText create a String of the Private Key

func (*PrivateKey) Public

func (k *PrivateKey) Public() *PublicKey

Public computes the public key matching this curve25519 secret key.

type PublicKey

type PublicKey struct {
	Key KeyType
}

func MakePublicKey

func MakePublicKey(key *RawKey, id string) *PublicKey

func (*PublicKey) Marshal

func (k *PublicKey) Marshal() string

type RawKey

type RawKey [32]byte

func AsRawKey

func AsRawKey(my []byte) *RawKey

func CreateRandomKey

func CreateRandomKey() (*RawKey, error)

CreateRandomKey generates a new random key.

func (*RawKey) As32Byte

func (my *RawKey) As32Byte() *[32]byte

Uncool to copie a key in local memory

func (*RawKey) Marshal

func (k *RawKey) Marshal() string

Jump to

Keyboard shortcuts

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