identityEntries

package
v6.4.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2019 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 4 more Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IdentityPrivateKeyPrefix1 = "4db6c9"
	IdentityPrivateKeyPrefix2 = "4db6e7"
	IdentityPrivateKeyPrefix3 = "4db705"
	IdentityPrivateKeyPrefix4 = "4db723"

	IdentityPublicKeyPrefix1 = "3fbeba"
	IdentityPublicKeyPrefix2 = "3fbed8"
	IdentityPublicKeyPrefix3 = "3fbef6"
	IdentityPublicKeyPrefix4 = "3fbf14"
)

Variables

This section is empty.

Functions

func CheckExternalIDsLength

func CheckExternalIDsLength(extIDs [][]byte, lengths []int) bool

Checking the external ids if they match the needed lengths

Types

type IdentityChainStructure

type IdentityChainStructure struct {
	//A Chain Name is constructed with 7 elements.
	//The first element is a binary string 0 signifying the version.
	Version byte
	//The second element is ASCII bytes "Identity Chain".
	FunctionName []byte //"Identity Chain"
	//The third element is the level 1 identity key in binary form.
	Key1 interfaces.IHash
	//Elements 4-6 are levels 2-4.
	Key2 interfaces.IHash
	Key3 interfaces.IHash
	Key4 interfaces.IHash
	//The 7th element is a nonce which is iterated until the first 3 bytes match 0x888888.
	Nonce []byte
}

https://github.com/FactomProject/FactomDocs/blob/master/Identity.md#factom-identity-chain-creation

func DecodeIdentityChainStructureFromExtIDs

func DecodeIdentityChainStructureFromExtIDs(extIDs [][]byte) (*IdentityChainStructure, error)

func (*IdentityChainStructure) DecodeFromExtIDs

func (ics *IdentityChainStructure) DecodeFromExtIDs(extIDs [][]byte) error

func (*IdentityChainStructure) GetChainID

func (ics *IdentityChainStructure) GetChainID() (rval interfaces.IHash)

func (*IdentityChainStructure) ToExternalIDs

func (ics *IdentityChainStructure) ToExternalIDs() [][]byte

type NewBitcoinKeyStructure

type NewBitcoinKeyStructure struct {

	//It has a version
	Version byte
	//a text string saying "New Bitcoin Key"
	FunctionName []byte //"New Bitcoin Key"
	//It specifies the root identity chainID.
	RootIdentityChainID interfaces.IHash
	//Next is a byte signifying the bitcoin key level.
	//It is 0 origin indexed, so with only 1 key it would be 0x00.
	BitcoinKeyLevel byte
	//The next extID specifies what type of Bitcoin key is used, P2PKH or P2SH.
	KeyType byte
	//Next is the 20 byte Bitcoin key.
	NewKey [20]byte
	//Seventh is a timestamp, which prevents replay attacks.
	Timestamp []byte
	//Eighth is the identity key preimage.
	PreimageIdentityKey []byte
	//Last is the signature of the serialized version through the timestamp.
	Signature []byte
}

https://github.com/FactomProject/FactomDocs/blob/master/Identity.md#add-new-bitcoin-key

func DecodeNewBitcoinKeyStructureFromExtIDs

func DecodeNewBitcoinKeyStructureFromExtIDs(extIDs [][]byte) (*NewBitcoinKeyStructure, error)

func (*NewBitcoinKeyStructure) DecodeFromExtIDs

func (nbks *NewBitcoinKeyStructure) DecodeFromExtIDs(extIDs [][]byte) error

func (*NewBitcoinKeyStructure) GetChainID

func (nbks *NewBitcoinKeyStructure) GetChainID() (rval interfaces.IHash)

func (*NewBitcoinKeyStructure) MarshalForSig

func (nbks *NewBitcoinKeyStructure) MarshalForSig() []byte

func (*NewBitcoinKeyStructure) ToExternalIDs

func (nbks *NewBitcoinKeyStructure) ToExternalIDs() [][]byte

func (*NewBitcoinKeyStructure) VerifySignature

func (nbks *NewBitcoinKeyStructure) VerifySignature(key1 interfaces.IHash) error

type NewBlockSigningKeyStruct

type NewBlockSigningKeyStruct struct {

	//The first part is a version binary string 0.
	Version byte
	//The second is the ASCII string "New Block Signing Key".
	FunctionName []byte //"New Block Signing Key"
	//The third is the root identity ChainID.
	RootIdentityChainID interfaces.IHash
	//Forth is the new public key being asserted.
	NewPublicKey []byte
	//5th is the timestamp with an 8 byte epoch time.
	Timestamp []byte
	//Next is the identity key preimage.
	PreimageIdentityKey []byte
	//7th is the signature of the serialized version, text, chainID, new key, and the timestamp.
	Signature []byte
}

https://github.com/FactomProject/FactomDocs/blob/master/Identity.md#add-new-block-signing-key

func DecodeNewBlockSigningKeyStructFromExtIDs

func DecodeNewBlockSigningKeyStructFromExtIDs(extIDs [][]byte) (*NewBlockSigningKeyStruct, error)

func (*NewBlockSigningKeyStruct) DecodeFromExtIDs

func (nbsk *NewBlockSigningKeyStruct) DecodeFromExtIDs(extIDs [][]byte) error

func (*NewBlockSigningKeyStruct) GetChainID

func (nbsk *NewBlockSigningKeyStruct) GetChainID() (rval interfaces.IHash)

func (*NewBlockSigningKeyStruct) MarshalForSig

func (nbsk *NewBlockSigningKeyStruct) MarshalForSig() []byte

func (*NewBlockSigningKeyStruct) ToExternalIDs

func (nbsk *NewBlockSigningKeyStruct) ToExternalIDs() [][]byte

func (*NewBlockSigningKeyStruct) VerifySignature

func (nbsk *NewBlockSigningKeyStruct) VerifySignature(key1 interfaces.IHash) error

type NewCoinbaseAddressStruct

type NewCoinbaseAddressStruct struct {

	//The first part is a version binary string 0.
	Version byte
	//The second is the ASCII string "Coinbase Address".
	FunctionName []byte //"Server Efficiency"
	//The third is the root identity ChainID.
	RootIdentityChainID interfaces.IHash
	//Forth is the new coinbase address
	CoinbaseAddress interfaces.IHash
	//5th is the timestamp with an 8 byte epoch time.
	Timestamp []byte
	//6th is the identity key preimage.
	PreimageIdentityKey []byte
	//7th is the signature of the serialized version through timestamp.
	Signature []byte
}

https://github.com/FactomProject/FactomDocs/blob/master/Identity.md#coinbase-address

func DecodeNewNewCoinbaseAddressStructFromExtIDs

func DecodeNewNewCoinbaseAddressStructFromExtIDs(extIDs [][]byte) (*NewCoinbaseAddressStruct, error)

func (*NewCoinbaseAddressStruct) DecodeFromExtIDs

func (ncas *NewCoinbaseAddressStruct) DecodeFromExtIDs(extIDs [][]byte) error

func (*NewCoinbaseAddressStruct) GetChainID

func (ncas *NewCoinbaseAddressStruct) GetChainID() (rval interfaces.IHash)

func (*NewCoinbaseAddressStruct) MarshalForSig

func (ncas *NewCoinbaseAddressStruct) MarshalForSig() []byte

func (*NewCoinbaseAddressStruct) SetFunctionName

func (ncas *NewCoinbaseAddressStruct) SetFunctionName()

func (*NewCoinbaseAddressStruct) ToExternalIDs

func (ncas *NewCoinbaseAddressStruct) ToExternalIDs() [][]byte

func (*NewCoinbaseAddressStruct) VerifySignature

func (ncas *NewCoinbaseAddressStruct) VerifySignature(key1 interfaces.IHash) error

type NewCoinbaseCancelStruct

type NewCoinbaseCancelStruct struct {

	//The first part is a version binary string 0.
	Version byte
	//The second is the ASCII string "Coinbase Address".
	FunctionName []byte //"Server Efficiency"
	//The third is the root identity ChainID.
	RootIdentityChainID interfaces.IHash
	//Forth is coinbase descriptor height
	CoinbaseDescriptorHeight uint32
	// Fifth is the descriptor index
	CoinbaseDescriptorIndex uint32
	//6th is the identity key preimage.
	PreimageIdentityKey []byte
	//7th is the signature of the serialized version, through descriptor index.
	Signature []byte
}

https://github.com/FactomProject/FactomDocs/blob/master/Identity.md#coinbase-cancel

func DecodeNewCoinbaseCancelStructFromExtIDs

func DecodeNewCoinbaseCancelStructFromExtIDs(extIDs [][]byte) (*NewCoinbaseCancelStruct, error)

func (*NewCoinbaseCancelStruct) DecodeFromExtIDs

func (ncas *NewCoinbaseCancelStruct) DecodeFromExtIDs(extIDs [][]byte) error

func (*NewCoinbaseCancelStruct) GetChainID

func (ncas *NewCoinbaseCancelStruct) GetChainID() (rval interfaces.IHash)

func (*NewCoinbaseCancelStruct) MarshalForSig

func (ncas *NewCoinbaseCancelStruct) MarshalForSig() []byte

func (*NewCoinbaseCancelStruct) SetFunctionName

func (ncas *NewCoinbaseCancelStruct) SetFunctionName()

func (*NewCoinbaseCancelStruct) ToExternalIDs

func (ncas *NewCoinbaseCancelStruct) ToExternalIDs() [][]byte

func (*NewCoinbaseCancelStruct) VerifySignature

func (ncas *NewCoinbaseCancelStruct) VerifySignature(key1 interfaces.IHash) error

type NewMatryoshkaHashStructure

type NewMatryoshkaHashStructure struct {

	//It starts with the version
	Version byte
	//and the text "New Matryoshka Hash".
	FunctionName []byte //"New Matryoshka Hash"
	//Next is the root identity chainID.
	RootIdentityChainID interfaces.IHash
	//Forth is the outermost M-hash.
	OutermostMHash interfaces.IHash
	//Fifth is a timestamp.
	Timestamp []byte
	//Sixth is the root identity key preimage.
	PreimageIdentityKey []byte
	//Last is the signature of the version through the timestamp.
	Signature []byte
}

https://github.com/FactomProject/FactomDocs/blob/master/Identity.md#add-new-matryoshka-hash

func DecodeNewMatryoshkaHashStructureFromExtIDs

func DecodeNewMatryoshkaHashStructureFromExtIDs(extIDs [][]byte) (*NewMatryoshkaHashStructure, error)

func (*NewMatryoshkaHashStructure) DecodeFromExtIDs

func (nmh *NewMatryoshkaHashStructure) DecodeFromExtIDs(extIDs [][]byte) error

func (*NewMatryoshkaHashStructure) GetChainID

func (nmh *NewMatryoshkaHashStructure) GetChainID() (rval interfaces.IHash)

func (*NewMatryoshkaHashStructure) MarshalForSig

func (nmh *NewMatryoshkaHashStructure) MarshalForSig() []byte

func (*NewMatryoshkaHashStructure) ToExternalIDs

func (nmh *NewMatryoshkaHashStructure) ToExternalIDs() [][]byte

func (*NewMatryoshkaHashStructure) VerifySignature

func (nmh *NewMatryoshkaHashStructure) VerifySignature(key1 interfaces.IHash) error

type NewServerEfficiencyStruct

type NewServerEfficiencyStruct struct {

	//The first part is a version binary string 0.
	Version byte
	//The second is the ASCII string "Server Efficiency".
	FunctionName []byte //"Server Efficiency"
	//The third is the root identity ChainID.
	RootIdentityChainID interfaces.IHash
	//Forth is the new efficiency
	Efficiency uint16
	//5th is the timestamp with an 8 byte epoch time.
	Timestamp []byte
	//6th is the identity key preimage.
	PreimageIdentityKey []byte
	//7th is the signature of the serialized version through timestamp.
	Signature []byte
}

https://github.com/FactomProject/FactomDocs/blob/master/Identity.md#add-server-efficiency

func DecodeNewServerEfficiencyStructFromExtIDs

func DecodeNewServerEfficiencyStructFromExtIDs(extIDs [][]byte) (*NewServerEfficiencyStruct, error)

func (*NewServerEfficiencyStruct) DecodeFromExtIDs

func (nses *NewServerEfficiencyStruct) DecodeFromExtIDs(extIDs [][]byte) error

func (*NewServerEfficiencyStruct) GetChainID

func (nses *NewServerEfficiencyStruct) GetChainID() (rval interfaces.IHash)

func (*NewServerEfficiencyStruct) MarshalForSig

func (nses *NewServerEfficiencyStruct) MarshalForSig() []byte

func (*NewServerEfficiencyStruct) SetFunctionName

func (nses *NewServerEfficiencyStruct) SetFunctionName()

func (*NewServerEfficiencyStruct) ToExternalIDs

func (nses *NewServerEfficiencyStruct) ToExternalIDs() [][]byte

func (*NewServerEfficiencyStruct) VerifySignature

func (nses *NewServerEfficiencyStruct) VerifySignature(key1 interfaces.IHash) error

type RegisterFactomIdentityStructure

type RegisterFactomIdentityStructure struct {
	//The registration message has 5 ExtIDs.
	//The first ExtID is a binary string 0 signifying the version.
	Version byte
	//The second ExtID has 24 ASCII bytes "Register Factom Identity".
	FunctionName []byte //"Register Factom Identity"
	//The third ExtID is the binary encoded ChainID of the identity. It will start with 888888.
	IdentityChainID interfaces.IHash //888888...
	//The 4th ExtID is the preimage to the identity key. It includes the type prefix (0x01) and the raw ed25519 pubkey.
	PreimageIdentityKey []byte
	//The 5th ExtID is the signature of the first, second, and third ExtIDs serialized together.
	Signature []byte
}

https://github.com/FactomProject/FactomDocs/blob/master/Identity.md#factom-identity-registration

func DecodeRegisterFactomIdentityStructureFromExtIDs

func DecodeRegisterFactomIdentityStructureFromExtIDs(extIDs [][]byte) (*RegisterFactomIdentityStructure, error)

func RandomRegisterFactomIdentityStructure

func RandomRegisterFactomIdentityStructure() *RegisterFactomIdentityStructure

func (*RegisterFactomIdentityStructure) DecodeFromExtIDs

func (rfi *RegisterFactomIdentityStructure) DecodeFromExtIDs(extIDs [][]byte) error

func (*RegisterFactomIdentityStructure) GetChainID

func (rfi *RegisterFactomIdentityStructure) GetChainID() (rval interfaces.IHash)

func (*RegisterFactomIdentityStructure) IsSameAs

func (*RegisterFactomIdentityStructure) MarshalBinary

func (r *RegisterFactomIdentityStructure) MarshalBinary() (rval []byte, err error)

func (*RegisterFactomIdentityStructure) MarshalForSig

func (rfi *RegisterFactomIdentityStructure) MarshalForSig() []byte

func (*RegisterFactomIdentityStructure) ToExternalIDs

func (rfi *RegisterFactomIdentityStructure) ToExternalIDs() [][]byte

func (*RegisterFactomIdentityStructure) UnmarshalBinary

func (e *RegisterFactomIdentityStructure) UnmarshalBinary(p []byte) error

func (*RegisterFactomIdentityStructure) UnmarshalBinaryData

func (e *RegisterFactomIdentityStructure) UnmarshalBinaryData(p []byte) (newData []byte, err error)

func (*RegisterFactomIdentityStructure) VerifySignature

func (rfi *RegisterFactomIdentityStructure) VerifySignature(key1 interfaces.IHash) error

type RegisterFactomIdentityStructureSort

type RegisterFactomIdentityStructureSort []*RegisterFactomIdentityStructure

func (RegisterFactomIdentityStructureSort) Len

func (RegisterFactomIdentityStructureSort) Less

func (RegisterFactomIdentityStructureSort) Swap

type RegisterServerManagementStructure

type RegisterServerManagementStructure struct {

	//The first ExtID is a binary string 0 signifying the version.
	Version byte
	//The second ExtID has 26 ASCII bytes "Register Server Management".
	FunctionName []byte //"Register Server Management"
	//The third ExtID is the binary encoded ChainID of the identity. It will start with 888888.
	SubchainChainID interfaces.IHash //888888...
	//The 4th ExtID is the preimage to the identity key. It includes the type prefix (0x01) and the raw ed25519 pubkey.
	PreimageIdentityKey []byte
	//The 5th ExtID is the signature of the first, second, and third ExtIDs serialized together.
	Signature []byte
}

https://github.com/FactomProject/FactomDocs/blob/master/Identity.md#server-management-subchain-registration

func DecodeRegisterServerManagementStructureFromExtIDs

func DecodeRegisterServerManagementStructureFromExtIDs(extIDs [][]byte) (*RegisterServerManagementStructure, error)

func (*RegisterServerManagementStructure) DecodeFromExtIDs

func (rsm *RegisterServerManagementStructure) DecodeFromExtIDs(extIDs [][]byte) error

func (*RegisterServerManagementStructure) GetChainID

func (rsm *RegisterServerManagementStructure) GetChainID() (rval interfaces.IHash)

func (*RegisterServerManagementStructure) MarshalForSig

func (rsm *RegisterServerManagementStructure) MarshalForSig() []byte

func (*RegisterServerManagementStructure) ToExternalIDs

func (rsm *RegisterServerManagementStructure) ToExternalIDs() [][]byte

func (*RegisterServerManagementStructure) VerifySignature

func (rsm *RegisterServerManagementStructure) VerifySignature(key1 interfaces.IHash) error

type ServerManagementStructure

type ServerManagementStructure struct {
	//This chain is created after the identity chain is known.
	//The Chain Name first element is a version, 0.
	Version byte
	//The second is the ASCII string "Server Management".
	FunctionName []byte //"Server Management"
	//The 3rd consists of the root identity chainID.
	RootIdentityChainID interfaces.IHash
	////The 4th is a nonce which makes the first 6 bytes of the chainID match 0x888888.
	Nonce []byte
}

https://github.com/FactomProject/FactomDocs/blob/master/Identity.md#server-management-subchain-creation

func DecodeServerManagementStructureFromExtIDs

func DecodeServerManagementStructureFromExtIDs(extIDs [][]byte) (*ServerManagementStructure, error)

func (*ServerManagementStructure) DecodeFromExtIDs

func (sm *ServerManagementStructure) DecodeFromExtIDs(extIDs [][]byte) error

func (*ServerManagementStructure) GetChainID

func (sm *ServerManagementStructure) GetChainID() (rval interfaces.IHash)

func (*ServerManagementStructure) ToExternalIDs

func (sm *ServerManagementStructure) ToExternalIDs() [][]byte

Jump to

Keyboard shortcuts

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