feat(sdk-core): add root-fetch detour in getUserPrv for safe child wallets - #9488
Conversation
ebc1572 to
a8653a5
Compare
a8653a5 to
fb3f9e8
Compare
|
|
||
| const decryptedPrv = await this.wallet.getPrv({ walletPassphrase }); | ||
| let decryptedPrv: string; | ||
| if (this.wallet.safeId()) { |
There was a problem hiding this comment.
Even if the wallet does come from a safe - if the spender is someone who the wallet was shared with, they will not require this detour - it is only required if it is the wallet minter.
There was a problem hiding this comment.
Make sense, removed the large if safeId() block and just detoured to getUserPrv if it is the safe wallet minter
2a91432 to
8850785
Compare
| ); | ||
| } | ||
|
|
||
| const rootKeychain = params.rootKeychain ?? (await fetchRootKeychainForSafeChild(keychains, childKeychain)); |
There was a problem hiding this comment.
nit: doesn't assert rootKeychain.id === childKeychain.parent before use, the pub-match check below catches a mismatch but an explicit assertion would make the invariant self-documenting
There was a problem hiding this comment.
I feel this could be a bit redundant - am okay with adding if we strongly feel it adds value though!
|
|
||
| // Soft seed derivation for SMC (and any explicit coldDerivationSeed), including | ||
| // after decrypting encryptedPrv when no params.prv was passed. | ||
| if (userPrv && params.coldDerivationSeed) { |
There was a problem hiding this comment.
nit: coldDerivationSeed now applies after decrypting encryptedPrv too, previously only for direct params.prv. no call site currently passes both together, intentional new path or unused scope creep?
There was a problem hiding this comment.
Thanks for calling this out, it was unintentional. No callers as you mentioned but looking to keep the existing paths the same and only add the additional path for the safe children. Closed this gap
8850785 to
82522a1
Compare
82522a1 to
b767ca2
Compare
Ticket: WCN-1200
Summary
Test plan