Merge branch 'dev'
CI/CD / deploy (push) Successful in 2m40s
Details
CI/CD / deploy (push) Successful in 2m40s
Details
This commit is contained in:
commit
75fef85df8
|
|
@ -688,7 +688,6 @@ export function showAuthModal(callbacks?: Partial<AuthModalCallbacks>): void {
|
||||||
{ alg: -257, type: 'public-key' as const },
|
{ alg: -257, type: 'public-key' as const },
|
||||||
],
|
],
|
||||||
authenticatorSelection: {
|
authenticatorSelection: {
|
||||||
authenticatorAttachment: 'platform',
|
|
||||||
residentKey: 'required',
|
residentKey: 'required',
|
||||||
requireResidentKey: true,
|
requireResidentKey: true,
|
||||||
userVerification: 'required',
|
userVerification: 'required',
|
||||||
|
|
@ -717,9 +716,9 @@ export function showAuthModal(callbacks?: Partial<AuthModalCallbacks>): void {
|
||||||
username,
|
username,
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
const data = await completeRes.json();
|
const data = await completeRes.json().catch(() => null);
|
||||||
if (!completeRes.ok || !data.success) {
|
if (!data || !completeRes.ok || !data.success) {
|
||||||
throw new Error(data.error || 'Registration failed');
|
throw new Error(data?.error || 'Registration failed');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. Store server-signed token with username
|
// 4. Store server-signed token with username
|
||||||
|
|
|
||||||
|
|
@ -934,7 +934,7 @@ export class RStackIdentity extends HTMLElement {
|
||||||
{ alg: -7, type: "public-key" as const },
|
{ alg: -7, type: "public-key" as const },
|
||||||
{ alg: -257, type: "public-key" as const },
|
{ alg: -257, type: "public-key" as const },
|
||||||
],
|
],
|
||||||
authenticatorSelection: { authenticatorAttachment: "platform", residentKey: "required", requireResidentKey: true, userVerification: "required" },
|
authenticatorSelection: { residentKey: "required", requireResidentKey: true, userVerification: "required" },
|
||||||
attestation: "none",
|
attestation: "none",
|
||||||
timeout: 60000,
|
timeout: 60000,
|
||||||
},
|
},
|
||||||
|
|
@ -958,8 +958,8 @@ export class RStackIdentity extends HTMLElement {
|
||||||
username,
|
username,
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
const data = await completeRes.json();
|
const data = await completeRes.json().catch(() => null);
|
||||||
if (!completeRes.ok || !data.success) throw new Error(data.error || "Registration failed");
|
if (!data || !completeRes.ok || !data.success) throw new Error(data?.error || "Registration failed");
|
||||||
|
|
||||||
storeSession(data.token, username, data.did || "");
|
storeSession(data.token, username, data.did || "");
|
||||||
close();
|
close();
|
||||||
|
|
@ -1751,7 +1751,7 @@ export class RStackIdentity extends HTMLElement {
|
||||||
{ alg: -7, type: "public-key" as const },
|
{ alg: -7, type: "public-key" as const },
|
||||||
{ alg: -257, type: "public-key" as const },
|
{ alg: -257, type: "public-key" as const },
|
||||||
],
|
],
|
||||||
authenticatorSelection: { authenticatorAttachment: "platform", residentKey: "required", requireResidentKey: true, userVerification: "required" },
|
authenticatorSelection: { residentKey: "required", requireResidentKey: true, userVerification: "required" },
|
||||||
attestation: "none",
|
attestation: "none",
|
||||||
timeout: 60000,
|
timeout: 60000,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -593,6 +593,10 @@ app.post('/api/register/start', async (c) => {
|
||||||
app.post('/api/register/complete', async (c) => {
|
app.post('/api/register/complete', async (c) => {
|
||||||
const { challenge, credential, userId, username, email, clientDid, eoaAddress } = await c.req.json();
|
const { challenge, credential, userId, username, email, clientDid, eoaAddress } = await c.req.json();
|
||||||
|
|
||||||
|
if (!userId || !credential || !username) {
|
||||||
|
return c.json({ error: 'Missing required fields: userId, credential, username' }, 400);
|
||||||
|
}
|
||||||
|
|
||||||
// Verify challenge
|
// Verify challenge
|
||||||
const challengeRecord = await getChallenge(challenge);
|
const challengeRecord = await getChallenge(challenge);
|
||||||
if (!challengeRecord || challengeRecord.type !== 'registration') {
|
if (!challengeRecord || challengeRecord.type !== 'registration') {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue