speakeasy
speakeasy copied to clipboard
generateSecret length param not working properly
const secret = speakeasy.generateSecret({
issuer: 'My site',
length: 32,
});
// secret -> HBWSKVZDKRPEU3T3G5HFI5CIKRNC4WSMN47T43SDNZKXGRCSNE4A
outputs a secret that has a length of 52
Adjusting the length down to 20 outputs a secret with a length of 32
const secret = speakeasy.generateSecret({
issuer: 'My site',
length: 20,
});
// secret -> JBRHUZ2UPJ3X23LOEZKCMRDXER4VEVDF
Hi!
Thanks for the report, I think this bug comes from the original library and fixing it might break existing code.
introduce a new parameter called "realLength"?