parent
5a950cf991
commit
46aaf8fa9a
4 changed files with 14 additions and 10 deletions
|
|
@ -1,10 +1,14 @@
|
|||
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) => ({
|
||||
id: `${config.url}/users/${user.id}/publickey`,
|
||||
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: key.publicKey
|
||||
publicKeyPem: createPublicKey(key.publicKey).export({
|
||||
type: 'spki',
|
||||
format: 'pem'
|
||||
})
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue