mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-03 19:35:28 +00:00
Handle flexible auth provider IDs in cache
This commit is contained in:
1 parent
147e57845b
commit
3d1486ef79
3 files changed
+53
-30
No files matched your search
+14
-12
@@ -9,7 +9,8 @@ updates can evolve it without breaking existing users.
|
||||
- `bitvid:profileCache:v1` – short-lived metadata cache for profile names and
|
||||
avatars. See `js/app.js` for TTL and eviction rules.
|
||||
- `bitvid:savedProfiles:v1` – persistent list of accounts the user authenticated
|
||||
with in this browser.
|
||||
with in this browser. The payload embeds a `version` field that is currently
|
||||
`2`.
|
||||
|
||||
Both keys live in the main origin scope. Clearing one should not affect the
|
||||
other.
|
||||
@@ -20,14 +21,14 @@ other.
|
||||
|
||||
```json
|
||||
{
|
||||
"version": 1,
|
||||
"version": 2,
|
||||
"entries": [
|
||||
{
|
||||
"pubkey": "<hex-encoded pubkey>",
|
||||
"npub": "<bech32 npub, optional>",
|
||||
"name": "<cached display name>",
|
||||
"picture": "<cached avatar URL>",
|
||||
"authType": "<auth strategy>"
|
||||
"authType": "<auth strategy or null>"
|
||||
}
|
||||
],
|
||||
"activePubkey": "<hex pubkey or null>"
|
||||
@@ -46,17 +47,18 @@ Notes:
|
||||
- `activePubkey` tracks the last account that successfully authenticated in this
|
||||
browser. It may be `null` when the user logs out but keeps saved entries.
|
||||
|
||||
### `authType` enum
|
||||
### `authType` handling
|
||||
|
||||
`authType` describes how the profile authenticated:
|
||||
`authType` describes how the profile authenticated and is stored exactly as the
|
||||
provider reported it (after trimming whitespace). Bitvid does not attempt to
|
||||
normalise these strings, so future auth integrations can safely persist custom
|
||||
identifiers.
|
||||
|
||||
- `"nip07"` – Browser extension flow (current default).
|
||||
- `"nsec"` – Reserved for future direct key import or signer integrations. New
|
||||
auth strategies should pick a distinct string and document how migration works
|
||||
alongside any recovery tooling.
|
||||
|
||||
When the app reads stored entries it normalises unknown values back to
|
||||
`"nip07"` but keeps recognised alternatives intact.
|
||||
- Legacy payloads (version `1`) did not include the field, so the loader treats
|
||||
those entries as `"nip07"` and rewrites the payload at version `2`.
|
||||
- Newer providers may surface alternative IDs (for example, Wallet Connect
|
||||
flows). UI components use provider metadata when available and otherwise fall
|
||||
back to a generic label so unknown identifiers do not break rendering.
|
||||
|
||||
## Migration notes
|
||||
|
||||
|
||||
Reference in new issue
Block a user