1
0
Fork 0
peertube/server/lib/activitypub/actors/keys.ts
2021-06-03 16:40:32 +02:00

16 lines
500 B
TypeScript

import { createPrivateAndPublicKeys } from '@server/helpers/peertube-crypto'
import { MActor } from '@server/types/models'
// Set account keys, this could be long so process after the account creation and do not block the client
async function generateAndSaveActorKeys <T extends MActor> (actor: T) {
const { publicKey, privateKey } = await createPrivateAndPublicKeys()
actor.publicKey = publicKey
actor.privateKey = privateKey
return actor.save()
}
export {
generateAndSaveActorKeys
}