docs: describe key_not_found as any unknown sk- credential and trim auth comment

This commit is contained in:
9qeklajc
2026-10-01 11:46:51 +02:00
parent f5e95a502c
commit e86f3f75ef
3 changed files with 4 additions and 10 deletions
+1 -1
View File
@@ -222,7 +222,7 @@ withdraw_balance(old_key)
- Typo in API key
- The credential is neither an `sk-...` key nor a `cashu...` token
A well-formed `sk-...` key that this node has no record of is reported
A credential starting with `sk-` that this node has no record of is reported
separately as `key_not_found` (also 401) — see
[Error Handling → Authentication Errors](errors.md#authentication-errors).
+3 -3
View File
@@ -119,10 +119,10 @@ Returned when the `Authorization` value is neither an `sk-...` API key nor a
preview and length (`Invalid API key format: preview=… length=…`) to distinguish
a typo from a wrong-shaped header.
#### API Key Not Found (well-formed but unknown to this node)
#### API Key Not Found (`sk-` key unknown to this node)
Returned when the credential is a well-formed `sk-...` key that this node has no
record of — for example a key minted by a different Routstr node, or one removed
Returned when the credential starts with `sk-` and this node has no record of
it — for example a key minted by a different Routstr node, or one removed
by key pruning. This is *not* a formatting problem.
```json
-6
View File
@@ -293,12 +293,6 @@ async def _validate_bearer_key_locked(
"sk- API key not found in database",
extra={"key_preview": bearer_key[:10] + "..."},
)
# The credential is a well-formed 'sk-...' API key: the format is
# valid and the failure is that the key does not exist on this node.
# Falling through to the generic handler below would report it as
# "Invalid API key format", sending callers after a formatting bug
# that does not exist. Report the real cause instead.
#
# Keep the "Key not found." prefix verbatim: @routstr/sdk (<=0.4.6)
# detects a dead key with a case-sensitive `body.includes("Key not
# found")` probe, and uses it to purge the key from its store. The