Skip to content

Conversation

@0xnullifier
Copy link
Contributor

No description provided.

@0xnullifier 0xnullifier force-pushed the feat/external-keystore-worker branch from d77bcb7 to 3398498 Compare December 2, 2025 04:07
@0xnullifier 0xnullifier changed the base branch from next to main December 2, 2025 04:07
@0xnullifier 0xnullifier force-pushed the feat/external-keystore-worker branch from 3398498 to 65d9cee Compare December 2, 2025 05:07
Copy link
Contributor

@WiktorStarczewski WiktorStarczewski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
Full disclosure, I did contribute a couple of snippets for this, so I'm biased though. (hence I shouldn't be the approver)

Comment on lines +112 to +114
insertKeyCb?: (
pubKey: Uint8Array,
secretKey: Uint8Array
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm aware this is already in the codebase. But It does make me raise an eyebrow the fact that we pass the secret key, I'm not saying this is wrong per se, but is this the proper way to handle it? Are there any chances of accidentaly revealing the SK given that it is a parameter?

Copy link
Contributor

@WiktorStarczewski WiktorStarczewski Dec 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anything can be revealed, but I think that the fact that its a parameter doesn't increase the exposure on its own. The only way this could be sniffed was if there was a console.log or a throw possible (generating stack trace), and that's down to the caller (callback implementation). So it is a risk in the sense that the caller uses a method exposing the secret key, therefore the secret is exposed, so care should be taken - but not because of the way we expose it. Does this make sense? Do you think it needs stronger documentation? Or would you advocate for a rethink whether not to pass it like this at all?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it does make sense, and I think the callback explains itself (because of what you said about stronger docs).
That being said, I'm not really sure if there's really another way to do it though, plus the SK import should happen only once.

this.signCb,
!!this.getKeyCb,
!!this.insertKeyCb,
!!this.signCb,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this change needed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To signify that we are not actually going to call those callbacks, this is just a boolean condition on whether to use the callbacks defined at the point of client instantiation. Otherwise it felt misleading.

Copy link
Contributor Author

@0xnullifier 0xnullifier Dec 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also adding to that we can't pass functions to the worker as they are not structurally cloneable thus we send boolean indicating if we have the functions on the main thread and use proxies instead

Copy link
Collaborator

@fkrause98 fkrause98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, left some comments.

@igamigo
Copy link
Collaborator

igamigo commented Dec 5, 2025

@0xnullifier can you resolve conflicts on this PR? I believe this should be ready to merge

@0xnullifier 0xnullifier force-pushed the feat/external-keystore-worker branch 2 times, most recently from a61d0f6 to ba647a5 Compare December 6, 2025 04:24
@0xnullifier 0xnullifier force-pushed the feat/external-keystore-worker branch from ba647a5 to df2a279 Compare December 6, 2025 04:26
@0xnullifier 0xnullifier requested a review from igamigo December 6, 2025 04:27
@WiktorStarczewski WiktorStarczewski merged commit cad2efc into 0xMiden:main Dec 8, 2025
22 checks passed
@WiktorStarczewski WiktorStarczewski deleted the feat/external-keystore-worker branch December 8, 2025 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants