def from_key(self, public_id, key): """ Return what the YubiKey would have returned when the button was pressed. """ otp = self.get_otp(key) from_key = modhex_encode(public_id.encode('hex')) + modhex_encode(otp.encode('hex')) return from_key
def from_key(self, public_id, key): """ Return what the YubiKey would have returned when the button was pressed. """ otp = self.get_otp(key) from_key = modhex_encode(public_id.encode('hex')) + modhex_encode( otp.encode('hex')) return from_key
def test_modhex_encode_decode(self): """ Test modhex encoding/decoding. """ h = '4d014d024d4ddd5382b11195144da07d' self.assertEquals(h, modhex_decode(modhex_encode(h)))
def test_modhex_encode_decode(self): """ Test modhex encoding/decoding. """ h = '4d014d024d4ddd5382b11195144da07d' self.assertEquals(h, modhex_decode( modhex_encode(h) ) )