fix
This commit is contained in:
parent
00738b90c2
commit
172546f3ef
|
@ -7,7 +7,7 @@ import { randomUUID } from 'node:crypto';
|
|||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import bcrypt from 'bcryptjs';
|
||||
import { IsNull, DataSource } from 'typeorm';
|
||||
import { genRsaKeyPair } from '@/misc/gen-key-pair.js';
|
||||
import { genRSAAndEd25519KeyPair } from '@/misc/gen-key-pair.js';
|
||||
import { MiUser } from '@/models/User.js';
|
||||
import { MiUserProfile } from '@/models/UserProfile.js';
|
||||
import { IdService } from '@/core/IdService.js';
|
||||
|
@ -38,7 +38,7 @@ export class CreateSystemUserService {
|
|||
// Generate secret
|
||||
const secret = generateNativeUserToken();
|
||||
|
||||
const keyPair = await genRsaKeyPair();
|
||||
const keyPair = await genRSAAndEd25519KeyPair();
|
||||
|
||||
let account!: MiUser;
|
||||
|
||||
|
@ -64,9 +64,8 @@ export class CreateSystemUserService {
|
|||
}).then(x => transactionalEntityManager.findOneByOrFail(MiUser, x.identifiers[0]));
|
||||
|
||||
await transactionalEntityManager.insert(MiUserKeypair, {
|
||||
publicKey: keyPair.publicKey,
|
||||
privateKey: keyPair.privateKey,
|
||||
userId: account.id,
|
||||
...keyPair,
|
||||
});
|
||||
|
||||
await transactionalEntityManager.insert(MiUserProfile, {
|
||||
|
|
|
@ -21,6 +21,7 @@ import { bindThis } from '@/decorators.js';
|
|||
import UsersChart from '@/core/chart/charts/users.js';
|
||||
import { UtilityService } from '@/core/UtilityService.js';
|
||||
import { MetaService } from '@/core/MetaService.js';
|
||||
import { genRSAAndEd25519KeyPair } from '@/misc/gen-key-pair.js';
|
||||
|
||||
@Injectable()
|
||||
export class SignupService {
|
||||
|
@ -93,22 +94,7 @@ export class SignupService {
|
|||
}
|
||||
}
|
||||
|
||||
const keyPair = await new Promise<string[]>((res, rej) =>
|
||||
generateKeyPair('rsa', {
|
||||
modulusLength: 2048,
|
||||
publicKeyEncoding: {
|
||||
type: 'spki',
|
||||
format: 'pem',
|
||||
},
|
||||
privateKeyEncoding: {
|
||||
type: 'pkcs8',
|
||||
format: 'pem',
|
||||
cipher: undefined,
|
||||
passphrase: undefined,
|
||||
},
|
||||
}, (err, publicKey, privateKey) =>
|
||||
err ? rej(err) : res([publicKey, privateKey]),
|
||||
));
|
||||
const keyPair = await genRSAAndEd25519KeyPair();
|
||||
|
||||
let account!: MiUser;
|
||||
|
||||
|
@ -131,9 +117,8 @@ export class SignupService {
|
|||
}));
|
||||
|
||||
await transactionalEntityManager.save(new MiUserKeypair({
|
||||
publicKey: keyPair[0],
|
||||
privateKey: keyPair[1],
|
||||
userId: account.id,
|
||||
...keyPair,
|
||||
}));
|
||||
|
||||
await transactionalEntityManager.save(new MiUserProfile({
|
||||
|
|
Loading…
Reference in a new issue