import {getTOTP} from "simple-totp";
const totp = getTOTP("JBSWY3DP", "base32", Date.now(), 6);
// {
// totp: "012345",
// remainingMs: 29995
// }
Because base32 is used to encode binary data, it uses Uint8Array as a container. There are also several helper functions to convert
import {convert} from "simple-totp";
const Hello = convert('base32', 'ascii', 'JBSWY3DP')//= 'Hello'
const JBSWY3DP = convert('ascii', 'base32', 'Hello')//= 'JBSWY3DP'