khatru: ForceSetAuthed()
This commit is contained in:
@@ -74,6 +74,13 @@ func IsAuthed(ctx context.Context, pubkey nostr.PubKey) bool {
|
|||||||
return false
|
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
|
// IsInternalCall returns true when a call to QueryEvents, for example, is being made because of a deletion
|
||||||
// or expiration request.
|
// or expiration request.
|
||||||
func IsInternalCall(ctx context.Context) bool {
|
func IsInternalCall(ctx context.Context) bool {
|
||||||
|
|||||||
Reference in New Issue
Block a user