common

module
v0.0.0-...-aeb4a1d Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2022 License: Apache-2.0

README

Common SDK

This repo hosts Blockchain for Healthcare Common Go packages and is intended to be used by Solution developers as sdk in developing Go chaincodes for Hyperledger Fabric. It provides common functionality like Key management, User management, User access control, Consent, Asset management, Data encryption/decryption etc.

Prerequisites
  • Common SDK was built and verified on
    • golang 1.12.12
    • Hyperledger Fabric 1.4.7

Development

Cloning

To test & develop this repo by itself, clone it to your GOPATH, e.g. Users\JohnDoe\go\src\common.

To use it in a chaincode solution, add common as git submodule in the solution's vendor directory (for e.g. solution_chaincode/vendor/common).

Building Common SDK Go Code
export GO111MODULE=auto

cd bchcls
go build --tags nopkcs11 ./...
Running Go Tests

The offchain db unit tests, require IBM Cloudant dev container to be running:

#To start cloudant container, do following root folder
docker-compose -f docker-compose-cloudant.yaml up -d
cd bchcls
go test --tags nopkcs11 ./...
Best practices
  • Format your Go Code via IDE or use
go fmt ./...

Directories

Path Synopsis
asset_mgmt
Package asset_mgmt is responsible for storing any type of asset on the ledger.
Package asset_mgmt is responsible for storing any type of asset on the ledger.
asset_mgmt/asset_key_func
Package asset_key_func provides asset key related functions.
Package asset_key_func provides asset key related functions.
asset_mgmt/asset_manager
Package asset_manager is an interface for high-level asset management functions.
Package asset_manager is an interface for high-level asset management functions.
cached_stub
Package cached_stub is used for caching ledger data and arbitrary data to improve transaction efficiency.
Package cached_stub is used for caching ledger data and arbitrary data to improve transaction efficiency.
consent_mgmt
Package consent_mgmt provides functionality for sharing assets with other users, groups, or orgs.
Package consent_mgmt provides functionality for sharing assets with other users, groups, or orgs.
crypto
Package crypto handles all encryption, decryption, hashing, and parsing of keys.
Package crypto handles all encryption, decryption, hashing, and parsing of keys.
custom_errors
Package custom_errors defines our custom error types.
Package custom_errors defines our custom error types.
data_model
Package data_model contains structs used across packages to prevent circular imports.
Package data_model contains structs used across packages to prevent circular imports.
datatype
Package datatype manages datatypes and their relationships.
Package datatype manages datatypes and their relationships.
datatype/datatype_interface
Package datatype_interface provides an interface for datatype methods.
Package datatype_interface provides an interface for datatype methods.
history
Package history handles transaction history logging.
Package history handles transaction history logging.
history/history_manager
Package history_manager is an interface for high-level history management functions.
Package history_manager is an interface for high-level history management functions.
index
Package index allows for creating indices in the state database.
Package index allows for creating indices in the state database.
index/table_interface
Package table_interface provides an interface for index table related methods.
Package table_interface provides an interface for index table related methods.
init_common
Package init_common contains a single function Init which initializes the indices for all packages in common.
Package init_common contains a single function Init which initializes the indices for all packages in common.
internal/asset_mgmt_i
Package asset_mgmt_i is responsible for storing any type of asset on the ledger.
Package asset_mgmt_i is responsible for storing any type of asset on the ledger.
internal/asset_mgmt_i/asset_mgmt_c
common package contain structs and functions to be used across all bchcls packages.
common package contain structs and functions to be used across all bchcls packages.
internal/common
package common contains structs and functions to be used across all bchcls packages.
package common contains structs and functions to be used across all bchcls packages.
internal/consent_mgmt_i
Package consent_mgmt_i provides functionality for sharing assets with other users, groups, or orgs.
Package consent_mgmt_i provides functionality for sharing assets with other users, groups, or orgs.
internal/datatype_i
Package datatype manages datatypes and their relationships.
Package datatype manages datatypes and their relationships.
internal/datatype_i/datatype_c
Package datatype manages datatypes and their relationships.
Package datatype manages datatypes and their relationships.
internal/history_i
Package history_i handles transaction history logging.
Package history_i handles transaction history logging.
internal/index_i
Package index allows for creating indices in the state database.
Package index allows for creating indices in the state database.
internal/metering_i
Package metering_i is responsible for metering transactions through the SDK.
Package metering_i is responsible for metering transactions through the SDK.
internal/user_access_ctrl_i
Package user_access_ctrl_i handles access to assets and keys.
Package user_access_ctrl_i handles access to assets and keys.
internal/user_mgmt_i
Package user_mgmt_i manages users and groups.
Package user_mgmt_i manages users and groups.
internal/user_mgmt_i/user_mgmt_c
common package contains global_data and functions to be shared across bchcls common packages.
common package contains global_data and functions to be shared across bchcls common packages.
sdk_life_cycle
Package sdk_life_cycle contains wrappers needed for SDK functionalities.
Package sdk_life_cycle contains wrappers needed for SDK functionalities.
simple_rule
Package simple_rule is a Go implementation of json-logic represented rules that can be used to evaluate data.
Package simple_rule is a Go implementation of json-logic represented rules that can be used to evaluate data.
test_utils
Package test_utils contains test utility functions for creating users, printing the ledger, and etc.
Package test_utils contains test utility functions for creating users, printing the ledger, and etc.
user_access_ctrl
Package user_access_ctrl handles access to assets and keys.
Package user_access_ctrl handles access to assets and keys.
user_access_ctrl/user_access_manager
Package user_access_manager is an interface for high-level user access control functions.
Package user_access_manager is an interface for high-level user access control functions.
user_mgmt
Package user_mgmt manages users and groups.
Package user_mgmt manages users and groups.
user_mgmt/user_groups
Package user_groups handles user management functions related to groups.
Package user_groups handles user management functions related to groups.
user_mgmt/user_keys
Package user_keys handles user management functions related to user keys.
Package user_keys handles user management functions related to user keys.
utils
Package utils contains convenience, helper, and utility functions.
Package utils contains convenience, helper, and utility functions.

Jump to

Keyboard shortcuts

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