diff --git a/biscuit/build.zig b/biscuit/build.zig index 6c69439..d4ff429 100644 --- a/biscuit/build.zig +++ b/biscuit/build.zig @@ -42,6 +42,7 @@ pub fn build(b: *std.Build) void { }); lib_unit_tests.root_module.addImport("biscuit-schema", schema.module("biscuit-schema")); lib_unit_tests.root_module.addImport("biscuit-format", format.module("biscuit-format")); + lib_unit_tests.root_module.addImport("biscuit-builder", builder.module("biscuit-builder")); lib_unit_tests.root_module.addImport("biscuit-datalog", datalog.module("biscuit-datalog")); const run_lib_unit_tests = b.addRunArtifact(lib_unit_tests); diff --git a/biscuit/src/biscuit.zig b/biscuit/src/biscuit.zig index 13b0423..bf00222 100644 --- a/biscuit/src/biscuit.zig +++ b/biscuit/src/biscuit.zig @@ -2,6 +2,7 @@ const std = @import("std"); const mem = std.mem; const Ed25519 = std.crypto.sign.Ed25519; const Authorizer = @import("authorizer.zig").Authorizer; +const AuthorizerError = @import("authorizer.zig").AuthorizerError; const Block = @import("block.zig").Block; const SymbolTable = @import("biscuit-datalog").SymbolTable; const World = @import("biscuit-datalog").world.World; @@ -124,10 +125,13 @@ test { var b = try Biscuit.fromBytes(allocator, bytes, public_key); defer b.deinit(); - var a = b.authorizer(allocator); + var a = try b.authorizer(allocator); defer a.deinit(); - try a.authorize(); + var errors = std.ArrayList(AuthorizerError).init(allocator); + defer errors.deinit(); + + _ = try a.authorize(&errors); } } @@ -155,9 +159,12 @@ test "Tokens that should fail to validate" { var b = try Biscuit.fromBytes(allocator, bytes, public_key); defer b.deinit(); - var a = b.authorizer(allocator); + var a = try b.authorizer(allocator); defer a.deinit(); - try testing.expectError(error.AuthorizationFailed, a.authorize()); + var errors = std.ArrayList(AuthorizerError).init(allocator); + defer errors.deinit(); + + try testing.expectError(error.AuthorizationFailed, a.authorize(&errors)); } }