auth98: fix nsec flow
This commit is contained in:
parent
527e276340
commit
dcc9d05ee5
|
@ -7,7 +7,7 @@ import {
|
||||||
validateAuthEvent,
|
validateAuthEvent,
|
||||||
} from '@/utils/nip98.ts';
|
} from '@/utils/nip98.ts';
|
||||||
import { localRequest } from '@/utils/web.ts';
|
import { localRequest } from '@/utils/web.ts';
|
||||||
import { signNostrConnect } from '@/sign.ts';
|
import { signEvent } from '@/sign.ts';
|
||||||
import { findUser, User } from '@/db/users.ts';
|
import { findUser, User } from '@/db/users.ts';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -63,7 +63,7 @@ function matchesRole(user: User, role: UserRole): boolean {
|
||||||
async function obtainProof(c: AppContext, opts?: ParseAuthRequestOpts) {
|
async function obtainProof(c: AppContext, opts?: ParseAuthRequestOpts) {
|
||||||
const req = localRequest(c);
|
const req = localRequest(c);
|
||||||
const reqEvent = await buildAuthEventTemplate(req, opts);
|
const reqEvent = await buildAuthEventTemplate(req, opts);
|
||||||
const resEvent = await signNostrConnect(reqEvent, c);
|
const resEvent = await signEvent(reqEvent, c);
|
||||||
const result = await validateAuthEvent(req, resEvent, opts);
|
const result = await validateAuthEvent(req, resEvent, opts);
|
||||||
|
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
|
|
|
@ -99,4 +99,4 @@ async function signAdminEvent<K extends number = number>(event: EventTemplate<K>
|
||||||
return finishEvent(event, Conf.seckey);
|
return finishEvent(event, Conf.seckey);
|
||||||
}
|
}
|
||||||
|
|
||||||
export { signAdminEvent, signEvent, signNostrConnect };
|
export { signAdminEvent, signEvent };
|
||||||
|
|
Loading…
Reference in New Issue