refreshAndprepareEd25519KeyPair
This commit is contained in:
parent
6a56aea422
commit
d772eacfa1
|
@ -5,13 +5,13 @@
|
||||||
|
|
||||||
import { Inject, Injectable, OnApplicationShutdown } from '@nestjs/common';
|
import { Inject, Injectable, OnApplicationShutdown } from '@nestjs/common';
|
||||||
import * as Redis from 'ioredis';
|
import * as Redis from 'ioredis';
|
||||||
|
import { genEd25519KeyPair } from '@misskey-dev/node-http-message-signatures';
|
||||||
import type { MiUser } from '@/models/User.js';
|
import type { MiUser } from '@/models/User.js';
|
||||||
import type { UserKeypairsRepository } from '@/models/_.js';
|
import type { UserKeypairsRepository } from '@/models/_.js';
|
||||||
import { RedisKVCache } from '@/misc/cache.js';
|
import { RedisKVCache } from '@/misc/cache.js';
|
||||||
import type { MiUserKeypair } from '@/models/UserKeypair.js';
|
import type { MiUserKeypair } from '@/models/UserKeypair.js';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
import { genEd25519KeyPair } from '@misskey-dev/node-http-message-signatures';
|
|
||||||
import { GlobalEventService, GlobalEvents } from '@/core/GlobalEventService.js';
|
import { GlobalEventService, GlobalEvents } from '@/core/GlobalEventService.js';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
|
@ -50,7 +50,7 @@ export class UserKeypairService implements OnApplicationShutdown {
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
public async prepareEd25519KeyPair(userId: MiUser['id']): Promise<void> {
|
public async refreshAndprepareEd25519KeyPair(userId: MiUser['id']): Promise<void> {
|
||||||
await this.refresh(userId);
|
await this.refresh(userId);
|
||||||
const keypair = await this.cache.fetch(userId);
|
const keypair = await this.cache.fetch(userId);
|
||||||
if (keypair.ed25519PublicKey != null) return;
|
if (keypair.ed25519PublicKey != null) return;
|
||||||
|
|
|
@ -109,7 +109,7 @@ class DeliverManager {
|
||||||
/**
|
/**
|
||||||
* ed25519の署名がなければ追加する
|
* ed25519の署名がなければ追加する
|
||||||
*/
|
*/
|
||||||
await this.userKeypairService.prepareEd25519KeyPair(this.actor.id);
|
await this.userKeypairService.refreshAndprepareEd25519KeyPair(this.actor.id);
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
// The value flags whether it is shared or not.
|
// The value flags whether it is shared or not.
|
||||||
|
|
Loading…
Reference in New Issue