mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2025-09-09 15:58:48 +00:00
Merge pull request #380 from PR0M3TH3AN/codex/add-managed_account-entry-type
Add managed_account entry type
This commit is contained in:
@@ -252,6 +252,21 @@ Each entry is stored within `seedpass_entries_db.json.enc` under the `entries` d
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### 8. Managed Account
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"entry_num": 7,
|
||||||
|
"fingerprint": "a1b2c3d4",
|
||||||
|
"kind": "managed_account",
|
||||||
|
"data": {
|
||||||
|
"account": "alice@example.com",
|
||||||
|
"password": "<encrypted_password>"
|
||||||
|
},
|
||||||
|
"timestamp": "2024-04-27T12:41:56Z"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
The `key` field is purely descriptive, while `value` holds the sensitive string
|
The `key` field is purely descriptive, while `value` holds the sensitive string
|
||||||
such as an API token. Notes and custom fields may also be included alongside the
|
such as an API token. Notes and custom fields may also be included alongside the
|
||||||
standard metadata.
|
standard metadata.
|
||||||
|
@@ -533,7 +533,11 @@ class EntryManager:
|
|||||||
|
|
||||||
if entry:
|
if entry:
|
||||||
etype = entry.get("type", entry.get("kind"))
|
etype = entry.get("type", entry.get("kind"))
|
||||||
if etype in (EntryType.PASSWORD.value, EntryType.KEY_VALUE.value):
|
if etype in (
|
||||||
|
EntryType.PASSWORD.value,
|
||||||
|
EntryType.KEY_VALUE.value,
|
||||||
|
EntryType.MANAGED_ACCOUNT.value,
|
||||||
|
):
|
||||||
entry.setdefault("custom_fields", [])
|
entry.setdefault("custom_fields", [])
|
||||||
logger.debug(f"Retrieved entry at index {index}: {entry}")
|
logger.debug(f"Retrieved entry at index {index}: {entry}")
|
||||||
return entry
|
return entry
|
||||||
@@ -620,7 +624,10 @@ class EntryManager:
|
|||||||
if url is not None:
|
if url is not None:
|
||||||
entry["url"] = url
|
entry["url"] = url
|
||||||
logger.debug(f"Updated URL to '{url}' for index {index}.")
|
logger.debug(f"Updated URL to '{url}' for index {index}.")
|
||||||
elif entry_type == EntryType.KEY_VALUE.value:
|
elif entry_type in (
|
||||||
|
EntryType.KEY_VALUE.value,
|
||||||
|
EntryType.MANAGED_ACCOUNT.value,
|
||||||
|
):
|
||||||
if value is not None:
|
if value is not None:
|
||||||
entry["value"] = value
|
entry["value"] = value
|
||||||
logger.debug(f"Updated value for index {index}.")
|
logger.debug(f"Updated value for index {index}.")
|
||||||
@@ -837,7 +844,7 @@ class EntryManager:
|
|||||||
entry.get("archived", entry.get("blacklisted", False)),
|
entry.get("archived", entry.get("blacklisted", False)),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
elif etype == EntryType.KEY_VALUE.value:
|
elif etype in (EntryType.KEY_VALUE.value, EntryType.MANAGED_ACCOUNT.value):
|
||||||
value_field = str(entry.get("value", ""))
|
value_field = str(entry.get("value", ""))
|
||||||
custom_fields = entry.get("custom_fields", [])
|
custom_fields = entry.get("custom_fields", [])
|
||||||
custom_match = any(
|
custom_match = any(
|
||||||
|
@@ -14,3 +14,4 @@ class EntryType(str, Enum):
|
|||||||
PGP = "pgp"
|
PGP = "pgp"
|
||||||
NOSTR = "nostr"
|
NOSTR = "nostr"
|
||||||
KEY_VALUE = "key_value"
|
KEY_VALUE = "key_value"
|
||||||
|
MANAGED_ACCOUNT = "managed_account"
|
||||||
|
@@ -1629,7 +1629,10 @@ class PasswordManager:
|
|||||||
pause()
|
pause()
|
||||||
return
|
return
|
||||||
|
|
||||||
if entry_type == EntryType.KEY_VALUE.value:
|
if entry_type in (
|
||||||
|
EntryType.KEY_VALUE.value,
|
||||||
|
EntryType.MANAGED_ACCOUNT.value,
|
||||||
|
):
|
||||||
label = entry.get("label", "")
|
label = entry.get("label", "")
|
||||||
value = entry.get("value", "")
|
value = entry.get("value", "")
|
||||||
notes = entry.get("notes", "")
|
notes = entry.get("notes", "")
|
||||||
@@ -1904,7 +1907,10 @@ class PasswordManager:
|
|||||||
digits=new_digits,
|
digits=new_digits,
|
||||||
custom_fields=custom_fields,
|
custom_fields=custom_fields,
|
||||||
)
|
)
|
||||||
elif entry_type == EntryType.KEY_VALUE.value:
|
elif entry_type in (
|
||||||
|
EntryType.KEY_VALUE.value,
|
||||||
|
EntryType.MANAGED_ACCOUNT.value,
|
||||||
|
):
|
||||||
label = entry.get("label", "")
|
label = entry.get("label", "")
|
||||||
value = entry.get("value", "")
|
value = entry.get("value", "")
|
||||||
blacklisted = entry.get("archived", False)
|
blacklisted = entry.get("archived", False)
|
||||||
|
Reference in New Issue
Block a user