registry

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2020 License: AGPL-3.0 Imports: 18 Imported by: 0

README

Registry API

The Registry API allows organizations to register new users into its database, the registration can be done by a generated token (the user can exists or not) or by just adding the user directly without any token validation. It also allows to fetch the current registration status of each user.

Available by default under /registry

Methods

register
  • Request:
{
  "id": "req-12345678",
  "request": {
    "method": "register",
    "entityId": "0x12345",
    "memberInfo": {
        "dateOfBirth": "1990-09-03",
        "email": "info@vocdoni.io",
        "firstName": "vocdoni",
        "lastName": "vocdoni",
        "phone": "+3674574221",
        "streetAddress": "Road av.",
        "origin": "Token",
        "customFields": {}
    }
    "timestamp": 1234567890
  },
  "signature": "0x12345"
}
  • Response:
{
  "response": {
    "ok": true,
    "request": "req-12345678",  
    "timestamp": 1556110671
  },
  "id": "req-12345678",
  "signature": "0x123456"
}
validate token
  • Request

The automated tag called "PendingValidation" is removed (if exists) from the member.

{
  "id": "req-12345678",
  "request": {
    "method": "validateToken",
    "entityId": "0x12345",
    "token": "xxx-yyy-zzz" 
    "timestamp": 1234567890
  },
  "signature": "0x12345"
}
  • Response:
{
  "response": {
    "ok": true,
    "request": "req-12345678",  
    "timestamp": 1556110671
  },
  "id": "req-12345678",
  "signature": "0x123456"
}
registration status
  • Request
{
  "id": "req-12345678",
  "request": {
    "method": "registrationStatus",
    "entityId": "0x12345",
    "timestamp": 1234567890
  },
  "signature": "0x12345"
}
  • Response:
{
  "response": {
    "ok": true,
    "request": "req-12345678",  
    "status": {
        "registered": true,
        "needsUpdate": false
    }
    "timestamp": 1556110671
  },
  "id": "req-12345678",
  "signature": "0x123456"
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// RegistryRequests ...
	RegistryRequests = prometheus.NewCounterVec(prometheus.CounterOpts{
		Namespace: "registry",
		Name:      "requests",
		Help:      "The number of registry requests",
	}, []string{"method"})
)

Registry collectors

Functions

This section is empty.

Types

type Registry

type Registry struct {
	Router *router.Router
	// contains filtered or unexported fields
}

func NewRegistry

func NewRegistry(r *router.Router, d database.Database, ma *metrics.Agent) *Registry

NewRegistry creates a new registry handler for the Router

func (*Registry) RegisterMethods

func (r *Registry) RegisterMethods(path string) error

RegisterMethods registers all registry methods behind the given path

Jump to

Keyboard shortcuts

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