Create keys for new users and pass correct number of arguments

This commit is contained in:
Jeremy Dormitzer 2018-10-26 07:07:49 -04:00
parent eb7a8b312b
commit f9addf7dc2
2 changed files with 7 additions and 1 deletions

View File

@ -17,6 +17,12 @@ add_action( 'rest_api_init', function() {
add_action( 'user_register', function( $user_id ) {
$slug = get_the_author_meta( 'user_nicename', $user_id );
\pterotype\actors\create_actor( $slug, 'user' );
$actor_id = \pterotype\actors\get_actor_id( $slug );
$keys_created = \pterotype\pgp\get_public_key( $slug );
if ( ! $keys_created ) {
$keys = \pterotype\pgp\gen_key( $slug );
\pterotype\pgp\persist_key( $actor_id, $keys['publickey'], $keys['privatekey'] );
}
} );
add_action( 'pterotype_init', function() {

View File

@ -130,7 +130,7 @@ function post_activity_to_inboxes( $actor_id, $activity, $recipients ) {
$request->set_method('POST');
$request->set_body( $activity );
$request->add_header( 'Content-Type', 'application/ld+json' );
$request->add_header( 'Signature', signature_header( $inbox, $actor_id ) );
$request->add_header( 'Signature', signature_header( $inbox, $actor_id, $date_str ) );
$request->add_header( 'Date', $date_str );
$server = rest_get_server();
$response = $server->dispatch( $request );