wallet.proto: rename to Key.Type.ENCRYPTED from ENCRYPTED_SCRYPT_AES

This commit is contained in:
Oliver Aemmer 2024-05-01 20:18:47 +02:00 committed by Andreas Schildbach
parent 92c2c29508
commit 70fb77d2d1
2 changed files with 11 additions and 4 deletions

View file

@ -361,7 +361,7 @@ public class BasicKeyChain implements EncryptableKeyChain {
.setInitialisationVector(ByteString.copyFrom(data.initialisationVector)));
// We don't allow mixing of encryption types at the moment.
checkState(item.getEncryptionType() == Protos.Wallet.EncryptionType.ENCRYPTED_SCRYPT_AES);
proto.setType(Protos.Key.Type.ENCRYPTED_SCRYPT_AES);
proto.setType(Protos.Key.Type.ENCRYPTED);
} else {
final byte[] secret = item.getSecretBytes();
// The secret might be missing in the case of a watching wallet, or a key for which the private key
@ -401,9 +401,9 @@ public class BasicKeyChain implements EncryptableKeyChain {
checkState(hashToKeys.isEmpty(), () ->
"tried to deserialize into a non-empty chain");
for (Protos.Key key : keys) {
if (key.getType() != Protos.Key.Type.ORIGINAL && key.getType() != Protos.Key.Type.ENCRYPTED_SCRYPT_AES)
if (key.getType() != Protos.Key.Type.ORIGINAL && key.getType() != Protos.Key.Type.ENCRYPTED)
continue;
boolean encrypted = key.getType() == Protos.Key.Type.ENCRYPTED_SCRYPT_AES;
boolean encrypted = key.getType() == Protos.Key.Type.ENCRYPTED;
byte[] priv = key.hasSecretBytes() ? key.getSecretBytes().toByteArray() : null;
if (!key.hasPublicKey())
throw new UnreadableWalletException("Public key missing");

View file

@ -86,11 +86,18 @@ message DeterministicKey {
*/
message Key {
enum Type {
option allow_alias = true;
/** Unencrypted - Original bitcoin secp256k1 curve */
ORIGINAL = 1;
/**
* Encrypted - Original bitcoin secp256k1 curve
* Details of the encryption are declared via Wallet.EncryptionType enum
*/
ENCRYPTED = 2;
/** Encrypted with Scrypt and AES - Original bitcoin secp256k1 curve */
ENCRYPTED_SCRYPT_AES = 2;
ENCRYPTED_SCRYPT_AES = 2 [deprecated = true];
/**
* Not really a key, but rather contains the mnemonic phrase for a deterministic key hierarchy in the private_key field.