1
0
forked from mirror/misskey
misskey/src/remote/activitypub/renderer/key.ts
MeiMei 46aaf8fa9a AP Actorの鍵とkeyIdのフォーマットの変更 (#5733)
* Node PKCS#8

* keyIdを#main-key形式に
2020-01-20 04:51:44 +09:00

15 lines
502 B
TypeScript

import config from '../../../config';
import { ILocalUser } from '../../../models/entities/user';
import { UserKeypair } from '../../../models/entities/user-keypair';
import { createPublicKey } from 'crypto';
export default (user: ILocalUser, key: UserKeypair, postfix?: string) => ({
id: `${config.url}/users/${user.id}${postfix || '/publickey'}`,
type: 'Key',
owner: `${config.url}/users/${user.id}`,
publicKeyPem: createPublicKey(key.publicKey).export({
type: 'spki',
format: 'pem'
})
});