Skip to content
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

implement set_root_key_id #44

Merged
merged 1 commit into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion js-tests/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@ test("biscuit builder", function(t) {
builder.addFact(fact`fact(${userId})`);
builder.addRule(rule`u($id) <- user($id, ${userId})`);
builder.addCheck(check`check if check(${userId})`);
builder.setRootKeyId(1234);
t.equal(
builder.toString(),
`// no root key id set
`// root key id: 1234
user("1234");
fact("1234");
u($id) <- user($id, "1234");
Expand Down
6 changes: 6 additions & 0 deletions src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ impl BiscuitBuilder {
self.0.merge(other.0.clone())
}

/// Sets the root key id
#[wasm_bindgen(js_name = setRootKeyId)]
pub fn set_root_key_id(&mut self, root_key_id: u32) {
self.0.set_root_key_id(root_key_id)
}

/// Adds a Datalog fact
#[wasm_bindgen(js_name = addFact)]
pub fn add_fact(&mut self, fact: &Fact) -> Result<(), JsValue> {
Expand Down