testutil

package
Version: v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2020 License: AGPL-3.0, MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RandTestBogusIdentity

func RandTestBogusIdentity() (tnet.Identity, error)

RandTestBogusIdentity returns a new test identity

func RandTestBogusIdentityOrFatal

func RandTestBogusIdentityOrFatal(t *testing.T) tnet.Identity

RandTestBogusIdentityOrFatal errors out if we cant generate a new identity

Types

type TestBogusPrivateKey

type TestBogusPrivateKey []byte

TestBogusPrivateKey is a key used for testing (to avoid expensive keygen)

func RandTestBogusPrivateKey

func RandTestBogusPrivateKey() (TestBogusPrivateKey, error)

RandTestBogusPrivateKey returns a new test private key

func RandTestBogusPrivateKeyOrFatal

func RandTestBogusPrivateKeyOrFatal(t *testing.T) TestBogusPrivateKey

RandTestBogusPrivateKeyOrFatal errors out if we cant generate a private key

func (TestBogusPrivateKey) Bytes

func (sk TestBogusPrivateKey) Bytes() ([]byte, error)

Bytes returns the bytes of the key

func (TestBogusPrivateKey) Decrypt

func (sk TestBogusPrivateKey) Decrypt(b []byte) ([]byte, error)

Decrypt decrypts the contents

func (TestBogusPrivateKey) Equals

func (sk TestBogusPrivateKey) Equals(k ic.Key) bool

Equals checks whether this key is equal to another

func (TestBogusPrivateKey) GenSecret

func (sk TestBogusPrivateKey) GenSecret() []byte

GenSecret returns a secret

func (TestBogusPrivateKey) GetPublic

func (sk TestBogusPrivateKey) GetPublic() ic.PubKey

GetPublic returns the public key

func (TestBogusPrivateKey) Raw

func (sk TestBogusPrivateKey) Raw() ([]byte, error)

Raw returns the raw bytes of the key (not wrapped in the libp2p-crypto protobuf).

func (TestBogusPrivateKey) Sign

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

Sign signs the message

func (TestBogusPrivateKey) Type

func (sk TestBogusPrivateKey) Type() pb.KeyType

Type returns the protobof key type.

type TestBogusPublicKey

type TestBogusPublicKey []byte

TestBogusPublicKey is a key used for testing (to avoid expensive keygen)

func RandTestBogusPublicKey

func RandTestBogusPublicKey() (TestBogusPublicKey, error)

RandTestBogusPublicKey returns a new test public key

func RandTestBogusPublicKeyOrFatal

func RandTestBogusPublicKeyOrFatal(t *testing.T) TestBogusPublicKey

RandTestBogusPublicKeyOrFatal errors out if we cant generate a public key

func (TestBogusPublicKey) Bytes

func (pk TestBogusPublicKey) Bytes() ([]byte, error)

Bytes returns the key bytes

func (TestBogusPublicKey) Encrypt

func (pk TestBogusPublicKey) Encrypt(b []byte) ([]byte, error)

Encrypt encrypts the contents

func (TestBogusPublicKey) Equals

func (pk TestBogusPublicKey) Equals(k ic.Key) bool

Equals checks whether this key is equal to another

func (TestBogusPublicKey) Raw

func (pk TestBogusPublicKey) Raw() ([]byte, error)

Raw returns the raw bytes of the key (not wrapped in the libp2p-crypto protobuf).

func (TestBogusPublicKey) Type

func (pk TestBogusPublicKey) Type() pb.KeyType

Type returns the protobof key type.

func (TestBogusPublicKey) Verify

func (pk TestBogusPublicKey) Verify(data, sig []byte) (bool, error)

Verify is used to verify the data

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL