proto.setType(Protos.Key.Type.DETERMINISTIC_KEY); final Protos.DeterministicKey.Builder detKey = proto.getDeterministicKeyBuilder(); detKey.setChainCode(ByteString.copyFrom(key.getChainCode())); for (ChildNumber num : key.getPath()) detKey.addPath(num.i()); if (key.equals(externalKey)) { detKey.setIssuedSubkeys(issuedExternalKeys); detKey.setLookaheadSize(lookaheadSize); } else if (key.equals(internalKey)) { detKey.setIssuedSubkeys(issuedInternalKeys); detKey.setLookaheadSize(lookaheadSize); detKey.setIsFollowing(true);
/** * <code>optional .com.openwallet.core.protos.DeterministicKey deterministic_key = 6;</code> */ public Builder setDeterministicKey( com.openwallet.core.protos.Protos.DeterministicKey.Builder builderForValue) { if (deterministicKeyBuilder_ == null) { deterministicKey_ = builderForValue.build(); onChanged(); } else { deterministicKeyBuilder_.setMessage(builderForValue.build()); } bitField0_ |= 0x00000020; return this; } /**
subBuilder.mergeFrom(deterministicKey_); deterministicKey_ = subBuilder.buildPartial();
public Builder mergeFrom(com.openwallet.core.protos.Protos.DeterministicKey other) { if (other == com.openwallet.core.protos.Protos.DeterministicKey.getDefaultInstance()) return this; if (other.hasChainCode()) { setChainCode(other.getChainCode()); } if (!other.path_.isEmpty()) { if (path_.isEmpty()) { path_ = other.path_; bitField0_ = (bitField0_ & ~0x00000002); } else { ensurePathIsMutable(); path_.addAll(other.path_); } onChanged(); } if (other.hasIssuedSubkeys()) { setIssuedSubkeys(other.getIssuedSubkeys()); } if (other.hasLookaheadSize()) { setLookaheadSize(other.getLookaheadSize()); } if (other.hasIsFollowing()) { setIsFollowing(other.getIsFollowing()); } this.mergeUnknownFields(other.getUnknownFields()); return this; }
/** * <code>optional .com.openwallet.core.protos.DeterministicKey deterministic_key = 6;</code> */ public Builder mergeDeterministicKey(com.openwallet.core.protos.Protos.DeterministicKey value) { if (deterministicKeyBuilder_ == null) { if (((bitField0_ & 0x00000020) == 0x00000020) && deterministicKey_ != com.openwallet.core.protos.Protos.DeterministicKey.getDefaultInstance()) { deterministicKey_ = com.openwallet.core.protos.Protos.DeterministicKey.newBuilder(deterministicKey_).mergeFrom(value).buildPartial(); } else { deterministicKey_ = value; } onChanged(); } else { deterministicKeyBuilder_.mergeFrom(value); } bitField0_ |= 0x00000020; return this; } /**
/** * <code>repeated uint32 path = 2;</code> * * <pre> * The path through the key tree. Each number is encoded in the standard form: high bit set for private derivation * and high bit unset for public derivation. * </pre> */ public Builder addAllPath( java.lang.Iterable<? extends java.lang.Integer> values) { ensurePathIsMutable(); com.google.protobuf.AbstractMessageLite.Builder.addAll( values, path_); onChanged(); return this; } /**
List<Protos.Key.Builder> toEditableProtobuf() { LinkedList<Protos.Key.Builder> entries = newLinkedList(); // Entropy Protos.Key.Builder entropyProto = KeyUtils.serializeKey(entropy); entropyProto.setType(Protos.Key.Type.DETERMINISTIC_KEY); final Protos.DeterministicKey.Builder detKey = entropyProto.getDeterministicKeyBuilder(); detKey.setChainCode(ByteString.copyFrom(entropy.getChainCode())); for (ChildNumber num : entropy.getPath()) { detKey.addPath(num.i()); } entries.add(entropyProto); // NTX key Protos.Key.Builder publicKeyProto = Protos.Key.newBuilder(); publicKeyProto.setType(Protos.Key.Type.ORIGINAL); publicKeyProto.setPublicKey(ByteString.copyFrom(publicKey)); entries.add(publicKeyProto); return entries; }
public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { com.openwallet.core.protos.Protos.DeterministicKey parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (com.openwallet.core.protos.Protos.DeterministicKey) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_;
/** * <code>repeated uint32 path = 2;</code> * * <pre> * The path through the key tree. Each number is encoded in the standard form: high bit set for private derivation * and high bit unset for public derivation. * </pre> */ public Builder setPath( int index, int value) { ensurePathIsMutable(); path_.set(index, value); onChanged(); return this; } /**
/** * <code>repeated uint32 path = 2;</code> * * <pre> * The path through the key tree. Each number is encoded in the standard form: high bit set for private derivation * and high bit unset for public derivation. * </pre> */ public Builder addPath(int value) { ensurePathIsMutable(); path_.add(value); onChanged(); return this; } /**
private Builder() { maybeForceBuilderInitialization(); }
private static Builder create() { return new Builder(); }
public static Builder newBuilder(com.openwallet.core.protos.Protos.DeterministicKey prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); }
public Builder clone() { return create().mergeFrom(buildPartial()); }
public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.openwallet.core.protos.Protos.DeterministicKey) { return mergeFrom((com.openwallet.core.protos.Protos.DeterministicKey)other); } else { super.mergeFrom(other); return this; } }
@java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /**
public com.openwallet.core.protos.Protos.DeterministicKey build() { com.openwallet.core.protos.Protos.DeterministicKey result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; }
private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() {
private static Protos.Key getMasterKeyProto(Wallet wallet) { DeterministicKey key = wallet.getMasterKey(); Protos.Key.Builder proto = KeyUtils.serializeKey(key); proto.setType(Protos.Key.Type.DETERMINISTIC_KEY); final Protos.DeterministicKey.Builder detKey = proto.getDeterministicKeyBuilder(); detKey.setChainCode(ByteString.copyFrom(key.getChainCode())); for (ChildNumber num : key.getPath()) { detKey.addPath(num.i()); } return proto.build(); }
public final boolean isInitialized() { if (!hasChainCode()) { return false; } return true; }