use gen-key-pair fn. from '@misskey-dev/node-http-message-signatures'
This commit is contained in:
@@ -11,7 +11,7 @@ import { RedisKVCache } from '@/misc/cache.js';
|
||||
import type { MiUserKeypair } from '@/models/UserKeypair.js';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import { genEd25519KeyPair } from '@/misc/gen-key-pair.js';
|
||||
import { genEd25519KeyPair } from '@misskey-dev/node-http-message-signatures';
|
||||
import { GlobalEventService, GlobalEvents } from '@/core/GlobalEventService.js';
|
||||
|
||||
@Injectable()
|
||||
|
@@ -3,41 +3,7 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import * as crypto from 'node:crypto';
|
||||
import * as util from 'node:util';
|
||||
|
||||
const generateKeyPair = util.promisify(crypto.generateKeyPair);
|
||||
|
||||
export async function genRsaKeyPair(modulusLength = 4096) {
|
||||
return await generateKeyPair('rsa', {
|
||||
modulusLength,
|
||||
publicKeyEncoding: {
|
||||
type: 'spki',
|
||||
format: 'pem',
|
||||
},
|
||||
privateKeyEncoding: {
|
||||
type: 'pkcs8',
|
||||
format: 'pem',
|
||||
cipher: undefined,
|
||||
passphrase: undefined,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export async function genEd25519KeyPair() {
|
||||
return await generateKeyPair('ed25519', {
|
||||
publicKeyEncoding: {
|
||||
type: 'spki',
|
||||
format: 'pem',
|
||||
},
|
||||
privateKeyEncoding: {
|
||||
type: 'pkcs8',
|
||||
format: 'pem',
|
||||
cipher: undefined,
|
||||
passphrase: undefined,
|
||||
},
|
||||
});
|
||||
}
|
||||
import { genEd25519KeyPair, genRsaKeyPair } from '@misskey-dev/node-http-message-signatures';
|
||||
|
||||
export async function genRSAAndEd25519KeyPair(rsaModulusLength = 4096) {
|
||||
const rsa = await genRsaKeyPair(rsaModulusLength);
|
||||
|
Reference in New Issue
Block a user