Conversation
components/brave_wallet/browser/polkadot/polkadot_utils_unittest.cc
Outdated
Show resolved
Hide resolved
components/brave_wallet/browser/polkadot/polkadot_import_keyring.h
Outdated
Show resolved
Hide resolved
components/brave_wallet/browser/polkadot/polkadot_import_keyring_unittest.cc
Show resolved
Hide resolved
|
Chromium major version is behind target branch (145.0.7632.109 vs 146.0.7680.32). Please rebase. |
|
Hmm, I'm wondering: do we need to introduce a new class here or can we just extend/modify the existing PolkadotKeyring? If all we're doing is just storing something like this: base::flat_map<uint32_t, HDKeySr25519> secondary_keys_;it feels like we should be able to reify all this functionality into a single umbrella, no? The only reason I push back against a new keyring type is that it seems to duplicate a lot of functionality and it increases our testing burden a lot more. |
I am following bitcoin approach here which is latest coin that supports import. |
|
Warning You have got a presubmit warning. Please address it if possible. Items: |
Polkadot import keyring required to store polkadot imported accounts. This PR also moves encoding\decoding methods to polkadot_utils to reuse them.
|
[puLL-Merge] - brave/brave-core@34209 DescriptionThis PR introduces a new Possible Issues
Security Hotspots
ChangesChanges
Test files
sequenceDiagram
participant Caller
participant PolkadotImportKeyring
participant HDKeySr25519
participant PolkadotKeyring
participant polkadot_utils
participant scrypt_utils
Note over Caller: Import Account Flow
Caller->>PolkadotImportKeyring: AddAccount(index, pkcs8_key)
PolkadotImportKeyring->>HDKeySr25519: CreateFromPkcs8(pkcs8_key)
HDKeySr25519-->>PolkadotImportKeyring: HDKeySr25519 instance
PolkadotImportKeyring-->>Caller: true/false
Note over Caller: Get Address
Caller->>PolkadotImportKeyring: GetAccountAddress(index)
PolkadotImportKeyring->>HDKeySr25519: GetPublicKey()
PolkadotImportKeyring->>polkadot_utils: Ss58Address::Encode()
polkadot_utils-->>Caller: SS58 address string
Note over Caller: Export Private Key
Caller->>PolkadotImportKeyring: EncodePrivateKeyForExport(index, password)
PolkadotImportKeyring->>PolkadotKeyring: EncodePrivateKeyForExport(keypair, password, salt, nonce)
PolkadotKeyring->>polkadot_utils: EncodePrivateKeyForExport(pkcs8, addr, pw, salt, nonce)
polkadot_utils->>scrypt_utils: ScryptDeriveKey(password, salt, params)
scrypt_utils-->>polkadot_utils: derived_key
polkadot_utils->>scrypt_utils: XSalsaPolyEncrypt(pkcs8, key, nonce)
scrypt_utils-->>polkadot_utils: ciphertext
polkadot_utils-->>Caller: JSON string
Note over Caller: Import from JSON
Caller->>polkadot_utils: DecodePrivateKeyFromExport(json, password)
polkadot_utils->>scrypt_utils: ScryptDeriveKey(password, salt, params)
scrypt_utils-->>polkadot_utils: derived_key
polkadot_utils->>scrypt_utils: XSalsaPolyDecrypt(ciphertext, nonce, key)
scrypt_utils-->>polkadot_utils: pkcs8_key
polkadot_utils-->>Caller: pkcs8_key array
|
* [Polkadot] Present Polkadot import keyring Polkadot import keyring required to store polkadot imported accounts. This PR also moves encoding\decoding methods to polkadot_utils to reuse them.
Polkadot import keyring required to store polkadot imported accounts. This PR also moves encoding\decoding methods to polkadot_utils to reuse them.
Resolves