Skip to content

Commit

Permalink
fixup! Implement query_exactly_one
Browse files Browse the repository at this point in the history
  • Loading branch information
divarvel committed Jan 17, 2025
1 parent 7462884 commit 790c7de
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
14 changes: 7 additions & 7 deletions biscuit-auth/src/token/authorizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,7 @@ impl Authorizer {
/// # use biscuit_auth::KeyPair;
/// # use biscuit_auth::Biscuit;
/// let keypair = KeyPair::new();
/// let mut builder = Biscuit::builder();
/// builder.add_fact("user(\"John Doe\", 42)");
/// let builder = Biscuit::builder().fact("user(\"John Doe\", 42)").unwrap();
///
/// let biscuit = builder.build(&keypair).unwrap();
///
Expand Down Expand Up @@ -1087,8 +1086,7 @@ mod tests {
use crate::Biscuit;
use crate::KeyPair;
let keypair = KeyPair::new();
let mut builder = Biscuit::builder();
builder.add_fact("user(\"John Doe\")").unwrap();
let builder = Biscuit::builder().fact("user(\"John Doe\")").unwrap();

let biscuit = builder.build(&keypair).unwrap();

Expand Down Expand Up @@ -1122,9 +1120,11 @@ mod tests {
use crate::Biscuit;
use crate::KeyPair;
let keypair = KeyPair::new();
let mut builder = Biscuit::builder();
builder.add_fact("user(\"John Doe\")").unwrap();
builder.add_fact("user(\"Jane Doe\")").unwrap();
let builder = Biscuit::builder()
.fact("user(\"John Doe\")")
.unwrap()
.fact("user(\"Jane Doe\")")
.unwrap();

let biscuit = builder.build(&keypair).unwrap();

Expand Down
4 changes: 4 additions & 0 deletions biscuit-capi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ pub enum ErrorKind {
FormatSignatureInvalidSignatureGeneration,
AlreadySealed,
Execution,
UnexpectedQueryResult,
}

#[no_mangle]
Expand Down Expand Up @@ -175,6 +176,9 @@ pub extern "C" fn error_kind() -> ErrorKind {
Token::RunLimit(RunLimit::TooManyFacts) => ErrorKind::TooManyFacts,
Token::RunLimit(RunLimit::TooManyIterations) => ErrorKind::TooManyIterations,
Token::RunLimit(RunLimit::Timeout) => ErrorKind::Timeout,
Token::RunLimit(RunLimit::UnexpectedQueryResult(_, _)) => {
ErrorKind::UnexpectedQueryResult
}
Token::ConversionError(_) => ErrorKind::ConversionError,
Token::Base64(_) => ErrorKind::FormatDeserializationError,
Token::Execution(_) => ErrorKind::Execution,
Expand Down

0 comments on commit 790c7de

Please sign in to comment.