Documentation
¶
Overview ¶
* Nuts registry * Copyright (C) 2020. Nuts community * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. *
* Nuts registry * Copyright (C) 2020. Nuts community * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. *
* Nuts registry * Copyright (C) 2020. Nuts community * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. *
Index ¶
- Constants
- Variables
- type Registry
- func (r *Registry) Configure() error
- func (r *Registry) Diagnostics() []core.DiagnosticResult
- func (r *Registry) EndpointsByOrganizationAndType(organizationIdentifier core.PartyID, endpointType *string) ([]db.Endpoint, error)
- func (r *Registry) Load() error
- func (r *Registry) OrganizationById(id core.PartyID) (*db.Organization, error)
- func (r *Registry) RefreshOrganizationCertificate(organizationID core.PartyID) (events.Event, error)
- func (r *Registry) RegisterEndpoint(organizationID core.PartyID, id string, url string, endpointType string, ...) (events.Event, error)
- func (r *Registry) RegisterVendor(certificate *x509.Certificate) (events.Event, error)
- func (r *Registry) ReverseLookup(name string) (*db.Organization, error)
- func (r *Registry) SearchOrganizations(query string) ([]db.Organization, error)
- func (r *Registry) Shutdown() error
- func (r *Registry) Start() error
- func (r *Registry) VendorById(id core.PartyID) (*db.Vendor, error)
- func (r *Registry) VendorCAs() [][]*x509.Certificate
- func (r *Registry) VendorClaim(orgID core.PartyID, orgName string, orgKeys []interface{}) (events.Event, error)
- func (r *Registry) Verify(fix bool) ([]events.Event, bool, error)
- type RegistryClient
- type RegistryConfig
Constants ¶
const ConfAddress = "address"
ConfAddress is the config name for the http server/client address
const ConfClientTimeout = "clientTimeout"
ConfClientTimeout is the time-out for the client in seconds (e.g. when using the CLI).
const ConfDataDir = "datadir"
ConfDataDir is the config name for specifiying the data location of the requiredFiles
const ConfMode = "mode"
ConfMode is the config name for the engine mode, server or client
const ConfOrganisationCertificateValidity = "organisationCertificateValidity"
ConfOrganisationCertificateValidity is the config name for the number of days organisation certificates are valid
const ConfSyncAddress = "syncAddress"
ConfSyncAddress is the config name for the remote address used to fetch updated registry files
const ConfSyncInterval = "syncInterval"
ConfSyncInterval is the config name for the interval in minutes to look for new registry files online
const ConfSyncMode = "syncMode"
ConfSyncMode is the config name for the used SyncMode
const ConfVendorCACertificateValidity = "vendorCACertificateValidity"
ConfVendorCACertificateValidity is the config name for the number of days vendor CA certificates are valid
const ModuleName = "Registry"
ModuleName == Registry
Variables ¶
var ErrCertificateIssue = errors.New("unable to issue certificate")
ErrCertificateIssue indicates a certificate couldn't be issued
var ErrJWKConstruction = errors.New("unable to construct JWK")
ErrJWKConstruction indicates that a JWK couldn't be constructed
var ErrOrganizationNotFound = errors.New("organization not found")
ErrOrganizationNotFound is returned when the specified organization was not found
var ErrVendorNotFound = errors.New("vendor not found")
ErrVendorNotFound is returned when a vendor is not found based on its ID
var ReloadRegistryIdleTimeout time.Duration
ReloadRegistryIdleTimeout defines the cooling down period after receiving a file watcher notification, before the registry is reloaded (from disk).
Functions ¶
This section is empty.
Types ¶
type Registry ¶
type Registry struct {
Config RegistryConfig
Db db.Db
EventSystem events.EventSystem
OnChange func(registry *Registry)
// contains filtered or unexported fields
}
Registry holds the config and Db reference
func NewRegistryInstance ¶ added in v0.15.0
func NewRegistryInstance(config RegistryConfig, cryptoClient crypto.Client, networkClient pkg.NetworkClient) *Registry
func NewTestRegistryInstance ¶ added in v0.15.0
func RegistryInstance ¶
func RegistryInstance() *Registry
RegistryInstance returns the singleton Registry
func (*Registry) Diagnostics ¶ added in v0.15.0
func (r *Registry) Diagnostics() []core.DiagnosticResult
func (*Registry) EndpointsByOrganizationAndType ¶
func (r *Registry) EndpointsByOrganizationAndType(organizationIdentifier core.PartyID, endpointType *string) ([]db.Endpoint, error)
EndpointsByOrganization is a wrapper for sam func on DB
func (*Registry) Load ¶
Load signals the Db to (re)load sources. On success the OnChange func is called
func (*Registry) OrganizationById ¶
OrganizationById is a wrapper for sam func on DB
func (*Registry) RefreshOrganizationCertificate ¶ added in v0.14.0
func (*Registry) RegisterEndpoint ¶
func (r *Registry) RegisterEndpoint(organizationID core.PartyID, id string, url string, endpointType string, status string, properties map[string]string) (events.Event, error)
RegisterEndpoint registers an endpoint for an organization
func (*Registry) RegisterVendor ¶
RegisterVendor registers a vendor
func (*Registry) ReverseLookup ¶
func (r *Registry) ReverseLookup(name string) (*db.Organization, error)
func (*Registry) SearchOrganizations ¶
func (r *Registry) SearchOrganizations(query string) ([]db.Organization, error)
SearchOrganizations is a wrapper for sam func on DB
func (*Registry) VendorById ¶ added in v0.15.1
func (*Registry) VendorCAs ¶ added in v0.15.0
func (r *Registry) VendorCAs() [][]*x509.Certificate
func (*Registry) VendorClaim ¶
func (r *Registry) VendorClaim(orgID core.PartyID, orgName string, orgKeys []interface{}) (events.Event, error)
VendorClaim registers an organization under a vendor. The specified vendor has to exist and have a valid CA certificate as to issue the organisation certificate. If specified orgKeys are interpreted as the organization's keys in JWK format. If not specified, a new key pair is generated.
type RegistryClient ¶
type RegistryClient interface {
// EndpointsByOrganization returns all registered endpoints for an organization
EndpointsByOrganizationAndType(organizationIdentifier core.PartyID, endpointType *string) ([]db.Endpoint, error)
// SearchOrganizations searches the registry for any Organization matching the given query
SearchOrganizations(query string) ([]db.Organization, error)
// OrganizationById returns an Organization given the Id or an error if it doesn't exist
OrganizationById(id core.PartyID) (*db.Organization, error)
// ReverseLookup finds an exact match on name or returns an error if not found
ReverseLookup(name string) (*db.Organization, error)
// RegisterEndpoint registers an endpoint for an organization
RegisterEndpoint(organizationID core.PartyID, id string, url string, endpointType string, status string, properties map[string]string) (events.Event, error)
// VendorClaim registers an organization under a vendor. orgKeys are the organization's keys in JWK format
VendorClaim(orgID core.PartyID, orgName string, orgKeys []interface{}) (events.Event, error)
// RegisterVendor registers a vendor with the given id, name for the specified domain. If the vendor with this ID
// already exists, it functions as an update.
RegisterVendor(certificate *x509.Certificate) (events.Event, error)
// RefreshOrganizationCertificate issues a new certificate for the organization. The organization must be registered under the current vendor.
// If successful it returns the resulting event.
RefreshOrganizationCertificate(organizationID core.PartyID) (events.Event, error)
// Verify verifies the data in the registry owned by this node.
// If fix=true, data will be fixed/upgraded when necessary (e.g. issue certificates). Events resulting from fixing the data are returned.
// If the returned bool=true there's data to be fixed and Verify should be run with fix=true.
Verify(fix bool) ([]events.Event, bool, error)
// VendorCAs returns all registered vendors as list of chains, PEM encoded. The first entry in a chain will be the leaf and the last one the root.
VendorCAs() [][]*x509.Certificate
// VendorById finds a vendor by its ID. When not found it returns an ErrVendorNotFound error and a nil result.
VendorById(vID core.PartyID) (*db.Vendor, error)
}
RegistryClient is the interface to be implemented by any remote or local client
type RegistryConfig ¶
type RegistryConfig struct {
Mode string
SyncMode string
SyncAddress string
SyncInterval int
Datadir string
Address string
VendorCACertificateValidity int
OrganisationCertificateValidity int
ClientTimeout int
}
RegistryConfig holds the config
func DefaultRegistryConfig ¶ added in v0.14.1
func DefaultRegistryConfig() RegistryConfig
func TestRegistryConfig ¶ added in v0.15.0
func TestRegistryConfig(testDirectory string) RegistryConfig
Directories
¶
| Path | Synopsis |
|---|---|
|
* Nuts registry * Copyright (C) 2020.
|
* Nuts registry * Copyright (C) 2020. |
|
* Nuts registry * Copyright (C) 2020.
|
* Nuts registry * Copyright (C) 2020. |
|
domain
* Nuts registry * Copyright (C) 2020.
|
* Nuts registry * Copyright (C) 2020. |
|
* Nuts registry * Copyright (C) 2020.
|
* Nuts registry * Copyright (C) 2020. |
|
nextgen
|
|
|
* Nuts registry * Copyright (C) 2020.
|
* Nuts registry * Copyright (C) 2020. |