parent
037837b551
commit
0e4a111f81
1714 changed files with 20803 additions and 11751 deletions
14
packages/backend/src/remote/activitypub/renderer/key.ts
Normal file
14
packages/backend/src/remote/activitypub/renderer/key.ts
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import config from '@/config/index';
|
||||
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'
|
||||
})
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue