psm

package
v0.25.3 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddBasicMessageRep

func AddBasicMessageRep(p *BasicMessageRep) (err error)

func AddDeviceIDRep

func AddDeviceIDRep(d *DeviceIDRep) (err error)

func AddIssueCredRep

func AddIssueCredRep(p *IssueCredRep) (err error)

func AddPSM

func AddPSM(p *PSM) (err error)

func AddPairwiseRep

func AddPairwiseRep(p *PairwiseRep) (err error)

func AddPresentProofRep

func AddPresentProofRep(p *PresentProofRep) (err error)

func AddRawPL

func AddRawPL(addr *endp.Addr, data []byte) (err error)

func AllPSM

func AllPSM(did string, tsSince *int64) (m *[]PSM, err error)

func GetAllDeviceIDRep

func GetAllDeviceIDRep(did string) (m *[]DeviceIDRep, err error)

func IsPSMReady

func IsPSMReady(key StateKey) (yes bool, err error)

func Open

func Open(filename string) (err error)

func RmPSM

func RmPSM(p *PSM) (err error)

func RmRawPL

func RmRawPL(addr *endp.Addr) (err error)

Types

type BasicMessageRep

type BasicMessageRep struct {
	Key           StateKey
	PwName        string
	Message       string
	SendTimestamp int64
	Timestamp     int64
	SentByMe      bool
	Delivered     bool
}

func GetBasicMessageRep

func GetBasicMessageRep(k StateKey) (m *BasicMessageRep, err error)

func NewBasicMessageRep

func NewBasicMessageRep(d []byte) *BasicMessageRep

func (*BasicMessageRep) Data

func (p *BasicMessageRep) Data() []byte

func (*BasicMessageRep) KData

func (p *BasicMessageRep) KData() []byte

type DB

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

func OpenDb

func OpenDb(filename string) (db *DB, err error)

func (*DB) AddBasicMessageRep

func (b *DB) AddBasicMessageRep(p *BasicMessageRep) (err error)

func (*DB) AddDeviceIDRep

func (b *DB) AddDeviceIDRep(d *DeviceIDRep) (err error)

func (*DB) AddIssueCredRep

func (b *DB) AddIssueCredRep(p *IssueCredRep) (err error)

func (*DB) AddPairwiseRep

func (b *DB) AddPairwiseRep(p *PairwiseRep) (err error)

func (*DB) AddPresentProofRep

func (b *DB) AddPresentProofRep(p *PresentProofRep) (err error)

func (*DB) AddRawPL

func (b *DB) AddRawPL(addr *endp.Addr, data []byte) (err error)

func (*DB) AllPSM

func (b *DB) AllPSM(did string, tsSinceNs *int64) (m *[]PSM, err error)

func (*DB) GetAllDeviceIDRep

func (b *DB) GetAllDeviceIDRep(did string) (m *[]DeviceIDRep, err error)

func (*DB) GetBasicMessageRep

func (b *DB) GetBasicMessageRep(k StateKey) (m *BasicMessageRep, err error)

func (*DB) GetIssueCredRep

func (b *DB) GetIssueCredRep(k StateKey) (m *IssueCredRep, err error)

func (*DB) GetPSM

func (b *DB) GetPSM(key StateKey) (s *PSM, err error)

func (*DB) GetPairwiseRep

func (b *DB) GetPairwiseRep(k StateKey) (m *PairwiseRep, err error)

func (*DB) GetPresentProofRep

func (b *DB) GetPresentProofRep(k StateKey) (m *PresentProofRep, err error)

func (*DB) IsPSMReady

func (b *DB) IsPSMReady(key StateKey) (yes bool, err error)

func (*DB) Open

func (b *DB) Open(filename string) (err error)

Open opens the database by name of the file. If it is already open it returns it, but it doesn't check the database name it isn't thread safe!

func (*DB) RmRawPL

func (b *DB) RmRawPL(addr *endp.Addr) (err error)

type DIDRep

type DIDRep struct {
	DID    string
	VerKey string
	Wallet WalletRep
	My     bool
	Endp   string
}

type DeviceIDRep

type DeviceIDRep struct {
	DID         string
	DeviceToken string
}

func NewDeviceIDRep

func NewDeviceIDRep(d []byte) *DeviceIDRep

func (*DeviceIDRep) Data

func (p *DeviceIDRep) Data() []byte

func (*DeviceIDRep) Key

func (p *DeviceIDRep) Key() []byte

type IssueCredRep

type IssueCredRep struct {
	Key         StateKey
	Timestamp   int64
	CredDefID   string
	CredDef     string
	CredOffer   string
	CredReqMeta string
	Values      string
	Attributes  []didcomm.CredentialAttribute
}

func GetIssueCredRep

func GetIssueCredRep(k StateKey) (m *IssueCredRep, err error)

func NewIssueCredRep

func NewIssueCredRep(d []byte) *IssueCredRep

func (*IssueCredRep) BuildCredRequest

func (rep *IssueCredRep) BuildCredRequest(packet comm.Packet) (cr string, err error)

BuildCredRequest builds credential request which is PROVER/HOLDER SIDE action.

func (*IssueCredRep) Data

func (rep *IssueCredRep) Data() []byte

func (*IssueCredRep) IssuerBuildCred

func (rep *IssueCredRep) IssuerBuildCred(packet comm.Packet, credReq string) (c string, err error)

IssuerBuildCred builds credentials in -- ISSUER SIDE --. Note! values are needed here!!

func (*IssueCredRep) KData

func (rep *IssueCredRep) KData() []byte

func (*IssueCredRep) StoreCred

func (rep *IssueCredRep) StoreCred(packet comm.Packet, cred string) error

StoreCred saves the credential to wallet which is prover/holder side action.

type PSM

type PSM struct {
	Key       StateKey
	Initiator bool
	InDID     string
	States    []State
}

func GetPSM

func GetPSM(key StateKey) (s *PSM, err error)

func NewPSM

func NewPSM(d []byte) *PSM

func (*PSM) Data

func (p *PSM) Data() []byte

func (*PSM) FirstState

func (p *PSM) FirstState() *State

func (*PSM) IsReady

func (p *PSM) IsReady() bool

func (*PSM) LastState

func (p *PSM) LastState() *State

func (*PSM) Next

func (p *PSM) Next() string

Next is for getting the upcoming protocol message type. For example, if we are waiting a certain message from other end, we can check the message type with this function.

func (*PSM) PairwiseName

func (p *PSM) PairwiseName() string

func (*PSM) PendingUserAction

func (p *PSM) PendingUserAction() bool

PendingUserAction returns true if we the PSM is waiting an user action msg.

func (*PSM) Protocol

func (p *PSM) Protocol() string

func (*PSM) TaskFor

func (p *PSM) TaskFor(plType string) (t comm.Task)

TaskFor returns Task of the PSM which corresponds PL.Type. If Type is not given it returns last state's Task.

func (*PSM) Timestamp

func (p *PSM) Timestamp() int64

type PairwiseRep

type PairwiseRep struct {
	Name       string // In our implementation this is connection id!
	Key        StateKey
	TheirLabel string
	Caller     DIDRep
	Callee     DIDRep
}

func GetPairwiseRep

func GetPairwiseRep(k StateKey) (m *PairwiseRep, err error)

func NewPairwiseRep

func NewPairwiseRep(d []byte) *PairwiseRep

func (*PairwiseRep) Data

func (p *PairwiseRep) Data() []byte

func (*PairwiseRep) KData

func (p *PairwiseRep) KData() []byte

type PayloadInfo

type PayloadInfo struct {
	Type string
}

type PresentProofRep

type PresentProofRep struct {
	Key        StateKey
	ProofReq   string
	Proof      string
	Values     string // currently only used for Task API to get data
	WeProposed bool
	Attributes []didcomm.ProofAttribute
}

func GetPresentProofRep

func GetPresentProofRep(k StateKey) (m *PresentProofRep, err error)

func NewPresentProofRep

func NewPresentProofRep(d []byte) *PresentProofRep

func (*PresentProofRep) CreateProof

func (rep *PresentProofRep) CreateProof(packet comm.Packet, rootDID string) (err error)

CreateProof is PROVER side helper.

func (*PresentProofRep) Data

func (rep *PresentProofRep) Data() []byte

func (*PresentProofRep) KData

func (rep *PresentProofRep) KData() []byte

func (*PresentProofRep) VerifyProof

func (rep *PresentProofRep) VerifyProof(packet comm.Packet) (ack bool, err error)

type State

type State struct {
	Timestamp int64
	T         comm.Task
	PLInfo    PayloadInfo
	Sub       SubState
}

type StateKey

type StateKey struct {
	DID   string
	Nonce string
}

func NewStateKey

func NewStateKey(agent comm.Receiver, nonce string) StateKey

func (*StateKey) Data

func (key *StateKey) Data() []byte

func (*StateKey) String

func (key *StateKey) String() string

type SubState

type SubState uint

SubState is enumeration for the state transitions PSM will have during its execution. The above PUML diagram illustrates what transitions are currently recognized. The Ready state should have 2 internal states: ACK/NACK

const (
	ACK  SubState = 0x01 << iota // Sub sub state of Ready
	NACK                         // Sub sub state of Ready
	Waiting
	Received
	Decrypted
	Sending
	Ready
	Failure
	Archiving
	Archived
)

States of the PSM`s individual state can be.

const (
	ReadyACK  SubState = Ready | ACK
	ReadyNACK SubState = Ready | NACK
)

func (SubState) IsReady

func (ss SubState) IsReady() bool

func (SubState) Pure

func (ss SubState) Pure() SubState

func (SubState) String

func (ss SubState) String() string

type WalletRep

type WalletRep struct {
	DID string
	ssi.Wallet
}

func NewWalletRep

func NewWalletRep(d []byte) *WalletRep

func (*WalletRep) Data

func (p *WalletRep) Data() []byte

func (*WalletRep) Key

func (p *WalletRep) Key() []byte

Jump to

Keyboard shortcuts

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