-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify verification of KeyFrag in WASM bindings #25
Comments
I guess the plan for this one is to call one of plain |
*The python version of this
Has these optional kwargs...
does this seem ok? |
Is that a common pattern in JS to handle optional arguments? Another possible variant is to just accept
but I guess that is more error-prone. |
Well the main difference with that would be that the arguments need to be
positional in that case.
It is fairly normal to take an object as “**kwargs”. It will just need to
be slightly different.
…On Mon, Jul 19, 2021 at 9:35 PM Bogdan Opanchuk ***@***.***> wrote:
Is that a common pattern in JS to handle optional arguments? Another
possible variant is to just accept null as a value, so you could write
e.g.
kfrag.verify(verifying_pk, delegating_pk, null)
but I guess that is more error-prone.
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
<#25 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABODDFFOED6HRPHEMDESFLTYT4I3ANCNFSM4UG3YTAQ>
.
|
If it's the standard way to deal with kwargs, then that'll work. |
Yeah it could be |
I think using objects as named parameters is not considered "best practice" as it's more pricey than passing primitives. However, there are cases where we want to provide the caller with extra safety (a lot of positional/optional parameters, security concerns, hard to debug behaviors). That being said, I think this is a completely acceptable solution in this case:
If |
thanks @piotr-roslaniec @fjarri I think I can go forward with this consensus! |
For now we're using a custom type ( verify(verifying_pk: PublicKey, delegating_pk: PublicKey | null, receiving_pk: PublicKey | null): VerifiedKeyFrag; When |
wasm-bindgen
does not supportOption<&MyType>
parameters, andOption<MyType>
have undesired side effects on the JS side (see rustwasm/wasm-bindgen#2370). So instead of oneverify()
with optional parameters we have to have four methods. Fix it when the blocker is fixed, or find a way to make it less cumbersome.The text was updated successfully, but these errors were encountered: