mock

package
v2.2.0-rc7 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2024 License: BSD-3-Clause Imports: 18 Imported by: 1

Documentation

Overview

Package mock provides a mock implementation for the access control functionalities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

New creates a new mock accesscontrol Controller.

Types

type GranteeListMock

type GranteeListMock interface {
	Add(publicKeys []*ecdsa.PublicKey) error
	Remove(removeList []*ecdsa.PublicKey) error
	Get() []*ecdsa.PublicKey
	Save() (swarm.Address, error)
}

type GranteeListStructMock

type GranteeListStructMock struct {
	// contains filtered or unexported fields
}

func NewGranteeList

func NewGranteeList() *GranteeListStructMock

func (*GranteeListStructMock) Add

func (g *GranteeListStructMock) Add(addList []*ecdsa.PublicKey) error

func (*GranteeListStructMock) Get

func (*GranteeListStructMock) Remove

func (g *GranteeListStructMock) Remove(removeList []*ecdsa.PublicKey) error

func (*GranteeListStructMock) Save

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option is an option passed to a mock accesscontrol Controller.

func WithAcceptAll

func WithAcceptAll() Option

WithAcceptAll sets the mock to return fixed references on every call to DownloadHandler.

func WithHistory

func WithHistory(h accesscontrol.History, ref string) Option

WithHistory sets the mock to use the given history reference.

func WithPublisher

func WithPublisher(ref string) Option

WithPublisher sets the mock to use the given reference as the publisher address.

type SessionMock

type SessionMock struct {
	KeyFunc func(publicKey *ecdsa.PublicKey, nonces [][]byte) ([][]byte, error)
	// contains filtered or unexported fields
}

func NewFromKeystore

func NewFromKeystore(
	ks keystore.Service,
	tag,
	password string,
	keyFunc func(publicKey *ecdsa.PublicKey, nonces [][]byte) ([][]byte, error),
) *SessionMock

func NewSessionMock

func NewSessionMock(key *ecdsa.PrivateKey) *SessionMock

func (*SessionMock) Key

func (s *SessionMock) Key(publicKey *ecdsa.PublicKey, nonces [][]byte) ([][]byte, error)

Jump to

Keyboard shortcuts

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