mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2025-09-08 07:18:47 +00:00
Add managed_account entry type and handle in code
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
|
||||
such as an API token. Notes and custom fields may also be included alongside the
|
||||
standard metadata.
|
||||
|
@@ -533,7 +533,11 @@ class EntryManager:
|
||||
|
||||
if entry:
|
||||
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", [])
|
||||
logger.debug(f"Retrieved entry at index {index}: {entry}")
|
||||
return entry
|
||||
@@ -620,7 +624,10 @@ class EntryManager:
|
||||
if url is not None:
|
||||
entry["url"] = url
|
||||
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:
|
||||
entry["value"] = value
|
||||
logger.debug(f"Updated value for index {index}.")
|
||||
@@ -837,7 +844,7 @@ class EntryManager:
|
||||
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", ""))
|
||||
custom_fields = entry.get("custom_fields", [])
|
||||
custom_match = any(
|
||||
|
@@ -14,3 +14,4 @@ class EntryType(str, Enum):
|
||||
PGP = "pgp"
|
||||
NOSTR = "nostr"
|
||||
KEY_VALUE = "key_value"
|
||||
MANAGED_ACCOUNT = "managed_account"
|
||||
|
@@ -1629,7 +1629,10 @@ class PasswordManager:
|
||||
pause()
|
||||
return
|
||||
|
||||
if entry_type == EntryType.KEY_VALUE.value:
|
||||
if entry_type in (
|
||||
EntryType.KEY_VALUE.value,
|
||||
EntryType.MANAGED_ACCOUNT.value,
|
||||
):
|
||||
label = entry.get("label", "")
|
||||
value = entry.get("value", "")
|
||||
notes = entry.get("notes", "")
|
||||
@@ -1904,7 +1907,10 @@ class PasswordManager:
|
||||
digits=new_digits,
|
||||
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", "")
|
||||
value = entry.get("value", "")
|
||||
blacklisted = entry.get("archived", False)
|
||||
|
Reference in New Issue
Block a user