msp

package
v1.0.0-alpha3 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUserNotFound indicates the user was not found
	ErrUserNotFound = errors.New("user not found")
)

Functions

This section is empty.

Types

type Attribute

type Attribute struct {
	Name  string
	Key   string
	Value string
}

Attribute defines additional attributes that may be passed along during registration

type AttributeRequest

type AttributeRequest struct {
	Name     string
	Optional bool
}

AttributeRequest is a request for an attribute.

type Client

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

Client enables access to Client services

func New

func New(clientProvider context.ClientProvider, opts ...ClientOption) (*Client, error)

New creates a new Client instance

func (*Client) Enroll

func (c *Client) Enroll(enrollmentID string, opts ...EnrollmentOption) error

Enroll enrolls a registered user in order to receive a signed X509 certificate. A new key pair is generated for the user. The private key and the enrollment certificate issued by the CA are stored in SDK stores. They can be retrieved by calling IdentityManager.GetSigningIdentity().

enrollmentID enrollment ID of a registered user opts represent enrollment options

func (*Client) GetSigningIdentity

func (c *Client) GetSigningIdentity(id string) (mspctx.SigningIdentity, error)

GetSigningIdentity returns signing identity for id

func (*Client) Reenroll

func (c *Client) Reenroll(enrollmentID string) error

Reenroll reenrolls an enrolled user in order to obtain a new signed X509 certificate

func (*Client) Register

func (c *Client) Register(request *RegistrationRequest) (string, error)

Register registers a User with the Fabric CA request: Registration Request Returns Enrolment Secret

func (*Client) Revoke

func (c *Client) Revoke(request *RevocationRequest) (*RevocationResponse, error)

Revoke revokes a User with the Fabric CA request: Revocation Request

type ClientOption

type ClientOption func(*Client) error

ClientOption describes a functional parameter for the New constructor

func WithOrg

func WithOrg(orgName string) ClientOption

WithOrg option

type EnrollmentOption

type EnrollmentOption func(*enrollmentOptions) error

EnrollmentOption describes a functional parameter for Enroll

func WithSecret

func WithSecret(secret string) EnrollmentOption

WithSecret enrollment option

type IdentityManager

type IdentityManager interface {
	GetSigningIdentity(name string) (msp.SigningIdentity, error)
}

IdentityManager provides management of identities in a Fabric network

type RegistrationRequest

type RegistrationRequest struct {
	// Name is the unique name of the identity
	Name string
	// Type of identity being registered (e.g. "peer, app, user")
	Type string
	// MaxEnrollments is the number of times the secret can  be reused to enroll.
	// if omitted, this defaults to max_enrollments configured on the server
	MaxEnrollments int
	// The identity's affiliation e.g. org1.department1
	Affiliation string
	// Optional attributes associated with this identity
	Attributes []Attribute
	// CAName is the name of the CA to connect to
	CAName string
	// Secret is an optional password.  If not specified,
	// a random secret is generated.  In both cases, the secret
	// is returned from registration.
	Secret string
}

RegistrationRequest defines the attributes required to register a user with the CA

type RevocationRequest

type RevocationRequest struct {
	// Name of the identity whose certificates should be revoked
	// If this field is omitted, then Serial and AKI must be specified.
	Name string
	// Serial number of the certificate to be revoked
	// If this is omitted, then Name must be specified
	Serial string
	// AKI (Authority Key Identifier) of the certificate to be revoked
	AKI string
	// Reason is the reason for revocation. See https://godoc.org/golang.org/x/crypto/ocsp
	// for valid values. The default value is 0 (ocsp.Unspecified).
	Reason string
	// CAName is the name of the CA to connect to
	CAName string
}

RevocationRequest defines the attributes required to revoke credentials with the CA

type RevocationResponse

type RevocationResponse struct {
	// RevokedCerts is an array of certificates that were revoked
	RevokedCerts []RevokedCert
	// CRL is PEM-encoded certificate revocation list (CRL) that contains all unexpired revoked certificates
	CRL []byte
}

RevocationResponse represents response from the server for a revocation request

type RevokedCert

type RevokedCert struct {
	// Serial number of the revoked certificate
	Serial string
	// AKI of the revoked certificate
	AKI string
}

RevokedCert represents a revoked certificate

Jump to

Keyboard shortcuts

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