Documentation ¶
Index ¶
- func NewExtractor() *extractor
- func NewIdentityManager(keystore Keystore) *identityManager
- func NewIdentityManagerFake(existingIdentities []Identity, newIdentity Identity) *idmFake
- func NewKeystoreFilesystem(directory string) *keystore.KeyStore
- func NewVerifierIdentity(peerID Identity) *verifierIdentity
- func NewVerifierSigned() *verifierSigned
- type Extractor
- type Identity
- type IdentityCache
- type IdentityCacheInterface
- type Keystore
- type Manager
- type Signature
- type Signer
- type SignerFactory
- type SignerFake
- type Verifier
- type VerifierFake
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewIdentityManager ¶
func NewIdentityManager(keystore Keystore) *identityManager
NewIdentityManager creates and returns new identityManager
func NewIdentityManagerFake ¶
func NewKeystoreFilesystem ¶
NewKeystoreFilesystem create new keystore, which keeps keys in filesystem
func NewVerifierIdentity ¶
func NewVerifierIdentity(peerID Identity) *verifierIdentity
NewVerifierIdentity constructs Verifier which:
- checks signature's sanity
- checks if message was unchanged by middleman
- checks if message is from exact identity
func NewVerifierSigned ¶
func NewVerifierSigned() *verifierSigned
NewVerifierSigned constructs Verifier which:
- checks signature's sanity
- checks if message was unchanged by middleman
Types ¶
type Identity ¶
type Identity struct {
Address string `json:"address"`
}
Identity represents unique user network identity
func FromAddress ¶
FromAddress converts address to identity
type IdentityCache ¶
type IdentityCache struct {
File string
}
IdentityCache saves identity to file
func (*IdentityCache) GetIdentity ¶
func (ic *IdentityCache) GetIdentity() (identity Identity, err error)
GetIdentity retrieves identity from cache
func (*IdentityCache) StoreIdentity ¶
func (ic *IdentityCache) StoreIdentity(identity Identity) error
StoreIdentity stores identity to cache
type IdentityCacheInterface ¶
type IdentityCacheInterface interface { GetIdentity() (identity Identity, err error) StoreIdentity(identity Identity) error }
IdentityCacheInterface allows caching single identity
func NewIdentityCache ¶
func NewIdentityCache(dir string, jsonFile string) IdentityCacheInterface
NewIdentityCache creates and returns identityCache
func NewIdentityCacheFake ¶
func NewIdentityCacheFake() IdentityCacheInterface
NewIdentityCacheFake creates and returns fake identity cache
type Keystore ¶
type Keystore interface { Accounts() []accounts.Account NewAccount(passphrase string) (accounts.Account, error) Find(a accounts.Account) (accounts.Account, error) Unlock(a accounts.Account, passphrase string) error SignHash(a accounts.Account, hash []byte) ([]byte, error) }
Keystore allows actions with accounts (listing, creating, unlocking, signing)
type Signature ¶
type Signature struct {
// contains filtered or unexported fields
}
Signature structure
func SignatureBase64 ¶
SignatureBase64 decodes base64 string signature into Signature
func SignatureBytes ¶
SignatureBytes constructs Signature structure instance from bytes
func SignatureHex ¶
SignatureHex returns Signature struct from hex string
type SignerFactory ¶
SignerFactory callback returning Signer
type SignerFake ¶
type SignerFake struct {
ErrorMock error
}
type VerifierFake ¶
type VerifierFake struct{}