Key

package
v1.0.11 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Blake224Hash

func Blake224Hash(b []byte, len int) ([]byte, error)

*

Blake224Hash computes the Blake2b-224 hash of the provided byte slice.

Params:
	b ([]byte): The input byte slice to hash.
	len (int): The length of the hash.

Returns:
	([]byte, error): The computed hash and an error if computation fails,
					 nil otherwise.

func Sign

func Sign(message []byte, sk []byte) ([]byte, error)

*

Sign function signs a message using the provided key and returns
the signature.

Params:
	message ([]byte): The message to sign.
	sk ([]byte): The signing key, which can be either an extended or an ed25519 private key.

Returns:
	[]byte: The signature of the message.
	error: An error if the signing fails.

Types

type PaymentKeyPair

type PaymentKeyPair struct {
	VerificationKey VerificationKey
	SigningKey      SigningKey
}

func PaymentKeyPairGenerate

func PaymentKeyPairGenerate() (*PaymentKeyPair, error)

*

PaymentKeyPairGenerate generates a PaymentKey pair with a randomly
generated key pair.

Returns:
	PaymentKeyPair: A newly generated PaymentKeyPair.
	error: An error if the payment fails.

type PaymentSigningKey

type PaymentSigningKey SigningKey

type PaymentVerificationKey

type PaymentVerificationKey VerificationKey

type SigningKey

type SigningKey struct {
	Payload []byte
}

func SigningKeyFromHexString added in v1.0.11

func SigningKeyFromHexString(hexString string) (*SigningKey, error)

func (*SigningKey) MarshalCBOR added in v1.0.11

func (sk *SigningKey) MarshalCBOR() ([]byte, error)

func (SigningKey) Sign

func (sk SigningKey) Sign(data []byte) ([]byte, error)

*

Sign function signs a data byte slice using
the signing key and the returns the signature.

Params:
	data ([]byte): The data to sign.

Returns:
	[]byte: The signature of the data.
	error: An error if the signing fails.

func (SigningKey) ToHexString added in v1.0.11

func (sk SigningKey) ToHexString() string

func (*SigningKey) UnmarshalCBOR added in v1.0.11

func (sk *SigningKey) UnmarshalCBOR(data []byte) error

type StakeSigningKey

type StakeSigningKey SigningKey

type StakeVerificationKey

type StakeVerificationKey VerificationKey

type VerificationKey

type VerificationKey struct {
	Payload []byte
}

func VerificationKeyFromCbor

func VerificationKeyFromCbor(cbor_string string) (*VerificationKey, error)

*

VerificationKeyFromCbor creates a VerificationKey
instance from a CBOR-encoded string.

Params:
	cbor_string (string): The CBOR-encoded string.

Returns:
	(*VerificationKey, error): A VerificationKey instance and an error
							   if decoding or unmarshaling fails, nil otherwise.

func VerificationKeyFromHexString added in v1.0.11

func VerificationKeyFromHexString(hexString string) (*VerificationKey, error)

func (VerificationKey) Hash

*

Hash computes the has of the VerificationKey and returns it as
public key.

Returns:
	(serialization.PubKeyHash, error): The computed hash and an error
										if computation fails, nil otherwise.

func (*VerificationKey) MarshalCBOR

func (vk *VerificationKey) MarshalCBOR() ([]byte, error)

*

MarshalCBOR marshals the VerificationKey instance into CBOR data.

Returns:
	([]byte, error): The CBOR-encoded data and error if marshaling fails, nil otherwise.

func (VerificationKey) ToHexString added in v1.0.11

func (vk VerificationKey) ToHexString() string

func (*VerificationKey) UnmarshalCBOR

func (vk *VerificationKey) UnmarshalCBOR(data []byte) error

*

UnmarshalCBOR function unmarshals data into a VerificationKey instance.

Params:
	data ([]byte): The CBOR data to unmarshal.

Returns:
	error: An error if unmarshaling fails, nil otherwise.

Jump to

Keyboard shortcuts

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