cdi

package
v0.0.0-...-c94e5b3 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2023 License: MIT Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//RefLookup represents a public reference of an certificate (IPFS block addr)
	RefLookup = "ref"
	//CertIDLookup represents a lookup against the certificates ID
	CertIDLookup = "id"
	//EmailLookup represents a lookup against any stored email in a certificate
	EmailLookup = "email"
)
View Source
const (
	//DefaultIPFSConfigPath default config path for IPFS node
	DefaultIPFSConfigPath = "~/.ocs/ipfs/"
)
View Source
const (
	//OCSCertificateMIME MIME type which can be used in web requests/responses
	OCSCertificateMIME = "application/x-ocs-certificate"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CertRef

type CertRef struct {
	Ref       string `msgpack:"r"`
	Signature []byte `msgpack:"s"`
	Nonce     []byte `msgpack:"n"`
}

CertRef represents a certificate reference structure

type CertStore

type CertStore interface {
	Lookup(context.Context, *Lookup) (io.Reader, error)
	Publish(context.Context, *cki.Certificate, *PublishRequest) (string, error)
}

CertStore provides a means of finding certificates

type IPFSCertStore

type IPFSCertStore struct {
	// contains filtered or unexported fields
}

IPFSCertStore uses IPFS to create a certificate store

func (*IPFSCertStore) Lookup

func (scs *IPFSCertStore) Lookup(ctx context.Context, l *Lookup) (io.Reader, error)

Lookup attempts to find a certificate based on the lookup request. The IPFS DHT may be used to search for certificate IDs or emails, otherwise block lookup is used.

func (*IPFSCertStore) Publish

func (scs *IPFSCertStore) Publish(ctx context.Context, c *cki.Certificate, r *PublishRequest) (string, error)

Publish publishes a certificate based on a signed public request

type Lookup

type Lookup struct {
	LookupType LookupType `json:"t" msgpack:"t"`
	Data       []byte     `json:"d" msgpack:"d"`
}

Lookup represents a lookup request data

type LookupType

type LookupType string

LookupType represents the mode of lookup

type PublishRequest

type PublishRequest struct {
	Cert      []byte `msgpack:"c" json:"c"`
	Signature []byte `msgpack:"s" json:"s"`
	Nonce     []byte `msgpack:"n" json:"n"`
}

PublishRequest represents a certificate publish request

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server a OCS-CDI node implementation

func NewServer

func NewServer() *Server

NewServer creates a new OCS CDI node

func (*Server) GetRevoke

func (s *Server) GetRevoke(ctx context.Context, id []byte) ([]byte, error)

GetRevoke searches for a certificate revoke in the DHT TODO(tcfw)

func (*Server) GetRevokeSignature

func (s *Server) GetRevokeSignature(ctx context.Context, id []byte, parent []byte) ([]byte, error)

GetRevokeSignature searches for a signature revoke in the DHT TODO(tcfw)

func (*Server) Revoke

func (s *Server) Revoke(ctx context.Context, c *cki.Certificate, sig []byte) error

Revoke stores a revoke certificate with signature to verify the revocation TODO(tcfw)

func (*Server) RevokeSignature

func (s *Server) RevokeSignature(ctx context.Context, c *cki.Certificate, sig []byte) error

RevokeSignature revokes an individual signature on a certificate for use in Multi-PKI mode TODO(tcfw)

func (*Server) Start

func (s *Server) Start() error

Start starts the node

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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