コード例 #1
0
        /// <summary>
        /// 获取当前验证码
        /// </summary>
        /// <param name="tokenSecretKey">Token密钥</param>
        /// <returns></returns>
        public static string CreateGoogleCode(string tokenSecretKey)
        {
            var Authenticator = new TwoFactorAuthenticator();
            var codes         = Authenticator.GetCurrentPINs(getDecodeString(tokenSecretKey), TimeSpan.FromSeconds(30));

            return(codes[codes.Length - 1]);
        }
コード例 #2
0
        public string[] GetCurrent(string secretKey)
        {
            TwoFactorAuthenticator tfA = new TwoFactorAuthenticator();

            string[] pins = tfA.GetCurrentPINs(secretKey);
            return(pins);
        }