khatru: ForceSetAuthed()

This commit is contained in:
fiatjaf
2026-05-04 10:17:06 -03:00
parent c75bd45d13
commit 61586d5d1b
+7
View File
@@ -74,6 +74,13 @@ func IsAuthed(ctx context.Context, pubkey nostr.PubKey) bool {
return false
}
// ForceSetAuthed modifies the context to insert a custom authed public key.
// It can be used in testing or other rare scenarios for making requests as if a given public key
// was authenticated when in fact it didn't perform any of the authentication rituals.
func ForceSetAuthed(ctx context.Context, pubkey nostr.PubKey) context.Context {
return context.WithValue(ctx, nip86HeaderAuthKey, pubkey)
}
// IsInternalCall returns true when a call to QueryEvents, for example, is being made because of a deletion
// or expiration request.
func IsInternalCall(ctx context.Context) bool {