client

package
v0.24.1 Latest Latest
Warning

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

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

Documentation

Overview

Package client implements an agency client, an Edge Agent. It is used for for integration tests, where it allows run client and server code in same process which helps for example debugging a lot.

Similar functionality can be found from cmds package which is preferred way to build CLI. Please see findy-cli for more information.

Please note, that this client implementation is interim. For that reason the code is not cleaned up or streamlined. When we decide if this API is permanent, refactoring will proceed.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Email       string      // Email address used for handshake/onboarding
	BaseAddress string      // URL for agency which serves this client (EA)
	Wallet      *ssi.Wallet // EA's local wallet
	// contains filtered or unexported fields
}

Client is a helper struct which implements an EA. The EA can be used to connect agency and perform CA API calls to EA's CA's. Note that all of the protocol calls are async. They return task ID which can be used to query how task is proceeded.

func (*Client) ContinueIssuingProtocol

func (edge *Client) ContinueIssuingProtocol(taskID string, allow bool) (err error)

ContinueIssuingProtocol calls agency to tell a certain protocol (taskID) does user accept to continue issuing protocol.

func (*Client) ContinueProtocol

func (edge *Client) ContinueProtocol(taskID string, allow bool) (err error)

ContinueProtocol calls agency to tell a certain protocol (taskID) does user accept to continue proofing protocol.

func (*Client) CreateCredDef

func (edge *Client) CreateCredDef(schID string, tag string) (credDefID string, err error)

CreateCredDef calls agency to create a cred def and write it to the ledger.

func (*Client) CreateDID

func (edge *Client) CreateDID() (DID string, err error)

CreateDID calls agency to create DID and write it to the ledger.

func (*Client) CreatePW

func (edge *Client) CreatePW(endpoint, endpKey, edgePw string) (tID string, err error)

CreatePW calls agency to create pairwise to other agent.

func (*Client) CreateSchema

func (edge *Client) CreateSchema(schema *ssi.Schema) (schID string, err error)

CreateSchema calls create schema API from agency which writes it to ledger as well.

func (*Client) CredOffer

func (edge *Client) CredOffer(
	edgePw, credDefID, email string) (tID string, err error)

CredOffer asks agency to start issuing protocol with offer i.e. from issuer's side.

func (*Client) CredReq

func (edge *Client) CredReq(
	edgePw, credDefID,
	email, verID string) (tID string, err error)

CredReq asks agency to start issuing protocol with propose i.e. from holder's side.

func (*Client) ExportLocalWallet

func (edge *Client) ExportLocalWallet(filePath, exportKey,
	theirDid string, handshakePayload *mesg.Payload) (err error)

ExportLocalWallet exports local wallet.

func (*Client) GetCredDef

func (edge *Client) GetCredDef(credDefID string) (err error)

GetCredDef calls agency to return cred def from the ledger.

func (*Client) GetSchema

func (edge *Client) GetSchema(schemaID string) (err error)

GetCredDef calls agency to get schema from ledger.

func (*Client) GetWallet

func (edge *Client) GetWallet() (name string, err error)

GetWallet prepares worker EA's (cloud allocated agent) wallet for download and returns the download URL.

func (*Client) Handshake

func (edge *Client) Handshake() (theirDid string,
	finalPL *mesg.Payload, eaEnp service.Addr, err error)

Handshake is a function to on-board the EA to this Agency. It creates the client side wallet and implements EA's part of the pairwise protocol. The currently implemented protocol is a version of old indy a2a protocol, which was a precursor of the Aries connection/didexhange protocol. todo: we move this later, this is here for tests at the moment

func (*Client) IsInit

func (edge *Client) IsInit() bool

IsInit returns if the client is initialized properly.

func (*Client) JWT

func (edge *Client) JWT() (jwt string, err error)

JWT is not implemented yet.

func (*Client) Listen

func (edge *Client) Listen(f trans2.EchoListener) (err error)

Listen is a helper function to be used from services to be able to listen web socket to receive realtime notifications from CA. It needs a callback as an argument. Currently it's called from SA implementations who use us as a framework.

func (*Client) MsgToCA

func (edge *Client) MsgToCA(t string, msg *mesg.Msg) (in mesg.Msg, err error)

MsgToCA send what ever message to an agency.

func (*Client) PingAPIEndp

func (edge *Client) PingAPIEndp() (err error)

PingAPIEndp asks an agency to ping service API endpoint.

func (*Client) PingCA

func (edge *Client) PingCA() (err error)

PingCA pings EA's CA.

func (*Client) ProofProp

func (edge *Client) ProofProp(edgePw, email string) (tID string, err error)

ProofProp asks agency to start proof protocol with propose proof from prover's side.

func (*Client) ProofRequest

func (edge *Client) ProofRequest(edgePw, credDefID string) (tID string, err error)

ProofRequest asks agency to start proof protocol with proof request from verifier's sid.

func (*Client) PwAndCredReq

func (edge *Client) PwAndCredReq(
	endpoint, endpKey, edgePw, credDefID,
	email, veriID string) (tID string, err error)

PwAndCredReq asks agency to perform two protocols in a row. 1st make pairwise, 2nd start issuing protocol with propose, all from holder's side.

func (*Client) PwAndProofProp

func (edge *Client) PwAndProofProp(
	endpoint, endpKey, edgePw, credDefID, email string) (tID string, err error)

PwAndProofProp asks agency to perform two protocols in a row. 1st make pairwise, 2nd start proof protocol with propose, all from holder/prover side.

func (*Client) PwAndTrustPing

func (edge *Client) PwAndTrustPing(
	endpoint, endpKey, edgePw string) (tID string, err error)

PwAndTrustPing asks agency to perform two protocols in a row. 1st make pairwise, 2nd make a trust ping.

func (*Client) PwFromInvitation

func (edge *Client) PwFromInvitation(i *didexchange.Invitation) (tID string, err error)

PwFromInvitation calls agency to create pairwise to other agent.

func (*Client) SendMsg

func (edge *Client) SendMsg(edgePw, ID, msg string) (tID string, err error)

SendMsg asks agency to send basic message to other agent defined by pairwise.

func (*Client) ServicePing

func (edge *Client) ServicePing() (err error)

ServicePing pings the agency. It's used to check if an agency is running and well.

func (*Client) SetAPIEndp

func (edge *Client) SetAPIEndp(endp service.Addr) (err error)

SetAPIEndp calls an agency to set service API endpoint for an agent.

func (*Client) SetAgent

func (edge *Client) SetAgent(a *cloud.Agent)

SetAgent sets the agent from outside so it will be reused not created.

func (*Client) SetSAImpl

func (edge *Client) SetSAImpl(ImplID string) (err error)

SetSAImpl calls agency to set EA's (service agent) current SA implementation. Please note this is more useful for integration tests. See SetAPIEndg for real use.

func (*Client) TaskReady

func (edge *Client) TaskReady(taskID string) (yes bool, err error)

TaskReady calls agency to get task status.

func (*Client) TaskStatus

func (edge *Client) TaskStatus(taskID string) (err error)

TaskStatus is a Client function just for to send CA API message as a test. Note that this function is only intended to be used as part of the integration tests.

func (*Client) TrustPingPW

func (edge *Client) TrustPingPW(edgePw string) (tID string, err error)

TrustPingPW calls agency to create pairwise and end it with trust ping.

type EndpointInfo

type EndpointInfo struct {
	CAEndpoint string       `json:"caEndpoint"`
	Pairwise   service.Addr `json:"pairwise"`
}

EndpointInfo is helper struct for ExportLocalWallet.

Jump to

Keyboard shortcuts

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