24 lines
783 B
Bash
Executable file
24 lines
783 B
Bash
Executable file
#!/bin/bash
|
|
# Check TOTP secret generation
|
|
|
|
echo "=== TOTP Secret Generation Test ==="
|
|
echo ""
|
|
|
|
kubectl exec -n towerops deployment/towerops -- bin/towerops rpc "
|
|
# Generate a test secret
|
|
secret = NimbleTOTP.secret()
|
|
IO.puts(\"Generated secret: #{secret}\")
|
|
IO.puts(\"Secret length: #{String.length(secret)} characters\")
|
|
IO.puts(\"Secret bytes: #{byte_size(secret)} bytes\")
|
|
IO.puts(\"Valid Base32?: #{String.match?(secret, ~r/^[A-Z2-7]+$/)}\")
|
|
|
|
# Try to generate a code with it
|
|
current_time = System.system_time(:second)
|
|
code = NimbleTOTP.verification_code(secret, time: current_time)
|
|
IO.puts(\"\")
|
|
IO.puts(\"Test verification code: #{code}\")
|
|
|
|
# Check if the code can be verified
|
|
valid = NimbleTOTP.valid?(secret, code, time: current_time)
|
|
IO.puts(\"Code validates: #{valid}\")
|
|
"
|