跳到主要内容

gen_auth_code

根据秘钥和时间计算验证码

声明

string gen_auth_code(string secret, int offset = 0)

参数

参数名描述
secret秘钥
offset时间偏移量,计算该偏移量(offset*30)下的验证码

返回值

计算结果,-1表示验证码生成失败

使用方式

string code = authenticator.gen_auth_code(key);
printf("Code: %s\n", code);

返回文档