create credential from snapshot
This commit is contained in:
parent
ad2b375346
commit
7c1e0a4870
|
@ -1,8 +1,13 @@
|
||||||
[settings]
|
[settings]
|
||||||
url = http://localhost:8000/api/snapshot/
|
url = http://localhost:8000/api/snapshot/
|
||||||
token = '1234'
|
#url = https://demo.ereuse.org/api/v1/snapshot/
|
||||||
|
# sample token that works with default deployment such as the previous two urls
|
||||||
|
token = 5018dd65-9abd-4a62-8896-80f34ac66150
|
||||||
|
|
||||||
|
# Idhub
|
||||||
# wb_sign_token = "27de6ad7-cee2-4fe8-84d4-c7eea9c969c8"
|
# wb_sign_token = "27de6ad7-cee2-4fe8-84d4-c7eea9c969c8"
|
||||||
# url_wallet = "http://localhost"
|
# url_wallet = "http://localhost"
|
||||||
|
|
||||||
# path = /path/to/save
|
# path = /path/to/save
|
||||||
# device = your_device_name
|
# device = your_device_name
|
||||||
# # erase = basic
|
# # erase = basic
|
||||||
|
|
|
@ -12,6 +12,8 @@ import gettext
|
||||||
import locale
|
import locale
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
from string import Template
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
|
|
||||||
|
@ -528,17 +530,12 @@ def main():
|
||||||
convert_to_legacy_snapshot(snapshot)
|
convert_to_legacy_snapshot(snapshot)
|
||||||
snapshot = json.dumps(snapshot)
|
snapshot = json.dumps(snapshot)
|
||||||
else:
|
else:
|
||||||
|
snapshot = convert_to_credential(snapshot)
|
||||||
url_wallet = config.get("url_wallet")
|
url_wallet = config.get("url_wallet")
|
||||||
wb_sign_token = config.get("wb_sign_token")
|
wb_sign_token = config.get("wb_sign_token")
|
||||||
|
|
||||||
if wb_sign_token:
|
|
||||||
tk = wb_sign_token.encode("utf8")
|
|
||||||
snapshot["operator_id"] = hashlib.sha3_256(tk).hexdigest()
|
|
||||||
|
|
||||||
if url_wallet and wb_sign_token:
|
if url_wallet and wb_sign_token:
|
||||||
snapshot = send_to_sign_credential(snapshot, wb_sign_token, url_wallet)
|
snapshot = send_to_sign_credential(snapshot, wb_sign_token, url_wallet)
|
||||||
else:
|
|
||||||
snapshot = json.dumps(snapshot)
|
|
||||||
|
|
||||||
save_snapshot_in_disk(snapshot, config['path'], snap_uuid)
|
save_snapshot_in_disk(snapshot, config['path'], snap_uuid)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue