diff --git a/docs/rfcs/2026-09-10-wallet-keys.md b/docs/rfcs/2026-09-10-wallet-keys.md index 123bfb568c..f2923dd2c7 100644 --- a/docs/rfcs/2026-09-10-wallet-keys.md +++ b/docs/rfcs/2026-09-10-wallet-keys.md @@ -66,12 +66,12 @@ at the profile level, while what a profile buys sits at the address level. Internal API. The names commands will call these; users will not. ``` -/_wallet the next name addresses -/_wallet create new generate the seed -/_wallet create seed= take the seed from a phrase -/_wallet export the seed mnemonic -/_wallet export one derived secret, as 0x and 64 hex digits -/_wallet delete delete the seed +/_wallet the next name addresses +/_wallet create new generate the seed +/_wallet create mnemonic= take the seed from a mnemonic +/_wallet export the seed mnemonic +/_wallet export one derived secret, as 0x and 64 hex digits +/_wallet delete delete the seed ``` Creating and importing are one command, because they differ only in where the diff --git a/src/Simplex/Chat/Library/Commands.hs b/src/Simplex/Chat/Library/Commands.hs index b336aca007..c601c3efd6 100644 --- a/src/Simplex/Chat/Library/Commands.hs +++ b/src/Simplex/Chat/Library/Commands.hs @@ -5584,7 +5584,7 @@ chatCommandP = "/_service_request " *> (APISendServiceRequest <$> A.decimal <* A.space <*> strP <*> optional (" timeout=" *> (realToFrac <$> A.double)) <*> optional (" sign_key=" *> strP) <* A.space <*> jsonP), "/_service_response " *> (APISendServiceResponse <$> A.decimal <* A.space <*> strP <* A.space <*> jsonP), "/_wallet create new" $> APIWalletCreate Nothing, - "/_wallet create seed=" *> (APIWalletCreate . Just <$> textP), + "/_wallet create mnemonic=" *> (APIWalletCreate . Just <$> textP), "/_wallet export " *> (APIWalletExportDerivedSecret <$> keyIndexP), "/_wallet export" $> APIWalletExportSeedMnemonic, "/_wallet delete" $> APIWalletDelete, diff --git a/tests/WalletTests.hs b/tests/WalletTests.hs index e84ed81eeb..4afbb0bff9 100644 --- a/tests/WalletTests.hs +++ b/tests/WalletTests.hs @@ -96,7 +96,7 @@ testWalletPersists ps = do testWalletSharedByProfiles :: HasCallStack => TestParams -> IO () testWalletSharedByProfiles ps = withNewTestChat ps "alice" aliceProfile $ \alice -> do - alice ##> ("/_wallet create seed=" <> B.unpack testPhrase) + alice ##> ("/_wallet create mnemonic=" <> B.unpack testPhrase) rows <- nameRows alice alice ##> "/create user alisa" showActiveUser alice "alisa" @@ -109,20 +109,20 @@ testWalletSharedByProfiles ps = withNewTestChat ps "alice" aliceProfile $ \alice testWalletImport :: HasCallStack => TestParams -> IO () testWalletImport ps = withNewTestChat ps "alice" aliceProfile $ \alice -> do - alice ##> ("/_wallet create seed=" <> B.unpack testPhrase) + alice ##> ("/_wallet create mnemonic=" <> B.unpack testPhrase) alice <## "m/44'/60'/0'/0/1 0x6Fac4D18c912343BF86fa7049364Dd4E424Ab9C0" alice <## "m/44'/60'/0'/0/2 0xb6716976A3ebe8D39aCEB04372f22Ff8e6802D7A" alice ##> "/_wallet export" alice <## B.unpack testPhrase - alice ##> ("/_wallet create seed=" <> B.unpack testPhrase) + alice ##> ("/_wallet create mnemonic=" <> B.unpack testPhrase) alice <## "bad chat command: this device already has a wallet key" -- a mistyped phrase says nothing about which word was wrong - alice ##> ("/_wallet create seed=" <> B.unpack (B.unwords $ replicate 12 "abandon")) + alice ##> ("/_wallet create mnemonic=" <> B.unpack (B.unwords $ replicate 12 "abandon")) alice <## "bad chat command: bad recovery phrase" testWalletExportDerivedSecret :: HasCallStack => TestParams -> IO () testWalletExportDerivedSecret ps = withNewTestChat ps "alice" aliceProfile $ \alice -> do - alice ##> ("/_wallet create seed=" <> B.unpack testPhrase) + alice ##> ("/_wallet create mnemonic=" <> B.unpack testPhrase) _ <- nameRows alice alice ##> "/_wallet export 1" alice <## "m/44'/60'/0'/0/1 0x6Fac4D18c912343BF86fa7049364Dd4E424Ab9C0 0x9a983cb3d832fbde5ab49d692b7a8bf5b5d232479c99333d0fc8e1d21f1b55b6" @@ -135,22 +135,22 @@ testWalletExportDerivedSecret ps = withNewTestChat ps "alice" aliceProfile $ \al testWalletDelete :: HasCallStack => TestParams -> IO () testWalletDelete ps = withNewTestChat ps "alice" aliceProfile $ \alice -> do - alice ##> ("/_wallet create seed=" <> B.unpack testPhrase) + alice ##> ("/_wallet create mnemonic=" <> B.unpack testPhrase) _ <- nameRows alice alice ##> "/_wallet delete" alice <## "no wallet key" - alice ##> ("/_wallet create seed=" <> B.unpack testPhrase) + alice ##> ("/_wallet create mnemonic=" <> B.unpack testPhrase) _ <- nameRows alice pure () testWalletImportThenRestore :: HasCallStack => TestParams -> IO () testWalletImportThenRestore ps = withNewTestChat ps "alice" aliceProfile $ \alice -> do - alice ##> ("/_wallet create seed=" <> B.unpack testPhrase) + alice ##> ("/_wallet create mnemonic=" <> B.unpack testPhrase) _ <- nameRows alice -- restoring the database replaces the seed with what the backup held, which is nothing forgetSeed alice alice ##> "/_wallet" alice <## "no wallet key" - alice ##> ("/_wallet create seed=" <> B.unpack testPhrase) + alice ##> ("/_wallet create mnemonic=" <> B.unpack testPhrase) rows <- nameRows alice map fst rows `shouldBe` ["m/44'/60'/0'/0/1", "m/44'/60'/0'/0/2"]