dataverse

package
v0.0.0-...-62ea655 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2024 License: BSD-3-Clause Imports: 16 Imported by: 1

Documentation

Index

Constants

View Source
const W3IDPrefix = "https://w3id.org/axone/ontology/v4"

Variables

View Source
var (
	VcBodySubject = cgschema.IRI_Full("dataverse:credential:body#subject")
	VcBodyType    = cgschema.IRI_Full("dataverse:credential:body#type")
	VcBodyClaim   = cgschema.IRI_Full("dataverse:credential:body#claim")
)

Functions

func NewDVError

func NewDVError(message MessageError, detail error) error

Types

type DVError

type DVError struct {
	// contains filtered or unexported fields
}

func (*DVError) Error

func (e *DVError) Error() string

type LawStoneFactory

type LawStoneFactory func(string) (lsschema.QueryClient, error)

type MessageError

type MessageError string
const (
	ErrNoResult    MessageError = "no result found in binding"
	ErrVarNotFound MessageError = "variable not found in binding result"
	ErrType        MessageError = "variable result type mismatch in binding result"

	ErrConvertRDF  MessageError = "could not convert credential to RDF"
	ErrMarshalJSON MessageError = "could not marshal JSON message"
	ErrSendTx      MessageError = "could not send transaction"
)

type QueryClient

type QueryClient interface {
	// GetResourceGovAddr returns the governance address of a resource.
	// It queries the cognitarium to get the governance address (law-stone contract address)
	// of a resource. The resource is identified by its DID.
	GetResourceGovAddr(context.Context, string) (string, error)

	// AskGovPermittedActions returns the permitted actions for a resource identified by its DID.
	// It queries the law-stone contract to get the permitted actions for a resource using the following predicate:
	// “`prolog
	// tell_permitted_actions(DID, Actions).
	// “`
	AskGovPermittedActions(context.Context, string, string) ([]string, error)

	// AskGovTellAction queries the law-stone contract to check if a given action is permitted for a resource.
	// It uses the following predicate:
	// “`prolog
	// tell(DID, Action, Result, Evidence).
	// “`
	// The function returns true if Result is 'permitted', false otherwise.
	AskGovTellAction(context.Context, string, string, string) (bool, error)
}

func NewQueryClient

func NewQueryClient(
	ctx context.Context,
	grpcAddr, contractAddr string,
	opts ...grpc.DialOption,
) (QueryClient, error)

type TxClient

type TxClient interface {
	// SubmitClaims submits a verifiable credential to the dataverse contract.
	// Credential must be signed to be submitted.
	SubmitClaims(ctx context.Context, credential *verifiable.Credential) (*types.TxResponse, error)
}

func NewTxClient

func NewTxClient(ctx context.Context,
	grpcAddr, contractAddr string,
	client tx.Client,
	txConfig client.TxConfig,
	signer keys.Keyring,
	opts ...grpc.DialOption,
) (TxClient, error)

Jump to

Keyboard shortcuts

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