helpers

package
v0.0.0-...-59feaff Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConfigKeys = []string{
	"connProfilePath",
	"relayEndpoint",
}

Valid keys for config

View Source
var ValidKeys = []string{
	"DEFAULT_CHANNEL",
	"DEFAULT_CHAINCODE",
	"MEMBER_CREDENTIAL_FOLDER",
	"LOCAL",
	"DEFAULT_APPLICATION_CHAINCODE",
	"CONFIG_PATH",
}

Valid keys for .env

Functions

func AddAssets

func AddAssets(dataFilePath, networkName, connProfilePath string, query QueryType, mspId, channelName, contractName, ccFunc, ccType string) error

func AddData

func AddData(filename string, connProfilePath string, networkName string, query QueryType, mspId string) error

func CheckIfFileOrDirectoryExists

func CheckIfFileOrDirectoryExists(path string) (bool, error)

func Contains

func Contains(list []string, value string) bool

return true if string array list contains the element value

func FabricHelper

func FabricHelper(gni GatewayNetworkInterface, channel, contractName, connProfilePath, networkName, mspId string, discoverEnabled bool, userString, userPwd string, registerUser bool) (*gateway.Gateway, *gateway.Contract, *gateway.Wallet, error)

func GenerateAccessControl

func GenerateAccessControl(channel, contractName, connProfilePath, networkName, templatePath, mspId, userString string) error

func GenerateMembership

func GenerateMembership(channel, contractName, connProfilePath, networkName, mspId, userString string) error

func GenerateSHA256HashInBase64Form

func GenerateSHA256HashInBase64Form(preimage string) string

function to generate a "SHA256" hash in base64 format for a given preimage

func GenerateVerificationPolicy

func GenerateVerificationPolicy(channel, contractName, connProfilePath, networkName, templatePath, mspId, userString string) error

func GetCredentialPath

func GetCredentialPath() string

func GetCurrentNetworkCredentialPath

func GetCurrentNetworkCredentialPath(networkId string) string

func GetIdentityFromWallet

func GetIdentityFromWallet(wallet *gateway.Wallet, userString string) (*gateway.X509Identity, error)

func GetKeyAndCertForRemoteRequestbyUserName

func GetKeyAndCertForRemoteRequestbyUserName(wallet *gateway.Wallet, username string) (string, string, error)

func Invoke

func Invoke(query QueryType, connProfilePath string, networkName string, mspId string, userString string) ([]byte, error)

func Query

func Query(query QueryType, connProfilePath string, networkName string, mspId string, userString string) ([]byte, error)

func SetLogLevel

func SetLogLevel(lvl log.Level)

func WalletSetup

func WalletSetup(connProfilePath, networkName, mspId, username, userPwd string, register bool) (*gateway.Wallet, error)

Types

type AccessControlPolicy

type AccessControlPolicy struct {
	SecurityDomain string `json:"securityDomain"`
	Rules          []Rule `json:"rules"`
}

type GatewayNetworkInterface

type GatewayNetworkInterface interface {
	GetNetwork(*gateway.Gateway, string) (*gateway.Network, error)
}

func NewGatewayNetworkInterface

func NewGatewayNetworkInterface() GatewayNetworkInterface

type Identifier

type Identifier struct {
	Pattern string                 `json:"pattern"`
	Policy  IdentifierAccessPolicy `json:"policy"`
}

type IdentifierAccessPolicy

type IdentifierAccessPolicy struct {
	Type     string   `json:"type"`
	Criteria []string `json:"criteria"`
}

type Member

type Member struct {
	Value string   `json:"value"`
	Type  string   `json:"type"`
	Chain []string `json:"chain"`
}

type Membership

type Membership struct {
	SecurityDomain string            `json:"securityDomain"`
	Members        map[string]Member `json:"members"`
}

type NetworkConfig

type NetworkConfig struct {
	RelayEndPoint   string `json:"relayEndPoint"`
	ConnProfilePath string `json:"connProfilePath"`
	MspId           string `json:"mspId"`
	ChannelName     string `json:"channelName"`
	Chaincode       string `json:"chaincode"`
}

func GetNetworkConfig

func GetNetworkConfig(networkId string) (NetworkConfig, error)

type QueryType

type QueryType struct {
	ContractName string   `json:"contractName"`
	Channel      string   `json:"channel"`
	CcFunc       string   `json:"ccFunc"`
	Args         []string `json:"args"`
}

type Rule

type Rule struct {
	Principal     string `json:"principal"`
	PrincipalType string `json:"principalType"`
	Resource      string `json:"resource"`
	Read          bool   `json:"read"`
}

type VerificationPolicy

type VerificationPolicy struct {
	SecurityDomain string       `json:"securityDomain"`
	Identifiers    []Identifier `json:"identifiers"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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