| @@ 65-72 (lines=8) @@ | ||
| 62 | } | |
| 63 | ||
| 64 | // Kind of annoying. Maybe refactor Jetpack_Signature to handle body-hashing | |
| 65 | 		if ( is_null( $body ) ) { | |
| 66 | $body_hash = ''; | |
| 67 | 		} else { | |
| 68 | 			if ( !is_string( $body ) ) { | |
| 69 | return new Jetpack_Error( 'invalid_body', 'Body is malformed.' ); | |
| 70 | } | |
| 71 | $body_hash = jetpack_sha1_base64( $body ); | |
| 72 | } | |
| 73 | ||
| 74 | $auth = array( | |
| 75 | 'token' => $token_key, | |
| @@ 81-86 (lines=6) @@ | ||
| 78 | } | |
| 79 | ||
| 80 | $required_parameters = array( 'token', 'timestamp', 'nonce', 'method', 'url' ); | |
| 81 | 		if ( !is_null( $body ) ) { | |
| 82 | $required_parameters[] = 'body_hash'; | |
| 83 | 			if ( !is_string( $body ) ) { | |
| 84 | return new Jetpack_Error( 'invalid_body', 'Body is malformed.' ); | |
| 85 | } | |
| 86 | } | |
| 87 | ||
| 88 | 		foreach ( $required_parameters as $required ) { | |
| 89 | 			if ( !is_scalar( $$required ) ) { | |