Add attachments to proofs calc in export cli call

This commit is contained in:
nolash 2021-10-22 19:41:01 +02:00
parent eb42095a74
commit d245f98cbd
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
4 changed files with 10 additions and 4 deletions

View File

@ -59,7 +59,6 @@ class Attachment(Data):
def __str__(self):
s = ''
#for i in range(len(self.contents)):
for k in self.contents.keys():
s += '{} = {}\n'.format(k, self.contents[k]) #self.digests[i].hex(), self.contents[i])

View File

@ -80,10 +80,10 @@ def execute(config, eargs):
cp = Proof(path=eargs.directory, attachments=ca, writer=writers['proof'](path=output_writer_path_meta))
cn = Network(path=eargs.directory)
ca.load()
ct.load()
cp.load()
cm.load()
ca.load()
cn.load()
chain_spec = None

View File

@ -54,7 +54,7 @@ class HTTPWriter(OutputWriter):
logg.debug('http writer post {}'.format(path))
rq = urllib.request.Request(path, method='POST', data=v)
r = urllib.request.urlopen(rq)
logg.info('proof submited at {}'.format(r.read()))
logg.info('http writer submitted at {}'.format(r.read()))
class KeyedWriter(OutputWriter):

View File

@ -44,6 +44,7 @@ class Proof(Data):
self.description = o['description']
self.namespace = o['namespace']
self.issuer = o['issuer']
self.proofs = o['proofs']
if self.extra_attachments != None:
a = self.extra_attachments.asdict()
@ -111,6 +112,7 @@ class Proof(Data):
if writer == None:
writer = self.writer
(k, v) = self.root()
writer.write(k, v)
@ -138,7 +140,12 @@ class Proof(Data):
#logg.debug('generated proof {} for hashes {}'.format(r_hex, hshs))
#writer.write(r_hex, hshs_cat)
o = self.asdict()
f = open(self.proof_path, 'w')
json.dump(o, f, sort_keys=True, indent="\t")
f.close()
return k