|
@@ 608-614 (lines=7) @@
|
| 605 |
|
throw new \InvalidArgumentException("Can't store Primary Mnemonic on server without a passphrase"); |
| 606 |
|
} |
| 607 |
|
|
| 608 |
|
if ($primaryPrivateKey) { |
| 609 |
|
if (is_string($primaryPrivateKey)) { |
| 610 |
|
$primaryPrivateKey = [$primaryPrivateKey, "m"]; |
| 611 |
|
} |
| 612 |
|
} else { |
| 613 |
|
$primaryPrivateKey = HierarchicalKeyFactory::fromEntropy((new Bip39SeedGenerator())->getSeed($primaryMnemonic, $options['passphrase'])); |
| 614 |
|
} |
| 615 |
|
|
| 616 |
|
if (!$storePrimaryMnemonic) { |
| 617 |
|
$primaryMnemonic = false; |
|
@@ 639-646 (lines=8) @@
|
| 636 |
|
$backupPublicKey = $options['backup_public_key']; |
| 637 |
|
} |
| 638 |
|
|
| 639 |
|
if ($backupPublicKey) { |
| 640 |
|
if (is_string($backupPublicKey)) { |
| 641 |
|
$backupPublicKey = [$backupPublicKey, "m"]; |
| 642 |
|
} |
| 643 |
|
} else { |
| 644 |
|
$backupPrivateKey = HierarchicalKeyFactory::fromEntropy((new Bip39SeedGenerator())->getSeed($backupMnemonic, "")); |
| 645 |
|
$backupPublicKey = BIP32Key::create($backupPrivateKey->toPublic(), "M"); |
| 646 |
|
} |
| 647 |
|
|
| 648 |
|
// create a checksum of our private key which we'll later use to verify we used the right password |
| 649 |
|
$checksum = $primaryPrivateKey->getPublicKey()->getAddress()->getAddress(); |