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.
- Host: GitHub
- URL: https://github.com/luukdegram/otp
- Owner: Luukdegram
- License: mit
- Created: 2020-04-26T17:33:03.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-07-29T17:20:39.000Z (about 5 years ago)
- Last Synced: 2025-03-29T02:51:29.219Z (7 months ago)
- Topics: one-time-password, otp, otpauth, zig, ziglang
- Language: Zig
- Size: 22.5 KB
- Stars: 10
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# OTP
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
```