|
@@ 592-598 (lines=7) @@
|
| 589 |
|
throw new \InvalidArgumentException("Can't store Primary Mnemonic on server without a passphrase"); |
| 590 |
|
} |
| 591 |
|
|
| 592 |
|
if ($primaryPrivateKey) { |
| 593 |
|
if (is_string($primaryPrivateKey)) { |
| 594 |
|
$primaryPrivateKey = [$primaryPrivateKey, "m"]; |
| 595 |
|
} |
| 596 |
|
} else { |
| 597 |
|
$primaryPrivateKey = HierarchicalKeyFactory::fromEntropy((new Bip39SeedGenerator())->getSeed($primaryMnemonic, $options['passphrase'])); |
| 598 |
|
} |
| 599 |
|
|
| 600 |
|
if (!$storePrimaryMnemonic) { |
| 601 |
|
$primaryMnemonic = false; |
|
@@ 623-630 (lines=8) @@
|
| 620 |
|
$backupPublicKey = $options['backup_public_key']; |
| 621 |
|
} |
| 622 |
|
|
| 623 |
|
if ($backupPublicKey) { |
| 624 |
|
if (is_string($backupPublicKey)) { |
| 625 |
|
$backupPublicKey = [$backupPublicKey, "m"]; |
| 626 |
|
} |
| 627 |
|
} else { |
| 628 |
|
$backupPrivateKey = HierarchicalKeyFactory::fromEntropy((new Bip39SeedGenerator())->getSeed($backupMnemonic, "")); |
| 629 |
|
$backupPublicKey = BIP32Key::create($backupPrivateKey->toPublic(), "M"); |
| 630 |
|
} |
| 631 |
|
|
| 632 |
|
// create a checksum of our private key which we'll later use to verify we used the right password |
| 633 |
|
$checksum = $primaryPrivateKey->getPublicKey()->getAddress()->getAddress(); |