Documentation ¶
Index ¶
- type AccessControlShim
- func (shim *AccessControlShim) ReadCertAttribute(attributeName string) ([]byte, error)
- func (shim *AccessControlShim) VerifyAttribute(attributeName string, attributeValue []byte) (bool, error)
- func (shim *AccessControlShim) VerifyAttributes(attrs ...*accesscontrol.Attribute) (bool, error)
- func (shim *AccessControlShim) VerifySignature(certificate, signature, message []byte) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccessControlShim ¶
type AccessControlShim struct {
// contains filtered or unexported fields
}
AccessControlShim wraps the object passed to chaincode for shim side handling of APIs to provide access control capabilities.
func NewAccessControlShim ¶
func NewAccessControlShim(stub shim.ChaincodeStubInterface) *AccessControlShim
NewAccessControlShim create a new AccessControlShim instance
func (*AccessControlShim) ReadCertAttribute ¶
func (shim *AccessControlShim) ReadCertAttribute(attributeName string) ([]byte, error)
ReadCertAttribute is used to read an specific attribute from the transaction certificate, *attributeName* is passed as input parameter to this function. Example:
attrValue,error:=stub.ReadCertAttribute("position")
func (*AccessControlShim) VerifyAttribute ¶
func (shim *AccessControlShim) VerifyAttribute(attributeName string, attributeValue []byte) (bool, error)
VerifyAttribute is used to verify if the transaction certificate has an attribute with name *attributeName* and value *attributeValue* which are the input parameters received by this function. Example:
containsAttr, error := stub.VerifyAttribute("position", "Software Engineer")
func (*AccessControlShim) VerifyAttributes ¶
func (shim *AccessControlShim) VerifyAttributes(attrs ...*accesscontrol.Attribute) (bool, error)
VerifyAttributes does the same as VerifyAttribute but it checks for a list of attributes and their respective values instead of a single attribute/value pair Example:
containsAttrs, error:= stub.VerifyAttributes(&attr.Attribute{"position", "Software Engineer"}, &attr.Attribute{"company", "ACompany"})
func (*AccessControlShim) VerifySignature ¶
func (shim *AccessControlShim) VerifySignature(certificate, signature, message []byte) (bool, error)
VerifySignature verifies the transaction signature and returns `true` if correct and `false` otherwise