Skip to content
This repository has been archived by the owner on May 28, 2024. It is now read-only.

findy-network/findy-common-go

Repository files navigation

findy-common-go

test codecov

Findy Agency is an open-source project for a decentralized identity agency. OP Lab developed it from 2019 to 2024. The project is no longer maintained, but the work will continue with new goals and a new mission. Follow the blog for updates.

Getting Started

Findy Agency is a collection of services (Core, Auth, Vault and Web Wallet) that provide full SSI agency along with a web wallet for individuals. To start experimenting with Findy Agency we recommend you to start with the documentation and set up the agency to your localhost environment.

Project

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