I am running into a compilation error when trying to use std.crypto.asn1.Oid.StaticMap that I can decipher.
So the error is:
..../Application Support/Code/User/globalStorage/ziglang.vscode-zig/zig/macos-aarch64-0.14.0/lib/std/crypto/asn1/Oid.zig:190:67: error: Each field of 'root.PubKeyFmt' must map to exactly one OID
if (oid_to_enum.values().len != enum_info.fields.len) @compileError(error_msg);
^~~~~~~~~~~~~~~~~~~~~~~~
And this is how I am trying to use it:
pub const PK = enum {
rsa,
ecdsa_p256,
};
_ = std.crypto.asn1.Oid.StaticMap(PK).initComptime(.{
.rsa = "1.2.840.113549.1.1.1",
.ecdsa_p256 = "1.2.840.10045.2.1",
});
The reason why I do not get why this is failing compilation is because, the fields in the PK
enum matches what is being passed in as struct, and the enum is exhaustive.
So not sure why this check is failing at comp time
if (!enum_info.is_exhaustive or enum_info.fields.len != struct_info.fields.len) {
@compileError(error_msg);
}
What am I doing wrong?