generate key if not existent
This commit is contained in:
parent
96953dfc7e
commit
180e882c4a
1 changed files with 10 additions and 0 deletions
|
@ -28,6 +28,10 @@ class Signature {
|
|||
$key = \get_user_meta( $user_id, 'magic_sig_public_key', true );
|
||||
}
|
||||
|
||||
if ( ! $key ) {
|
||||
return self::generate_key_pair( $user_id, true );
|
||||
}
|
||||
|
||||
return $key;
|
||||
}
|
||||
|
||||
|
@ -47,6 +51,10 @@ class Signature {
|
|||
$key = \get_user_meta( $user_id, 'magic_sig_private_key', true );
|
||||
}
|
||||
|
||||
if ( ! $key ) {
|
||||
return self::generate_key_pair( $user_id, true );
|
||||
}
|
||||
|
||||
return $key;
|
||||
}
|
||||
|
||||
|
@ -108,6 +116,8 @@ class Signature {
|
|||
$signed_string = "(request-target): $http_method $path\nhost: $host\ndate: $date";
|
||||
}
|
||||
|
||||
var_dump($key);
|
||||
|
||||
$signature = null;
|
||||
\openssl_sign( $signed_string, $signature, $key, \OPENSSL_ALGO_SHA256 );
|
||||
$signature = \base64_encode( $signature ); // phpcs:ignore
|
||||
|
|
Loading…
Reference in a new issue