psm

package
v0.25.10 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2021 License: Apache-2.0 Imports: 18 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 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 Open

func 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 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 DIDRep

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

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 // todo: rename StartedByUs
	InDID     string
	States    []State
}

func FindPSM added in v0.25.7

func FindPSM(k StateKey) (m *PSM, err error)

FindPSM doesn't return error if the PSM doesn't exist. Instead the returned PSM is nil.

func GetPSM

func GetPSM(k StateKey) (m *PSM, err error)

GetPSM get existing PSM from DB. If the PSM doesn't exist it returns error. See FindPSM for version which doesn't return error if the PSM doesn't exist.

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) PresentTask added in v0.25.8

func (p *PSM) PresentTask() (t comm.Task)

PresentTask returns latest state's Task of the PSM.

func (*PSM) Protocol

func (p *PSM) Protocol() string

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