aboutsummaryrefslogblamecommitdiffhomepage
path: root/server/lib/activitypub/actors/keys.ts
blob: c3d18abd8406ad59b6f0a10e74f9f46acacc239c (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16















                                                                                                         
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
}