diff --git a/backend/core/identity.go b/backend/core/identity.go index 297807e26..fd3f226f0 100644 --- a/backend/core/identity.go +++ b/backend/core/identity.go @@ -45,13 +45,15 @@ func AccountFromMnemonic(m []string, passphrase string) (KeyPair, error) { return AccountFromSeed(seed) } -// AccountDerivationPath value according to SLIP-10 and BIP-44. -// 109116116 is the concatenation of Unicode code point values for letters mtt - stands for Mintter. -const AccountDerivationPath = "m/44'/109116116'/0'" +// keyDerivationPath value according to SLIP-10 and BIP-44. +// 104109 is the concatenation of Unicode code point values for 'hm' - stands for Hypermedia. +// The first zero segment can be incremented to derive multiple accounts eventually. +// PR to add our derivation code to SLIP-44: https://github.com/satoshilabs/slips/pull/1742. +const keyDerivationPath = "m/44'/104109'/0'/0/0" // AccountFromSeed creates an account key pair from a previously generated entropy. func AccountFromSeed(rand []byte) (KeyPair, error) { - slipSeed, err := slip10.DeriveForPath(AccountDerivationPath, rand) + slipSeed, err := slip10.DeriveForPath(keyDerivationPath, rand) if err != nil { return KeyPair{}, err } diff --git a/backend/core/identity_test.go b/backend/core/identity_test.go index b994f48f2..c2c335a1b 100644 --- a/backend/core/identity_test.go +++ b/backend/core/identity_test.go @@ -12,7 +12,7 @@ func TestSLIP10Derivation(t *testing.T) { seed, err := hex.DecodeString("000102030405060708090a0b0c0d0e0f") require.NoError(t, err) - k, err := slip10.DeriveForPath(AccountDerivationPath, seed) + k, err := slip10.DeriveForPath(keyDerivationPath, seed) require.NoError(t, err) require.Equal(t, "6dba7f7e7d2e1e51072c601e2e35cdd7025cea3978c4ecc54068b84f0f666a40", hex.EncodeToString(k.Seed())) diff --git a/backend/mttnet/mttnet.go b/backend/mttnet/mttnet.go index 630a040ec..92bf791bc 100644 --- a/backend/mttnet/mttnet.go +++ b/backend/mttnet/mttnet.go @@ -46,6 +46,11 @@ import ( const protocolSupportKey = "mintter-support" // This is what we use as a key to protect the connection in ConnManager. +const ( + protocolPrefix = "/hypermedia/" + protocolVersion = "0.4.0" +) + var userAgent = "mintter/" // GatewayClient is the bridge to talk to the gateway. @@ -160,7 +165,7 @@ func New(cfg config.P2P, db *sqlitex.Pool, blobs *hyper.Storage, me core.Identit testnetSuffix = "-" + cfg.TestnetName } - protoInfo := newProtocolInfo("/hypermedia/", "0.3.0"+testnetSuffix) + protoInfo := newProtocolInfo(protocolPrefix, protocolVersion+testnetSuffix) client := newClient(me, host, protoInfo.ID) clean.Add(client)