cc

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2025 License: MIT Imports: 42 Imported by: 2

Documentation

Index

Constants

View Source
const ACLChaincodeName = "acl"

Variables

This section is empty.

Functions

This section is empty.

Types

type ACL

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

func New

func New() *ACL

func (*ACL) AddAdditionalKey

func (c *ACL) AddAdditionalKey(stub shim.ChaincodeStubInterface, args []string) error

AddAdditionalKey adds a new additional public key to the user account. Associates the new key with the "parent" address of the user in the ACL.

Call Arguments:

  • arg[0] - user address for linking the additional key
  • arg[1] - additional key in base58 format to add to your account
  • arg[2] - JSON array of tag strings to the key
  • arg[3] - nonce value in string format
  • arg[4:] - public keys and validator signatures

func (*ACL) AddAddressForNominee added in v0.0.8

func (c *ACL) AddAddressForNominee(stub shim.ChaincodeStubInterface, args []string) error

AddAddressForNominee adding principal address for nominee args[0] -> channelName args[1] -> chaincodeName args[2] -> nomineeAddress args[3] -> principalAddress

func (*ACL) AddMultisig

func (c *ACL) AddMultisig(stub shim.ChaincodeStubInterface, args []string) error

AddMultisig creates multi-signature address which operates when N of M signatures is present arg[0] N number of signature policy (number of sufficient signatures), M part is derived from number of public keys arg[1] nonce args[2:] are the public keys and signatures hex of all participants in the multi-wallet and signatures confirming the agreement of all participants with the signature policy

func (*ACL) AddMultisigWithBase58Signature

func (c *ACL) AddMultisigWithBase58Signature(stub shim.ChaincodeStubInterface, args []string) error

AddMultisigWithBase58Signature creates multi-signature address which operates when N of M signatures is present args[0] request id args[1] chaincodeName acl args[2] channelID acl args[3] N number of signature policy (number of sufficient signatures), M part is derived from number of public keys args[4] nonce args[5:] are the public keys and signatures base58 of all participants in the multi-wallet and signatures confirming the agreement of all participants with the signature policy

func (*ACL) AddRights

func (c *ACL) AddRights(stub shim.ChaincodeStubInterface, args []string) error

AddRights adds rights to the access matrix args[0] -> channelName args[1] -GetOperationAllRights> chaincodeName args[2] -> roleName args[3] -> operationName args[4] -> addressEncoded

func (*ACL) AddToList

func (c *ACL) AddToList(stub shim.ChaincodeStubInterface, args []string) error

AddToList sets address to 'gray list' or 'black list' arg[0] - address arg[1] - "gray" of "black"

func (*ACL) AddUser

func (c *ACL) AddUser(stub shim.ChaincodeStubInterface, args []string) error

AddUser adds user by public key to the ACL args is slice of parameters: args[0] - encoded base58 user publicKey args[1] - Know Your Client (KYC) hash args[2] - user identifier args[3] - user can do industrial operation or not (boolean)

func (*ACL) AddUserWithPublicKeyType

func (c *ACL) AddUserWithPublicKeyType(stub shim.ChaincodeStubInterface, args []string) error

AddUserWithPublicKeyType adds user by public key to the ACL args is slice of parameters: args[0] - encoded base58 user publicKey args[1] - Know Your Client (KYC) hash args[2] - user identifier args[3] - user can do industrial operation or not (boolean) args[4] - key type: ed25519, ecdsa, gost

func (*ACL) ChangeMultisigPublicKey

func (c *ACL) ChangeMultisigPublicKey(stub shim.ChaincodeStubInterface, args []string) error

ChangeMultisigPublicKey changes public key of multisig member arg[0] - multisig address (base58check) arg[1] - old key (base58) arg[2] - new key (base58) arg[3] - reason (string) arg[4] - reason ID (string) arg[5] - nonce arg[6:] - public keys and signatures of validators

func (*ACL) ChangePublicKey

func (c *ACL) ChangePublicKey(stub shim.ChaincodeStubInterface, args []string) error

ChangePublicKey changes public key of user arg[0] - user's address (base58check) arg[1] - reason (string) arg[2] - reason ID (string) arg[3] - new key (base58) arg[4] - nonce arg[5:] - public keys and signatures of validators

func (*ACL) ChangePublicKeyWithBase58Signature

func (c *ACL) ChangePublicKeyWithBase58Signature(stub shim.ChaincodeStubInterface, args []string) error

ChangePublicKeyWithBase58Signature changes the public key of a user with base58 encoding. It expects the following arguments: - 0: Request ID - 1: Chaincode name - 2: Channel ID - 3: User's address (base58check) - 4: Reason (string) - 5: Reason ID (string) - 6: New key (base58) - 7: Nonce - 8 and onwards: List of validators' public keys and their corresponding signatures

func (*ACL) CheckAddress

func (c *ACL) CheckAddress(stub shim.ChaincodeStubInterface, args []string) ([]byte, error)

CheckAddress checks if the address is grayListed returns an error if the address is grayListed or returns pb.Address if not args[0] - base58-encoded address

func (*ACL) CheckKeys

func (c *ACL) CheckKeys(stub shim.ChaincodeStubInterface, args []string) ([]byte, error)

CheckKeys returns AclResponse with account indo fetched by public keys

func (*ACL) DelFromList

func (c *ACL) DelFromList(stub shim.ChaincodeStubInterface, args []string) error

DelFromList removes address from gray list or black list arg[0] - address arg[1] - "gray" of "black"

func (*ACL) GetAccountAllRights

func (c *ACL) GetAccountAllRights(stub shim.ChaincodeStubInterface, args []string) ([]byte, error)

GetAccountAllRights returns all operations specified account have right to execute args[0] -> addressEncoded

func (*ACL) GetAccountInfo

func (c *ACL) GetAccountInfo(stub shim.ChaincodeStubInterface, args []string) ([]byte, error)

GetAccountInfo returns json-serialized account info (KYC hash, grayList and blacklist attributes) for address. arg[0] - address

func (*ACL) GetAccountOperationRight

func (c *ACL) GetAccountOperationRight(stub shim.ChaincodeStubInterface, args []string) ([]byte, error)

GetAccountOperationRight checks address have rights for the operation args[0] -> channelName args[1] -GetOperationAllRights> chaincodeName args[2] -> roleName args[3] -> operationName args[4] -> addressEncoded

func (*ACL) GetAccountOperationRightJSON added in v0.0.2

func (c *ACL) GetAccountOperationRightJSON(stub shim.ChaincodeStubInterface, args []string) ([]byte, error)

GetAccountOperationRightJSON checks address have rights for the operation args[0] -> channelName args[1] -GetOperationAllRights> chaincodeName args[2] -> roleName args[3] -> operationName args[4] -> addressEncoded

func (*ACL) GetAccountsInfo added in v0.0.4

func (c *ACL) GetAccountsInfo(stub shim.ChaincodeStubInterface, _ []string) ([]byte, error)

func (*ACL) GetAddressRightForNominee added in v0.0.8

func (c *ACL) GetAddressRightForNominee(stub shim.ChaincodeStubInterface, args []string) ([]byte, error)

GetAddressRightForNominee return if nominee have right to access to principal address args[0] -> channelName args[1] -> chaincodeName args[2] -> nomineeAddress args[3] -> principalAddress

func (*ACL) GetAddresses

func (c *ACL) GetAddresses(stub shim.ChaincodeStubInterface, args []string) ([]byte, error)

GetAddresses reads and returns addresses from state by given page size and bookmark

func (*ACL) GetAddressesListForNominee added in v0.0.8

func (c *ACL) GetAddressesListForNominee(stub shim.ChaincodeStubInterface, args []string) ([]byte, error)

GetAddressesListForNominee returns all principal addresses for specified nominee args[0] -> channelName args[1] -> chaincodeName args[2] -> nomineeAddress

func (*ACL) GetOperationAllRights

func (c *ACL) GetOperationAllRights(stub shim.ChaincodeStubInterface, args []string) ([]byte, error)

GetOperationAllRights returns all accounts having right to execute specified operation args[0] -> channelName args[1] -GetOperationAllRights> chaincodeName args[2] -> roleName args[3] -> operationName

func (*ACL) GetUser

func (c *ACL) GetUser(stub shim.ChaincodeStubInterface, args []string) ([]byte, error)

GetUser returns user by address args is slice of parameters: args[0] - encoded base58 user address

func (*ACL) Init

func (c *ACL) Init(stub shim.ChaincodeStubInterface) *peer.Response

Init - method for initialize chaincode args: adminSKI, validatorsCount, validatorBase58Ed25519PublicKey1, ..., validatorBase58Ed25519PublicKeyN

func (*ACL) Invoke

func (c *ACL) Invoke(stub shim.ChaincodeStubInterface) *peer.Response

func (*ACL) RemoveAdditionalKey

func (c *ACL) RemoveAdditionalKey(stub shim.ChaincodeStubInterface, args []string) error

RemoveAdditionalKey removes the optional key from the user account. For cases, when the key is no longer needed or has been compromised.

Call Arguments:

  • arg[0] - user address for "linking" the additional key
  • arg[1] - additional key in base58 format for deletion from the account
  • arg[2] - nonce value in string format
  • arg[3:] - public keys and validator signatures

func (*ACL) RemoveAddressFromNominee added in v0.0.8

func (c *ACL) RemoveAddressFromNominee(stub shim.ChaincodeStubInterface, args []string) error

RemoveAddressFromNominee adding principal address for nominee args[0] -> channelName args[1] -> chaincodeName args[2] -> nomineeAddress args[3] -> principalAddress

func (*ACL) RemoveRights

func (c *ACL) RemoveRights(stub shim.ChaincodeStubInterface, args []string) error

RemoveRights removes rights from the access matrix args[0] -> channelName args[1] -GetOperationAllRights> chaincodeName args[2] -> roleName args[3] -> operationName args[4] -> addressEncoded

func (*ACL) SetAccountInfo

func (c *ACL) SetAccountInfo(stub shim.ChaincodeStubInterface, args []string) error

SetAccountInfo sets account info (KYC hash, grayList and blacklist attributes) for address. arg[0] - address arg[1] - KYC hash arg[2] - is address gray listed? ("true" or "false") arg[3] - is address black listed? ("true" or "false")

func (*ACL) Setkyc

func (c *ACL) Setkyc(stub shim.ChaincodeStubInterface, args []string) error

Setkyc updates KYC for address arg[0] - address arg[1] - KYC hash arg[2] - nonce arg[3:] - public keys and signatures of validators

func (*ACL) Start

func (c *ACL) Start() error

type Account

type Account struct {
	Address string   `json:"address"`
	Balance *big.Int `json:"balance"`
}

type AddMultisigRequest

type AddMultisigRequest struct {
	RequestID               string
	ChaincodeName           string
	ChannelName             string
	PublicKeys              []PublicKey
	RequiredSignaturesCount int
	Signatures              [][]byte
	Message                 string
	SignedTx                []string
	Nonce                   string
}

type AddUserRequest

type AddUserRequest struct {
	PublicKey
	KYCHash      string
	UserID       string
	IsIndustrial bool
}

type AddrsWithPagination

type AddrsWithPagination struct {
	Addrs    []string
	Bookmark string
}

type CheckKeysRequest

type CheckKeysRequest struct {
	PublicKeys []PublicKey
}

type ListType

type ListType string
const (
	BlackList ListType = "black"
	GrayList  ListType = "gray"
)

func (ListType) String

func (lt ListType) String() string

type PublicKey

type PublicKey struct {
	InBase58          string
	Bytes             []byte
	Hash              []byte
	HashInHex         string
	HashInBase58Check string
	Type              string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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