mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-10-23 06:22:43 +00:00
core: pin simplexmq for the BIP-44 path, and use it
ethereumPath now takes the address index, so the path a name key sits at is built once in the library rather than again here. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rvc3HbiWBTqbAvRT45G5oX
This commit is contained in:
1 parent
81fd2415a5
commit
3ad17ca477
3 files changed
+5
-8
No files matched your search
+1
-1
@@ -21,7 +21,7 @@ constraints: zip +disable-bzip2 +disable-zstd
|
||||
source-repository-package
|
||||
type: git
|
||||
location: https://github.com/simplex-chat/simplexmq.git
|
||||
tag: a23da20fb53eb6e43012aa5ee305ed41f7f6f6ab
|
||||
tag: 22987046875e2a7e40ef3c1d3cba89879b437581
|
||||
|
||||
source-repository-package
|
||||
type: git
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"https://github.com/simplex-chat/simplexmq.git"."a23da20fb53eb6e43012aa5ee305ed41f7f6f6ab" = "1s0m80i0z7b5x7xx2rqkzqv28zaxmmfm4x1vkgka1vb9qxmpb1p1";
|
||||
"https://github.com/simplex-chat/simplexmq.git"."22987046875e2a7e40ef3c1d3cba89879b437581" = "1xx1id2xq2l0wk9qqbwnykpyw5w7sicq28rwg44c7rxpx7gyj6dx";
|
||||
"https://github.com/simplex-chat/hs-socks.git"."a30cc7a79a08d8108316094f8f2f82a0c5e1ac51" = "0yasvnr7g91k76mjkamvzab2kvlb1g5pspjyjn2fr6v83swjhj38";
|
||||
"https://github.com/simplex-chat/direct-sqlcipher.git"."f814ee68b16a9447fbb467ccc8f29bdd3546bfd9" = "1ql13f4kfwkbaq7nygkxgw84213i0zm7c1a8hwvramayxl38dq5d";
|
||||
"https://github.com/simplex-chat/sqlcipher-simple.git"."a46bd361a19376c5211f1058908fc0ae6bf42446" = "1z0r78d8f0812kxbgsm735qf6xx8lvaz27k1a0b4a2m0sshpd5gl";
|
||||
|
||||
@@ -30,6 +30,7 @@ import Data.Word (Word32)
|
||||
import qualified Simplex.Messaging.Crypto.BIP32 as B32
|
||||
import qualified Simplex.Messaging.Crypto.BIP39 as B39
|
||||
import qualified Simplex.Messaging.Crypto.Secp256k1 as S
|
||||
import Simplex.Messaging.Eth.Address (ethereumPath)
|
||||
|
||||
type SeedId = Int64
|
||||
|
||||
@@ -64,15 +65,11 @@ seedMaster s = do
|
||||
m <- B39.entropyToMnemonic (wsEntropy s)
|
||||
B32.masterKey (B39.mnemonicToSeed m "")
|
||||
|
||||
-- | So the phrase reaches the same addresses in other wallets.
|
||||
nameKeyPath :: AccountIndex -> NameIndex -> [Word32]
|
||||
nameKeyPath acc nm = [B32.hardened 44, B32.hardened 60, B32.hardened acc, 0, nm]
|
||||
|
||||
renderNameKeyPath :: AccountIndex -> NameIndex -> Text
|
||||
renderNameKeyPath acc nm = decodeLatin1 . B32.renderPath $ nameKeyPath acc nm
|
||||
renderNameKeyPath acc nm = decodeLatin1 . B32.renderPath $ ethereumPath acc nm
|
||||
|
||||
deriveNameKey :: B32.ExtendedKey -> AccountIndex -> NameIndex -> Either String S.PrivateKey
|
||||
deriveNameKey master acc nm = B32.xkKey <$> B32.derivePath master (nameKeyPath acc nm)
|
||||
deriveNameKey master acc nm = B32.xkKey <$> B32.derivePath master (ethereumPath acc nm)
|
||||
|
||||
-- | As wallets take it when a key is imported on its own.
|
||||
nameKeySecret :: S.PrivateKey -> ByteString
|
||||
|
||||
Reference in new issue
Block a user