findy-common-go

module
v0.1.16 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2021 License: Apache-2.0

README

findy-common-go

Main purpose of this package is to provide helpers and utility functionality for connecting to findy-agent core through findy-agent-api GRPC interface.

Main features

  • Code generated from API IDL.
  • Helpers for opening secure GRPC connection to core agency.
  • Helpers for API protocol starters and event listeners.
  • Test TLS certificates for local development setup.

Example

import (
	"context"
	"os"

	"github.com/findy-network/findy-common-go/agency/client"
	agency "github.com/findy-network/findy-common-go/grpc/agency/v1"
	"github.com/google/uuid"
	"google.golang.org/grpc"
)

// Generates new Aries invitation for agent and prints out the invitation JSON string.
// JWT token should be acquired using authentication service before executing this call.
// Note: this function panics on incorrect configuration.
func TryCreateInvitation(ctx context.Context, jwtToken, label string) {
	conf := client.BuildClientConnBase(
		"/path/to/findy-common-go/cert",
		"localhost",
		50051,
		[]grpc.DialOption{},
	)
	conn := client.TryAuthOpen(jwtToken, conf)

	sc := agency.NewAgentServiceClient(conn)
	id := uuid.New().String()

	if invitation, err := sc.CreateInvitation(
		ctx,
		&agency.InvitationBase{Label: label, ID: id},
	); err == nil {
		fmt.Printf("Created invitation\n %s\n", invitation.JSON)
	}
}

Reference implementations

  • findy-agent-cli: GRPC client, agent CLI tool providing most API functionality through a handy command-line-interface.

  • findy-agent: GRPC server (agency internal). Implements core agency services.

  • findy-agent-vault: GRPC client (agency internal). Provides agency data storage service.

  • findy-agent-auth: GRPC client (agency internal). Provides agency authentication service

Development

Unit testing: make test

Linting: Install golangci-lint and run make lint.

See more

Directories

Path Synopsis
agency
fsm
Package backup implements dedicated helpers for the current backup system.
Package backup implements dedicated helpers for the current backup system.
db
grpc
infra
aws Module
jwt
mw
std
didexchange/invitation
Package invitation is for invitation data model.
Package invitation is for invitation data model.
tools

Jump to

Keyboard shortcuts

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