/** * Creates a deterministic key chain with the given watch key and that follows some other keychain. In a married * wallet following keychain represents "spouse" * Watch key has to be an account key. */ public static DeterministicKeyChain watchAndFollow(DeterministicKey watchKey) { return new DeterministicKeyChain(watchKey, true); }
/** * Factory method to create a key chain from a seed. * Subclasses should override this to create an instance of the subclass instead of a plain DKC. * This is used in encryption/decryption. */ protected DeterministicKeyChain makeKeyChainFromSeed(DeterministicSeed seed) { return new DeterministicKeyChain(seed); }
/** * Factory method to create a key chain from a seed. * Subclasses should override this to create an instance of the subclass instead of a plain DKC. * This is used in encryption/decryption. */ protected DeterministicKeyChain makeKeyChainFromSeed(DeterministicSeed seed, boolean useSegwit) { return new DeterministicKeyChain(seed, useSegwit); }
/** * Creates a key chain that watches the given account key. */ public static DeterministicKeyChain watch(DeterministicKey accountKey) { return new DeterministicKeyChain(accountKey); }
/** * Creates a deterministic key chain with the given watch key and that follows some other keychain. In a married * wallet following keychain represents "spouse" * Watch key has to be an account key. */ public static DeterministicKeyChain watchAndFollow(DeterministicKey watchKey) { return new DeterministicKeyChain(watchKey, true, false); }
/** * Creates a key chain that watches the given account key. */ public static DeterministicKeyChain watch(DeterministicKey accountKey, boolean useSegwit) { return new DeterministicKeyChain(accountKey, useSegwit); }
/** * Factory method to create a key chain from a seed. * Subclasses should override this to create an instance of the subclass instead of a plain DKC. * This is used in encryption/decryption. */ protected DeterministicKeyChain makeKeyChainFromSeed(DeterministicSeed seed) { return new DeterministicKeyChain(seed); }
/** * Creates a keychain group with no basic chain, and an HD chain initialized from the given seed. Account path is * provided. */ public KeyChainGroup(NetworkParameters params, DeterministicSeed seed, ImmutableList<ChildNumber> accountPath) { this(params, null, ImmutableList.of(new DeterministicKeyChain(seed, accountPath)), null, null); }
@Override public DeterministicKeyChain makeKeyChain(Protos.Key key, Protos.Key firstSubKey, DeterministicSeed seed, KeyCrypter crypter, boolean isMarried) { DeterministicKeyChain chain; if (isMarried) chain = new MarriedKeyChain(seed, crypter); else chain = new DeterministicKeyChain(seed, crypter); return chain; }
/** Adds a new HD chain to the chains list, and make it the default chain (from which keys are issued). */ public void createAndActivateNewHDChain() { // We can't do auto upgrade here because we don't know the rotation time, if any. final DeterministicKeyChain chain = new DeterministicKeyChain(new SecureRandom()); addAndActivateHDChain(chain); }
/** Adds a new HD chain to the chains list, and make it the default chain (from which keys are issued). */ public void createAndActivateNewHDChain() { // We can't do auto upgrade here because we don't know the rotation time, if any. final DeterministicKeyChain chain = new DeterministicKeyChain(new SecureRandom()); addAndActivateHDChain(chain); }
/** Adds a new HD chain to the chains list, and make it the default chain (from which keys are issued). */ public void createAndActivateNewHDChain() { // We can't do auto upgrade here because we don't know the rotation time, if any. final DeterministicKeyChain chain = new DeterministicKeyChain(new SecureRandom(), useSegwit); addAndActivateHDChain(chain); }
/** Adds a new HD chain to the chains list, and make it the default chain (from which keys are issued). */ public void createAndActivateNewHDChain() { // We can't do auto upgrade here because we don't know the rotation time, if any. final DeterministicKeyChain chain = new DeterministicKeyChain(new SecureRandom()); addAndActivateHDChain(chain); }
@Override public DeterministicKeyChain makeKeyChain(Protos.Key key, Protos.Key firstSubKey, DeterministicSeed seed, KeyCrypter crypter, boolean isMarried, ImmutableList<ChildNumber> accountPath) { DeterministicKeyChain chain; if (isMarried) chain = new MarriedKeyChain(seed, crypter); else chain = new DeterministicKeyChain(seed, crypter, accountPath); return chain; }
@Override public DeterministicKeyChain makeKeyChain(Protos.Key key, Protos.Key firstSubKey, DeterministicSeed seed, KeyCrypter crypter, boolean isMarried) { DeterministicKeyChain chain; if (isMarried) chain = new MarriedKeyChain(seed, crypter); else chain = new DeterministicKeyChain(seed, crypter); return chain; }
@Override public DeterministicKeyChain makeWatchingKeyChain(Protos.Key key, Protos.Key firstSubKey, DeterministicKey accountKey, boolean isFollowingKey, boolean isMarried) throws UnreadableWalletException { DeterministicKeyChain chain; if (isMarried) chain = new MarriedKeyChain(accountKey); else chain = new DeterministicKeyChain(accountKey, isFollowingKey); return chain; } }
@Override public DeterministicKeyChain makeKeyChain(Protos.Key key, Protos.Key firstSubKey, DeterministicSeed seed, KeyCrypter crypter, boolean isMarried, boolean useSegwit) { DeterministicKeyChain chain; if (isMarried) chain = new MarriedKeyChain(seed, crypter); else chain = new DeterministicKeyChain(seed, crypter, useSegwit); return chain; }
@Override public DeterministicKeyChain makeKeyChain(Protos.Key key, Protos.Key firstSubKey, DeterministicSeed seed, KeyCrypter crypter, boolean isMarried) { DeterministicKeyChain chain; if (isMarried) chain = new MarriedKeyChain(seed, crypter); else chain = new DeterministicKeyChain(seed, crypter); return chain; }
@Test public void random() { // Can't test much here but verify the constructor worked and the class is functional. The other tests rely on // a fixed seed to be deterministic. chain = new DeterministicKeyChain(new SecureRandom(), 384); chain.setLookaheadSize(10); chain.getKey(KeyChain.KeyPurpose.RECEIVE_FUNDS).sign(Sha256Hash.ZERO_HASH); chain.getKey(KeyChain.KeyPurpose.CHANGE).sign(Sha256Hash.ZERO_HASH); }
@Before public void setup() { BriefLogFormatter.init(); // You should use a random seed instead. The secs constant comes from the unit test file, so we can compare // serialized data properly. long secs = 1389353062L; chain = new DeterministicKeyChain(ENTROPY, "", secs); chain.setLookaheadSize(10); assertEquals(secs, checkNotNull(chain.getSeed()).getCreationTimeSeconds()); }