merge-requests/5/head
Terence Eden 2024-02-14 09:51:14 +00:00
rodzic 74bf3d1a68
commit 24283f5f96
1 zmienionych plików z 6 dodań i 6 usunięć

Wyświetl plik

@ -17,7 +17,7 @@
$username = rawurlencode("example"); // Encoded as it is often used as part of a URl $username = rawurlencode("example"); // Encoded as it is often used as part of a URl
$realName = "E. Xample. Jr."; $realName = "E. Xample. Jr.";
$summary = "Some text about the user."; $summary = "Some text about the user.";
$server = $_SERVER['SERVER_NAME']; // Domain name this is hosted on $server = $_SERVER["SERVER_NAME"]; // Domain name this is hosted on
// Generate locally or from https://cryptotools.net/rsagen // Generate locally or from https://cryptotools.net/rsagen
// Newlines must be replaced with "\n" // Newlines must be replaced with "\n"
@ -45,7 +45,7 @@
} }
// Create a timestamp in ISO 8601 format for the filename // Create a timestamp in ISO 8601 format for the filename
$timestamp = date('c'); $timestamp = date( "c" );
// Filename for the log // Filename for the log
$filename = "{$timestamp}{$type}.txt"; $filename = "{$timestamp}{$type}.txt";
@ -253,7 +253,7 @@
function uuid() { function uuid() {
// Date sortable UUID // Date sortable UUID
return sprintf( '%08x-%04x-%04x-%04x-%012x', return sprintf( "%08x-%04x-%04x-%04x-%012x",
time(), time(),
mt_rand(0, 0xffff), mt_rand(0, 0xffff),
mt_rand(0, 0xffff), mt_rand(0, 0xffff),
@ -272,9 +272,9 @@
$keyId = "https://{$server}/{$username}#main-key"; $keyId = "https://{$server}/{$username}#main-key";
// Generate signing variables // Generate signing variables
$hash = hash( 'sha256', $message_json, true ); $hash = hash( "sha256", $message_json, true );
$digest = base64_encode( $hash ); $digest = base64_encode( $hash );
$date = date( 'D, d M Y H:i:s \G\M\T' ); $date = date( "D, d M Y H:i:s \G\M\T" );
// Get the Private Key // Get the Private Key
$signer = openssl_get_privatekey( $key_private ); $signer = openssl_get_privatekey( $key_private );
@ -402,7 +402,7 @@ HTML;
// Each server needs its own cURL handle // Each server needs its own cURL handle
// Each POST to an inbox needs to be signed separately // Each POST to an inbox needs to be signed separately
foreach ( $hosts as $host ) { foreach ( $hosts as $host ) {
$path = '/inbox'; $path = "/inbox";
// Get the signed headers // Get the signed headers
$headers = generate_signed_headers( $message, $host, $path ); $headers = generate_signed_headers( $message, $host, $path );