def txs(self): self.check_key() if self.cached_txs is not None: for tx in self.cached_txs: yield tx else: self.cached_txs = [] encor = SymEnc(self.key) for data, commit in self.walk_branch('txs'): tx = yaml.safe_load(data) tx['who'] = commit.author tx['when'] = commit.commit_time tx['amount'] = int(encor.decrypt(EncResult.from_dict(tx['amount']))) tx['description'] = encor.decrypt(EncResult.from_dict(tx['description'])) self.cached_txs.append(tx) yield tx
def from_dict(pickle_key, state): s = SymEnc(pickle_key) state['encrypt'] = s.decrypt(EncResult.from_dict(state['encrypt'])) state['hmac'] = s.decrypt(EncResult.from_dict(state['hmac'])) return SymEncKey(state)