Documentation ¶
Overview ¶
Package client implements helpers for gRPC client connection to Agency
Index ¶
- func BuildClientConnBase(tlsPath, addr string, port int, opts []grpc.DialOption) *rpc.ClientCfg
- func BuildConnBase(tlsPath, fullAddr string, opts []grpc.DialOption) *rpc.ClientCfg
- func BuildInsecureClientConnBase(addr string, port int, opts []grpc.DialOption) *rpc.ClientCfg
- func OkStatus(s *agency.ProtocolState) bool
- type Conn
- func (conn Conn) DoRelease(ctx context.Context, id *agency.ProtocolID, cOpts ...grpc.CallOption) (pid *agency.ProtocolID, err error)
- func (conn Conn) DoResume(ctx context.Context, state *agency.ProtocolState, cOpts ...grpc.CallOption) (pid *agency.ProtocolID, err error)
- func (conn Conn) DoStart(ctx context.Context, protocol *agency.Protocol, cOpts ...grpc.CallOption) (pid *agency.ProtocolID, err error)
- func (conn Conn) DoStatus(ctx context.Context, id *agency.ProtocolID, cOpts ...grpc.CallOption) (status *agency.ProtocolStatus, err error)
- func (conn Conn) Listen(ctx context.Context, client *agency.ClientID, cOpts ...grpc.CallOption) (ch chan *agency.Question, err error)
- func (conn Conn) ListenAndRetry(ctx context.Context, client *agency.ClientID, cOpts ...grpc.CallOption) (ch chan *agency.Question)
- func (conn Conn) ListenStatus(ctx context.Context, client *agency.ClientID, cOpts ...grpc.CallOption) (ch chan *agency.AgentStatus, err error)
- func (conn Conn) ListenStatusAndRetry(ctx context.Context, client *agency.ClientID, cOpts ...grpc.CallOption) (sch chan *agency.AgentStatus)
- func (conn Conn) ListenStatusErr(ctx context.Context, client *agency.ClientID, cOpts ...grpc.CallOption) (ch chan *agency.AgentStatus, errCh chan error, err error)
- func (conn Conn) PSMHook(ctx context.Context, cOpts ...grpc.CallOption) (ch chan *ops.AgencyStatus, err error)
- func (conn Conn) Wait(ctx context.Context, client *agency.ClientID, cOpts ...grpc.CallOption) (ch chan *agency.Question, err error)
- func (conn Conn) WaitAndRetry(ctx context.Context, client *agency.ClientID, cOpts ...grpc.CallOption) (ch chan *agency.Question)
- func (conn Conn) WaitErr(ctx context.Context, client *agency.ClientID, cOpts ...grpc.CallOption) (ch chan *agency.Question, errCh chan error, err error)
- type Pairwise
- func (pw Pairwise) BasicMessage(ctx context.Context, content string) (ch chan *agency.ProtocolState, err error)
- func (pw *Pairwise) Connection(ctx context.Context, invitationStr string) (connID string, ch chan *agency.ProtocolState, err error)
- func (pw Pairwise) Issue(ctx context.Context, credDefID, attrsJSON string) (ch chan *agency.ProtocolState, err error)
- func (pw Pairwise) IssueWithAttrs(ctx context.Context, credDefID string, ...) (ch chan *agency.ProtocolState, err error)
- func (pw Pairwise) Ping(ctx context.Context) (ch chan *agency.ProtocolState, err error)
- func (pw Pairwise) ProposeIssue(ctx context.Context, credDefID, attrsJSON string) (ch chan *agency.ProtocolState, err error)
- func (pw Pairwise) ProposeIssueWithAttrs(ctx context.Context, credDefID string, ...) (ch chan *agency.ProtocolState, err error)
- func (pw Pairwise) ProposeProof(ctx context.Context, proofAttrs string) (ch chan *agency.ProtocolState, err error)
- func (pw Pairwise) ProposeProofWithAttrs(ctx context.Context, proofAttrs *agency.Protocol_Proof) (ch chan *agency.ProtocolState, err error)
- func (pw Pairwise) ReqProof(ctx context.Context, proofAttrs string) (ch chan *agency.ProtocolState, err error)
- func (pw Pairwise) ReqProofWithAttrs(ctx context.Context, proofAttrs *agency.Protocol_Proof) (ch chan *agency.ProtocolState, err error)
- func (pw *Pairwise) WaitConnection(ctx context.Context, invitationStr string) (connID string, ch chan *agency.ProtocolState, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildClientConnBase ¶
func BuildConnBase ¶
func BuildConnBase(tlsPath, fullAddr string, opts []grpc.DialOption) *rpc.ClientCfg
BuildConnBase builds the rpc.ClientCfg from tls path and full service address including the port e.g. localhost:50051.
func BuildInsecureClientConnBase ¶ added in v0.1.41
func OkStatus ¶
func OkStatus(s *agency.ProtocolState) bool
Types ¶
type Conn ¶
type Conn struct { *grpc.ClientConn // contains filtered or unexported fields }
func TryAuthOpenWithSleep ¶ added in v0.1.28
func TryAuthOpenWithSleep( jwtToken string, conf *rpc.ClientCfg, s func(d time.Duration), ) ( c Conn, )
TryAuthOpenWithSleep opens authorized gRPC connection with sleep time. nolintlint
func (Conn) DoRelease ¶
func (conn Conn) DoRelease(ctx context.Context, id *agency.ProtocolID, cOpts ...grpc.CallOption) (pid *agency.ProtocolID, err error)
func (Conn) DoResume ¶
func (conn Conn) DoResume(ctx context.Context, state *agency.ProtocolState, cOpts ...grpc.CallOption) (pid *agency.ProtocolID, err error)
func (Conn) DoStart ¶
func (conn Conn) DoStart(ctx context.Context, protocol *agency.Protocol, cOpts ...grpc.CallOption) (pid *agency.ProtocolID, err error)
func (Conn) DoStatus ¶
func (conn Conn) DoStatus(ctx context.Context, id *agency.ProtocolID, cOpts ...grpc.CallOption) (status *agency.ProtocolStatus, err error)
func (Conn) Listen ¶
func (conn Conn) Listen( ctx context.Context, client *agency.ClientID, cOpts ...grpc.CallOption, ) ( ch chan *agency.Question, err error, )
Listen listens both status notifications and agent questions. Client is specified by clientID. Both notifications and questions arriwe from same channel which is Question type.
func (Conn) ListenAndRetry ¶
func (conn Conn) ListenAndRetry( ctx context.Context, client *agency.ClientID, cOpts ...grpc.CallOption, ) ( ch chan *agency.Question, )
ListenAndRetry listens both status notifications and agent questions. Client is specified by clientID. Both notifications and questions arriwe from same channel which is Question type. NOTE! This function handles connection errors by itself i.e. it tries to reopen error connnections until its terminated by ctx.Cancel. The actual retry logic is implemented in ListenStatusAndRetry and WaitAndRetry functions.
func (Conn) ListenStatus ¶
func (conn Conn) ListenStatus( ctx context.Context, client *agency.ClientID, cOpts ...grpc.CallOption, ) ( ch chan *agency.AgentStatus, err error, )
ListenStatus listens agent notification statuses. Client connection is identifed by ClientID. NOTE! The function filters KEEPALIVE messages.
func (Conn) ListenStatusAndRetry ¶
func (conn Conn) ListenStatusAndRetry( ctx context.Context, client *agency.ClientID, cOpts ...grpc.CallOption, ) ( sch chan *agency.AgentStatus, )
ListenStatusAndRetry listens agent notification statuses. Client connection is identifed by ClientID. NOTE! This function handles connection errors by itself i.e. it tries to reopen error connnections until its terminated by ctx.Cancel. NOTE! The function filters KEEPALIVE messages.
func (Conn) ListenStatusErr ¶
func (conn Conn) ListenStatusErr( ctx context.Context, client *agency.ClientID, cOpts ...grpc.CallOption, ) ( ch chan *agency.AgentStatus, errCh chan error, err error, )
ListenStatusErr listens agent notification statuses. It terminates on an error and transports it to the caller thru the error channel. Client connection is identifed by ClientID. NOTE! The function filters KEEPALIVE messages.
func (Conn) PSMHook ¶
func (conn Conn) PSMHook(ctx context.Context, cOpts ...grpc.CallOption) (ch chan *ops.AgencyStatus, err error)
func (Conn) Wait ¶
func (conn Conn) Wait( ctx context.Context, client *agency.ClientID, cOpts ...grpc.CallOption, ) ( ch chan *agency.Question, err error, )
Wait listens agent notification questions. It terminates on error and closes the returned listening channel. Client connection is identifed by ClientID. NOTE! The function filters KEEPALIVE messages.
func (Conn) WaitAndRetry ¶
func (conn Conn) WaitAndRetry( ctx context.Context, client *agency.ClientID, cOpts ...grpc.CallOption, ) ( ch chan *agency.Question, )
WaitAndRetry listens agent notification questions. Client connection is identifed by ClientID. NOTE! This function handles connection errors by itself i.e. it tries to reopen error connnections until its terminated by ctx.Cancel. NOTE! The function filters KEEPALIVE messages.
func (Conn) WaitErr ¶
func (conn Conn) WaitErr( ctx context.Context, client *agency.ClientID, cOpts ...grpc.CallOption, ) ( ch chan *agency.Question, errCh chan error, err error, )
WaitErr listens agent notification questions. It terminates on an error and transports it to the caller thru an error channel. Client connection is identifed by ClientID. NOTE! The function filters KEEPALIVE messages.
type Pairwise ¶
func (Pairwise) BasicMessage ¶
func (*Pairwise) Connection ¶
func (pw *Pairwise) Connection( ctx context.Context, invitationStr string, ) ( connID string, ch chan *agency.ProtocolState, err error, )
Connection is a helper wrapper to start a connection protocol in the agency. The invitationStr accepts both JSON and URL formated invitations. The agency does the same.
func (Pairwise) IssueWithAttrs ¶
func (pw Pairwise) IssueWithAttrs( ctx context.Context, credDefID string, attrs *agency.Protocol_IssuingAttributes, ) ( ch chan *agency.ProtocolState, err error)
func (Pairwise) ProposeIssue ¶ added in v0.1.17
func (Pairwise) ProposeIssueWithAttrs ¶ added in v0.1.17
func (pw Pairwise) ProposeIssueWithAttrs( ctx context.Context, credDefID string, attrs *agency.Protocol_IssuingAttributes, ) ( ch chan *agency.ProtocolState, err error)
func (Pairwise) ProposeProof ¶ added in v0.1.17
func (Pairwise) ProposeProofWithAttrs ¶ added in v0.1.17
func (pw Pairwise) ProposeProofWithAttrs( ctx context.Context, proofAttrs *agency.Protocol_Proof, ) ( ch chan *agency.ProtocolState, err error, )
func (Pairwise) ReqProofWithAttrs ¶
func (pw Pairwise) ReqProofWithAttrs( ctx context.Context, proofAttrs *agency.Protocol_Proof, ) ( ch chan *agency.ProtocolState, err error, )