agent

package
v0.2.173 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const AgencyPort = 50051
View Source
const MaxWaitTime = time.Minute * 3
View Source
const WaitTime = time.Millisecond * 500

Variables

This section is empty.

Functions

func PublicDID added in v0.1.19

func PublicDID() string

func PublicVerkey added in v0.1.19

func PublicVerkey() string

Types

type AgencyClient

type AgencyClient struct {
	Conn           client.Conn
	AgentClient    agency.AgentServiceClient
	ProtocolClient agency.ProtocolServiceClient
}

type Agent

type Agent struct {
	User       string
	JWT        string
	Client     *AgencyClient
	AgencyHost string
	*ConnectionStore
	*CredentialStore
	*ProofStore
	*SchemaStore
}

func Init

func Init() *Agent

func (*Agent) CreateCredDef added in v0.1.6

func (a *Agent) CreateCredDef(schemaID, tag string) (id string, err error)

func (*Agent) GetCredDef added in v0.1.6

func (a *Agent) GetCredDef(credDefID string) (credDefJSON string, err error)

func (*Agent) Login

func (a *Agent) Login()

type Connection

type Connection struct {
	ID string `json:"id"`
}

type ConnectionStore

type ConnectionStore struct {
	User string
	// contains filtered or unexported fields
}

func InitConnections

func InitConnections(a *AgencyClient, userName string) *ConnectionStore

func (*ConnectionStore) AddConnection

func (s *ConnectionStore) AddConnection(id string, c *ConnectionStatus) (*Connection, error)

func (*ConnectionStore) AddConnectionInvitation

func (s *ConnectionStore) AddConnectionInvitation(id, invitationJSON string) (string, error)

func (*ConnectionStore) CreateInvitation

func (s *ConnectionStore) CreateInvitation() (invitation string, err error)

func (*ConnectionStore) GetConnection

func (s *ConnectionStore) GetConnection(id string) (*Connection, error)

func (*ConnectionStore) GetConnectionInvitation

func (s *ConnectionStore) GetConnectionInvitation(id string) (string, error)

func (*ConnectionStore) HandleConnectionNotification

func (s *ConnectionStore) HandleConnectionNotification(notification *agency.Notification) (err error)

func (*ConnectionStore) RequestConnection

func (s *ConnectionStore) RequestConnection(id string) (invitationID string, err error)

func (*ConnectionStore) TrustPing

func (s *ConnectionStore) TrustPing(connectionID string) (res string, err error)

type Credential

type Credential struct {
	ID        string `json:"referent"`
	CredDefID string `json:"cred_def_id"`
	SchemaID  string `json:"schema_id"`
}

type CredentialProposal added in v0.1.6

type CredentialProposal = agency.Question_IssueProposeMsg

type CredentialStore

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

func InitCredentials

func InitCredentials(a *AgencyClient) *CredentialStore

func (*CredentialStore) AcceptCredentialProposal added in v0.1.6

func (s *CredentialStore) AcceptCredentialProposal(id string) (threadID string, err error)

func (*CredentialStore) GetCredential

func (s *CredentialStore) GetCredential(id string) (bool, IssueCredentialState, error)

func (*CredentialStore) GetCredentialContent added in v0.1.8

func (s *CredentialStore) GetCredentialContent(id string) (*Credential, error)

func (*CredentialStore) HandleCredentialNotification

func (s *CredentialStore) HandleCredentialNotification(notification *agency.Notification) (err error)

func (*CredentialStore) HandleCredentialQuestion added in v0.1.6

func (s *CredentialStore) HandleCredentialQuestion(question *agency.Question) (err error)

func (*CredentialStore) IssueCredential added in v0.1.8

func (s *CredentialStore) IssueCredential(id string) (err error)

func (*CredentialStore) OfferCredential added in v0.1.6

func (s *CredentialStore) OfferCredential(
	connectionID, credDefID string,
	attributes []*CredentialAttribute,
) (threadID string, err error)

func (*CredentialStore) ProposeCredential

func (s *CredentialStore) ProposeCredential(
	connectionID, credDefID string,
	attributes []*CredentialAttribute,
) (threadID string, err error)

func (*CredentialStore) ReceiveCredential added in v0.1.10

func (s *CredentialStore) ReceiveCredential(id string) (err error)

func (*CredentialStore) RequestCredential

func (s *CredentialStore) RequestCredential(id string) (threadID string, err error)

type IssueCredentialState added in v0.1.8

type IssueCredentialState int
const (
	PROPOSAL   IssueCredentialState = 1
	OFFER      IssueCredentialState = 2
	REQUEST    IssueCredentialState = 3
	CREDENTIAL IssueCredentialState = 4
	DONE       IssueCredentialState = 5
	FAILURE    IssueCredentialState = 6
)

func (IssueCredentialState) String added in v0.1.8

func (e IssueCredentialState) String() string

type PresentProofState added in v0.1.8

type PresentProofState int
const (
	StateProofProposal     PresentProofState = 1
	StateProofRequest      PresentProofState = 2
	StateProofPresentation PresentProofState = 3
	StateProofDone         PresentProofState = 4
)

func (PresentProofState) String added in v0.1.8

func (e PresentProofState) String() string

type Proof

type Proof struct {
	ID         string `json:"referent"`
	ProofDefID string `json:"proof_def_id"`
	SchemaID   string `json:"schema_id"`
}

type ProofAttribute

type ProofAttribute = agency.Protocol_Proof_Attribute

type ProofPredicate added in v0.1.6

type ProofPredicate = agency.Protocol_Predicates_Predicate

type ProofPresentation added in v0.1.6

type ProofPresentation = agency.Question_ProofVerifyMsg

type ProofStore

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

func InitProofs

func InitProofs(a *AgencyClient) *ProofStore

func (*ProofStore) GetProof

func (s *ProofStore) GetProof(id string) (bool, PresentProofState, error)

func (*ProofStore) HandleProofNotification

func (s *ProofStore) HandleProofNotification(notification *agency.Notification) (err error)

func (*ProofStore) HandleProofQuestion added in v0.1.6

func (s *ProofStore) HandleProofQuestion(question *agency.Question) (err error)

func (*ProofStore) ProposeProof added in v0.1.8

func (s *ProofStore) ProposeProof(connectionID string, attributes []*ProofAttribute) (threadID string, err error)

func (*ProofStore) RequestProof added in v0.1.8

func (s *ProofStore) RequestProof(
	connectionID string,
	attributes []*ProofAttribute,
	predicates []*ProofPredicate,
) (threadID string, err error)

func (*ProofStore) SendProofPresentation

func (s *ProofStore) SendProofPresentation(id string) (threadID string, err error)

func (*ProofStore) VerifyPresentation added in v0.1.8

func (s *ProofStore) VerifyPresentation(id string) (err error)

type QuestionHeader added in v0.1.6

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

type SchemaStore added in v0.1.6

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

func InitSchemas added in v0.1.6

func InitSchemas(a *AgencyClient) *SchemaStore

func (*SchemaStore) AddStoredSchema added in v0.1.6

func (s *SchemaStore) AddStoredSchema(storeID, id string) (string, error)

func (*SchemaStore) CreateSchema added in v0.1.6

func (s *SchemaStore) CreateSchema(name, version string, attributes []string) (id string, err error)

func (*SchemaStore) GetSchema added in v0.1.6

func (s *SchemaStore) GetSchema(schemaID string) (schemaJSON string, err error)

func (*SchemaStore) GetStoredSchema added in v0.1.6

func (s *SchemaStore) GetStoredSchema(id string) (string, error)

Jump to

Keyboard shortcuts

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