Skip to content

Commit ea01a4d

Browse files
implement set_root_key_id without error handling
1 parent 3c5527f commit ea01a4d

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

js-tests/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,10 @@ test("biscuit builder", function(t) {
3838
builder.addFact(fact`fact(${userId})`);
3939
builder.addRule(rule`u($id) <- user($id, ${userId})`);
4040
builder.addCheck(check`check if check(${userId})`);
41+
builder.setRootKeyId(1234);
4142
t.equal(
4243
builder.toString(),
43-
`// no root key id set
44+
`// root key id: 1234
4445
user("1234");
4546
fact("1234");
4647
u($id) <- user($id, "1234");

src/builder.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ impl BiscuitBuilder {
3636
self.0.merge(other.0.clone())
3737
}
3838

39+
/// Sets the root key id
40+
#[wasm_bindgen(js_name = setRootKeyId)]
41+
pub fn set_root_key_id(&mut self, root_key_id: u32) {
42+
self.0.set_root_key_id(root_key_id)
43+
}
44+
3945
/// Adds a Datalog fact
4046
#[wasm_bindgen(js_name = addFact)]
4147
pub fn add_fact(&mut self, fact: &Fact) -> Result<(), JsValue> {

0 commit comments

Comments
 (0)