Skip to content

Commit

Permalink
Merge pull request #44 from louisjmorgan/set-rootkey-id
Browse files Browse the repository at this point in the history
implement set_root_key_id
  • Loading branch information
divarvel authored Dec 11, 2023
2 parents 3c5527f + ea01a4d commit 73431c4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
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

0 comments on commit 73431c4

Please sign in to comment.