Documentation ¶
Index ¶
- Constants
- func MarshallRawOwner(o *RawOwner) (view.Identity, error)
- type DeserializeVerifierProvider
- type Deserializer
- type EnrollmentIDUnmarshaler
- type Info
- type KVS
- type Provider
- func (p *Provider) AddDeserializer(d Deserializer)
- func (p *Provider) Bind(id view.Identity, to view.Identity) error
- func (p *Provider) GetAuditInfo(identity view.Identity) ([]byte, error)
- func (p *Provider) GetEnrollmentID(auditInfo []byte) (string, error)
- func (p *Provider) GetIdentityInfo(role driver.IdentityRole, id string) (driver.IdentityInfo, error)
- func (p *Provider) GetSigner(identity view.Identity) (driver.Signer, error)
- func (p *Provider) IsMe(identity view.Identity) bool
- func (p *Provider) LookupIdentifier(role driver.IdentityRole, v interface{}) (view.Identity, string, error)
- func (p *Provider) RegisterAuditInfo(id view.Identity, auditInfo []byte) error
- func (p *Provider) RegisterIssuerWallet(id string, path string) error
- func (p *Provider) RegisterOwnerWallet(id string, path string) error
- func (p *Provider) RegisterRecipientIdentity(id view.Identity) error
- func (p *Provider) RegisterSigner(identity view.Identity, signer driver.Signer, verifier driver.Verifier) error
- type RawOwner
- type RawOwnerIdentityDeserializer
- func (deserializer *RawOwnerIdentityDeserializer) DeserializeSigner(raw []byte) (driver.Signer, error)
- func (deserializer *RawOwnerIdentityDeserializer) DeserializeVerifier(id view.Identity) (driver.Verifier, error)
- func (deserializer *RawOwnerIdentityDeserializer) Info(raw []byte, auditInfo []byte) (string, error)
- type Wallet
- type WalletEntry
- type Wallets
- type WalletsRegistry
- func (r *WalletsRegistry) ContainsIdentity(identity view.Identity, wID string) bool
- func (r *WalletsRegistry) GetWallet(identity view.Identity) (string, error)
- func (r *WalletsRegistry) Lookup(id interface{}) (driver.Wallet, driver.IdentityInfo, string, error)
- func (r *WalletsRegistry) RegisterIdentity(identity view.Identity, wID string) error
- func (r *WalletsRegistry) RegisterWallet(id string, w driver.Wallet)
Constants ¶
const (
SerializedIdentityType = "si"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Deserializer ¶
type Deserializer interface { // DeserializeSigner deserializes a signer from its bytes representation DeserializeSigner(raw []byte) (driver.Signer, error) }
Deserializer is an interface for deserializing identities
type EnrollmentIDUnmarshaler ¶
type EnrollmentIDUnmarshaler interface { // GetEnrollmentID returns the enrollment ID from the audit info GetEnrollmentID(auditInfo []byte) (string, error) }
EnrollmentIDUnmarshaler decodes an enrollment ID form an audit info
type Info ¶
type Info struct { driver.IdentityInfo Provider *Provider }
Info wraps a driver.IdentityInfo to further register the audit info, and binds the new identity to the default FSC node identity
func (*Info) EnrollmentID ¶
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider implements the driver.IdentityProvider interface
func NewProvider ¶
func NewProvider(sp view2.ServiceProvider, enrollmentIDUnmarshaler EnrollmentIDUnmarshaler, wallets Wallets) *Provider
NewProvider creates a new identity provider
func (*Provider) AddDeserializer ¶
func (p *Provider) AddDeserializer(d Deserializer)
func (*Provider) GetAuditInfo ¶
func (*Provider) GetEnrollmentID ¶
func (*Provider) GetIdentityInfo ¶
func (p *Provider) GetIdentityInfo(role driver.IdentityRole, id string) (driver.IdentityInfo, error)
func (*Provider) LookupIdentifier ¶
func (*Provider) RegisterAuditInfo ¶
func (*Provider) RegisterIssuerWallet ¶
func (*Provider) RegisterOwnerWallet ¶
func (*Provider) RegisterRecipientIdentity ¶
type RawOwner ¶
type RawOwner struct { // Type encodes the type of the owner (currently it can only be a SerializedIdentity) Type string `protobuf:"bytes,1,opt,name=type,json=type,proto3" json:"type,omitempty"` // Identity encodes the identity Identity []byte `protobuf:"bytes,2,opt,name=identity,proto3" json:"identity,omitempty"` }
RawOwner encodes an owner of an identity
type RawOwnerIdentityDeserializer ¶
type RawOwnerIdentityDeserializer struct {
DeserializeVerifierProvider
}
RawOwnerIdentityDeserializer takes as MSP identity and returns an ECDSA verifier
func NewRawOwnerIdentityDeserializer ¶
func NewRawOwnerIdentityDeserializer(dvp DeserializeVerifierProvider) *RawOwnerIdentityDeserializer
func (*RawOwnerIdentityDeserializer) DeserializeSigner ¶
func (deserializer *RawOwnerIdentityDeserializer) DeserializeSigner(raw []byte) (driver.Signer, error)
func (*RawOwnerIdentityDeserializer) DeserializeVerifier ¶
type Wallet ¶
type Wallet interface { // MapToID returns the identity for the given argument MapToID(v interface{}) (view.Identity, string, error) // GetIdentityInfo returns the identity information for the given identity identifier GetIdentityInfo(id string) driver.IdentityInfo // RegisterIdentity registers the given identity RegisterIdentity(id string, path string) error }
Wallet helps to find identity identifiers and retrieve the corresponding identities
type WalletEntry ¶
type Wallets ¶
type Wallets map[driver.IdentityRole]Wallet
Wallets is a map of Wallet, one for each identity role
type WalletsRegistry ¶
type WalletsRegistry struct { ID token.TMSID IdentityProvider driver.IdentityProvider IdentityRole driver.IdentityRole KVS KVS sync.RWMutex Wallets map[string]*WalletEntry }
func NewWalletsRegistry ¶
func NewWalletsRegistry(id token.TMSID, identityProvider driver.IdentityProvider, identityRole driver.IdentityRole, KVS KVS) *WalletsRegistry
NewWalletsRegistry returns a new wallets registry for the passed parameters
func (*WalletsRegistry) ContainsIdentity ¶
func (r *WalletsRegistry) ContainsIdentity(identity view.Identity, wID string) bool
ContainsIdentity returns true if the passed identity belongs to the passed wallet, false otherwise
func (*WalletsRegistry) GetWallet ¶
func (r *WalletsRegistry) GetWallet(identity view.Identity) (string, error)
GetWallet returns the wallet identifier bound to the passed identity
func (*WalletsRegistry) Lookup ¶
func (r *WalletsRegistry) Lookup(id interface{}) (driver.Wallet, driver.IdentityInfo, string, error)
Lookup searches the wallet corresponding to the passed id. If a wallet is found, Lookup returns the wallet and its identifier. If no wallet is found, Lookup returns the identity info and a potential wallet identifier for the passed id. The identity info can be nil meaning that nothing has been found bound to the passed identifier
func (*WalletsRegistry) RegisterIdentity ¶
func (r *WalletsRegistry) RegisterIdentity(identity view.Identity, wID string) error
RegisterIdentity binds the passed identity to the passed wallet identifier
func (*WalletsRegistry) RegisterWallet ¶
func (r *WalletsRegistry) RegisterWallet(id string, w driver.Wallet)
RegisterWallet binds the passed wallet to the passed id