]>
Commit | Line | Data |
---|---|---|
136d7efd C |
1 | import { createPrivateAndPublicKeys } from '@server/helpers/peertube-crypto' |
2 | import { MActor } from '@server/types/models' | |
3 | ||
4 | // Set account keys, this could be long so process after the account creation and do not block the client | |
5 | async function generateAndSaveActorKeys <T extends MActor> (actor: T) { | |
6 | const { publicKey, privateKey } = await createPrivateAndPublicKeys() | |
7 | ||
8 | actor.publicKey = publicKey | |
9 | actor.privateKey = privateKey | |
10 | ||
11 | return actor.save() | |
12 | } | |
13 | ||
14 | export { | |
15 | generateAndSaveActorKeys | |
16 | } |