예제 #1
0
def googleScan(inputStr):
    from otpauth import OtpAuth
    auth = OtpAuth(inputStr)  # a secret string
    # to_google(self, type, label, issuer, counter=None)
    s = auth.to_google(type='totp', issuer="PyPI", label='SHA1', counter='6')
    print(s)
    return s
예제 #2
0
def test_to_google_hotp(f_provider,f_authKey):
  print "\n3.a test to google hotp"
  auth   = OtpAuth(f_provider)
  expect = 'otpauth://hotp/'+f_provider+'?secret=' + f_authKey + '&issuer='+f_provider+'&counter=4'
  assert auth.to_google('hotp', 'python', 'python', 4) == expect
  print "provider <%s> authKey <%s> secret <%s> to_google <%s>" % (f_provider, f_authKey, auth.secret, expect)
  print dir(auth) 
  print "completed successfully"
예제 #3
0
def test_to_google_totp(f_provider,f_authKey):
  print "\n2.a test to google totp"
  auth   = OtpAuth(f_provider)
  expect = 'otpauth://totp/python?secret='+f_authKey+'&issuer=' + f_provider
  assert auth.to_google('totp', 'python', 'python') == expect
  print "provider <%s> authKey <%s> secret <%s> to_google <%s>" % (f_provider, f_authKey, auth.secret, expect)
  #print dir(auth) 
  print "completed successfully"
예제 #4
0
def test_to_google_totp():
    auth = OtpAuth('python')
    expect = 'otpauth://totp/python?secret=OB4XI2DPNY&issuer=python'
    assert auth.to_google('totp', 'python', 'python') == expect
예제 #5
0
def test_to_google_hotp():
    auth = OtpAuth('python')
    expect = 'otpauth://hotp/python?secret=OB4XI2DPNY&issuer=python&counter=4'
    assert auth.to_google('hotp', 'python', 'python', 4) == expect
예제 #6
0
def test_to_google_hotp_raise():
    auth = OtpAuth('python')
    auth.to_google('hotp', 'python', 'python')
예제 #7
0
def test_to_google_raise():
    auth = OtpAuth('python')
    auth.to_google('invalid', 'python', 'python')