Module: Trezor::Protobuf

Defined in:
lib/trezor/protobuf.rb,
lib/trezor/protobuf/types.pb.rb,
lib/trezor/protobuf/messages.pb.rb

Defined Under Namespace

Classes: Address, ApplyFlags, ApplySettings, BackupDevice, ButtonAck, ButtonRequest, ButtonRequestType, Cancel, ChangePin, CipherKeyValue, CipheredKeyValue, ClearSession, CosiCommit, CosiCommitment, CosiSign, CosiSignature, DebugLinkDecision, DebugLinkFlashErase, DebugLinkGetState, DebugLinkLog, DebugLinkMemory, DebugLinkMemoryRead, DebugLinkMemoryWrite, DebugLinkState, DebugLinkStop, DecryptMessage, DecryptedMessage, ECDHSessionKey, EncryptMessage, EncryptedMessage, Entropy, EntropyAck, EntropyRequest, EstimateTxSize, EthereumAddress, EthereumGetAddress, EthereumMessageSignature, EthereumSignMessage, EthereumSignTx, EthereumTxAck, EthereumTxRequest, EthereumVerifyMessage, Failure, FailureType, Features, FirmwareErase, FirmwareRequest, FirmwareUpload, GetAddress, GetECDHSessionKey, GetEntropy, GetFeatures, GetPublicKey, HDNodePathType, HDNodeType, IdentityType, Initialize, InputScriptType, LiskAddress, LiskDelegateType, LiskGetAddress, LiskGetPublicKey, LiskMultisignatureType, LiskPublicKey, LiskSignTx, LiskSignatureType, LiskSignedTx, LiskTransactionAsset, LiskTransactionCommon, LiskTransactionType, LoadDevice, MessageSignature, MessageType, MultisigRedeemScriptType, NEMAddress, NEMAggregateModification, NEMCosignatoryModification, NEMDecryptMessage, NEMDecryptedMessage, NEMGetAddress, NEMImportanceTransfer, NEMImportanceTransferMode, NEMModificationType, NEMMosaic, NEMMosaicCreation, NEMMosaicDefinition, NEMMosaicLevy, NEMMosaicSupplyChange, NEMProvisionNamespace, NEMSignTx, NEMSignedTx, NEMSupplyChangeType, NEMTransactionCommon, NEMTransfer, OutputScriptType, PassphraseAck, PassphraseRequest, PassphraseSourceType, PassphraseStateAck, PassphraseStateRequest, PinMatrixAck, PinMatrixRequest, PinMatrixRequestType, Ping, PublicKey, RecoveryDevice, RecoveryDeviceType, RequestType, ResetDevice, SelfTest, SetU2FCounter, SignIdentity, SignMessage, SignTx, SignedIdentity, SimpleSignTx, StellarAccountMergeOp, StellarAllowTrustOp, StellarAssetType, StellarBumpSequenceOp, StellarChangeTrustOp, StellarCreateAccountOp, StellarCreatePassiveOfferOp, StellarGetPublicKey, StellarManageDataOp, StellarManageOfferOp, StellarPathPaymentOp, StellarPaymentOp, StellarPublicKey, StellarSetOptionsOp, StellarSignTx, StellarSignedTx, StellarTxOpRequest, Success, TransactionType, TxAck, TxInputType, TxOutputBinType, TxOutputType, TxRequest, TxRequestDetailsType, TxRequestSerializedType, TxSize, VerifyMessage, WipeDevice, WordAck, WordRequest, WordRequestType

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.[](class_name) ⇒ Object



21
22
23
24
25
# File 'lib/trezor/protobuf.rb', line 21

def self.[](class_name)
  const_get(class_name.to_s.camelize)
rescue NameError
  # log debug message
end

.decode(blob) ⇒ Object



16
17
18
19
# File 'lib/trezor/protobuf.rb', line 16

def self.decode(blob)
  buffer = Utils::Buffer.from(:htb, blob)
  MessageType[buffer.read_short].decode(buffer.read_string)
end

.serialize(message) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/trezor/protobuf.rb', line 8

def self.serialize(message)
  msg_type = MessageType.for(message)
  serialized = message.serialize
  header = Utils::Buffer.from(:short, msg_type.to_i, :long, serialized.length)
  payload = Utils::Buffer.from(:bth, [header.to_s, serialized])
  payload.to_s
end

Instance Method Details

#java_packageObject

File Options



168
# File 'lib/trezor/protobuf/types.pb.rb', line 168

set_option :java_package, "com.satoshilabs.trezor.lib.protobuf"