Documentation ¶
Overview ¶
Package objects contains the contnet objects and functions for working with the Cryptographically curated content objects
Index ¶
- func NameSegmentEscape(nameSegment string) string
- func NameSegmentUnescape(s string) (string, error)
- func NewDString() string
- func ObjectTypeEscape(objectType string) string
- func ObjectTypeUnescape(s string) (string, error)
- func RegisterGeterPoster(getPublicKeyForHkid func(hkid HKID) PublicKey, ...)
- func SignatureEscape(signature []byte) string
- func SignatureUnescape(s string) ([]byte, error)
- func Unmarshal(curve elliptic.Curve, data []byte) (x, y *big.Int)
- func VersionEscape(version int64) (versionstr string)
- func VersionUnescape(s string) (int64, error)
- type Blob
- type Byteser
- type Commit
- type GeterPoster
- type HCID
- type HID
- type HKID
- type Hexer
- type List
- func (l List) Add(nameSegment string, hash HID, typeString string) List
- func (l List) Bytes() []byte
- func (l List) Hash() HCID
- func (l List) HashForNamesegment(namesegment string) (string, HID)
- func (l List) Log()
- func (l List) Remove(nameSegment string) List
- func (l List) Rename(oldNameSeg, newNameSeg string) (List, error)
- func (l List) String() string
- type Parents
- type PrivateKey
- type PublicKey
- type Tag
- func (t Tag) Bytes() []byte
- func (t Tag) Delete() Tag
- func (t Tag) Hash() HCID
- func (t Tag) Log()
- func (t Tag) Merge(tags []Tag, hashBytes HID, typeString string) Tag
- func (t Tag) Rename(newNameSegment string) (tombstone, newTag Tag)
- func (t Tag) String() string
- func (t Tag) Update(hashBytes HID, typeString string) Tag
- func (t Tag) Verify() bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NameSegmentEscape ¶
NameSegmentEscape escapes the text of NameSegment
func NameSegmentUnescape ¶
NameSegmentUnescape escapes the text of NameSegment
func NewDString ¶
func NewDString() string
func ObjectTypeEscape ¶
ObjectTypeEscape escapes the text of types
func ObjectTypeUnescape ¶
ObjectTypeUnescape unescapes the text of types
func RegisterGeterPoster ¶
func RegisterGeterPoster( getPublicKeyForHkid func(hkid HKID) PublicKey, getPrivateKeyForHkid func(hkid HKID) (k *PrivateKey, err error), PostKey func(p *PrivateKey) error, PostBlob func(b Blob) error, )
RegisterGeterPoster ads a given GeterPoster for use with objects
func SignatureEscape ¶
SignatureEscape escapes the text of signature
func SignatureUnescape ¶
SignatureUnescape escapes the text of signature
func Unmarshal ¶
Unmarshal converts a point, serialized by Marshal, into an x, y pair. It is an error if the point is not on the curve. On error, x = nil.
func VersionEscape ¶
VersionEscape escapes the text of version
func VersionUnescape ¶
VersionUnescape escapes the text of version
Types ¶
type Byteser ¶
type Byteser interface {
Bytes() []byte
}
Byteser is a object that can be exported as a slice of byte
type Commit ¶
type Commit struct { ListHash HCID Version int64 Parents Parents Hkid HKID Signature []byte //131 byte max }
Commit is the type for defining a repository at a moment in time
func CommitFromBytes ¶
CommitFromBytes build a Commit form a slice of byte or error
type GeterPoster ¶
type GeterPoster struct { PostKey func(p *PrivateKey) error PostBlob func(b Blob) error // contains filtered or unexported fields }
GeterPoster is a struct of functions for use with objects
type HCID ¶
type HCID []byte
HCID is the type to represent content by it's cryptographic hash
func HcidFromHex ¶
HcidFromHex return an HCID if the string contains 64 digits of Hex
type HKID ¶
type HKID []byte
HKID is the hash of a public key stored in a slice of byte
func HkidFromDString ¶
HkidFromDString builds a HKID using a number in base in a string
func HkidFromHex ¶
HkidFromHex gives you an HKID form a hex string
type Hexer ¶
type Hexer interface {
Hex() string
}
Hexer is a object that can be exported as a string of hex
type List ¶
type List map[string]entry
List is a map from nameSegments to HIDs and TypeStrings
func ListFromBytes ¶
ListFromBytes parses a slice of byte to a list
func (List) HashForNamesegment ¶
HashForNamesegment retrieves the TypeString and HID for a NameSegment
type PrivateKey ¶
type PrivateKey ecdsa.PrivateKey
PrivateKey wrapper around the ecdsa.PrivateKey type
func PrivateKeyFromBytes ¶
func PrivateKeyFromBytes(b []byte) (priv *PrivateKey, err error)
PrivteKeyFromBytes makes a private key from a slice of bytes and returns it.
func PrivateKeyFromD ¶
func PrivateKeyFromD(D big.Int) (*PrivateKey, error)
PrivteKeyFromD makes a private key from a big int and returns it
func (PrivateKey) Bytes ¶
func (p PrivateKey) Bytes() []byte
Bytes returns the marshaled public key as a slice of byte.
func (PrivateKey) Hkid ¶
func (p PrivateKey) Hkid() HKID
Hkid returns the hkid that for private key. this is the hcid of your public key
func (PrivateKey) Verify ¶
func (p PrivateKey) Verify() bool
Verify returns true if PrivateKey and PrivateKey are a pair.
type PublicKey ¶
PublicKey wrapper around the ecdsa.PrivateKey type
type Tag ¶
type Tag struct { HashBytes HID TypeString string NameSegment string Version int64 Parents Parents Hkid HKID Signature []byte }
Tag is a individually versioned reference to a content object
func NewTag ¶
func NewTag( HashBytes HID, TypeString string, nameSegment string, tparent Parents, hkid HKID, ) Tag
NewTag build a new tag with the initial content
func TagFromBytes ¶
TagFromBytes parses a slice of byte to a tag