Documentation ¶
Index ¶
- Constants
- func Sign(k crypto.PrivateKey, o *Object) error
- func SignDeep(k crypto.PrivateKey, o *Object) error
- func Traverse(v interface{}, f func(string, interface{}) bool)
- func Unmarshal(o *Object, out interface{}) error
- func Verify(o *Object) error
- type ByteMashaller
- type ByteUnmashaller
- type EvaluationResult
- type Getter
- type GetterFunc
- type MapMashaller
- type MapUnmashaller
- type Metadata
- type Object
- type Parents
- type ParsedType
- type Policies
- type Policy
- type PolicyAction
- type PolicyEffect
- type PolicyType
- type ReadCloser
- type Reader
- type Request
- type Response
- type Signature
- type StringMashaller
- type StringUnmashaller
- type Typer
Constants ¶
View Source
const ( // Policy types SignaturePolicy PolicyType = "signature" // Policy actions ReadAction PolicyAction = "read" // Policy effects AllowEffect PolicyEffect = "allow" DenyEffect PolicyEffect = "deny" // Policy Evaluation results Deny EvaluationResult = "deny" Allow EvaluationResult = "allow" )
View Source
const ( // ErrInvalidObjectType is returned when the signature being verified // is not an encoded object of type "signature". ErrInvalidObjectType = errors.Error("invalid object type") // ErrAlgorithNotImplemented is returned when the algorithm specified // has not been implemented ErrAlgorithNotImplemented = errors.Error("algorithm not implemented") )
View Source
const ( ErrInvalidSigner = errors.Error("signer does not match owner") ErrMissingSignature = errors.Error("missing signature") ErrCouldNotVerify = errors.Error("could not verify signature") )
View Source
const (
// AlgorithmObjectHash is the only supported signing algorithm right now.
AlgorithmObjectHash = "EdDSA"
)
View Source
const (
ErrReaderDone = errors.Error("reader done")
)
View Source
const RequestType = "nimona.io/Request"
View Source
const ResponseType = "nimona.io/Response"
Variables ¶
This section is empty.
Functions ¶
func Sign ¶ added in v0.19.0
func Sign(k crypto.PrivateKey, o *Object) error
Sign an object given a private key, updates the object's metadata in place
func SignDeep ¶ added in v0.19.0
func SignDeep(k crypto.PrivateKey, o *Object) error
SignDeep an object and all nested objects we own or have no owner WARNING: THIS _WILL_ CHANGE, DO NOT USE! TODO: not sure which nested objects this should sign. All? Own?
Types ¶
type ByteMashaller ¶ added in v0.19.0
type ByteUnmashaller ¶ added in v0.19.0
type EvaluationResult ¶ added in v0.17.1
type EvaluationResult string
type GetterFunc ¶ added in v0.11.0
GetterFunc is an adapter to allow the use of ordinary functions as object.Getter
type MapMashaller ¶ added in v0.19.0
type MapUnmashaller ¶ added in v0.19.0
type Metadata ¶ added in v0.11.0
type Metadata struct { Owner did.DID `nimona:"owner:s"` Parents Parents `nimona:"parents:m"` Policies Policies `nimona:"policies:am"` Root tilde.Digest `nimona:"root:r"` Sequence uint64 `nimona:"sequence:u,omitzero"` Signature Signature `nimona:"_signature:m"` Timestamp string `nimona:"timestamp:s"` }
Metadata for object TODO: add shape TODO: add authors, contributors, license, copyright TODO: add version
type Object ¶
func MustMarshal ¶ added in v0.19.0
func MustMarshal(in interface{}) *Object
func (*Object) MarshalJSON ¶ added in v0.15.7
func (*Object) UnmarshalJSON ¶ added in v0.15.7
type Parents ¶ added in v0.18.0
type Parents map[string]tilde.DigestArray
type ParsedType ¶ added in v0.11.0
func ParseType ¶ added in v0.11.0
func ParseType(objectType string) ParsedType
type Policies ¶ added in v0.17.1
type Policies []Policy
Policies
func (Policies) Evaluate ¶ added in v0.17.1
func (ps Policies) Evaluate( subject crypto.PublicKey, resource string, action PolicyAction, ) EvaluationResult
type Policy ¶
type Policy struct { Name string `nimona:"name:s"` Type PolicyType `nimona:"type:s"` Subjects []crypto.PublicKey `nimona:"subjects:as"` Resources []string `nimona:"resources:as"` Actions []PolicyAction `nimona:"actions:as"` Effect PolicyEffect `nimona:"effect:s"` }
Policy for object metadata
func (Policy) Evaluate ¶ added in v0.17.1
func (p Policy) Evaluate( subject crypto.PublicKey, resource string, action PolicyAction, ) EvaluationResult
type PolicyAction ¶ added in v0.17.1
type PolicyAction string
type PolicyEffect ¶ added in v0.17.1
type PolicyEffect string
type PolicyType ¶
type PolicyType string
type ReadCloser ¶ added in v0.11.0
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 Signature ¶ added in v0.5.0
type Signature struct { Delegator did.DID `nimona:"d:s"` Signer did.DID `nimona:"s:s"` Key crypto.PublicKey `nimona:"jwk:s"` Alg string `nimona:"alg:s"` X []byte `nimona:"x:d"` // contains filtered or unexported fields }
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
type StringMashaller ¶ added in v0.19.0
type StringUnmashaller ¶ added in v0.19.0
Click to show internal directories.
Click to hide internal directories.