Introducing new Janet bindings, Janet-botan. #1433
tttuuu888
started this conversation in
Show and tell
Replies: 1 comment
-
Haven't tried it out yet, but IIUC, one might be able to adapt the code in this janet-botan test to work with Github's 2FA stuff. May be I'll compare the output from adapted code with that of oathtool (^^; Update: Seems to work :) (import botan :as b)
# XXX: when using oathtool from command line for real use, don't type in key
# as part of the invocation. use - instead of the key and type the
# key in after starting the invocation. this is to prevent other
# processes from snooping on the key value.
#
# $ oathtool --verbose \
# --totp=SHA1 \
# --digits=6 \
# --time-step-size=30s \
# --now="1970-01-01 00:00:59 UTC" \
# 3132333435363738393031323334353637383930
# Hex secret: 3132333435363738393031323334353637383930
# Base32 secret: GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ
# Digits: 6
# Window size: 0
# TOTP mode: SHA1
# Step size (seconds): 30
# Start time: 1970-01-01 00:00:00 UTC (0)
# Current time: 1970-01-01 00:00:59 UTC (59)
# Counter: 0x1 (1)
#
# 287082
# "12345678901234567890"
(def key (b/hex-decode "3132333435363738393031323334353637383930"))
(def digits 6)
(def timestep 30)
(def totp (b/totp/new key "SHA-1" digits timestep))
(:generate totp 59)
# =>
287082 Would be nice to see base32 encoding / decoding show up somewhere since Github seems to hand stuff out in base32. May be since spork has base64 already, adding base32 would make sense. Update 2: Adapting spork's base64.janet might look like this. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi @bakpakin and all community members,
Thank you for creating and evolving this interesting language.
I liked Janet from the moment I saw it and immediately wanted to create something with it.
So I've been working on creating a new Janet binding for my favorite crypto library, Botan.
I hope this helps someone, and you can get more information from the link below.
https://tttuuu888.github.io/janet-botan/
I would appreciate any feedback you may have.
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions