Documentation ¶
Index ¶
- Constants
- Variables
- func FromBoolArray(s BoolArray) []bool
- func FromDataArray(s DataArray) [][]byte
- func FromFloatArray(s FloatArray) []float64
- func FromHashArray(s HashArray) []string
- func FromIntArray(s IntArray) []int64
- func FromStringArray(s StringArray) []string
- func FromUintArray(s UintArray) []uint64
- func Traverse(v interface{}, f func(string, interface{}) bool)
- func UnloadReferences(ctx context.Context, obj *Object) (result *Object, unloaded []*Object, err error)
- func Verify(o *Object) error
- type ArrayValue
- type Bool
- type BoolArray
- type Certificate
- type CertificateRequest
- type Data
- type DataArray
- type Float
- type FloatArray
- type Getter
- type GetterFunc
- type Hash
- type HashArray
- type HashSlice
- type Hint
- type Int
- type IntArray
- type Map
- type MapArray
- type Metadata
- type Object
- type ObjectArray
- type ParsedType
- type Policy
- type ReadCloser
- type Reader
- type Request
- type Response
- type Signature
- type String
- type StringArray
- type Typed
- type Uint
- type UintArray
- type Value
Constants ¶
const ( ErrInvalidSigner = errors.Error("signer is does not match owner") ErrMissingSignature = errors.Error("missing signature") ErrCouldNotVerify = errors.Error("could not verify signature") )
const (
// AlgorithmObjectHash for creating ObjectHash+ES256 based signatures
AlgorithmObjectHash = "OH_ES256"
)
const (
EmptyHash = Hash("")
)
const (
ErrReaderDone = errors.Error("reader done")
)
const (
ErrSourceNotSupported = errors.Error("encoding source not supported")
)
Variables ¶
var ( // ErrInvalidObjectType is returned when the signature being verified // is not an encoded object of type "signature". ErrInvalidObjectType = errors.New("invalid object type") // ErrAlgorithNotImplemented is returned when the algorithm specified // has not been implemented ErrAlgorithNotImplemented = errors.New("algorithm not implemented") )
var (
ErrTimeout = errors.New("timeout")
)
Functions ¶
func FromBoolArray ¶ added in v0.15.7
func FromDataArray ¶ added in v0.15.7
func FromFloatArray ¶ added in v0.15.7
func FromFloatArray(s FloatArray) []float64
func FromHashArray ¶ added in v0.15.7
func FromIntArray ¶ added in v0.15.7
func FromStringArray ¶ added in v0.15.7
func FromStringArray(s StringArray) []string
func FromUintArray ¶ added in v0.15.7
func UnloadReferences ¶ added in v0.11.0
Types ¶
type ArrayValue ¶ added in v0.15.7
type Bool ¶ added in v0.10.0
type Bool bool
basic types
func (*Bool) UnmarshalJSON ¶ added in v0.15.7
type BoolArray ¶ added in v0.15.7
type BoolArray []Bool
array types
func ToBoolArray ¶ added in v0.15.7
type Certificate ¶ added in v0.5.0
type Certificate struct { Metadata Metadata `nimona:"metadata:m,omitempty"` Nonce string Created string Expires string }
func NewCertificate ¶ added in v0.5.0
func NewCertificate( subject crypto.PublicKey, issuer crypto.PrivateKey, ) (*Certificate, error)
func NewCertificateSelfSigned ¶ added in v0.11.0
func NewCertificateSelfSigned(k crypto.PrivateKey) (*Certificate, error)
func (*Certificate) FromObject ¶ added in v0.5.0
func (e *Certificate) FromObject(o *Object) error
func (Certificate) ToObject ¶ added in v0.5.0
func (e Certificate) ToObject() *Object
func (*Certificate) Type ¶ added in v0.12.0
func (e *Certificate) Type() string
type CertificateRequest ¶ added in v0.11.0
type CertificateRequest struct { Metadata Metadata `nimona:"metadata:m,omitempty"` ApplicationName string ApplicationDescription string ApplicationURL string Subject string Resources []string Actions []string Nonce string }
func (*CertificateRequest) FromObject ¶ added in v0.11.0
func (e *CertificateRequest) FromObject(o *Object) error
func (CertificateRequest) ToObject ¶ added in v0.11.0
func (e CertificateRequest) ToObject() *Object
func (*CertificateRequest) Type ¶ added in v0.12.0
func (e *CertificateRequest) Type() string
type FloatArray ¶ added in v0.15.7
type FloatArray []Float
func ToFloatArray ¶ added in v0.15.7
func ToFloatArray(s []float64) FloatArray
func (FloatArray) Hint ¶ added in v0.15.7
func (v FloatArray) Hint() Hint
func (FloatArray) Len ¶ added in v0.15.7
func (v FloatArray) Len() int
type GetterFunc ¶ added in v0.11.0
GetterFunc is an adapter to allow the use of ordinary functions as object.Getter
type Hash ¶
type Hash string
func GetReferences ¶ added in v0.11.0
func SortHashes ¶ added in v0.12.0
SortHashes sorts a slice of Hashes in increasing order, and also returns it. The return part is mostly for allowing this to be used as a helper method in tests.
type Hint ¶ added in v0.15.7
type Hint string
const ( // basic hints BoolHint Hint = "b" DataHint Hint = "d" FloatHint Hint = "f" IntHint Hint = "i" MapHint Hint = "m" ObjectHint Hint = "o" StringHint Hint = "s" UintHint Hint = "u" HashHint Hint = "r" // array hints BoolArrayHint Hint = "ab" DataArrayHint Hint = "ad" FloatArrayHint Hint = "af" IntArrayHint Hint = "ai" MapArrayHint Hint = "am" ObjectArrayHint Hint = "ao" StringArrayHint Hint = "as" UintArrayHint Hint = "au" HashArrayHint Hint = "ar" )
type Map ¶ added in v0.10.0
func (Map) MarshalJSON ¶ added in v0.15.7
func (Map) UnmarshalJSON ¶ added in v0.15.7
type Metadata ¶ added in v0.11.0
type Metadata struct { Owner crypto.PublicKey Datetime string Parents []Hash Policy Policy Stream Hash Signature Signature }
Metadata for object
func MetadataFromMap ¶ added in v0.15.7
type Object ¶
Object
func LoadReferences ¶ added in v0.11.0
LoadReferences will look for references in the given object, request the referred objects using the getter, and will replace the references with the actual object before returning the complete
func (Object) MarshalJSON ¶ added in v0.15.7
func (*Object) UnmarshalJSON ¶ added in v0.15.7
type ObjectArray ¶ added in v0.15.7
type ObjectArray []*Object // nolint: golint
func (ObjectArray) Hint ¶ added in v0.15.7
func (v ObjectArray) Hint() Hint
func (ObjectArray) Len ¶ added in v0.15.7
func (v ObjectArray) Len() int
type ParsedType ¶ added in v0.11.0
func ParseType ¶ added in v0.11.0
func ParseType(objectType string) ParsedType
type ReadCloser ¶ added in v0.11.0
func FetchWithReferences ¶ added in v0.11.0
func FetchWithReferences( ctx context.Context, getter GetterFunc, objectHash Hash, ) (ReadCloser, error)
FetchWithReferences will look for references in the given object, request the primary object and all referred objects using the getter, and will return them in a lazy loaded result.
func NewReadCloser ¶ added in v0.11.0
func NewReadCloser( ctx context.Context, objects <-chan *Object, errs <-chan error, closer chan<- struct{}, ) ReadCloser
func NewReadCloserFromObjects ¶ added in v0.11.0
func NewReadCloserFromObjects(objects []*Object) ReadCloser
NewReadCloserFromObjects is mainly used for testing and mocks that return a Reader, or ReadCloser.
type Request ¶ added in v0.11.0
type Request struct { Metadata Metadata `nimona:"metadata:m,omitempty"` RequestID string ObjectHash Hash }
func (*Request) FromObject ¶ added in v0.11.0
type Response ¶ added in v0.11.0
type Response struct { Metadata Metadata `nimona:"metadata:m,omitempty"` RequestID string Object *Object }
func (*Response) FromObject ¶ added in v0.11.0
type Signature ¶ added in v0.5.0
type Signature struct { Signer crypto.PublicKey `nimona:"signer:s,omitempty"` Alg string `nimona:"alg:s,omitempty"` X []byte `nimona:"x:d,omitempty"` Certificate *Certificate `nimona:"certificate:m,omitempty"` }
func NewSignature ¶ added in v0.5.0
func NewSignature( k crypto.PrivateKey, o *Object, ) (Signature, error)
NewSignature returns a signature given some bytes and a private key
func SignatureFromMap ¶ added in v0.15.7
type StringArray ¶ added in v0.15.7
type StringArray []String
func ToStringArray ¶ added in v0.15.7
func ToStringArray(s []string) StringArray
func (StringArray) Hint ¶ added in v0.15.7
func (v StringArray) Hint() Hint
func (StringArray) Len ¶ added in v0.15.7
func (v StringArray) Len() int