api

package
v0.0.0-...-a9ac1ba Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2019 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRequest

func NewRequest(method string, urs string, body io.Reader, tm time.Time, userKey *keyup.UserKey) (*http.Request, error)

NewRequest returns new authorized/signed HTTP request.

func SetLogger

func SetLogger(l Logger)

SetLogger sets package log

Types

type Auth

type Auth struct {
	Method  string
	URL     *url.URL
	Sig     string
	Message string
}

Auth describes auth for a HTTP request.

func NewAuth

func NewAuth(method string, urs string, tm time.Time, userKey *keyup.UserKey) (*Auth, error)

NewAuth returns auth for an HTTP request. The url shouldn't have ? or &.

type Error

type Error struct {
	Message string `json:"message,omitempty"`
	Status  int    `json:"status,omitempty"`
}

Error ...

type LogLevel

type LogLevel int

LogLevel ...

const (
	// DebugLevel ...
	DebugLevel LogLevel = 3
	// InfoLevel ...
	InfoLevel LogLevel = 2
	// WarnLevel ...
	WarnLevel LogLevel = 1
	// ErrLevel ...
	ErrLevel LogLevel = 0
)

type Logger

type Logger interface {
	Debugf(format string, args ...interface{})
	Infof(format string, args ...interface{})
	Warningf(format string, args ...interface{})
	Errorf(format string, args ...interface{})
}

Logger interface used in this package

type Message

type Message struct {
	Data []byte   `json:"data"`
	ID   keyup.ID `json:"id"`
	Path string   `json:"path"`
}

Message ...

type MessagesResponse

type MessagesResponse struct {
	Messages  []*Message           `json:"messages"`
	Metadata  map[string]*Metadata `json:"md,omitempty"`
	Recipient keyup.ID             `json:"recipient"`
	Version   string               `json:"version"`
}

MessagesResponse is the response from messages.

func (MessagesResponse) MetadataFor

func (r MessagesResponse) MetadataFor(msg *Message) *Metadata

MetadataFor returns metadata for Message.

type Metadata

type Metadata struct {
	CreatedAt time.Time `json:"createdAt"`
}

Metadata ...

type Response

type Response struct {
	Error *Error `json:"error,omitempty"`
}

Response ...

type SigchainResponse

type SigchainResponse struct {
	Metadata      map[string]*Metadata `json:"md,omitempty"`
	Statements    []*keyup.Statement   `json:"statements"`
	UserPublicKey *keyup.UserPublicKey `json:"upk"`
}

SigchainResponse is the response format for a Sigchain request.

func (SigchainResponse) MetadataFor

func (r SigchainResponse) MetadataFor(st *keyup.Statement) *Metadata

MetadataFor returns metadata for Signed.

func (SigchainResponse) Sigchain

func (r SigchainResponse) Sigchain() (*keyup.Sigchain, error)

Sigchain from response.

type SigchainsResponse

type SigchainsResponse struct {
	Metadata   map[string]*Metadata `json:"md,omitempty"`
	Statements []*keyup.Statement   `json:"statements"`
	Version    string               `json:"version"`
}

SigchainsResponse is the response format for a listing all sigchain statements.

func (SigchainsResponse) MetadataFor

func (r SigchainsResponse) MetadataFor(st *keyup.Statement) *Metadata

MetadataFor returns metadata for Signed.

type UserPublicKeyResponse

type UserPublicKeyResponse struct {
	Metadata      *Metadata            `json:"md,omitempty"`
	UserPublicKey *keyup.UserPublicKey `json:"upk"`
}

UserPublicKeyResponse is the response format for a UserPublicKey request.

type UserPublicKeysResponse

type UserPublicKeysResponse struct {
	Metadata       map[string]*Metadata   `json:"md,omitempty"`
	UserPublicKeys []*keyup.UserPublicKey `json:"upks"`
	Version        string                 `json:"version"`
}

UserPublicKeysResponse is the response format for a UserPublicKeys request.

func (UserPublicKeysResponse) MetadataFor

func (r UserPublicKeysResponse) MetadataFor(upk *keyup.UserPublicKey) *Metadata

MetadataFor returns metadata for UserPublicKey.

type UsersResponse

type UsersResponse struct {
	Users []*user.User `json:"users"`
}

UsersResponse ...

Jump to

Keyboard shortcuts

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