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