Skip to content

Initial implementation#2

Merged
maurges merged 15 commits intomfrom
master
Apr 15, 2025
Merged

Initial implementation#2
maurges merged 15 commits intomfrom
master

Conversation

@maurges
Copy link
Copy Markdown
Contributor

@maurges maurges commented Jan 21, 2025

Based on threshold BLS paper for MPC.

Docs may be improved I feel, but they already outnumber the code

@maurges maurges requested a review from survived January 21, 2025 16:02
@survived
Copy link
Copy Markdown
Contributor

Didn't we want to do a threshold DH after all? I thought we'll end up with a protocol in which parties share secret key $x$, and given point $P$, parties can jointly compute $xP$. This should allow us to construct a KEM, but also, if we ever need the deterministic threshold one-way function, we can replace $X$ with hash_to_curve(...) in downstream library

@maurges
Copy link
Copy Markdown
Contributor Author

maurges commented Jan 22, 2025

Didn't we want to do a threshold DH after all?

We never discussed it in detail, so I just finished what I had. Your idea sounds useful, I'll switch to it

@maurges
Copy link
Copy Markdown
Contributor Author

maurges commented Jan 30, 2025

I'll rename the repo before merge. Not sure if we want to reserve a crates.io name before actually using this anywhere

@survived
Copy link
Copy Markdown
Contributor

Not sure if we want to reserve a crates.io name before actually using this anywhere

I usually do that, I've been in situation when a troll took crate name before we found time to publish it. Our repo is yet private, so the risk is smaller

Copy link
Copy Markdown
Contributor

@survived survived left a comment

Choose a reason for hiding this comment

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

The crate overall feels a bit too low-level. On one hand we have start_ecdh function, which uses round-based and key-share crates, and which is pretty intuitive, but on other hand, we have {partial_ecdh, aggregate} functions, which are quite difficult to use: one needs to manually extract necessary information from the key share, and figure out what piece of information to put to each argument (in my intuition, it may be very confusing for someone unfamiliar with MPC).

I'm not sure what the best way to improve. Possible approaches:

  1. Move low-level functions into separate module, for advanced users to find
  2. Annotate each function that it's low level, and that it's more difficult to use, and if you're unsure, please use start_ecdh.
  3. Change the functions so they do accept the key share or key info

@maurges
Copy link
Copy Markdown
Contributor Author

maurges commented Jan 31, 2025

The low-levelness and the missing examples come from one reason: we don't currently have a usage for this crate. I wrote both styles, intending to see how we're going to use it in signers (the first draft used high-level run and I think we would have gone with it). It's hard to design a good API without a use-case.

Moving lower-level functions into a separate module and documenting them as such seems like a good idea.

@survived
Copy link
Copy Markdown
Contributor

we don't currently have a usage for this crate

We do! Asymmetric encryption! Large one on our roadmap

@survived
Copy link
Copy Markdown
Contributor

Ah you mean that it's not currently used anywhere in the code yet. Yeah, that's true, when you write a code that uses the library, it's easier to polish the API.

@survived
Copy link
Copy Markdown
Contributor

survived commented Jan 31, 2025

On other hand, current API is usable, so you can easily use partial_ecdh/aggregate functions in the prod code (no brainer for you, as you wrote it), and then it will stay the same for eternity 😅 I'd rather make them accept key-share, so we don't need to decompose key shares in prod code, and do complex input arguments manipulation

@survived
Copy link
Copy Markdown
Contributor

Anyway, separating low-level function into separate module is a good first step. I will look after prod code so they don't get to be used there 😃

nikita-dfns and others added 2 commits February 21, 2025 12:02
Signed-off-by: Denis Varlakov <denis@dfns.co>
@maurges maurges merged commit 600b6c9 into m Apr 15, 2025
8 checks passed
@maurges maurges deleted the master branch April 15, 2025 12:03
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.

3 participants