registry

package
v0.0.0-...-be0919c Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2018 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddIdentityRegistrationEndpoint

func AddIdentityRegistrationEndpoint(router *httprouter.Router, dataProvider RegistrationDataProvider, statusProvider IdentityRegistry)

AddIdentityRegistrationEndpoint adds identity registration data endpoint to given http router

func NewIdentityRegistryContract

func NewIdentityRegistryContract(contractBackend bind.ContractBackend, registryAddress common.Address) (*contractRegistry, error)

NewIdentityRegistryContract creates identity registry service which uses blockchain for information

func NewRegistrationDataProvider

func NewRegistrationDataProvider(ks *keystore.KeyStore) *keystoreRegistrationDataProvider

NewRegistrationDataProvider creates registration data provider backed up by identity which is managed by keystore

func PrintRegistrationData

func PrintRegistrationData(data *registry.RegistrationData)

PrintRegistrationData prints identity registration data needed to register identity with payments contract

Types

type FakeRegistrationDataProvider

type FakeRegistrationDataProvider struct {
}

FakeRegistrationDataProvider fake registration data provider

func (*FakeRegistrationDataProvider) ProvideRegistrationData

func (m *FakeRegistrationDataProvider) ProvideRegistrationData(id identity.Identity) (*registry.RegistrationData, error)

ProvideRegistrationData provides fake registration data

type FakeRegistry

type FakeRegistry struct {
	RegistrationEventExists bool
	Registered              bool
}

FakeRegistry fake register

func (*FakeRegistry) IsRegistered

func (registry *FakeRegistry) IsRegistered(id identity.Identity) (bool, error)

IsRegistered returns fake identity registration status within payments contract

func (*FakeRegistry) SubscribeToRegistrationEvent

func (registry *FakeRegistry) SubscribeToRegistrationEvent(id identity.Identity) (
	registrationEvent chan RegistrationEvent,
	unsubscribe func(),
)

SubscribeToRegistrationEvent returns fake registration event if given providerAddress was registered within payments contract

type IdentityRegistry

type IdentityRegistry interface {
	IsRegistered(identity.Identity) (bool, error)
	SubscribeToRegistrationEvent(identity.Identity) (registeredEvent chan RegistrationEvent, unsubscribe func())
}

IdentityRegistry enables identity registration actions

type PublicKeyPartsDTO

type PublicKeyPartsDTO struct {
	// First 32 bytes of public key in hex representation
	// example: "0x1321313212312..."
	Part1 string `json:"part1"`
	// Last 32 bytes of public key inx hex representation
	// example: "0x1321313212312..."
	Part2 string `json:"part2"`
}

PublicKeyPartsDTO represents ECDSA public key with first byte stripped (0x04) and splitted into two 32 bytes size arrays

swagger:model PublicKeyPartsDTO

type RegistrationDataDTO

type RegistrationDataDTO struct {
	// Returns true if identity is registered in payments smart contract
	Registered bool `json:"registered"`

	PublicKey PublicKeyPartsDTO `json:"publicKey"`

	Signature SignatureDTO `json:"signature"`
}

RegistrationDataDTO represents registration status and needed data for registering of given identity

swagger:model RegistrationDataDTO

type RegistrationDataProvider

type RegistrationDataProvider interface {
	ProvideRegistrationData(identity.Identity) (*registry.RegistrationData, error)
}

RegistrationDataProvider provides registration information for given identity required to register it on blockchain

type RegistrationEvent

type RegistrationEvent int

RegistrationEvent describes registration events

const (
	Registered RegistrationEvent = 0
	Cancelled  RegistrationEvent = 1
)

Possible registration events

type SignatureDTO

type SignatureDTO struct {
	// S part of signature
	// example: "0x1321313212312..."
	R string `json:"r"`
	// R part of signature
	// example: "0x1234563564354..."
	S string `json:"s"`
	// Sign - 27 or 28 as expected by ethereum ecrecover function
	// example: 27
	V uint8 `json:"v"`
}

SignatureDTO represents Elliptic Curve signature parts

swagger:model DecomposedSignatureDTO

Jump to

Keyboard shortcuts

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