sig3

package
v4.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2019 License: BSD-3-Clause, BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

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

Base struct for sig3 links that contains much of the raw material pulled down or off local storage. Most implementations of sig3 links should include this base class.

func (*Base) Inner

func (b *Base) Inner() *InnerLink

Inner returns a pointer to the InnerLink in this base class.

func (*Base) Outer

func (b *Base) Outer() OuterLink

Outer returns a copy of the OuterLink in this base class

func (*Base) Prev

func (b *Base) Prev() *LinkID

Prev returns the LinkID of the previous link, or nil if none was provided.

func (*Base) Seqno

func (b *Base) Seqno() Seqno

Seqno returns the seqno of this link, as reported in the outer link itself.

func (*Base) Signer

func (b *Base) Signer() *Signer

Signer returns the (uid, eldest, KID) of the signer of this link if a sig was provided, and it was successfully verified (as reported by the link itself). If not, then this will return a nil.

type ChainType

type ChainType = keybase1.SeqType
const (
	ChainTypeUserPrivateHidden ChainType = 16
	ChainTypeTeamPrivateHidden ChainType = 17
)

The values are picked so they don't conflict with Sigchain V1 and V2 SeqType's

type ClientInfo

type ClientInfo struct {
	Desc    string `codec:"d"`
	Version string `codec:"v"`
}

type EncryptionParameters

type EncryptionParameters struct {
	KID     KID    `codec:"k"`
	Nonce   []byte `codec:"n"`
	Version int    `codec:"v"`
}

If the inner link is encrypted, we specify the encryption parameters with this offloaded structure. So far, we don't know of any such encrypted payloads, but we'll allow it.

type Entropy

type Entropy []byte

type Generic

type Generic interface {
	Signer() *Signer
	Prev() *LinkID
	Seqno() Seqno
	Outer() OuterLink
	Inner() *InnerLink
	// contains filtered or unexported methods
}

Generic sig3 wrapper class, should implement the following interface.

type IgnoreIfUnsupported

type IgnoreIfUnsupported bool
type InnerLink struct {
	Body        interface{} `codec:"b"` // The actual body, which varies based on the type in the outer link
	Ctime       Time        `codec:"c"` // Seconds since 1970 UTC.
	Entropy     Entropy     `codec:"e"` // entropy for hiding the value of the inner link
	ClientInfo  *ClientInfo `codec:"i"` // Optional client type making sig
	MerkleRoot  *MerkleRoot `codec:"m"` // Optional snapshot of merkle root at time of sig
	ParentChain *Tail       `codec:"p"` // Optional grab of the most-recent chain tail of the corresponding parent chain
	Signer      Signer      `codec:"s"` // Info on the signer, including UID, KID and eldest
	Team        *Team       `codec:"t"` // for teams, and null otherwise
}

type KID

type KID = keybase1.BinaryKID

type KeyPair

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

type LinkID

type LinkID [32]byte

type LinkType

type LinkType int
const (
	LinkTypeNone      LinkType = 0
	LinkTypeUserPeg   LinkType = 65
	LinkTypeRotateKey LinkType = 81
)

These values are picked so they don't conflict with Sigchain V1 and V2 link types

type MerkleRoot

type MerkleRoot struct {
	Ctime Time   `codec:"c"`
	Hash  []byte `codec:"h"` // HashMeta of the MerkleRoot
	Seqno Seqno  `codec:"s"`
}
type OuterLink struct {
	Version             SigVersion          `codec:"version"` // should be 3
	Seqno               Seqno               `codec:"seqno"`
	Prev                *LinkID             `codec:"prev"`
	InnerLinkID         LinkID              `codec:"curr"` // hash of the msgpack of the InnerLink
	LinkType            LinkType            `codec:"type"` // hash of the msgpack of the previous OuterLink
	ChainType           ChainType           `codec:"chaintype"`
	IgnoreIfUnsupported IgnoreIfUnsupported `codec:"ignore_if_unsupported"`
	// New field for V3; if this link is encrypted, specify the format, nonce and PUK
	EncryptionParameters *EncryptionParameters `codec:"encryption_parameters"`
	// contains filtered or unexported fields
}

OuterLink V3 is the third version of Keybase sigchain signatures, it roughly approximates the outer link v2s that we have previously used.

type PTKType

type PTKType int
const (
	// The default, legacy type. All users, including the readers, can access it.
	PTKTypeReader PTKType = 0
)

type ParseError

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

func (ParseError) Error

func (e ParseError) Error() string

type PerTeamKey

type PerTeamKey struct {
	AppkeyDerivationVersion int                  `codec:"a"`
	EncryptionKID           KID                  `codec:"e"`
	Generation              PerTeamKeyGeneration `codec:"g"`
	ReverseSig              *Sig                 `codec:"r"` // Can be null if we are checking sigs
	SigningKID              KID                  `codec:"s"`
	PTKType                 PTKType              `codec:"t"`
}

type PerTeamKeyGeneration

type PerTeamKeyGeneration = keybase1.PerTeamKeyGeneration

type RotateKey

type RotateKey struct {
	Base
}

RotateKey is a sig3 link type for a PTK rotation. Handles multiple PTK types being rotated in one link.

func NewRotateKey

func NewRotateKey(o OuterLink, i InnerLink, b RotateKeyBody) *RotateKey

NewRotateKey makes a new rotate key given sig3 skeletons (Outer and Inner) and also the PTKs that are going to be advertised in the sig3 link.

func (RotateKey) Sign

func (r RotateKey) Sign(outer KeyPair, inners []KeyPair) (ret *Sig3Bundle, err error)

Sign the RotateKey structure, with the given user's keypair (outer), and with the new PTKs (inner). Return a Sig3Bundle, which was the exportable information, that you can export either to local storage or up to the server.

type RotateKeyBody

type RotateKeyBody struct {
	PTKs []PerTeamKey `codec:"k"`
}

type Seqno

type Seqno = keybase1.Seqno

type Sig

type Sig [64]byte

type Sig3Bundle

type Sig3Bundle struct {
	Inner *InnerLink `json:"i,omitempty"`
	Outer OuterLink  `json:"o"`
	Sig   *Sig       `json:"s,omitempty"`
}

Sig3Bundle is for storing sig3 links locally

func (Sig3Bundle) Export

func (s Sig3Bundle) Export() (ret Sig3ExportJSON, err error)

Export a sig3 up to the server in base64'ed JSON format, as in a POST request.

type Sig3Error

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

func (Sig3Error) Error

func (e Sig3Error) Error() string

type Sig3ExportJSON

type Sig3ExportJSON struct {
	Inner string `json:"i,omitempty"`
	Outer string `json:"o,omitempty"`
	Sig   string `json:"s,omitempty"`
}

Sig3ExportJSON is for communicating with the API server.

func (Sig3ExportJSON) Import

func (s Sig3ExportJSON) Import() (Generic, error)

Import from Sig3ExportJSON format (as sucked down from the server) into a Generic link type, that can be casted into the supported link types (like RotateKey). Returns an error if we failed to parse the input data, or if signature validation failed.

type SigVersion

type SigVersion int
const (
	SigVersion3 SigVersion = 3
)

type Signer

type Signer struct {
	EldestSeqno keybase1.Seqno `codec:"e"`
	KID         KID            `codec:"k"`
	UID         UID            `codec:"u"`
}

type Tail

type Tail struct {
	Hash      LinkID    `codec:"h"` // hash of the outer link
	Seqno     Seqno     `codec:"s"`
	ChainType ChainType `codec:"t"`
}

type Team

type Team struct {
	TeamID     TeamID `codec:"i"`
	IsImplicit bool   `codec:"m"`
	IsPublic   bool   `codec:"p"`
}

type TeamID

type TeamID [16]byte

type Time

type Time = keybase1.Time

type UID

type UID [16]byte

Jump to

Keyboard shortcuts

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