client

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2025 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AffiliationOpt

type AffiliationOpt func(values *url.Values) error

func WithForce

func WithForce() AffiliationOpt

type CertificateListOpt

type CertificateListOpt func(values *url.Values) error

func WithEnrollId

func WithEnrollId(enrollId string) CertificateListOpt

type Client

type Client interface {
	// CAInfo Getting information about CA
	CAInfo(ctx context.Context) (*response.CAInfo, error)

	Register(ctx context.Context, req request.Registration) (string, error)
	Enroll(ctx context.Context, name, secret string, req *x509.CertificateRequest, opts ...EnrollOpt) (
		*x509.Certificate, interface{}, error)
	Revoke(ctx context.Context, req request.RevocationRequest) (*pkix.CertificateList, error)
	IdentityList(ctx context.Context) ([]entity.Identity, error)
	IdentityGet(ctx context.Context, enrollId string) (*entity.Identity, error)
	CertificateList(ctx context.Context, opts ...CertificateListOpt) ([]*x509.Certificate, error)
	// AffiliationList lists all affiliations and identities of identity affiliation
	AffiliationList(ctx context.Context, rootAffiliation ...string) ([]entity.Identity, []entity.Affiliation, error)
	AffiliationCreate(ctx context.Context, name string, opts ...AffiliationOpt) error
	AffiliationDelete(ctx context.Context, name string, opts ...AffiliationOpt) ([]entity.Identity, []entity.Affiliation, error)
}

func NewHttp

func NewHttp(opts ...HttpOpt) (Client, error)

type EnrollOpt

type EnrollOpt func(opts *EnrollOpts) error

func WithEnrollPrivateKey

func WithEnrollPrivateKey(privateKey interface{}) EnrollOpt

WithEnrollPrivateKey allows to use previously created private key

func WithEnrollProfile

func WithEnrollProfile(profile EnrollProfile) EnrollOpt

WithEnrollProfile allows to require profile of enrolled certificate

type EnrollOpts

type EnrollOpts struct {
	PrivateKey interface{}
	Profile    EnrollProfile
}

type EnrollProfile

type EnrollProfile string
const (
	// EnrollProfileDefault asks Fabric CA for certificate used for signing
	EnrollProfileDefault EnrollProfile = ""
	// EnrollProfileTls asks Fabric CA for certificate used for TLS communication
	EnrollProfileTls EnrollProfile = "tls"
)

type ErrUnexpectedHTTPStatus

type ErrUnexpectedHTTPStatus struct {
	Status int
	Body   []byte
}

func (ErrUnexpectedHTTPStatus) Error

func (err ErrUnexpectedHTTPStatus) Error() string

type HttpOpt

type HttpOpt func(c *httpClient) error

func WithBytesConfig

func WithBytesConfig(configBytes []byte) HttpOpt

func WithHTTPClient

func WithHTTPClient(client *http.Client) HttpOpt

func WithIdentity

func WithIdentity(signer crypto.Signer) HttpOpt

func WithRawConfig

func WithRawConfig(conf *config.CAConfig) HttpOpt

func WithYamlConfig

func WithYamlConfig(path string) HttpOpt

WithYamlConfig allows using YAML config from file

type ResponseError

type ResponseError struct {
	Errors   []response.Message
	Messages []response.Message
}

func (ResponseError) Error

func (err ResponseError) Error() string

Jump to

Keyboard shortcuts

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