soc

package
v1.0.0-rc2.17 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2021 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

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

Index

Constants

View Source
const (
	IdSize        = 32
	SignatureSize = 65
)

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) Chunk

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

Chunk returns the SOC chunk.

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) 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