Documentation ¶
Overview ¶
Package registry provides an interface to the Oasis off-chain registry of signed statements.
Index ¶
- Constants
- Variables
- type EntityMetadata
- func (e *EntityMetadata) Equal(other *EntityMetadata) bool
- func (e *EntityMetadata) Load(id signature.PublicKey, r io.Reader) error
- func (e *EntityMetadata) PrettyPrint(ctx context.Context, prefix string, w io.Writer)
- func (e EntityMetadata) PrettyType() (interface{}, error)
- func (e *EntityMetadata) ValidateBasic() error
- type GitConfig
- type MutableProvider
- type Provider
- type SignedEntityMetadata
Constants ¶
const ( // MaxStatementSize is the maximum encoded signed statement size in bytes. MaxStatementSize = 16 * 1024 // MaxEntityNameLength is the maximum length of the entity metadata's Name field. MaxEntityNameLength = 50 // MaxEntityURLLength is the maximum length of the entity metadata's URL field. MaxEntityURLLength = 64 // MaxEntityEmailLength is the maximum length of the entity metadata's Email field. MaxEntityEmailLength = 32 // MaxEntityKeybaseLength is the maximum length of the entity metadata's Keybase field. MaxEntityKeybaseLength = 32 // MaxEntityTwitterLength is the maximum length of the entity metadata's Twitter field. MaxEntityTwitterLength = 32 // MinSupportedVersion is the minimum supported entity metadata version. MinSupportedVersion = 1 // MaxSupportedVersion is the maximum supported entity metadata version. MaxSupportedVersion = 1 )
Variables ¶
var ( // ErrNoSuchEntity is the error returned where the requested entity cannot be found. ErrNoSuchEntity = errors.New("registry: no such entity") // ErrCorruptedRegistry is the error returned where the registry is corrupted (does not conform // to the specifications or contains data that fails signature verification). ErrCorruptedRegistry = errors.New("registry: corrupted registry") )
var ( // TwitterHandleRegexp is the regular expression used for validating the Twitter field. TwitterHandleRegexp = regexp.MustCompile(`^[A-Za-z0-9_]+$`) // KeybaseHandleRegexp is the regular expression used for validating the Keybase field. KeybaseHandleRegexp = regexp.MustCompile(`^[A-Za-z0-9_]+$`) )
var EntityMetadataSignatureContext = signature.NewContext("oasis-metadata-registry: entity")
EntityMetadataSignatureContext is the domain separation context used for entity metadata.
Functions ¶
This section is empty.
Types ¶
type EntityMetadata ¶
type EntityMetadata struct { cbor.Versioned // Serial is the serial number of the entity metadata statement. Serial uint64 `json:"serial"` // Name is the entity name. Name string `json:"name,omitempty"` // URL is an URL associated with an entity. URL string `json:"url,omitempty"` // Email is the entity's contact e-mail address. Email string `json:"email,omitempty"` // Keybase is the keybase.io handle. Keybase string `json:"keybase,omitempty"` // Twitter is the Twitter handle. Twitter string `json:"twitter,omitempty"` }
EntityMetadata contains metadata about an entity.
func (*EntityMetadata) Equal ¶
func (e *EntityMetadata) Equal(other *EntityMetadata) bool
Equal compares vs another entity metadata for equality.
func (*EntityMetadata) Load ¶
Load loads and verifies entity metadata from a given reader containing signed entity metadata.
func (*EntityMetadata) PrettyPrint ¶
PrettyPrint writes a pretty-printed representation of EntityMetadata to the given writer.
func (EntityMetadata) PrettyType ¶
func (e EntityMetadata) PrettyType() (interface{}, error)
PrettyType returns a representation of EntityMetadata that can be used for pretty printing.
func (*EntityMetadata) ValidateBasic ¶
func (e *EntityMetadata) ValidateBasic() error
ValidateBasic performs basic validity checks on the entity metadata.
type GitConfig ¶
type GitConfig struct { // URL is the repository URL. URL string // Branch is the Git branch to use. Branch string }
GitConfig contains the configuration of the Git provider.
func NewGitConfig ¶
func NewGitConfig() GitConfig
NewGitConfig creates a default Git provider configuration pointing to the production branch.
func NewTestGitConfig ¶
func NewTestGitConfig() GitConfig
NewTestGitConfig creates a Git provider configuration pointing to the test branch.
type MutableProvider ¶
type MutableProvider interface { Provider // BaseDir returns the base registry directory (when available). BaseDir() string // Init initializes a new registry in the local filesystem. Init() error // UpdateEntity updates entity metadata in the registry. UpdateEntity(entity *SignedEntityMetadata) error }
MutableProvider is a mutable registry provider interface.
func NewFilesystemPathProvider ¶
func NewFilesystemPathProvider(path string) (MutableProvider, error)
NewFilesystemPathProvider creates a new filesystem-based registry interface for the given path.
func NewFilesystemProvider ¶
func NewFilesystemProvider(fs billy.Filesystem) (MutableProvider, error)
NewFilesystemProvider creates a new filesystem-based registry interface.
type Provider ¶
type Provider interface { // Verify verifies the integrity of the whole registry. Verify() error // VerifyUpdate verifies the integrity of a registry update from src. VerifyUpdate(src Provider) error // GetEntities returns a list of all entities in the registry. GetEntities(ctx context.Context) (map[signature.PublicKey]*EntityMetadata, error) // GetEntity returns metadata for a specific entity. GetEntity(ctx context.Context, id signature.PublicKey) (*EntityMetadata, error) }
Provider is the read-only registry provider interface.
func NewGitProvider ¶
NewGitProvider creates a new git-backed metadata registry provider.
type SignedEntityMetadata ¶
SignedEntityMetadata is a signed entity metadata statement.
func SignEntityMetadata ¶
func SignEntityMetadata(signer signature.Signer, meta *EntityMetadata) (*SignedEntityMetadata, error)
SignEntityMetadata serializes the EntityMetadata and signs the result.
func (*SignedEntityMetadata) Open ¶
func (s *SignedEntityMetadata) Open(meta *EntityMetadata) error
Open first verifies the blob signature and then unmarshals the blob.
Directories ¶
Path | Synopsis |
---|---|
examples
|
|
lookup
Module
|
|
gen_vectors generates test vectors for entity metadata descriptors.
|
gen_vectors generates test vectors for entity metadata descriptors. |
Package main implements the oasis-registry binary which provides tooling to manage a filesystem based Oasis Metadata Registry.
|
Package main implements the oasis-registry binary which provides tooling to manage a filesystem based Oasis Metadata Registry. |