Documentation ¶
Overview ¶
Package identityprovider defines a default identity provider for IPFS Log and OrbitDB.
Index ¶
- func AddIdentityProvider(identityProvider func(*CreateIdentityOptions) Interface) error
- func IsSupported(typeName string) bool
- func RemoveIdentityProvider(name string)
- type CreateIdentityOptions
- type Identities
- func (i *Identities) CreateIdentity(ctx context.Context, options *CreateIdentityOptions) (*Identity, error)
- func (i *Identities) Sign(ctx context.Context, identity *Identity, data []byte) ([]byte, error)
- func (i *Identities) Verify(signature []byte, publicKey crypto.PubKey, data []byte) (bool, error)
- func (i *Identities) VerifyIdentity(identity *Identity) error
- type Identity
- type IdentitySignature
- type Interface
- type P2PDBIdentityProvider
- func (p *P2PDBIdentityProvider) GetID(ctx context.Context, options *CreateIdentityOptions) (string, error)
- func (*P2PDBIdentityProvider) GetType() string
- func (p *P2PDBIdentityProvider) Sign(ctx context.Context, identity *Identity, data []byte) ([]byte, error)
- func (p *P2PDBIdentityProvider) SignIdentity(ctx context.Context, data []byte, id string) ([]byte, error)
- func (p *P2PDBIdentityProvider) UnmarshalPublicKey(data []byte) (crypto.PubKey, error)
- func (p *P2PDBIdentityProvider) VerifyIdentity(identity *Identity) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddIdentityProvider ¶
func AddIdentityProvider(identityProvider func(*CreateIdentityOptions) Interface) error
AddIdentityProvider registers an new identity provider.
func IsSupported ¶
IsSupported checks if an identity type is supported.
func RemoveIdentityProvider ¶
func RemoveIdentityProvider(name string)
RemoveIdentityProvider unregisters an identity provider.
Types ¶
type CreateIdentityOptions ¶
type Identities ¶
type Identities struct {
// contains filtered or unexported fields
}
func (*Identities) CreateIdentity ¶
func (i *Identities) CreateIdentity(ctx context.Context, options *CreateIdentityOptions) (*Identity, error)
CreateIdentity creates a new Identity.
func (*Identities) VerifyIdentity ¶
func (i *Identities) VerifyIdentity(identity *Identity) error
VerifyIdentity checks an identity.
type Identity ¶
type Identity struct { ID string `json:"id,omitempty"` PublicKey []byte `json:"publicKey,omitempty"` Signatures *IdentitySignature `json:"signatures,omitempty"` Type string `json:"type,omitempty"` Provider Interface }
func CreateIdentity ¶
func CreateIdentity(ctx context.Context, options *CreateIdentityOptions) (*Identity, error)
CreateIdentity creates a new identity.
type IdentitySignature ¶
type Interface ¶
type Interface interface { // GetID returns id of identity (to be signed by orbit-db public key). GetID(context.Context, *CreateIdentityOptions) (string, error) // SignIdentity returns signature of OrbitDB public key signature. SignIdentity(ctx context.Context, data []byte, id string) ([]byte, error) // GetType returns the type for this identity provider. GetType() string // VerifyIdentity checks an identity. VerifyIdentity(identity *Identity) error // Sign will sign a value. Sign(ctx context.Context, identity *Identity, bytes []byte) ([]byte, error) // UnmarshalPublicKey will provide a crypto.PubKey from a key bytes. UnmarshalPublicKey(data []byte) (crypto.PubKey, error) }
func NewP2PDBIdentityProvider ¶
func NewP2PDBIdentityProvider(options *CreateIdentityOptions) Interface
NewOrbitDBIdentityProvider creates a new identity for use with OrbitDB.
type P2PDBIdentityProvider ¶
type P2PDBIdentityProvider struct {
// contains filtered or unexported fields
}
func (*P2PDBIdentityProvider) GetID ¶
func (p *P2PDBIdentityProvider) GetID(ctx context.Context, options *CreateIdentityOptions) (string, error)
GetID returns the identity's ID.
func (*P2PDBIdentityProvider) GetType ¶
func (*P2PDBIdentityProvider) GetType() string
GetType returns the current identity type.
func (*P2PDBIdentityProvider) Sign ¶
func (p *P2PDBIdentityProvider) Sign(ctx context.Context, identity *Identity, data []byte) ([]byte, error)
Sign signs a value using the current.
func (*P2PDBIdentityProvider) SignIdentity ¶
func (p *P2PDBIdentityProvider) SignIdentity(ctx context.Context, data []byte, id string) ([]byte, error)
SignIdentity signs an OrbitDB identity.
func (*P2PDBIdentityProvider) UnmarshalPublicKey ¶
func (p *P2PDBIdentityProvider) UnmarshalPublicKey(data []byte) (crypto.PubKey, error)
func (*P2PDBIdentityProvider) VerifyIdentity ¶
func (p *P2PDBIdentityProvider) VerifyIdentity(identity *Identity) error
VerifyIdentity checks an OrbitDB identity.
Click to show internal directories.
Click to hide internal directories.