|
@@ 622-628 (lines=7) @@
|
| 619 |
|
throw new \InvalidArgumentException("Can't store Primary Mnemonic on server without a passphrase"); |
| 620 |
|
} |
| 621 |
|
|
| 622 |
|
if ($primaryPrivateKey) { |
| 623 |
|
if (is_string($primaryPrivateKey)) { |
| 624 |
|
$primaryPrivateKey = [$primaryPrivateKey, "m"]; |
| 625 |
|
} |
| 626 |
|
} else { |
| 627 |
|
$primaryPrivateKey = HierarchicalKeyFactory::fromEntropy((new Bip39SeedGenerator())->getSeed($primaryMnemonic, $options['passphrase'])); |
| 628 |
|
} |
| 629 |
|
|
| 630 |
|
if (!$storePrimaryMnemonic) { |
| 631 |
|
$primaryMnemonic = false; |
|
@@ 653-660 (lines=8) @@
|
| 650 |
|
$backupPublicKey = $options['backup_public_key']; |
| 651 |
|
} |
| 652 |
|
|
| 653 |
|
if ($backupPublicKey) { |
| 654 |
|
if (is_string($backupPublicKey)) { |
| 655 |
|
$backupPublicKey = [$backupPublicKey, "m"]; |
| 656 |
|
} |
| 657 |
|
} else { |
| 658 |
|
$backupPrivateKey = HierarchicalKeyFactory::fromEntropy((new Bip39SeedGenerator())->getSeed($backupMnemonic, "")); |
| 659 |
|
$backupPublicKey = BIP32Key::create($backupPrivateKey->toPublic(), "M"); |
| 660 |
|
} |
| 661 |
|
|
| 662 |
|
// create a checksum of our private key which we'll later use to verify we used the right password |
| 663 |
|
$checksum = $primaryPrivateKey->getPublicKey()->getAddress()->getAddress(); |