soc

package
v0.0.0-...-eb12069 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2023 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package soc provides the single-owner chunk implementation and validator.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateAddress

func CreateAddress(id ID, owner []byte) (swarm.Address, error)

CreateAddress creates a new SOC address from the id and the ethereum address of the owner.

func Valid

func Valid(ch swarm.Chunk) bool

Valid checks if the chunk is a valid single-owner chunk.

Types

type ID

type ID []byte

ID is a SOC identifier

type SOC

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

SOC wraps a content-addressed chunk.

func FromChunk

func FromChunk(sch swarm.Chunk) (*SOC, error)

FromChunk recreates a SOC representation from swarm.Chunk data.

func New

func New(id ID, ch swarm.Chunk) *SOC

New creates a new SOC representation from arbitrary id and a content-addressed chunk.

func NewSigned

func NewSigned(id ID, ch swarm.Chunk, owner, sig []byte) (*SOC, error)

NewSigned creates a single-owner chunk based on already signed data.

func (*SOC) Address

func (s *SOC) Address() (swarm.Address, error)

Address returns the SOC chunk address.

func (*SOC) Chunk

func (s *SOC) Chunk() (swarm.Chunk, error)

Chunk returns the SOC chunk.

func (*SOC) ID

func (s *SOC) ID() []byte

ID returns the SOC id.

func (*SOC) OwnerAddress

func (s *SOC) OwnerAddress() []byte

OwnerAddress returns the ethereum address of the SOC owner.

func (*SOC) Sign

func (s *SOC) Sign(signer crypto.Signer) (swarm.Chunk, error)

Sign signs a SOC using the given signer. It returns a signed SOC chunk ready for submission to the network.

func (*SOC) Signature

func (s *SOC) Signature() []byte

Signature returns the SOC signature.

func (*SOC) WrappedChunk

func (s *SOC) WrappedChunk() swarm.Chunk

WrappedChunk returns the chunk wrapped by the SOC.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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