This commit is contained in:
syuilo
2019-04-08 03:35:02 +09:00
parent d9a5e06b5b
commit 142d59be85
4 changed files with 29 additions and 18 deletions

View File

@ -1,4 +1,3 @@
import { createPublicKey } from 'crypto';
import config from '../../../config';
import { ILocalUser } from '../../../models/entities/user';
import { UserKeypair } from '../../../models/entities/user-keypair';
@ -7,5 +6,5 @@ export default (user: ILocalUser, key: UserKeypair) => ({
id: `${config.url}/users/${user.id}/publickey`,
type: 'Key',
owner: `${config.url}/users/${user.id}`,
publicKeyPem: createPublicKey(key.keyPem)
publicKeyPem: key.publicKey
});

View File

@ -67,7 +67,7 @@ export default async (user: ILocalUser, url: string, object: any) => {
sign(req, {
authorizationHeaderName: 'Signature',
key: keypair.keyPem,
key: keypair.privateKey,
keyId: `${config.url}/users/${user.id}/publickey`,
headers: ['date', 'host', 'digest']
});