邮箱脱敏
在保留域可见度的同时遮盖局部部件.
全球电话格式
在保留格式与后四位可见的同时脱敏敏感数字。
构建器式 API
在处理前显式启用邮箱/电话脱敏与掩码字符。
安装与开始使用
Zig [git-only: v0.2.0]: 使用下方当前的安装方式,加载 Zig API 并运行最小示例。该示例会明确启用电子邮件和电话号码遮罩,并显示预期输出。
安装
zig fetch --save https://github.com/finitefield-org/mask-pii/archive/refs/tags/v0.2.0.tar.gz
使用
src/main.zig
const std = @import("std");
const MaskPII = @import("mask-pii");
pub fn main() !void {
var masker = MaskPII.Masker.init();
_ = masker.maskEmails().maskPhones().withMaskChar('#');
const allocator = std.heap.page_allocator;
const input = "Contact: alice@example.com or 090-1234-5678.";
const output = try masker.process(allocator, input);
defer allocator.free(output);
try std.io.getStdOut().writer().print("{s}\n", .{output});
// Output: "Contact: a####@example.com or ###-####-5678."
}
注意
请查看 README ,以获取该语言对应包生态与 API 示例。