Package org.bitcoinj.wallet
Class Protos.Key.Builder
- java.lang.Object
-
- com.google.protobuf.AbstractMessageLite.Builder<MessageType,BuilderType>
-
- com.google.protobuf.GeneratedMessageLite.Builder<Protos.Key,Protos.Key.Builder>
-
- org.bitcoinj.wallet.Protos.Key.Builder
-
- All Implemented Interfaces:
com.google.protobuf.MessageLite.Builder,com.google.protobuf.MessageLiteOrBuilder,java.lang.Cloneable,Protos.KeyOrBuilder
- Enclosing class:
- Protos.Key
public static final class Protos.Key.Builder extends com.google.protobuf.GeneratedMessageLite.Builder<Protos.Key,Protos.Key.Builder> implements Protos.KeyOrBuilder
A key used to control Bitcoin spending. Either the private key, the public key or both may be present. It is recommended that if the private key is provided that the public key is provided too because deriving it is slow. If only the public key is provided, the key can only be used to watch the blockchain and verify transactions, and not for spending.
Protobuf typewallet.Key
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Protos.Key.BuilderaddAccountPath(int value)The path to the root.Protos.Key.BuilderaddAllAccountPath(java.lang.Iterable<? extends java.lang.Integer> values)The path to the root.Protos.Key.BuilderclearAccountPath()The path to the root.Protos.Key.BuilderclearCreationTimestamp()Timestamp stored as millis since epoch.Protos.Key.BuilderclearDeterministicKey()optional .wallet.DeterministicKey deterministic_key = 7;Protos.Key.BuilderclearDeterministicSeed()The seed for a deterministic key hierarchy.Protos.Key.BuilderclearEncryptedData()If the secret data is encrypted, then secret_bytes is missing and this field is set.Protos.Key.BuilderclearEncryptedDeterministicSeed()Encrypted version of the seedProtos.Key.BuilderclearLabel()User-provided label associated with the key.Protos.Key.BuilderclearOutputScriptType()Type of addresses (aka output scripts) to generate for receiving.Protos.Key.BuilderclearPublicKey()The public EC key derived from the private key.Protos.Key.BuilderclearSecretBytes()Either the private EC key bytes (without any ASN.1 wrapping), or the deterministic root seed.Protos.Key.BuilderclearType()required .wallet.Key.Type type = 1;intgetAccountPath(int index)The path to the root.intgetAccountPathCount()The path to the root.java.util.List<java.lang.Integer>getAccountPathList()The path to the root.longgetCreationTimestamp()Timestamp stored as millis since epoch.Protos.DeterministicKeygetDeterministicKey()optional .wallet.DeterministicKey deterministic_key = 7;com.google.protobuf.ByteStringgetDeterministicSeed()The seed for a deterministic key hierarchy.Protos.EncryptedDatagetEncryptedData()If the secret data is encrypted, then secret_bytes is missing and this field is set.Protos.EncryptedDatagetEncryptedDeterministicSeed()Encrypted version of the seedjava.lang.StringgetLabel()User-provided label associated with the key.com.google.protobuf.ByteStringgetLabelBytes()User-provided label associated with the key.Protos.Key.OutputScriptTypegetOutputScriptType()Type of addresses (aka output scripts) to generate for receiving.com.google.protobuf.ByteStringgetPublicKey()The public EC key derived from the private key.com.google.protobuf.ByteStringgetSecretBytes()Either the private EC key bytes (without any ASN.1 wrapping), or the deterministic root seed.Protos.Key.TypegetType()required .wallet.Key.Type type = 1;booleanhasCreationTimestamp()Timestamp stored as millis since epoch.booleanhasDeterministicKey()optional .wallet.DeterministicKey deterministic_key = 7;booleanhasDeterministicSeed()The seed for a deterministic key hierarchy.booleanhasEncryptedData()If the secret data is encrypted, then secret_bytes is missing and this field is set.booleanhasEncryptedDeterministicSeed()Encrypted version of the seedbooleanhasLabel()User-provided label associated with the key.booleanhasOutputScriptType()Type of addresses (aka output scripts) to generate for receiving.booleanhasPublicKey()The public EC key derived from the private key.booleanhasSecretBytes()Either the private EC key bytes (without any ASN.1 wrapping), or the deterministic root seed.booleanhasType()required .wallet.Key.Type type = 1;Protos.Key.BuildermergeDeterministicKey(Protos.DeterministicKey value)optional .wallet.DeterministicKey deterministic_key = 7;Protos.Key.BuildermergeEncryptedData(Protos.EncryptedData value)If the secret data is encrypted, then secret_bytes is missing and this field is set.Protos.Key.BuildermergeEncryptedDeterministicSeed(Protos.EncryptedData value)Encrypted version of the seedProtos.Key.BuildersetAccountPath(int index, int value)The path to the root.Protos.Key.BuildersetCreationTimestamp(long value)Timestamp stored as millis since epoch.Protos.Key.BuildersetDeterministicKey(Protos.DeterministicKey value)optional .wallet.DeterministicKey deterministic_key = 7;Protos.Key.BuildersetDeterministicKey(Protos.DeterministicKey.Builder builderForValue)optional .wallet.DeterministicKey deterministic_key = 7;Protos.Key.BuildersetDeterministicSeed(com.google.protobuf.ByteString value)The seed for a deterministic key hierarchy.Protos.Key.BuildersetEncryptedData(Protos.EncryptedData value)If the secret data is encrypted, then secret_bytes is missing and this field is set.Protos.Key.BuildersetEncryptedData(Protos.EncryptedData.Builder builderForValue)If the secret data is encrypted, then secret_bytes is missing and this field is set.Protos.Key.BuildersetEncryptedDeterministicSeed(Protos.EncryptedData value)Encrypted version of the seedProtos.Key.BuildersetEncryptedDeterministicSeed(Protos.EncryptedData.Builder builderForValue)Encrypted version of the seedProtos.Key.BuildersetLabel(java.lang.String value)User-provided label associated with the key.Protos.Key.BuildersetLabelBytes(com.google.protobuf.ByteString value)User-provided label associated with the key.Protos.Key.BuildersetOutputScriptType(Protos.Key.OutputScriptType value)Type of addresses (aka output scripts) to generate for receiving.Protos.Key.BuildersetPublicKey(com.google.protobuf.ByteString value)The public EC key derived from the private key.Protos.Key.BuildersetSecretBytes(com.google.protobuf.ByteString value)Either the private EC key bytes (without any ASN.1 wrapping), or the deterministic root seed.Protos.Key.BuildersetType(Protos.Key.Type value)required .wallet.Key.Type type = 1;-
Methods inherited from class com.google.protobuf.GeneratedMessageLite.Builder
build, buildPartial, clear, clone, copyOnWrite, copyOnWriteInternal, getDefaultInstanceForType, internalMergeFrom, isInitialized, mergeFrom, mergeFrom, mergeFrom, mergeFrom
-
Methods inherited from class com.google.protobuf.AbstractMessageLite.Builder
addAll, addAll, mergeDelimitedFrom, mergeDelimitedFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, newUninitializedMessageException
-
-
-
-
Method Detail
-
hasType
public boolean hasType()
required .wallet.Key.Type type = 1;- Specified by:
hasTypein interfaceProtos.KeyOrBuilder- Returns:
- Whether the type field is set.
-
getType
public Protos.Key.Type getType()
required .wallet.Key.Type type = 1;- Specified by:
getTypein interfaceProtos.KeyOrBuilder- Returns:
- The type.
-
setType
public Protos.Key.Builder setType(Protos.Key.Type value)
required .wallet.Key.Type type = 1;- Parameters:
value- The enum numeric value on the wire for type to set.- Returns:
- This builder for chaining.
-
clearType
public Protos.Key.Builder clearType()
required .wallet.Key.Type type = 1;- Returns:
- This builder for chaining.
-
hasSecretBytes
public boolean hasSecretBytes()
Either the private EC key bytes (without any ASN.1 wrapping), or the deterministic root seed. If the secret is encrypted, or this is a "watching entry" then this is missing.
optional bytes secret_bytes = 2;- Specified by:
hasSecretBytesin interfaceProtos.KeyOrBuilder- Returns:
- Whether the secretBytes field is set.
-
getSecretBytes
public com.google.protobuf.ByteString getSecretBytes()
Either the private EC key bytes (without any ASN.1 wrapping), or the deterministic root seed. If the secret is encrypted, or this is a "watching entry" then this is missing.
optional bytes secret_bytes = 2;- Specified by:
getSecretBytesin interfaceProtos.KeyOrBuilder- Returns:
- The secretBytes.
-
setSecretBytes
public Protos.Key.Builder setSecretBytes(com.google.protobuf.ByteString value)
Either the private EC key bytes (without any ASN.1 wrapping), or the deterministic root seed. If the secret is encrypted, or this is a "watching entry" then this is missing.
optional bytes secret_bytes = 2;- Parameters:
value- The secretBytes to set.- Returns:
- This builder for chaining.
-
clearSecretBytes
public Protos.Key.Builder clearSecretBytes()
Either the private EC key bytes (without any ASN.1 wrapping), or the deterministic root seed. If the secret is encrypted, or this is a "watching entry" then this is missing.
optional bytes secret_bytes = 2;- Returns:
- This builder for chaining.
-
hasEncryptedData
public boolean hasEncryptedData()
If the secret data is encrypted, then secret_bytes is missing and this field is set.
optional .wallet.EncryptedData encrypted_data = 6;- Specified by:
hasEncryptedDatain interfaceProtos.KeyOrBuilder- Returns:
- Whether the encryptedData field is set.
-
getEncryptedData
public Protos.EncryptedData getEncryptedData()
If the secret data is encrypted, then secret_bytes is missing and this field is set.
optional .wallet.EncryptedData encrypted_data = 6;- Specified by:
getEncryptedDatain interfaceProtos.KeyOrBuilder- Returns:
- The encryptedData.
-
setEncryptedData
public Protos.Key.Builder setEncryptedData(Protos.EncryptedData value)
If the secret data is encrypted, then secret_bytes is missing and this field is set.
optional .wallet.EncryptedData encrypted_data = 6;
-
setEncryptedData
public Protos.Key.Builder setEncryptedData(Protos.EncryptedData.Builder builderForValue)
If the secret data is encrypted, then secret_bytes is missing and this field is set.
optional .wallet.EncryptedData encrypted_data = 6;
-
mergeEncryptedData
public Protos.Key.Builder mergeEncryptedData(Protos.EncryptedData value)
If the secret data is encrypted, then secret_bytes is missing and this field is set.
optional .wallet.EncryptedData encrypted_data = 6;
-
clearEncryptedData
public Protos.Key.Builder clearEncryptedData()
If the secret data is encrypted, then secret_bytes is missing and this field is set.
optional .wallet.EncryptedData encrypted_data = 6;
-
hasPublicKey
public boolean hasPublicKey()
The public EC key derived from the private key. We allow both to be stored to avoid mobile clients having to do lots of slow EC math on startup. For DETERMINISTIC_MNEMONIC entries this is missing.
optional bytes public_key = 3;- Specified by:
hasPublicKeyin interfaceProtos.KeyOrBuilder- Returns:
- Whether the publicKey field is set.
-
getPublicKey
public com.google.protobuf.ByteString getPublicKey()
The public EC key derived from the private key. We allow both to be stored to avoid mobile clients having to do lots of slow EC math on startup. For DETERMINISTIC_MNEMONIC entries this is missing.
optional bytes public_key = 3;- Specified by:
getPublicKeyin interfaceProtos.KeyOrBuilder- Returns:
- The publicKey.
-
setPublicKey
public Protos.Key.Builder setPublicKey(com.google.protobuf.ByteString value)
The public EC key derived from the private key. We allow both to be stored to avoid mobile clients having to do lots of slow EC math on startup. For DETERMINISTIC_MNEMONIC entries this is missing.
optional bytes public_key = 3;- Parameters:
value- The publicKey to set.- Returns:
- This builder for chaining.
-
clearPublicKey
public Protos.Key.Builder clearPublicKey()
The public EC key derived from the private key. We allow both to be stored to avoid mobile clients having to do lots of slow EC math on startup. For DETERMINISTIC_MNEMONIC entries this is missing.
optional bytes public_key = 3;- Returns:
- This builder for chaining.
-
hasLabel
public boolean hasLabel()
User-provided label associated with the key.
optional string label = 4;- Specified by:
hasLabelin interfaceProtos.KeyOrBuilder- Returns:
- Whether the label field is set.
-
getLabel
public java.lang.String getLabel()
User-provided label associated with the key.
optional string label = 4;- Specified by:
getLabelin interfaceProtos.KeyOrBuilder- Returns:
- The label.
-
getLabelBytes
public com.google.protobuf.ByteString getLabelBytes()
User-provided label associated with the key.
optional string label = 4;- Specified by:
getLabelBytesin interfaceProtos.KeyOrBuilder- Returns:
- The bytes for label.
-
setLabel
public Protos.Key.Builder setLabel(java.lang.String value)
User-provided label associated with the key.
optional string label = 4;- Parameters:
value- The label to set.- Returns:
- This builder for chaining.
-
clearLabel
public Protos.Key.Builder clearLabel()
User-provided label associated with the key.
optional string label = 4;- Returns:
- This builder for chaining.
-
setLabelBytes
public Protos.Key.Builder setLabelBytes(com.google.protobuf.ByteString value)
User-provided label associated with the key.
optional string label = 4;- Parameters:
value- The bytes for label to set.- Returns:
- This builder for chaining.
-
hasCreationTimestamp
public boolean hasCreationTimestamp()
Timestamp stored as millis since epoch. Useful for skipping block bodies before this point. The reason it's optional is that keys derived from a parent don't have this data.
optional int64 creation_timestamp = 5;- Specified by:
hasCreationTimestampin interfaceProtos.KeyOrBuilder- Returns:
- Whether the creationTimestamp field is set.
-
getCreationTimestamp
public long getCreationTimestamp()
Timestamp stored as millis since epoch. Useful for skipping block bodies before this point. The reason it's optional is that keys derived from a parent don't have this data.
optional int64 creation_timestamp = 5;- Specified by:
getCreationTimestampin interfaceProtos.KeyOrBuilder- Returns:
- The creationTimestamp.
-
setCreationTimestamp
public Protos.Key.Builder setCreationTimestamp(long value)
Timestamp stored as millis since epoch. Useful for skipping block bodies before this point. The reason it's optional is that keys derived from a parent don't have this data.
optional int64 creation_timestamp = 5;- Parameters:
value- The creationTimestamp to set.- Returns:
- This builder for chaining.
-
clearCreationTimestamp
public Protos.Key.Builder clearCreationTimestamp()
Timestamp stored as millis since epoch. Useful for skipping block bodies before this point. The reason it's optional is that keys derived from a parent don't have this data.
optional int64 creation_timestamp = 5;- Returns:
- This builder for chaining.
-
hasDeterministicKey
public boolean hasDeterministicKey()
optional .wallet.DeterministicKey deterministic_key = 7;- Specified by:
hasDeterministicKeyin interfaceProtos.KeyOrBuilder- Returns:
- Whether the deterministicKey field is set.
-
getDeterministicKey
public Protos.DeterministicKey getDeterministicKey()
optional .wallet.DeterministicKey deterministic_key = 7;- Specified by:
getDeterministicKeyin interfaceProtos.KeyOrBuilder- Returns:
- The deterministicKey.
-
setDeterministicKey
public Protos.Key.Builder setDeterministicKey(Protos.DeterministicKey value)
optional .wallet.DeterministicKey deterministic_key = 7;
-
setDeterministicKey
public Protos.Key.Builder setDeterministicKey(Protos.DeterministicKey.Builder builderForValue)
optional .wallet.DeterministicKey deterministic_key = 7;
-
mergeDeterministicKey
public Protos.Key.Builder mergeDeterministicKey(Protos.DeterministicKey value)
optional .wallet.DeterministicKey deterministic_key = 7;
-
clearDeterministicKey
public Protos.Key.Builder clearDeterministicKey()
optional .wallet.DeterministicKey deterministic_key = 7;
-
hasDeterministicSeed
public boolean hasDeterministicSeed()
The seed for a deterministic key hierarchy. Derived from the mnemonic, but cached here for quick startup. Only applicable to a DETERMINISTIC_MNEMONIC key entry.
optional bytes deterministic_seed = 8;- Specified by:
hasDeterministicSeedin interfaceProtos.KeyOrBuilder- Returns:
- Whether the deterministicSeed field is set.
-
getDeterministicSeed
public com.google.protobuf.ByteString getDeterministicSeed()
The seed for a deterministic key hierarchy. Derived from the mnemonic, but cached here for quick startup. Only applicable to a DETERMINISTIC_MNEMONIC key entry.
optional bytes deterministic_seed = 8;- Specified by:
getDeterministicSeedin interfaceProtos.KeyOrBuilder- Returns:
- The deterministicSeed.
-
setDeterministicSeed
public Protos.Key.Builder setDeterministicSeed(com.google.protobuf.ByteString value)
The seed for a deterministic key hierarchy. Derived from the mnemonic, but cached here for quick startup. Only applicable to a DETERMINISTIC_MNEMONIC key entry.
optional bytes deterministic_seed = 8;- Parameters:
value- The deterministicSeed to set.- Returns:
- This builder for chaining.
-
clearDeterministicSeed
public Protos.Key.Builder clearDeterministicSeed()
The seed for a deterministic key hierarchy. Derived from the mnemonic, but cached here for quick startup. Only applicable to a DETERMINISTIC_MNEMONIC key entry.
optional bytes deterministic_seed = 8;- Returns:
- This builder for chaining.
-
hasEncryptedDeterministicSeed
public boolean hasEncryptedDeterministicSeed()
Encrypted version of the seed
optional .wallet.EncryptedData encrypted_deterministic_seed = 9;- Specified by:
hasEncryptedDeterministicSeedin interfaceProtos.KeyOrBuilder- Returns:
- Whether the encryptedDeterministicSeed field is set.
-
getEncryptedDeterministicSeed
public Protos.EncryptedData getEncryptedDeterministicSeed()
Encrypted version of the seed
optional .wallet.EncryptedData encrypted_deterministic_seed = 9;- Specified by:
getEncryptedDeterministicSeedin interfaceProtos.KeyOrBuilder- Returns:
- The encryptedDeterministicSeed.
-
setEncryptedDeterministicSeed
public Protos.Key.Builder setEncryptedDeterministicSeed(Protos.EncryptedData value)
Encrypted version of the seed
optional .wallet.EncryptedData encrypted_deterministic_seed = 9;
-
setEncryptedDeterministicSeed
public Protos.Key.Builder setEncryptedDeterministicSeed(Protos.EncryptedData.Builder builderForValue)
Encrypted version of the seed
optional .wallet.EncryptedData encrypted_deterministic_seed = 9;
-
mergeEncryptedDeterministicSeed
public Protos.Key.Builder mergeEncryptedDeterministicSeed(Protos.EncryptedData value)
Encrypted version of the seed
optional .wallet.EncryptedData encrypted_deterministic_seed = 9;
-
clearEncryptedDeterministicSeed
public Protos.Key.Builder clearEncryptedDeterministicSeed()
Encrypted version of the seed
optional .wallet.EncryptedData encrypted_deterministic_seed = 9;
-
getAccountPathList
public java.util.List<java.lang.Integer> getAccountPathList()
The path to the root. Only applicable to a DETERMINISTIC_MNEMONIC key entry.
repeated uint32 account_path = 10 [packed = true];- Specified by:
getAccountPathListin interfaceProtos.KeyOrBuilder- Returns:
- A list containing the accountPath.
-
getAccountPathCount
public int getAccountPathCount()
The path to the root. Only applicable to a DETERMINISTIC_MNEMONIC key entry.
repeated uint32 account_path = 10 [packed = true];- Specified by:
getAccountPathCountin interfaceProtos.KeyOrBuilder- Returns:
- The count of accountPath.
-
getAccountPath
public int getAccountPath(int index)
The path to the root. Only applicable to a DETERMINISTIC_MNEMONIC key entry.
repeated uint32 account_path = 10 [packed = true];- Specified by:
getAccountPathin interfaceProtos.KeyOrBuilder- Parameters:
index- The index of the element to return.- Returns:
- The accountPath at the given index.
-
setAccountPath
public Protos.Key.Builder setAccountPath(int index, int value)
The path to the root. Only applicable to a DETERMINISTIC_MNEMONIC key entry.
repeated uint32 account_path = 10 [packed = true];- Parameters:
value- The accountPath to set.- Returns:
- This builder for chaining.
-
addAccountPath
public Protos.Key.Builder addAccountPath(int value)
The path to the root. Only applicable to a DETERMINISTIC_MNEMONIC key entry.
repeated uint32 account_path = 10 [packed = true];- Parameters:
value- The accountPath to add.- Returns:
- This builder for chaining.
-
addAllAccountPath
public Protos.Key.Builder addAllAccountPath(java.lang.Iterable<? extends java.lang.Integer> values)
The path to the root. Only applicable to a DETERMINISTIC_MNEMONIC key entry.
repeated uint32 account_path = 10 [packed = true];- Parameters:
values- The accountPath to add.- Returns:
- This builder for chaining.
-
clearAccountPath
public Protos.Key.Builder clearAccountPath()
The path to the root. Only applicable to a DETERMINISTIC_MNEMONIC key entry.
repeated uint32 account_path = 10 [packed = true];- Returns:
- This builder for chaining.
-
hasOutputScriptType
public boolean hasOutputScriptType()
Type of addresses (aka output scripts) to generate for receiving.
optional .wallet.Key.OutputScriptType output_script_type = 11;- Specified by:
hasOutputScriptTypein interfaceProtos.KeyOrBuilder- Returns:
- Whether the outputScriptType field is set.
-
getOutputScriptType
public Protos.Key.OutputScriptType getOutputScriptType()
Type of addresses (aka output scripts) to generate for receiving.
optional .wallet.Key.OutputScriptType output_script_type = 11;- Specified by:
getOutputScriptTypein interfaceProtos.KeyOrBuilder- Returns:
- The outputScriptType.
-
setOutputScriptType
public Protos.Key.Builder setOutputScriptType(Protos.Key.OutputScriptType value)
Type of addresses (aka output scripts) to generate for receiving.
optional .wallet.Key.OutputScriptType output_script_type = 11;- Parameters:
value- The enum numeric value on the wire for outputScriptType to set.- Returns:
- This builder for chaining.
-
clearOutputScriptType
public Protos.Key.Builder clearOutputScriptType()
Type of addresses (aka output scripts) to generate for receiving.
optional .wallet.Key.OutputScriptType output_script_type = 11;- Returns:
- This builder for chaining.
-
-