No description
Find a file
2023-04-15 09:55:03 +10:00
.github/workflows github action script 2021-02-03 20:17:22 +11:00
src Implement gcsafe 2023-04-13 00:44:02 +02:00
tests minor project structre modification and convert 4spaces indents to 2spaces 2021-04-10 03:00:19 +10:00
.gitignore change project structure and add .nimble 2021-02-02 18:48:36 +11:00
LICENSE Create License 2021-07-30 12:17:52 +10:00
nauthy.nimble fix incorrect srcDir in nauthy.nimble 2022-01-10 10:57:53 +08:00
README.md Update README.md 2022-01-08 16:33:20 +04:00

nauthy - one-time password library for nim

nauthy is a Nim library for generating and verifying one-time passwords: HOTP (RFC4226) and TOTP (RFC6238). Various hash modes are supported: md5, sha1, sha256 and sha512. Support for key URI is also included.

Basic example:

import nauthy
 
# Construct a new TOTP with a base-32 encoded key.
var totp = initTotp("HXDMVJECJJWSRB3HWIZR4IFUGFTMXBOZ")
# Print out the current totp value
echo totp.now()

# Construct a new TOTP from a URI.
var otp = otpFromUri(
   "otpauth://totp/ACME%20Co:john@example.com?secret=HXDMVJECJJWSRB3HWIZR4IFUGFTMXBOZ&issuer=ACME%20Co"
)
echo otp.totp.now() 

# Build a URI from a TOTP
totp.uri = newUri("Example issuer", "accountname@example.com")
echo totp.buildUri()