services

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: Apache-2.0 Imports: 22 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 GetSdkVersion added in v1.7.0

func GetSdkVersion() string

GetSdkVersion used to send metadata

func NewServiceConnection added in v1.4.0

func NewServiceConnection(options *options.TrinsicOptions, 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 profile and returns an encoded auth token

Types

type AccessManagementService added in v1.9.0

type AccessManagementService interface {
	Service

	// AddRoleAssignment Deprecated: This method is experimental
	// Adds a role assignment to an account
	AddRoleAssignment(userContext context.Context, request *provider.AddRoleAssignmentRequest) (*provider.AddRoleAssignmentResponse, error)
	// RemoveRoleAssignment Deprecated: This method is experimental
	// Removes a role assignment from the account
	RemoveRoleAssignment(userContext context.Context, request *provider.RemoveRoleAssignmentRequest) (*provider.RemoveRoleAssignmentResponse, error)
	// ListRoleAssignments Deprecated: This method is experimental
	// List the role assignments for the given account
	ListRoleAssignments(userContext context.Context, request *provider.ListRoleAssignmentsRequest) (*provider.ListRoleAssignmentsResponse, error)
}

AccessManagementService defines the interface for interacting with credentials

func NewAccessManagementService added in v1.9.0

func NewAccessManagementService(options *Options) (AccessManagementService, error)

NewAccessManagementService returns an access management service with the base service configured using the provided options

type ConnectService added in v1.11.8

type ConnectService interface {
	Service

	// CreateSession  Create an IDVSession
	CreateSession(userContext context.Context, request *connect.CreateSessionRequest) (*connect.CreateSessionResponse, error)
	// CancelSession  Cancel an IDVSession
	CancelSession(userContext context.Context, request *connect.CancelSessionRequest) (*connect.CancelSessionResponse, error)
	// GetSession  Get an IDVSession
	GetSession(userContext context.Context, request *connect.GetSessionRequest) (*connect.GetSessionResponse, error)
	// ListSessions  List IDVSessions created by the calling wallet
	ListSessions(userContext context.Context, request *connect.ListSessionsRequest) (*connect.ListSessionsResponse, error)
	// HasValidCredential  Checks if the identity provided in the request has a wallet containing a valid reusable credential
	HasValidCredential(userContext context.Context, request *connect.HasValidCredentialRequest) (*connect.HasValidCredentialResponse, error)
}

ConnectService wraps all the functions for interacting with Trinsic Connect

func NewConnectService added in v1.11.8

func NewConnectService(options *Options) (ConnectService, error)

NewConnectService returns a Trinsic Connect service

type CredentialService added in v1.2.1

type CredentialService interface {
	Service

	// IssueFromTemplate  Sign and issue a verifiable credential from a pre-defined template.
	// This process will also add schema validation and
	// revocation registry values to the credential.
	IssueFromTemplate(userContext context.Context, request *credential.IssueFromTemplateRequest) (*credential.IssueFromTemplateResponse, error)
	// CheckStatus  Check credential status in the revocation registry
	CheckStatus(userContext context.Context, request *credential.CheckStatusRequest) (*credential.CheckStatusResponse, error)
	// UpdateStatus  Update credential status by setting the revocation value
	UpdateStatus(userContext context.Context, request *credential.UpdateStatusRequest) (*credential.UpdateStatusResponse, error)
	// CreateProof  Create a proof from a signed document that is a valid
	// verifiable credential and contains a signature from which a proof can be derived.
	CreateProof(userContext context.Context, request *credential.CreateProofRequest) (*credential.CreateProofResponse, error)
	// VerifyProof  Verifies a proof by checking the signature value, and if possible schema validation,
	// revocation status, and issuer status against a trust registry
	VerifyProof(userContext context.Context, request *credential.VerifyProofRequest) (*credential.VerifyProofResponse, error)
	// Send  Sends a document directly to a user's email within the given ecosystem
	Send(userContext context.Context, request *credential.SendRequest) (*credential.SendResponse, error)
	// CreateCredentialOffer  Create credential offer
	CreateCredentialOffer(userContext context.Context, request *credential.CreateCredentialOfferRequest) (*credential.CreateCredentialOfferResponse, error)
	// AcceptCredential  Accept an offer to exchange a credential
	AcceptCredential(userContext context.Context, request *credential.AcceptCredentialRequest) (*credential.AcceptCredentialResponse, error)
	// RejectCredential  Reject an offer to exchange a credential
	RejectCredential(userContext context.Context, request *credential.RejectCredentialRequest) (*credential.RejectCredentialResponse, 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 FileManagementService added in v1.9.0

type FileManagementService interface {
	Service

	// UploadFile Deprecated: This method is experimental
	// Upload a file to Trinsic's CDN
	UploadFile(userContext context.Context, request *filemanagement.UploadFileRequest) (*filemanagement.UploadFileResponse, error)
	// GetFile Deprecated: This method is experimental
	// Fetch information about a file by its ID
	GetFile(userContext context.Context, request *filemanagement.GetFileRequest) (*filemanagement.GetFileResponse, error)
	// DeleteFile Deprecated: This method is experimental
	// Delete a file by its ID
	DeleteFile(userContext context.Context, request *filemanagement.DeleteFileRequest) (*filemanagement.DeleteFileResponse, error)
	// ListFiles Deprecated: This method is experimental
	// List files the calling account has uploaded
	ListFiles(userContext context.Context, request *filemanagement.ListFilesRequest) (*filemanagement.ListFilesResponse, error)
	// GetStorageStats Deprecated: This method is experimental
	// Get statistics about files uploaded by the calling account
	GetStorageStats(userContext context.Context) (*filemanagement.GetStorageStatsResponse, error)
}

FileManagementService defines the interface for interacting with credentials

func NewFileManagementService added in v1.9.0

func NewFileManagementService(options *Options) (FileManagementService, error)

NewFileManagementService returns a file management service with the base service configured using the provided options

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(TrinsicOptions *options.TrinsicOptions) 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 {
	TrinsicOptions  *options.TrinsicOptions
	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 ProviderService

type ProviderService interface {
	Service
	// CreateEcosystem creates a new ecosystem
	CreateEcosystem(ctx context.Context, request *provider.CreateEcosystemRequest) (*provider.CreateEcosystemResponse, error)

	// GetOberonKey  Returns the public key being used to create/verify oberon tokens
	GetOberonKey(userContext context.Context) (*provider.GetOberonKeyResponse, error)
	// UpgradeDID  Upgrade a wallet's DID from `did:key` to another method
	UpgradeDID(userContext context.Context, request *provider.UpgradeDidRequest) (*provider.UpgradeDidResponse, error)
	// SearchWalletConfigurations  Search for issuers/providers/verifiers in the current ecosystem
	SearchWalletConfigurations(userContext context.Context, request *provider.SearchWalletConfigurationsRequest) (*provider.SearchWalletConfigurationResponse, 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 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)
	// SetAuthToken assigns the given auth token to the service. This token will be used for
	// make all api calls
	SetAuthToken(token string)
	// GetAuthToken returns the auth token currently assigned to this service or an empty string
	// if none is set
	GetAuthToken() string
	// GetServiceOptions returns the set of TrinsicOptions the service is using
	GetServiceOptions() *options.TrinsicOptions
	// 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 TemplateService added in v1.7.0

type TemplateService interface {
	Service

	// Create  Create a credential template in the current ecosystem
	Create(userContext context.Context, request *template.CreateCredentialTemplateRequest) (*template.CreateCredentialTemplateResponse, error)
	// Get  Fetch a credential template by ID
	Get(userContext context.Context, request *template.GetCredentialTemplateRequest) (*template.GetCredentialTemplateResponse, error)
	// Update  Update metadata of a template
	Update(userContext context.Context, request *template.UpdateCredentialTemplateRequest) (*template.UpdateCredentialTemplateResponse, error)
	// List  Search credential templates using SQL, returning strongly-typed template data
	List(userContext context.Context, request *template.ListCredentialTemplatesRequest) (*template.ListCredentialTemplatesResponse, error)
	// Search  Search credential templates using SQL, returning raw JSON data
	Search(userContext context.Context, request *template.SearchCredentialTemplatesRequest) (*template.SearchCredentialTemplatesResponse, error)
	// Delete  Delete a credential template from the current ecosystem by ID
	Delete(userContext context.Context, request *template.DeleteCredentialTemplateRequest) (*template.DeleteCredentialTemplateResponse, error)
	// CreateVerificationTemplate Deprecated: This method is experimental
	// Create/update verification templates
	CreateVerificationTemplate(userContext context.Context, request *template.CreateVerificationTemplateRequest) (*template.CreateVerificationTemplateResponse, error)
	// ListVerificationTemplates Deprecated: This method is experimental
	ListVerificationTemplates(userContext context.Context, request *template.ListVerificationTemplatesRequest) (*template.ListVerificationTemplatesResponse, error)
	// GetVerificationTemplate Deprecated: This method is experimental
	GetVerificationTemplate(userContext context.Context, request *template.GetVerificationTemplateRequest) (*template.GetVerificationTemplateResponse, error)
	// UpdateVerificationTemplate Deprecated: This method is experimental
	UpdateVerificationTemplate(userContext context.Context, request *template.UpdateVerificationTemplateRequest) (*template.UpdateVerificationTemplateResponse, error)
	// DeleteVerificationTemplate Deprecated: This method is experimental
	DeleteVerificationTemplate(userContext context.Context, request *template.DeleteVerificationTemplateRequest) (*template.DeleteVerificationTemplateResponse, error)
}

TemplateService defines the interface for interacting with credentials templates

func NewTemplateService added in v1.7.0

func NewTemplateService(options *Options) (TemplateService, error)

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

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) AccessManagement added in v1.9.0

func (t *Trinsic) AccessManagement() AccessManagementService

func (*Trinsic) Connect added in v1.11.8

func (t *Trinsic) Connect() ConnectService

func (*Trinsic) Credential added in v1.6.0

func (t *Trinsic) Credential() CredentialService

func (*Trinsic) FileManagement added in v1.9.0

func (t *Trinsic) FileManagement() FileManagementService

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() TemplateService

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

	// RegisterMember  Register an authoritative issuer for a credential schema
	RegisterMember(userContext context.Context, request *trustregistry.RegisterMemberRequest) (*trustregistry.RegisterMemberResponse, error)
	// UnregisterMember  Removes an authoritative issuer for a credential schema from the trust registry
	UnregisterMember(userContext context.Context, request *trustregistry.UnregisterMemberRequest) (*trustregistry.UnregisterMemberResponse, error)
	// GetMemberAuthorizationStatus  Fetch the status of a member for a given credential schema in a trust registry
	GetMemberAuthorizationStatus(userContext context.Context, request *trustregistry.GetMemberAuthorizationStatusRequest) (*trustregistry.GetMemberAuthorizationStatusResponse, error)
	// ListAuthorizedMembers  Fetch the ecosystem's authorized issuers and the respective templates against which it can issue
	ListAuthorizedMembers(userContext context.Context, request *trustregistry.ListAuthorizedMembersRequest) (*trustregistry.ListAuthorizedMembersResponse, error)
	// GetMember  Get member for a given did in a trust registry
	GetMember(userContext context.Context, request *trustregistry.GetMemberRequest) (*trustregistry.GetMemberResponse, 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 searches the wallet using a SQL-like syntax
	SearchWallet(userContext context.Context, request *wallet.SearchRequest) (*wallet.SearchResponse, error)

	// GetItem  Retrieve an item from the wallet with a given item identifier
	GetItem(userContext context.Context, request *wallet.GetItemRequest) (*wallet.GetItemResponse, error)
	// Search  Search the wallet using a SQL syntax
	Search(userContext context.Context, request *wallet.SearchRequest) (*wallet.SearchResponse, error)
	// InsertItem  Insert an item into the wallet
	InsertItem(userContext context.Context, request *wallet.InsertItemRequest) (*wallet.InsertItemResponse, error)
	// UpdateItem  Update an item in the wallet
	UpdateItem(userContext context.Context, request *wallet.UpdateItemRequest) (*wallet.UpdateItemResponse, error)
	// DeleteItem  Delete an item from the wallet permanently
	DeleteItem(userContext context.Context, request *wallet.DeleteItemRequest) (*wallet.DeleteItemResponse, error)
	// DeleteWallet  Delete a wallet and its credentials
	DeleteWallet(userContext context.Context, request *wallet.DeleteWalletRequest) (*wallet.DeleteWalletResponse, error)
	// CreateWallet  Create a new wallet and generate an auth token for access
	CreateWallet(userContext context.Context, request *wallet.CreateWalletRequest) (*wallet.CreateWalletResponse, error)
	// GetWalletInfo  Retrieve wallet details and configuration
	GetWalletInfo(userContext context.Context, request *wallet.GetWalletInfoRequest) (*wallet.GetWalletInfoResponse, error)
	// GetMyInfo  Retrieve wallet details and configuration about the currently authenticated wallet
	GetMyInfo(userContext context.Context) (*wallet.GetMyInfoResponse, error)
	// GetWalletFromExternalIdentity  Retrieve information from an ecosystem wallet by searching for its external identity (email or phone)
	GetWalletFromExternalIdentity(userContext context.Context, request *wallet.GetWalletFromExternalIdentityRequest) (*wallet.GetWalletFromExternalIdentityResponse, error)
	// GenerateAuthToken  Generate new token for a given wallet and add it to the collection of known auth tokens.
	// This endpoint requires authentication and will return a new token ID and auth token.
	// Use this endpoint if you want to authorize another device, without having to share your
	// existing auth token.
	GenerateAuthToken(userContext context.Context, request *wallet.GenerateAuthTokenRequest) (*wallet.GenerateAuthTokenResponse, error)
	// RevokeAuthToken  Revokes a previously issued auth token and updates the collection of known auth tokens.
	// This endpoint requires authentication.
	RevokeAuthToken(userContext context.Context, request *wallet.RevokeAuthTokenRequest) (*wallet.RevokeAuthTokenResponse, error)
	// AddExternalIdentityInit  Add new external identity to the current wallet, such as email, sms, ethereum address, etc.
	// This identity ownership must be confirmed using `AddIdentityConfirm` via OTP, signature, etc.
	AddExternalIdentityInit(userContext context.Context, request *wallet.AddExternalIdentityInitRequest) (*wallet.AddExternalIdentityInitResponse, error)
	// AddExternalIdentityConfirm  Confirm identity added to the current wallet using `AddExternalIdentityInit`
	AddExternalIdentityConfirm(userContext context.Context, request *wallet.AddExternalIdentityConfirmRequest) (*wallet.AddExternalIdentityConfirmResponse, error)
	// RemoveExternalIdentity  Remove an external identity from the current wallet
	RemoveExternalIdentity(userContext context.Context, request *wallet.RemoveExternalIdentityRequest) (*wallet.RemoveExternalIdentityResponse, error)
	// AuthenticateInit  Sign-in to an already existing wallet, using an identity added that was previously registered
	// This endpoint does not require authentication, and will return a challenge to be signed or verified
	AuthenticateInit(userContext context.Context, request *wallet.AuthenticateInitRequest) (*wallet.AuthenticateInitResponse, error)
	// AuthenticateConfirm  Confirm sign-in to an already existing wallet and return authentication token
	AuthenticateConfirm(userContext context.Context, request *wallet.AuthenticateConfirmRequest) (*wallet.AuthenticateConfirmResponse, error)
	// AuthenticateResendCode  Resend previous authentication code
	AuthenticateResendCode(userContext context.Context, request *wallet.AuthenticateResendCodeRequest) (*wallet.AuthenticateResendCodeResponse, error)
	// ListWallets  List all wallets in the ecosystem
	ListWallets(userContext context.Context, request *wallet.ListWalletsRequest) (*wallet.ListWalletsResponse, error)
	// ListByVerificationTemplate  List credentials which match a given verification template
	ListByVerificationTemplate(userContext context.Context, request *wallet.ListByVerificationTemplateRequest) (*wallet.ListByVerificationTemplateResponse, 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