diff --git a/settings.ini.example b/settings.ini.example index bec3ba4..33f4dad 100644 --- a/settings.ini.example +++ b/settings.ini.example @@ -3,8 +3,11 @@ url = http://localhost:8000/api/snapshot/ #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" # url_wallet = "http://localhost" + # path = /path/to/save # device = your_device_name # # erase = basic diff --git a/workbench-script.py b/workbench-script.py index 6a4c537..826fa38 100644 --- a/workbench-script.py +++ b/workbench-script.py @@ -13,6 +13,8 @@ import gettext import locale import logging +from pathlib import Path +from string import Template from datetime import datetime @@ -445,22 +447,20 @@ def main(): elif config['erase'] and not config.get("legacy"): snapshot['erase'] = gen_erase(all_disks, config['erase']) + if config.get("wb_sign_token"): + tk = config.get("wb_sign_token").encode("utf8") + snapshot["token_hash"] = hashlib.hash256(tk).hexdigest() - if config.get("legacy"): + if legacy: convert_to_legacy_snapshot(snapshot) snapshot = json.dumps(snapshot) else: + snapshot = convert_to_credential(snapshot) url_wallet = config.get("url_wallet") 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: 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)