calypso

package
v0.0.0-...-db4a7b7 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2023 License: GPL-3.0 Imports: 10 Imported by: 0

README

This package is kept for historical purposes and may be removed later or updated to work. It had been implemented with a previous version of Dela that was quite different from now.

# start node 1 and 2
go install && LLVL=info memcoin --config /tmp/node1 start --port 2001
LLVL=info memcoin --config /tmp/node2 start --port 2002

# share the address between the two nodes
memcoin --config /tmp/node2 minogrpc join --address 127.0.0.1:2001 $(memcoin --config /tmp/node1 minogrpc token)


# start the proxy server
memcoin --config /tmp/node1 proxy start --clientaddr 127.0.0.1:8081    

# start DKG on each node
memcoin --config /tmp/node1 calypso listen
memcoin --config /tmp/node2 calypso listen

# register the GUI handlers on node 1
memcoin --config /tmp/node1 calypso register

# setup DKG
memcoin --config /tmp/node1 calypso setup --pubkeys 486278384128ad175090d08fc3e98e4f8eb2b9d032b5d4648189eaf3bbfad601,9a23f874a73130b8e6ae747d0c03c0d0dd934b47538cdc69aec5373f30d04daf --addrs RjEyNy4wLjAuMToyMDAx,RjEyNy4wLjAuMToyMDAy --threshold 2

Documentation

Index

Constants

View Source
const (
	// ArcRuleUpdate defines the rule to update the arc. This rule must be set
	// at the write creation to allow the arc to be latter updated.
	ArcRuleUpdate = "calypso_update"
	// ArcRuleRead defines the arc rule to read a value
	ArcRuleRead = "calypso_read"
)

Variables

This section is empty.

Functions

func NewRecordFactory

func NewRecordFactory() serde.Factory

NewRecordFactory returns a new instance of the record factory.

func RegisterRecordFormats

func RegisterRecordFormats(format serde.Format, engine serde.FormatEngine)

RegisterRecordFormats registers the engine for the provided format.

Types

type AccessKeyFac

type AccessKeyFac struct{}

AccessKeyFac is the key to the access control factory.

type Calypso

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

Calypso is a wrapper around DKG that provides a private storage

implements calypso.PrivateStorage

func NewCalypso

func NewCalypso(actor dkg.Actor) *Calypso

NewCalypso creates a new Calypso

func (*Calypso) GetPublicKey

func (c *Calypso) GetPublicKey() (kyber.Point, error)

GetPublicKey implements calypso.PrivateStorage

func (*Calypso) Read

func (c *Calypso) Read(id []byte, idents ...access.Identity) ([]byte, error)

Read implements calypso.PrivateStorage

func (*Calypso) Setup

func (c *Calypso) Setup(ca crypto.CollectiveAuthority,
	threshold int) (pubKey kyber.Point, err error)

Setup implements calypso.PrivateStorage

func (*Calypso) UpdateAccess

func (c *Calypso) UpdateAccess(id []byte, ident access.Identity,
	newAc access.Service) error

UpdateAccess implements calypso.PrivateStorage. It sets a new arc for a given ID, provided the current arc allows the given ident to do so.

func (*Calypso) Write

func (c *Calypso) Write(em EncryptedMessage,
	ac access.Service) ([]byte, error)

Write implements calypso.PrivateStorage

type EncryptedMessage

type EncryptedMessage interface {
	GetK() kyber.Point
	GetC() kyber.Point
}

EncryptedMessage wraps the K, C arguments needed to decrypt a message. K is the ephemeral DH public key and C the blinded secret. The combination of (K, C) should always be uniq, as it is used to compute the storage key.

type PrivateStorage

type PrivateStorage interface {
	// Setup must be called only ONCE by one of the node to setup the secret
	// sharing
	Setup(ca crypto.CollectiveAuthority, threshold int) (pubKey kyber.Point, err error)

	// GetPublicKey returns the collective public key. Returns an error if the
	// setup has not been done.
	GetPublicKey() (kyber.Point, error)

	Write(message EncryptedMessage, ac access.Service) (ID []byte, err error)
	Read(ID []byte, idents ...access.Identity) (msg []byte, err error)
	UpdateAccess(ID []byte, ident access.Identity, ac access.Service) error
}

PrivateStorage defines the primitives to run a Calypso-like app. It is mainly a wrapper arround DKG that provides a storage and authorization layer.

type Record

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

Record defines what is stored in the db, which is the secrect and its corresponding access control

func NewRecord

func NewRecord(K, C kyber.Point, access access.Service) Record

NewRecord creates a new record from the points and the access control.

func (Record) GetAccess

func (r Record) GetAccess() access.Service

GetAccess returns the access control for this record.

func (Record) GetC

func (r Record) GetC() kyber.Point

GetC returns C.

func (Record) GetK

func (r Record) GetK() kyber.Point

GetK returns K.

func (Record) Serialize

func (r Record) Serialize(ctx serde.Context) ([]byte, error)

Serialize implements serde.Message.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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