An open API service indexing awesome lists of open source software.

https://github.com/luukdegram/otp

Simple, basic OTP library written in Zig.
https://github.com/luukdegram/otp

one-time-password otp otpauth zig ziglang

Last synced: 6 months ago
JSON representation

Simple, basic OTP library written in Zig.

Awesome Lists containing this project

README

          

# OTP
![Test](https://github.com/Luukdegram/otp/workflows/Test/badge.svg)

OTP is a one-time-password library supporting both HOTP and TOTP according to [`RFC 4226`](https://tools.ietf.org/html/rfc4226) and [`RFC 6238`](https://tools.ietf.org/html/rfc6238).

Currently only the generation of codes is supported. Verification has to be done by the implementation.

**note**

This library's primary goal was to get more familair with the Zig language.

## Example
```zig
const std = @import("std");
const otp = @import("otp");
const warn = std.debug.warn;

pub fn main() !void {
const hotp = otp.Hotp.init();
const code = try hotp.generateCode("secretkey", 0);
warn("code: {}\n", .{code});
}
```
You can use the `build.zig` file as reference point on how to link the library to your own project.

### Tests
You can run the tests using the following command
```shell
zig build
```