Remove 'user' from AppContext
This commit is contained in:
parent
a061c248bd
commit
45b766af4d
|
@ -96,8 +96,6 @@ interface AppEnv extends HonoEnv {
|
|||
signer?: NostrSigner;
|
||||
/** NIP-98 signed event proving the pubkey is owned by the user. */
|
||||
proof?: NostrEvent;
|
||||
/** User associated with the pubkey, if any. */
|
||||
user?: User;
|
||||
/** Store */
|
||||
store: NStore;
|
||||
};
|
||||
|
|
|
@ -34,9 +34,8 @@ type UserRole = 'user' | 'admin';
|
|||
|
||||
/** Require the user to prove their role before invoking the controller. */
|
||||
function requireRole(role: UserRole, opts?: ParseAuthRequestOpts): AppMiddleware {
|
||||
return withProof(async (c, proof, next) => {
|
||||
return withProof(async (_c, proof, next) => {
|
||||
const user = await findUser({ pubkey: proof.pubkey });
|
||||
c.set('user', user);
|
||||
|
||||
if (user && matchesRole(user, role)) {
|
||||
await next();
|
||||
|
|
Loading…
Reference in New Issue