def __init__(self, sid): ''' Constructor Parameters: sid = session id associated to the nonce ''' self.sid = sid self.uid = None # Initializes a value for the nonce (let's call that the nonce id) self.nid = bitid.generate_nonce() # Sets the creation date self.created = datetime.now()
def __init__(self, sid): ''' Constructor Parameters: sid = session id associated to the nonce ''' self.sid = sid self.uid = None # Initializes a value for the nonce (let's call that the nonce id) self.nid = bitid.generate_nonce() # Sets the creation date self.created = datetime.now() # Sets the redirect uri self.redirect_uri = "" # Sets the bitcoin address used for 2fa self.tfa_address = None
def test_generate_nonce(self): len_nonce = len(bitid.generate_nonce()) self.assertEqual(NONCE_LENGTH, len_nonce)
def save(self, *args, **kwargs): if self.pk is None: self.nid = bitid.generate_nonce() super(Nonce, self).save(*args, **kwargs)