mirror of
https://github.com/certd/certd.git
synced 2026-04-24 04:17:25 +08:00
perf: 优化passkey
This commit is contained in:
@@ -95,9 +95,7 @@ export class LoginController extends BaseController {
|
||||
this.ctx
|
||||
);
|
||||
|
||||
return this.ok({
|
||||
...options,
|
||||
});
|
||||
return this.ok(options);
|
||||
}
|
||||
|
||||
@Post('/loginByPasskey', { description: Constants.per.guest })
|
||||
|
||||
@@ -37,7 +37,6 @@ export class MinePasskeyController extends BaseController {
|
||||
|
||||
return this.ok({
|
||||
...options,
|
||||
userId
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -51,8 +51,6 @@ export class AutoAInitSite {
|
||||
//加载一次密钥
|
||||
await this.sysSettingsService.getSecret();
|
||||
|
||||
//加载设置
|
||||
await this.sysSettingsService.reloadSettings();
|
||||
|
||||
// 授权许可
|
||||
try {
|
||||
@@ -60,6 +58,9 @@ export class AutoAInitSite {
|
||||
} catch (e) {
|
||||
logger.error('授权许可验证失败', e);
|
||||
}
|
||||
|
||||
//加载设置
|
||||
await this.sysSettingsService.reloadSettings();
|
||||
|
||||
//加载站点隐藏配置
|
||||
await this.safeService.reloadHiddenStatus(true)
|
||||
|
||||
@@ -60,6 +60,13 @@ export class PasskeyService extends BaseService<PasskeyEntity> {
|
||||
timeout: 60000,
|
||||
attestationType: "none",
|
||||
excludeCredentials: [],
|
||||
preferredAuthenticatorType: 'localDevice',
|
||||
authenticatorSelection: {
|
||||
authenticatorAttachment: "cross-platform",
|
||||
userVerification: "preferred",
|
||||
residentKey: "preferred",
|
||||
requireResidentKey: false
|
||||
},
|
||||
});
|
||||
logger.info('[passkey] 注册选项:', JSON.stringify(options));
|
||||
cache.set(`passkey:registration:${options.challenge}`, userId, {
|
||||
@@ -121,6 +128,7 @@ export class PasskeyService extends BaseService<PasskeyEntity> {
|
||||
rpID: rpId,
|
||||
timeout: 60000,
|
||||
allowCredentials: [],
|
||||
userVerification: 'preferred' //'required' | 'preferred' | 'discouraged';
|
||||
});
|
||||
|
||||
// cache.set(`passkey:authentication:${options.challenge}`, userId, {
|
||||
|
||||
Reference in New Issue
Block a user