Base32 Decode or Encode
Aron2560 opened this issue · comments
I see you're using "DecodeString
". Is that intentionally or you it supposed to say "EncodeString
"
key, err := base32.StdEncoding.DecodeString(inputNoSpacesUpper)
Thanks much
It is intentional. From the accompanying blog entry:
First we'll need to base32 decode the secret. Google presents it with spaces and in lowercase to make it easier to grok for humans, but base32 actually does not allow spaces and only allows uppercase letters. Thus:
original_secret = xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx
secret = BASE32_DECODE(TO_UPPERCASE(REMOVE_SPACES(original_secret)))