Skip to content

Commit

Permalink
admin/show-userで公開鍵(リモートユーザー)/秘密鍵公開鍵ペア(ローカルユーザー)を確認できるように
Browse files Browse the repository at this point in the history
  • Loading branch information
tamaina committed Jul 20, 2024
1 parent 0c9af9a commit 69bf858
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/backend/src/server/api/endpoints/admin/show-user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import { RoleService } from '@/core/RoleService.js';
import { RoleEntityService } from '@/core/entities/RoleEntityService.js';
import { IdService } from '@/core/IdService.js';
import { notificationRecieveConfig } from '@/models/json-schema/user.js';
import { ApDbResolverService } from '@/core/activitypub/ApDbResolverService.js';
import { UserEntityService } from '@/core/entities/UserEntityService.js';
import { UserKeypairService } from '@/core/UserKeypairService.js';

export const meta = {
tags: ['admin'],
Expand Down Expand Up @@ -172,6 +175,14 @@ export const meta = {
},
},
},
publicKeys: {
type: 'array',
optional: false, nullable: true,
},
keyPairs: {
type: 'object',
optional: false, nullable: true,
},
},
},
} as const;
Expand Down Expand Up @@ -199,6 +210,9 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
private roleService: RoleService,
private roleEntityService: RoleEntityService,
private idService: IdService,
private apDbResolverService: ApDbResolverService,
private userEntityService: UserEntityService,
private userKeypairService: UserKeypairService,
) {
super(meta, paramDef, async (ps, me) => {
const [user, profile] = await Promise.all([
Expand Down Expand Up @@ -251,6 +265,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
expiresAt: a.expiresAt ? a.expiresAt.toISOString() : null,
roleId: a.roleId,
})),
publicKeys: this.userEntityService.isRemoteUser(user) ? await this.apDbResolverService.getPublicKeyByUserId(user.id) : null,
keyPairs: this.userEntityService.isLocalUser(user) ? await this.userKeypairService.getUserKeypair(user.id) : null,
};
});
}
Expand Down

0 comments on commit 69bf858

Please sign in to comment.