Documentation ¶
Index ¶
- func GetMSPKeyfile(homeDir string) (string, error)
- func Init(conf *config.Config, lgr *zap.Logger) error
- func RegisterAndEnrollUser(regReq api.RegistrationRequest) (*lib.Identity, error)
- func SubmitTransaction(ctx context.Context, channelID, chaincodeID, fn string, args ...string) ([]byte, error)
- type CAClient
- type GWClient
- type MSPKeyCert
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetMSPKeyfile ¶
GetMSPKeyfile finds the first key file in the keystore directory within the specified home directory.
func RegisterAndEnrollUser ¶
func RegisterAndEnrollUser(regReq api.RegistrationRequest) (*lib.Identity, error)
RegisterAndEnrollUser registers and enrolls a new user using the provided admin identity. It creates a user directory, initializes CA clients for the admin and the new user, enrolls the admin, registers the new user, and then enrolls the new user.
func SubmitTransaction ¶
func SubmitTransaction(ctx context.Context, channelID, chaincodeID, fn string, args ...string) ([]byte, error)
SubmitTransaction submits a transaction to the Fabric network. It retrieves user information from the context, creates a gateway client using the user's credentials, and submits the transaction to the specified channel and chaincode.
Types ¶
type CAClient ¶
type CAClient struct {
// contains filtered or unexported fields
}
CAClient wraps the Fabric CA client with additional functionality.
func NewCAClient ¶
NewCAClient initializes and returns a new Fabric CA client using configuration from the config package
func (*CAClient) Enroll ¶
Enroll performs the enrollment process for a user or administrator. It takes an api.EnrollmentRequest and returns the resulting lib.Identity or an error.
func (*CAClient) EnrollAdmin ¶
EnrollAdmin enrolls the admin user and returns the admin identity. If an admin identity is already loaded, it is returned directly. Otherwise, it attempts to enroll the admin using credentials from environment variables or provided arguments.
type GWClient ¶
GWClient wraps the Fabric Gateway client.
func NewGatewayClient ¶
NewGatewayClient creates a new Fabric Gateway client. It establishes a gRPC connection to the Fabric peer, creates user identity and signing objects, and returns a GWClient instance for interacting with the Fabric network.
type MSPKeyCert ¶
MSPKeyCert holds the certificate and key for a user's Membership Service Provider (MSP).
func LoadMSPKeyCert ¶
func LoadMSPKeyCert(homeDir string) (*MSPKeyCert, error)
LoadMSPKeyCert loads the key and certificate from the user's directory.