Documentation ¶
Index ¶
- Variables
- func PhononPubKeyToECDSA(pubKey PhononPubKey) (*ecdsa.PublicKey, error)
- type CounterpartyPhononCard
- type CurrencyType
- type CurveType
- type Denomination
- type ECCPubKey
- type NativePubKey
- type Phonon
- type PhononCard
- type PhononJSON
- type PhononPubKey
- type RemotePairingStatus
- type RequestCardPair1
- type RequestCertificate
- type RequestFinalizeCardPair
- type RequestGetName
- type RequestIdentifyCard
- type RequestPairWithRemote
- type RequestReceivePhonons
- type RequestSetPaired
- type RequestSetRemote
- type ResponseCardPair1
- type ResponseCertificate
- type ResponseFinalizeCardPair
- type ResponseGetName
- type ResponseIdentifyCard
- type ResponsePairWithRemote
- type ResponseReceivePhonons
- type ResponseSetPaired
- type ResponseSetRemote
- type SessionRequest
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidDenomination = errors.New("value cannot be represented as a phonon denomination")
Functions ¶
func PhononPubKeyToECDSA ¶
func PhononPubKeyToECDSA(pubKey PhononPubKey) (*ecdsa.PublicKey, error)
Convenience function to easily convert PhononPublicKeys to their underyling concrete type when possible
Types ¶
type CounterpartyPhononCard ¶
type CounterpartyPhononCard interface { GetCertificate() (*cert.CardCertificate, error) CardPair(initPairingData []byte) (cardPairData []byte, err error) CardPair2(cardPairData []byte) (cardPairData2 []byte, err error) FinalizeCardPair(cardPair2Data []byte) error ReceivePhonons(phononTransfer []byte) error GenerateInvoice() (invoiceData []byte, err error) ReceiveInvoice(invoiceData []byte) error VerifyPaired() error PairingStatus() RemotePairingStatus ConnectToCard(string) error }
type CurrencyType ¶
type CurrencyType uint16
const ( Unspecified CurrencyType = 0x0000 Bitcoin CurrencyType = 0x0001 Ethereum CurrencyType = 0x0002 Native CurrencyType = 0x0003 )
func (CurrencyType) String ¶
func (i CurrencyType) String() string
type Denomination ¶
func NewDenomination ¶
func NewDenomination(i *big.Int) (Denomination, error)
NewDenomination takes an integer input and attempts to store it as a compressible value representing currency base units Precision is limited to significant digits no greater than the value 255, along with exponentiation up to 255 digits
func (*Denomination) MarshalJSON ¶
func (d *Denomination) MarshalJSON() ([]byte, error)
Marshal denominations as strings
func (Denomination) String ¶
func (d Denomination) String() string
func (*Denomination) UnmarshalJSON ¶
func (d *Denomination) UnmarshalJSON(b []byte) error
Unmarshal Denominations from string to internal representation
func (Denomination) Value ¶
func (d Denomination) Value() *big.Int
type ECCPubKey ¶
func (*ECCPubKey) Decode ¶
func (pubKey *ECCPubKey) Decode(data []byte) (pk PhononPubKey, err error)
func (*ECCPubKey) Equal ¶
func (pubKey *ECCPubKey) Equal(x PhononPubKey) bool
type NativePubKey ¶
type NativePubKey struct {
Hash []byte
}
func (*NativePubKey) Bytes ¶
func (nat *NativePubKey) Bytes() []byte
func (*NativePubKey) Decode ¶
func (nat *NativePubKey) Decode(data []byte) (pk PhononPubKey, err error)
func (*NativePubKey) Equal ¶
func (nat *NativePubKey) Equal(x PhononPubKey) bool
func (*NativePubKey) String ¶
func (nat *NativePubKey) String() string
type Phonon ¶
type Phonon struct { KeyIndex uint16 PubKey PhononPubKey CurveType CurveType SchemaVersion uint8 ExtendedSchemaVersion uint8 Denomination Denomination CurrencyType CurrencyType ChainID int ExtendedTLV tlv.TLVList Address string //chain specific attribute not stored on card AddressType uint8 //chain specific address type identifier }
func (*Phonon) MarshalJSON ¶
func (*Phonon) UnmarshalJSON ¶
Unmarshals a PhononUserView into an internal phonon representation
type PhononCard ¶
type PhononCard interface { Select() (instanceUID []byte, cardPubKey *ecdsa.PublicKey, cardInitialized bool, err error) Pair() (*cert.CardCertificate, error) OpenSecureChannel() error OpenSecureConnection() error Init(pin string) error IdentifyCard(nonce []byte) (cardPubKey *ecdsa.PublicKey, cardSig *util.ECDSASignature, err error) VerifyPIN(pin string) error ChangePIN(pin string) error CreatePhonon(curveType CurveType) (keyIndex uint16, pubKey PhononPubKey, err error) SetDescriptor(phonon *Phonon) error ListPhonons(currencyType CurrencyType, lessThanValue uint64, greaterThanValue uint64, continuation bool) ([]*Phonon, error) GetPhononPubKey(keyIndex uint16, crv CurveType) (pubkey PhononPubKey, err error) DestroyPhonon(keyIndex uint16) (privKey *ecdsa.PrivateKey, err error) SendPhonons(keyIndices []uint16, extendedRequest bool) (transferPhononPackets []byte, err error) ReceivePhonons(phononTransfer []byte) error SetReceiveList(phononPubKeys []*ecdsa.PublicKey) error TransactionAck(keyIndices []uint16) error InitCardPairing(receiverCertificate cert.CardCertificate) (initPairingData []byte, err error) CardPair(initPairingData []byte) (cardPairData []byte, err error) CardPair2(cardPairData []byte) (cardPair2Data []byte, err error) FinalizeCardPair(cardPair2Data []byte) (err error) InstallCertificate(signKeyFunc func([]byte) ([]byte, error)) (err error) GenerateInvoice() (invoiceData []byte, err error) ReceiveInvoice(invoiceData []byte) (err error) SetFriendlyName(name string) error GetFriendlyName() (string, error) GetAvailableMemory() (persistentMem int, onResetMem int, onDeselectMem int, err error) MineNativePhonon(difficulty uint8) (keyIndex uint16, hash []byte, err error) }
type PhononJSON ¶
type PhononJSON struct { KeyIndex uint16 PubKey string //pubkey as hexstring Address string //Chain specific address as hexstring AddressType uint8 SchemaVersion uint8 ExtendedSchemaVersion uint8 Denomination Denomination CurrencyType int ChainID int CurveType uint8 }
Phonon data structured for display to the user and use in frontends
type PhononPubKey ¶
type PhononPubKey interface { Decode([]byte) (PhononPubKey, error) String() string Bytes() []byte Equal(PhononPubKey) bool }
func NewPhononPubKey ¶
func NewPhononPubKey(rawPubKey []byte, crv CurveType) (pubKey PhononPubKey, err error)
NewPhononPubKey parses raw public key data into the assigned PhononPubKey interface based on the given CurveType
type RemotePairingStatus ¶
type RemotePairingStatus int
const ( StatusUnconnected RemotePairingStatus = iota StatusConnectedToBridge StatusConnectedToCard StatusCardPair1Complete StatusCardPair2Complete StatusPaired )
type RequestCardPair1 ¶
type RequestCardPair1 struct { Ret chan ResponseCardPair1 Payload []byte }
func (*RequestCardPair1) GetName ¶
func (*RequestCardPair1) GetName() string
type RequestCertificate ¶
type RequestCertificate struct {
Ret chan ResponseCertificate
}
func (*RequestCertificate) GetName ¶
func (*RequestCertificate) GetName() string
type RequestFinalizeCardPair ¶
type RequestFinalizeCardPair struct { Ret chan ResponseFinalizeCardPair Payload []byte }
func (*RequestFinalizeCardPair) GetName ¶
func (*RequestFinalizeCardPair) GetName() string
type RequestGetName ¶
type RequestGetName struct {
Ret chan ResponseGetName
}
func (*RequestGetName) GetName ¶
func (*RequestGetName) GetName() string
type RequestIdentifyCard ¶
type RequestIdentifyCard struct { Ret chan ResponseIdentifyCard Nonce []byte }
func (*RequestIdentifyCard) GetName ¶
func (*RequestIdentifyCard) GetName() string
type RequestPairWithRemote ¶
type RequestPairWithRemote struct { Ret chan ResponsePairWithRemote Card CounterpartyPhononCard }
func (*RequestPairWithRemote) GetName ¶
func (*RequestPairWithRemote) GetName() string
type RequestReceivePhonons ¶
type RequestReceivePhonons struct { Ret chan ResponseReceivePhonons Payload []byte }
func (*RequestReceivePhonons) GetName ¶
func (*RequestReceivePhonons) GetName() string
type RequestSetPaired ¶
type RequestSetPaired struct { Ret chan ResponseSetPaired Status bool }
func (*RequestSetPaired) GetName ¶
func (*RequestSetPaired) GetName() string
type RequestSetRemote ¶
type RequestSetRemote struct { Ret chan ResponseSetRemote Card CounterpartyPhononCard }
func (*RequestSetRemote) GetName ¶
func (*RequestSetRemote) GetName() string
type ResponseCardPair1 ¶
type ResponseCertificate ¶
type ResponseCertificate struct { Err error Payload *cert.CardCertificate }
type ResponseFinalizeCardPair ¶
type ResponseFinalizeCardPair struct {
Err error
}
type ResponseGetName ¶
type ResponseIdentifyCard ¶
type ResponseIdentifyCard struct { PubKey *ecdsa.PublicKey Sig *util.ECDSASignature Err error }
type ResponsePairWithRemote ¶
type ResponsePairWithRemote struct {
Err error
}
type ResponseReceivePhonons ¶
type ResponseReceivePhonons struct {
Err error
}
type ResponseSetPaired ¶
type ResponseSetPaired struct {
Err error
}
type ResponseSetRemote ¶
type ResponseSetRemote struct {
Err error
}
type SessionRequest ¶
type SessionRequest interface {
GetName() string
}