-
Notifications
You must be signed in to change notification settings - Fork 10
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
No addRootKeyId functionality #42
Comments
It has not been exposed yet. That could be a nice first contribution. The difference with python is that we can't move JS closures to the rust side, so we can't have a key selection based on the root key id function in JS (we might be able to work around it by providing a map instead of a function to provide minimal support). If you're interested i can provide guidance / help. |
I am interested, although it's probably something I would have to do in my spare time. I've limited experience with WASM, so a good place to start would be guidance on that. For clarity, if I were to set a fact when creating the biscuit like |
The key id is set in a different way indeed: since it is needed to verify the token signature, it is used before any datalog operation happens, so it requires being set this way. The setting part is easy to do. The trickier part is using this key id when parsing a token in biscuit-wasm (which might not be an issue for you if you intend to use this lib only to mint tokens (or to only consume tokens signed with a single key). As for the wasm setup, it's fairly well integrated in cargo.
When exposing a new function like setRootKeyId, most of the work is defining a new function in the rust code, with the proper annotation for exposing it as a JS function, and add a couple JS tests to make sure it behaves as expected. |
Thanks very much for all the info. As you've correctly deduced, my main interest is in minting tokens although it would be nice if our front end could also perform the key selection natively. I will certainly attempt to implement the setRootKeyId function, and depending on how that goes I will ask for more help and try to implement the key selection piece. |
Thanks for merging the commit relating to setRootKeyId, do you have a timeline for when the next version of this package would be published to the npm registry? I would also be keen to have a look at the key selection part. I guess your idea to use a map instead of a function would be something like:
{
[key id]: {public key}
}
Is that more or less right? Based on reading the wasm serde bindgen docs, it seems like using a json string as the argument could be faster than a js object as well? |
@divarvel thanks! Is anything additional required to publish the new version to npm? |
nope, https://www.npmjs.com/package/@biscuit-auth/biscuit-wasm/v/0.4.1 (i gave adding key selection a try, but it's a bit more involved, i don't have anything working yet) |
I'm happy to have a go if you don't have time |
i pushed a branch with the current state of things https://github.com/biscuit-auth/biscuit-wasm/tree/key-selector part of the changes are due to an update to |
Thanks, I will take a look this weekend if you haven't solved it by then. |
I notice in the Python library, there is a
set_root_key_id
method on thebuilder
construct, but nothing like that seems to exist in this library.Are there plans to add it? Or is it equivalent to just add the root key id as a normal fact?
The text was updated successfully, but these errors were encountered: