Update build.zig; use @tagName instead std.meta.tagName
parent
6623561a2e
commit
eeed72622e
22
build.zig
22
build.zig
|
@ -3,14 +3,24 @@ const std = @import("std");
|
|||
pub fn build(b: *std.build.Builder) void {
|
||||
// Standard release options allow the person running `zig build` to select
|
||||
// between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall.
|
||||
const mode = b.standardReleaseOptions();
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
|
||||
const lib = b.addStaticLibrary("zig-jwt", "jwt.zig");
|
||||
lib.setBuildMode(mode);
|
||||
lib.install();
|
||||
const target = b.standardTargetOptions(.{});
|
||||
_ = b.addModule("jwt", .{
|
||||
.source_file = .{ .path = "jwt.zig" },
|
||||
});
|
||||
|
||||
var main_tests = b.addTest("jwt.zig");
|
||||
main_tests.setBuildMode(mode);
|
||||
const lib = b.addStaticLibrary(.{
|
||||
.name = "zig-jwt",
|
||||
.root_source_file = .{ .path = "jwt.zig" },
|
||||
.optimize = optimize,
|
||||
.target = target,
|
||||
});
|
||||
b.installArtifact(lib);
|
||||
|
||||
var main_tests = b.addTest(.{
|
||||
.root_source_file = .{ .path = "jwt.zig" },
|
||||
});
|
||||
|
||||
const test_step = b.step("test", "Run library tests");
|
||||
test_step.dependOn(&main_tests.step);
|
||||
|
|
2
jwt.zig
2
jwt.zig
|
@ -46,7 +46,7 @@ pub fn encode(allocator: std.mem.Allocator, comptime alg: Algorithm, payload: an
|
|||
pub fn encodeMessage(allocator: std.mem.Allocator, comptime alg: Algorithm, message: []const u8, signatureOptions: SignatureOptions) ![]const u8 {
|
||||
var protected_header = std.json.ObjectMap.init(allocator);
|
||||
defer protected_header.deinit();
|
||||
try protected_header.put("alg", .{ .string = std.meta.tagName(alg) });
|
||||
try protected_header.put("alg", .{ .string = @tagName(alg) });
|
||||
try protected_header.put("typ", .{ .string = "JWT" });
|
||||
if (signatureOptions.kid) |kid| {
|
||||
try protected_header.put("kid", .{ .string = kid });
|
||||
|
|
Loading…
Reference in New Issue