mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-02 20:15:55 +02:00
fix lint
This commit is contained in:
@@ -10,9 +10,9 @@ export const meta = {
|
||||
|
||||
params: {
|
||||
token: {
|
||||
validator: $.str
|
||||
}
|
||||
}
|
||||
validator: $.str,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, user) => {
|
||||
@@ -27,7 +27,7 @@ export default define(meta, async (ps, user) => {
|
||||
const verified = (speakeasy as any).totp.verify({
|
||||
secret: profile.twoFactorTempSecret,
|
||||
encoding: 'base32',
|
||||
token: token
|
||||
token: token,
|
||||
});
|
||||
|
||||
if (!verified) {
|
||||
@@ -36,6 +36,6 @@ export default define(meta, async (ps, user) => {
|
||||
|
||||
await UserProfiles.update(user.id, {
|
||||
twoFactorSecret: profile.twoFactorTempSecret,
|
||||
twoFactorEnabled: true
|
||||
twoFactorEnabled: true,
|
||||
});
|
||||
});
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
UserProfiles,
|
||||
UserSecurityKeys,
|
||||
AttestationChallenges,
|
||||
Users
|
||||
Users,
|
||||
} from '@/models/index';
|
||||
import config from '@/config/index';
|
||||
import { procedures, hash } from '../../../2fa';
|
||||
@@ -22,21 +22,21 @@ export const meta = {
|
||||
|
||||
params: {
|
||||
clientDataJSON: {
|
||||
validator: $.str
|
||||
validator: $.str,
|
||||
},
|
||||
attestationObject: {
|
||||
validator: $.str
|
||||
validator: $.str,
|
||||
},
|
||||
password: {
|
||||
validator: $.str
|
||||
validator: $.str,
|
||||
},
|
||||
challengeId: {
|
||||
validator: $.str
|
||||
validator: $.str,
|
||||
},
|
||||
name: {
|
||||
validator: $.str
|
||||
}
|
||||
}
|
||||
validator: $.str,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const rpIdHashReal = hash(Buffer.from(config.hostname, 'utf-8'));
|
||||
@@ -99,7 +99,7 @@ export default define(meta, async (ps, user) => {
|
||||
clientDataHash: clientDataJSONHash,
|
||||
credentialId,
|
||||
publicKey,
|
||||
rpIdHash
|
||||
rpIdHash,
|
||||
});
|
||||
if (!verificationData.valid) throw new Error('signature invalid');
|
||||
|
||||
@@ -107,7 +107,7 @@ export default define(meta, async (ps, user) => {
|
||||
userId: user.id,
|
||||
id: ps.challengeId,
|
||||
registrationChallenge: true,
|
||||
challenge: hash(clientData.challenge).toString('hex')
|
||||
challenge: hash(clientData.challenge).toString('hex'),
|
||||
});
|
||||
|
||||
if (!attestationChallenge) {
|
||||
@@ -116,7 +116,7 @@ export default define(meta, async (ps, user) => {
|
||||
|
||||
await AttestationChallenges.delete({
|
||||
userId: user.id,
|
||||
id: ps.challengeId
|
||||
id: ps.challengeId,
|
||||
});
|
||||
|
||||
// Expired challenge (> 5min old)
|
||||
@@ -134,17 +134,17 @@ export default define(meta, async (ps, user) => {
|
||||
id: credentialIdString,
|
||||
lastUsed: new Date(),
|
||||
name: ps.name,
|
||||
publicKey: verificationData.publicKey.toString('hex')
|
||||
publicKey: verificationData.publicKey.toString('hex'),
|
||||
});
|
||||
|
||||
// Publish meUpdated event
|
||||
publishMainStream(user.id, 'meUpdated', await Users.pack(user.id, user, {
|
||||
detail: true,
|
||||
includeSecrets: true
|
||||
includeSecrets: true,
|
||||
}));
|
||||
|
||||
return {
|
||||
id: credentialIdString,
|
||||
name: ps.name
|
||||
name: ps.name,
|
||||
};
|
||||
});
|
||||
|
||||
@@ -9,13 +9,13 @@ export const meta = {
|
||||
|
||||
params: {
|
||||
value: {
|
||||
validator: $.boolean
|
||||
}
|
||||
}
|
||||
validator: $.boolean,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, user) => {
|
||||
await UserProfiles.update(user.id, {
|
||||
usePasswordLessLogin: ps.value
|
||||
usePasswordLessLogin: ps.value,
|
||||
});
|
||||
});
|
||||
|
||||
@@ -16,9 +16,9 @@ export const meta = {
|
||||
|
||||
params: {
|
||||
password: {
|
||||
validator: $.str
|
||||
}
|
||||
}
|
||||
validator: $.str,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, user) => {
|
||||
@@ -49,11 +49,11 @@ export default define(meta, async (ps, user) => {
|
||||
id: challengeId,
|
||||
challenge: hash(Buffer.from(challenge, 'utf-8')).toString('hex'),
|
||||
createdAt: new Date(),
|
||||
registrationChallenge: true
|
||||
registrationChallenge: true,
|
||||
});
|
||||
|
||||
return {
|
||||
challengeId,
|
||||
challenge
|
||||
challenge,
|
||||
};
|
||||
});
|
||||
|
||||
@@ -13,9 +13,9 @@ export const meta = {
|
||||
|
||||
params: {
|
||||
password: {
|
||||
validator: $.str
|
||||
}
|
||||
}
|
||||
validator: $.str,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, user) => {
|
||||
@@ -30,11 +30,11 @@ export default define(meta, async (ps, user) => {
|
||||
|
||||
// Generate user's secret key
|
||||
const secret = speakeasy.generateSecret({
|
||||
length: 32
|
||||
length: 32,
|
||||
});
|
||||
|
||||
await UserProfiles.update(user.id, {
|
||||
twoFactorTempSecret: secret.base32
|
||||
twoFactorTempSecret: secret.base32,
|
||||
});
|
||||
|
||||
// Get the data URL of the authenticator URL
|
||||
@@ -42,13 +42,13 @@ export default define(meta, async (ps, user) => {
|
||||
secret: secret.base32,
|
||||
encoding: 'base32',
|
||||
label: user.username,
|
||||
issuer: config.host
|
||||
issuer: config.host,
|
||||
}));
|
||||
|
||||
return {
|
||||
qr: dataUrl,
|
||||
secret: secret.base32,
|
||||
label: user.username,
|
||||
issuer: config.host
|
||||
issuer: config.host,
|
||||
};
|
||||
});
|
||||
|
||||
@@ -11,12 +11,12 @@ export const meta = {
|
||||
|
||||
params: {
|
||||
password: {
|
||||
validator: $.str
|
||||
validator: $.str,
|
||||
},
|
||||
credentialId: {
|
||||
validator: $.str
|
||||
validator: $.str,
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, user) => {
|
||||
@@ -32,13 +32,13 @@ export default define(meta, async (ps, user) => {
|
||||
// Make sure we only delete the user's own creds
|
||||
await UserSecurityKeys.delete({
|
||||
userId: user.id,
|
||||
id: ps.credentialId
|
||||
id: ps.credentialId,
|
||||
});
|
||||
|
||||
// Publish meUpdated event
|
||||
publishMainStream(user.id, 'meUpdated', await Users.pack(user.id, user, {
|
||||
detail: true,
|
||||
includeSecrets: true
|
||||
includeSecrets: true,
|
||||
}));
|
||||
|
||||
return {};
|
||||
|
||||
@@ -10,9 +10,9 @@ export const meta = {
|
||||
|
||||
params: {
|
||||
password: {
|
||||
validator: $.str
|
||||
}
|
||||
}
|
||||
validator: $.str,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, user) => {
|
||||
@@ -27,6 +27,6 @@ export default define(meta, async (ps, user) => {
|
||||
|
||||
await UserProfiles.update(user.id, {
|
||||
twoFactorSecret: null,
|
||||
twoFactorEnabled: false
|
||||
twoFactorEnabled: false,
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user