identity

package
v0.0.0-...-cf42d2a Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2018 License: MIT Imports: 14 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Level to use in signing when registering
	RegisterIdentityLevel int = 1
	// For ChainIDs
	ProofOfWorkChainID     = []byte{0x88, 0x88, 0x88}
	ProofOfWorkLength  int = 3 // DEFAULT = 3, set lower for faster tests
	// For Registering Root Chain
	// e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
	RootRegisterChain string = "888888001750ede0eff4b05f0c3f557890b256450cabbb84cada937f9c258327"
	// If true will show "." on screen to show user program is computing
	ShowBruteForce bool = true
	// Will change frequency of dots for brute forcing
	BruteForcePeriod int = 400000
	// Amount of hashes on seed to generate MHash
	MHashAmount int = 100000
	//Seed Hex Length (length/2 = bytes)
	SeedMin int = 4
	SeedMax int = 64
	// Curl Commands for Milestone 1 or 2
	Version int = 2
)

Functions

func CheckHumanReadable

func CheckHumanReadable(key []byte) bool

func CheckNonce

func CheckNonce(upToNonce []byte, nonceInt int) bool

func GetChainCommitString

func GetChainCommitString(c *factom.Chain, ec *factom.ECAddress) (string, error)

func GetChainRevealString

func GetChainRevealString(c *factom.Chain) (string, error)

func GetEntryCommitString

func GetEntryCommitString(e *factom.Entry, ec *factom.ECAddress) (string, error)

func GetEntryRevealString

func GetEntryRevealString(e *factom.Entry) (string, error)

func MapToObject

func MapToObject(source interface{}, dst interface{}) error

func NewRootChainCreate

func NewRootChainCreate(idSet *IdentitySet, ecAddr *factom.ECAddress) (*factom.Chain, error)

Types

type BitcoinKey

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

func MakeBitcoinKey

func MakeBitcoinKey(rootChainID string, subChainID string, btcKeyLevel int, btcType int, btcKey []byte, privateKey *[64]byte) (*BitcoinKey, error)

Creates a new BitcoinKey type. Used to add bitcoinkeys to subchain Params:

rootChainID 	string
subChainID		string
btcKeyLevel		int		=	1-4
btcType			int		=	0-1
btcKey			[]byte	=	len:20
identiyPrimage	[]byte	= 	len:33
privateKey		*[64]byte

func (*BitcoinKey) GetEntry

func (b *BitcoinKey) GetEntry() *factom.Entry

type BlockSigningKey

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

func MakeBlockSigningKey

func MakeBlockSigningKey(rootChainIDStr string, subchainID string, privateKey *[64]byte) (*BlockSigningKey, []byte, error)

func MakeBlockSigningKeyFixed

func MakeBlockSigningKeyFixed(rootChainIDStr string, subchainID string, privateKey *[64]byte, random bool) (*BlockSigningKey, []byte, error)

Creates a new BlockSigningKey type. Used to change keys in identity chain

func MakeBlockSigningKeySeeded

func MakeBlockSigningKeySeeded(rootChainIDStr string, subchainID string, privateKey *[64]byte, signingkey *[64]byte) (*BlockSigningKey, []byte, error)

func (*BlockSigningKey) GetEntry

func (b *BlockSigningKey) GetEntry() *factom.Entry

type Commit

type Commit struct {
	Jsonrpc string  `json:"jsonrpc"`
	ID      int     `json:"id"`
	Params  *ParamC `json:"params"`
	Method  string  `json:"method"`
}

type Identity

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

Individual component level in an IdentitySet

func NewIdentity

func NewIdentity() *Identity

func (*Identity) GenerateIdentity

func (i *Identity) GenerateIdentity(count int) error

func (*Identity) GenerateIdentityFromPrivateKey

func (i *Identity) GenerateIdentityFromPrivateKey(key *[ed.PrivateKeySize]byte, count int) error

func (*Identity) GetIdentityKey

func (i *Identity) GetIdentityKey() *[ed.PublicKeySize]byte

func (*Identity) GetPrefix

func (i *Identity) GetPrefix() []byte

func (*Identity) GetPrivateKey

func (i *Identity) GetPrivateKey() *[ed.PrivateKeySize]byte

func (*Identity) GetPublicKey

func (i *Identity) GetPublicKey() *[ed.PublicKeySize]byte

func (*Identity) HumanReadableIdentity

func (i *Identity) HumanReadableIdentity() string

func (*Identity) HumanReadablePrivate

func (i *Identity) HumanReadablePrivate() string

func (*Identity) HumanReadablePublic

func (i *Identity) HumanReadablePublic() string

type IdentitySet

type IdentitySet struct {
	IdentityLevel [4]*Identity
}

Set of 4 Identities

func NewIdentitySet

func NewIdentitySet() *IdentitySet

func (*IdentitySet) GenerateIdentitySet

func (i *IdentitySet) GenerateIdentitySet() error

func (*IdentitySet) GenerateIdentitySetFromPrivateKeys

func (i *IdentitySet) GenerateIdentitySetFromPrivateKeys(keys [4]*[ed.PrivateKeySize]byte) error

type MHash

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

func MakeMHash

func MakeMHash(rootChainID string, subChainID string, seed string, privateKey *[64]byte) (*MHash, error)

func (*MHash) GetEntry

func (m *MHash) GetEntry() *factom.Entry

func (*MHash) GetMHash

func (m *MHash) GetMHash() string

type ParamC

type ParamC struct {
	Message string `json:"message"`
}

type ParamCommitChain

type ParamCommitChain struct {
	Message string `json:"message"`
}

type ParamEntry

type ParamEntry struct {
	Entry string `json:"entry"`
}

type ParamR

type ParamR struct {
	Message string `json:"entry"`
}

type RegisterIdentity

type RegisterIdentity struct {
	Version          []byte
	Message          []byte
	EncodedChainID   []byte
	IdentityPreimage []byte
	Signiture        []byte
}

func MakeRegisterIdentity

func MakeRegisterIdentity(idSet *IdentitySet, chainID string) (*RegisterIdentity, error)

func (*RegisterIdentity) GetEntry

func (r *RegisterIdentity) GetEntry() *factom.Entry

type RegisterSubchain

type RegisterSubchain struct {
	Version []byte
	Message []byte

	IdentityPreimage []byte
	Signiture        []byte
	// contains filtered or unexported fields
}

func MakeRegisterSubchain

func MakeRegisterSubchain(idSet *IdentitySet, chainID string) (*RegisterSubchain, error)

func (*RegisterSubchain) ExtIDList

func (r *RegisterSubchain) ExtIDList() [][]byte

func (*RegisterSubchain) GetEntry

func (r *RegisterSubchain) GetEntry(rootChainID string) *factom.Entry

type Reveal

type Reveal struct {
	Jsonrpc string  `json:"jsonrpc"`
	ID      int     `json:"id"`
	Params  *ParamR `json:"params"`
	Method  string  `json:"method"`
}

type RootChain

type RootChain struct {
	IdSet *IdentitySet
	// contains filtered or unexported fields
}

func MakeRootChain

func MakeRootChain() *RootChain

* Generates all the keys and nonce * Preffered to use MakeRootChainFromIdentitySet

func MakeRootChainFromIdentitySet

func MakeRootChainFromIdentitySet(idSet *IdentitySet) *RootChain

* If you have a set of 4 private keys, the IdentityChainHead can be * constructed from them * * param: * IdentitySet id = A type IdentitySet that constructs IdentityKeys * from a set of private keys

type Subchain

type Subchain struct {
	Version     []byte
	Message     []byte
	RootChainID []byte
	Nonce       []byte
	ChainID     string
}

func MakeSubChain

func MakeSubChain(chainID string) (*Subchain, error)

Chain ID of root identity chain

func (*Subchain) GetFactomChain

func (sub *Subchain) GetFactomChain() *factom.Chain

Jump to

Keyboard shortcuts

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