services

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2022 License: Apache-2.0 Imports: 25 Imported by: 1

README

  1. To find the latest binary packages, go to the output of the action
  2. Click on the latest successful run, scroll down
  3. Download appropriate output file
  4. Unpack okapi.h and appropriate binaries into the /sdk/go/servicesdirectory
  5. Set the following environment variables so that okapi will compile:
    1. CGO_LDFLAGS=-L[path to repo]/go/services
    2. CGO_CFLAGS=-I[path to repo]/go/services

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewServiceConnection added in v1.4.0

func NewServiceConnection(options *options.ServiceOptions, grpcDialOptions ...grpc.DialOption) (*grpc.ClientConn, error)

NewServiceConnection returns a grpc client connection to the target provided in the options (ServerEndpoint, ServerPort, and ServerUseTLS)

func ProfileFromToken added in v1.4.0

func ProfileFromToken(token string) (*account.AccountProfile, error)

ProfileFromToken takes an encoded auth token and returns the account profile

func ProfileToToken added in v1.4.0

func ProfileToToken(profile *account.AccountProfile) (string, error)

ProfileToToken takes the proile and returns an encoded auth token

Types

type AccountService added in v1.2.1

type AccountService interface {
	Service

	// SignIn (DEPRECATED, USE Login) attempts to log in and returns an authentication token
	SignIn(userContext context.Context, request *account.SignInRequest) (string, account.ConfirmationMethod, error)

	// Unprotect takes an authtoken that has been protected using a pin code
	// and returns an unlocked token
	Unprotect(authtoken, securityCode string) (string, error)

	// Protect will apply the given security code blind to the provided token
	Protect(authtoken, securityCode string) (string, error)

	// Login performs the first stage of login, which must be finalized with LoginConfirm
	Login(userContext context.Context, request *account.LoginRequest) (*account.LoginResponse, error)

	// LoginConfirm finalizes login, using challenge received from Login(), and authCode sent to user email
	LoginConfirm(userContext context.Context, challenge []byte, authCode string) (string, error)

	// LoginAnonymous creates an anonymous account in the current ecosystem and returns an auth token
	LoginAnonymous(userContext context.Context) (string, error)

	// GetInfo returns details about the wallet associated with the account token
	GetInfo(userContext context.Context) (*account.AccountInfoResponse, error)

	// ListDevices returns a list of devices that are associated with the cloud wallet
	ListDevices(userContext context.Context, request *account.ListDevicesRequest) (*account.ListDevicesResponse, error)

	// RevokeDevice removes access to the cloud wallet for the provided device
	RevokeDevice(userContext context.Context, request *account.RevokeDeviceRequest) (*account.RevokeDeviceResponse, error)

	// AuthorizeWebhook authorizes provider of account's ecosystem to receive webhooks for events relating to this account
	AuthorizeWebhook(userContext context.Context, request *account.AuthorizeWebhookRequest) (*account.AuthorizeWebhookResponse, error)
}

AccountService wraps all the functions for interacting with accounts

func NewAccountService added in v1.2.1

func NewAccountService(options *Options) (AccountService, error)

NewAccountService returns an account service with the base service configured using the provided options

type CredentialService added in v1.2.1

type CredentialService interface {
	Service
	// IssueCredential using a document json
	IssueCredential(userContext context.Context, request *credential.IssueRequest) (*credential.IssueResponse, error)
	// IssueFromTemplate issues a credential using a template
	IssueFromTemplate(userContext context.Context, request *credential.IssueFromTemplateRequest) (*credential.IssueFromTemplateResponse, error)
	// CheckStatus of the credential
	CheckStatus(userContext context.Context, request *credential.CheckStatusRequest) (*credential.CheckStatusResponse, error)
	// UpdateStatus of the credential (i.e. revoke)
	UpdateStatus(userContext context.Context, request *credential.UpdateStatusRequest) (*credential.UpdateStatusResponse, error)
	// CreateProof using either a credential in a cloud wallet or based on the json document provided
	CreateProof(userContext context.Context, request *credential.CreateProofRequest) (*credential.CreateProofResponse, error)
	// VerifyProof presentation
	VerifyProof(userContext context.Context, request *credential.VerifyProofRequest) (*credential.VerifyProofResponse, error)
	// Send a credential to another use's wallet
	Send(userContext context.Context, request *credential.SendRequest) (*credential.SendResponse, error)
}

CredentialService defines the interface for interacting with credentials

func NewCredentialService added in v1.2.1

func NewCredentialService(options *Options) (CredentialService, error)

NewCredentialService returns a credential service with the base service configured using the provided options

type CredentialTemplateService added in v1.2.1

type CredentialTemplateService interface {
	Service
	// Create a credential template
	Create(userContext context.Context, request *template.CreateCredentialTemplateRequest) (*template.CreateCredentialTemplateResponse, error)
	// Get a specific credential template
	Get(userContext context.Context, request *template.GetCredentialTemplateRequest) (*template.GetCredentialTemplateResponse, error)
	// List available credential templates
	List(userContext context.Context, request *template.ListCredentialTemplatesRequest) (*template.ListCredentialTemplatesResponse, error)
	// Search for a template
	Search(userContext context.Context, request *template.SearchCredentialTemplatesRequest) (*template.SearchCredentialTemplatesResponse, error)
	// Delete a template
	Delete(userContext context.Context, request *template.DeleteCredentialTemplateRequest) (*template.DeleteCredentialTemplateResponse, error)
}

CredentialTemplateService defines the interface for interacting with credentials templates

func NewCredentialTemplateService added in v1.2.1

func NewCredentialTemplateService(options *Options) (CredentialTemplateService, error)

NewCredentialTemplateService returns a credential template service with the base service configured using the provided options

type OberonSecurityProvider added in v1.2.1

type OberonSecurityProvider struct {
}

OberonSecurityProvider implements the SecurityProvider interface and provides oberon token functionality

func (OberonSecurityProvider) GetAuthHeader added in v1.2.1

func (o OberonSecurityProvider) GetAuthHeader(profile *account.AccountProfile, message proto.Message) (string, error)

GetAuthHeader returns an authentication header with a correctly formatted oberon token

type Option added in v1.4.0

type Option func(*Options) error

Option function for setting options when configuring the service

func WithAuthToken added in v1.4.0

func WithAuthToken(token string) Option

WithAuthToken sets a specific account token to use

func WithDefaultEcosystem added in v1.4.0

func WithDefaultEcosystem(ecosystemID string) Option

WithDefaultEcosystem will set the default ecosystem used for each of the calls

This value will be added to calls that reqire an ecosystemID to be set if no value is provided

func WithDevEnv added in v1.4.0

func WithDevEnv() Option

WithDevEnv will configure the server to use the trinsic development environment

func WithGrpcDialOptions added in v1.5.0

func WithGrpcDialOptions(grpcDialOptions ...grpc.DialOption) Option

WithGrpcDialOptions sets grpc dial options

This function can be user for setting up client-side middlewares (i.e. monitoring, logging, tracing, retry)

func WithOptions added in v1.4.0

func WithOptions(serviceOptions *options.ServiceOptions) Option

WithOptions will replace the current options with the one provided

func WithProductionEnv added in v1.4.0

func WithProductionEnv() Option

WithProductionEnv will configure the server to use the trinsic production environment

func WithStagingEnv added in v1.4.0

func WithStagingEnv() Option

WithStagingEnv will configure the server to use the trinsic staging environment

func WithTestEnv added in v1.4.0

func WithTestEnv() Option

WithTestEnv will configure the server to use the environment provided by environment variables falling back to trinsic production environment if necessary

type Options added in v1.4.0

type Options struct {
	ServiceOptions  *options.ServiceOptions
	GrpcDialOptions []grpc.DialOption
}

Options for configuring the sdk

func NewServiceOptions added in v1.4.0

func NewServiceOptions(opts ...Option) (*Options, error)

NewServiceOptions returns a service options configuration with the provided options set

type ProfileProvider added in v1.2.1

type ProfileProvider interface {
	Get(name string) (account.AccountProfile, error)
	Save(name string, profile account.AccountProfile) error
}

ProfileProvider defines the interface for interacting with stored profiles

type ProviderService

type ProviderService interface {
	Service
	// CreateEcosystem creates a new ecosystem
	CreateEcosystem(ctx context.Context, request *provider.CreateEcosystemRequest) (*provider.CreateEcosystemResponse, error)
	// UpdateEcosystem update an existing ecosystem
	UpdateEcosystem(ctx context.Context, request *provider.UpdateEcosystemRequest) (*provider.UpdateEcosystemResponse, error)
	AddWebhook(ctx context.Context, request *provider.AddWebhookRequest) (*provider.AddWebhookResponse, error)
	DeleteWebhook(ctx context.Context, request *provider.DeleteWebhookRequest) (*provider.DeleteWebhookResponse, error)
	EcosystemInfo(ctx context.Context, request *provider.EcosystemInfoRequest) (*provider.EcosystemInfoResponse, error)
	// GenerateToken returns an authToken that can be used for interacting with the ecosystem
	GenerateToken(ctx context.Context, request *provider.GenerateTokenRequest) (*provider.GenerateTokenResponse, error)
	// InviteParticipant to the ecosystem
	InviteParticipant(userContext context.Context, request *provider.InviteRequest) (*provider.InviteResponse, error)
	// InvitationStatus returns the status of the invitation
	InvitationStatus(userContext context.Context, request *provider.InvitationStatusRequest) (*provider.InvitationStatusResponse, error)
	// GenerateToken returns an authToken that can be used for interacting with the ecosystem
	GetOberonKey(ctx context.Context, request *provider.GetOberonKeyRequest) (*provider.GetOberonKeyResponse, error)
	// GenerateToken returns an authToken that can be used for interacting with the ecosystem
	GetEventToken(ctx context.Context, request *provider.GetEventTokenRequest) (*provider.GetEventTokenResponse, error)
}

ProviderService wraps all the functions for interacting with providers (ecosystems)

func NewProviderService added in v1.2.1

func NewProviderService(options *Options) (ProviderService, error)

NewProviderService returns a provider service with the base service configured using the provided options

type SecurityProvider added in v1.2.1

type SecurityProvider interface {
	GetAuthHeader(profile *account.AccountProfile, message proto.Message) (string, error)
}

SecurityProvider defines the required functionality to provide authentication to the api

type Service

type Service interface {
	// GetMetadataContext returns a context with the required grpc metadata embedded in it
	GetMetadataContext(userContext context.Context, message proto.Message) (context.Context, error)
	// BuildMetadata builds the required grpc metadata
	BuildMetadata(message proto.Message) (metadata.MD, error)
	// SetToken assigns the given auth token to the service. This token will be used for
	// make all api calls
	SetToken(token string)
	// SetEcosystemId assigns the given ecosystem ID to the service.
	SetEcosystemId(ecosystemId string)
	// GetToken returns the auth token currently assigned to this service or an empty string
	// if none is set
	GetToken() string
	// GetProfile returns the account profile associated with this service, or null if none
	GetProfile() *account.AccountProfile
	// GetServiceOptions returns the set of ServiceOptions the service is using
	GetServiceOptions() *options.ServiceOptions
	// GetChannel returns the grpc client connect
	GetChannel() *grpc.ClientConn
}

Service defines functionality common to all services

func NewServiceBase added in v1.2.1

func NewServiceBase(options *Options) (Service, error)

NewServiceBase returns a base service which is the foundation for all the other services

type Trinsic added in v1.6.0

type Trinsic struct {
	Service
	// contains filtered or unexported fields
}

func NewTrinsic added in v1.6.0

func NewTrinsic(options ...Option) (*Trinsic, error)

func (*Trinsic) Account added in v1.6.0

func (t *Trinsic) Account() AccountService

func (*Trinsic) Credential added in v1.6.0

func (t *Trinsic) Credential() CredentialService

func (*Trinsic) Provider added in v1.6.0

func (t *Trinsic) Provider() ProviderService

func (*Trinsic) Template added in v1.6.0

func (t *Trinsic) Template() CredentialTemplateService

func (*Trinsic) TrustRegistry added in v1.6.0

func (t *Trinsic) TrustRegistry() TrustRegistryService

func (*Trinsic) Wallet added in v1.6.0

func (t *Trinsic) Wallet() WalletService

type TrustRegistryService added in v1.2.1

type TrustRegistryService interface {
	Service
	// AddFramework in the ecosystem
	AddFramework(userContext context.Context, request *trustregistry.AddFrameworkRequest) (*trustregistry.AddFrameworkResponse, error)
	// RemoveFramework from the ecosystem
	RemoveFramework(userContext context.Context, request *trustregistry.RemoveFrameworkRequest) (*trustregistry.RemoveFrameworkResponse, error)
	// RegisterMember to issue the given credentials within the governance framework
	RegisterMember(userContext context.Context, request *trustregistry.RegisterMemberRequest) (*trustregistry.RegisterMemberResponse, error)
	// UnregisterMember in the given governance framework
	UnregisterMember(userContext context.Context, request *trustregistry.UnregisterMemberRequest) (*trustregistry.UnregisterMemberResponse, error)
	// GetMembershipStatus indicates whether the given member has a status within the given framework
	GetMembershipStatus(userContext context.Context, request *trustregistry.GetMembershipStatusRequest) (*trustregistry.GetMembershipStatusResponse, error)
	// SearchRegistry for frameworks, issues, and verifiers
	SearchRegistry(userContext context.Context, request *trustregistry.SearchRegistryRequest) (*trustregistry.SearchRegistryResponse, error)
	// FetchData from the provided governance framework
	FetchData(userContext context.Context, request *trustregistry.FetchDataRequest) (trustregistry.TrustRegistry_FetchDataClient, error)
}

TrustRegistryService defines the interface for interacting with trust registries

func NewTrustRegistryService added in v1.2.1

func NewTrustRegistryService(options *Options) (TrustRegistryService, error)

NewTrustRegistryService returns a trust registry service with the base service configured using the provided options

type WalletService

type WalletService interface {
	Service
	Search(userContext context.Context, request *wallet.SearchRequest) (*wallet.SearchResponse, error)
	InsertItem(userContext context.Context, request *wallet.InsertItemRequest) (*wallet.InsertItemResponse, error)
	DeleteItem(userContext context.Context, request *wallet.DeleteItemRequest) (*wallet.DeleteItemResponse, error)
}

WalletService defines the interface for interacting with wallet

func NewWalletService added in v1.4.0

func NewWalletService(options *Options) (WalletService, error)

NewWalletService returns a wallet service with the base service configured using the provided options

Jump to

Keyboard shortcuts

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