access

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: BSD-3-Clause Imports: 10 Imported by: 1

Documentation

Overview

Package access implements a native contract to handle access. It allows an authorized identity to add access as an {ID, CONTRACT, COMMAND, IDENTITIES} quadruplet.

ID is the credential identifier. This identifier is generally defined at the contract's creation. CONTRACT is the contract name. COMMAND specifies the command to grant access to on the contract. IDENTITIES is a list of standard base64 encoded bls public keys, separated by comas.

Documentation Last Review: 02.02.2021

Index

Constants

View Source
const (
	// ContractUID is the unique (4-bytes) identifier of the contract, it is
	// used to prefix keys in the K/V store and by DARCs for access control.
	ContractUID = "DARC"

	// ContractName is the name of the access contract.
	ContractName = "go.dedis.ch/dela.Access"

	// GrantIDArg is the argument's name in the transaction that contains the
	// provided id to grant
	GrantIDArg = "access:grant_id"

	// GrantContractArg is the argument's name in the transaction that contain
	// the provided contract name to grant the access to.
	GrantContractArg = "access:grant_contract"

	// GrantCommandArg is the argument's name in the transaction that contains
	// the provided command to grant access to.
	GrantCommandArg = "access:grant_command"

	// IdentityArg is the argument's name in the transaction that contains the
	// provided identity to grant access to.
	IdentityArg = "access:identity"

	// CmdArg is the argument's name to indicate the kind of command we want to
	// run on the contract. Should be one of the Command type.
	CmdArg = "access:command"

	// CredentialAllCommand defines the credential command that is allowed to
	// perform all commands.
	CredentialAllCommand = "all"
)

Variables

This section is empty.

Functions

func NewCreds

func NewCreds() access.Credential

NewCreds creates new credentials for an access contract execution.

func RegisterContract

func RegisterContract(exec *native.Service, c Contract)

RegisterContract registers the access contract to the given execution service.

Types

type Command

type Command string

Command defines a command for the command contract

const (
	// CmdSet defines the command to grant access
	CmdSet Command = "GRANT"
)

type Contract

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

Contract is the access contract that allows one to handle access.

- implements native.Contract

func NewContract

func NewContract(srvc access.Service, store store.Readable) Contract

NewContract creates a new access contract

func (Contract) Execute

func (c Contract) Execute(snap store.Snapshot, step execution.Step) error

Execute implements native.Contract

func (Contract) UID

func (c Contract) UID() string

UID returns the unique 4-bytes contract identifier.

- implements native.Contract

Directories

Path Synopsis
Package controller implements a controller for the access contract.
Package controller implements a controller for the access contract.

Jump to

Keyboard shortcuts

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