Skip to content

Commit

Permalink
Apply cs fixer
Browse files Browse the repository at this point in the history
  • Loading branch information
sop committed Sep 27, 2021
1 parent 963b080 commit fb1d89f
Show file tree
Hide file tree
Showing 206 changed files with 388 additions and 1,913 deletions.
13 changes: 7 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,20 @@
/.pydevproject

# VS Code
/.vscode
/.vscode/

# build files
# Build files
/build/
/.*.cache
.cache/
.*[.-]cache

# Composer
/vendor/
/composer.lock

# non-dist files
# Non-dist files
/phpunit.xml
/.php_cs
/.php-cs-fixer.php

# sandbox
# Sandbox
/demo/
40 changes: 40 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

declare(strict_types = 1);

$finder = \PhpCsFixer\Finder::create()
->in(__DIR__);

$config = new \PhpCsFixer\Config();
return $config->setRules([
'@PSR2' => true,
'@PhpCsFixer' => true,
'multiline_whitespace_before_semicolons' => [
'strategy' => 'no_multi_line'
],
'declare_equal_normalize' => [
'space' => 'single'
],
'method_argument_space' => [
'on_multiline' => 'ignore'
],
'trailing_comma_in_multiline' => [
'elements' => []
],
'blank_line_before_statement' => [
'statements' => []
],
'concat_space' => [
'spacing' => 'one'
],
'list_syntax' => [
'syntax' => 'short'
],
'echo_tag_syntax' => [
'format' => 'short'
],
'no_alternative_syntax' => false,
'php_unit_test_class_requires_covers' => false,
'phpdoc_to_comment' => false,
'phpdoc_var_without_name' => false,
])->setFinder($finder);
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ language: php
php:
- "7.2"
- "7.3"
- "7.4"
- "8.0"
before_script:
- "composer install"
- "composer require php-coveralls/php-coveralls"
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2016-2019 Joni Eskelinen
Copyright (c) 2016-2021 Joni Eskelinen

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
74 changes: 37 additions & 37 deletions lib/JWX/JWA/JWA.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,187 +18,187 @@ abstract class JWA
/**
* HMAC using SHA-256.
*/
const ALGO_HS256 = 'HS256';
public const ALGO_HS256 = 'HS256';

/**
* HMAC using SHA-384.
*/
const ALGO_HS384 = 'HS384';
public const ALGO_HS384 = 'HS384';

/**
* HMAC using SHA-512.
*/
const ALGO_HS512 = 'HS512';
public const ALGO_HS512 = 'HS512';

/**
* RSASSA-PKCS1-v1_5 using SHA-256.
*/
const ALGO_RS256 = 'RS256';
public const ALGO_RS256 = 'RS256';

/**
* RSASSA-PKCS1-v1_5 using SHA-384.
*/
const ALGO_RS384 = 'RS384';
public const ALGO_RS384 = 'RS384';

/**
* RSASSA-PKCS1-v1_5 using SHA-512.
*/
const ALGO_RS512 = 'RS512';
public const ALGO_RS512 = 'RS512';

/**
* ECDSA using P-256 and SHA-256.
*/
const ALGO_ES256 = 'ES256';
public const ALGO_ES256 = 'ES256';

/**
* ECDSA using P-384 and SHA-384.
*/
const ALGO_ES384 = 'ES384';
public const ALGO_ES384 = 'ES384';

/**
* ECDSA using P-521 and SHA-512.
*/
const ALGO_ES512 = 'ES512';
public const ALGO_ES512 = 'ES512';

/**
* RSASSA-PSS using SHA-256 and MGF1 with SHA-256.
*/
const ALGO_PS256 = 'PS256';
public const ALGO_PS256 = 'PS256';

/**
* RSASSA-PSS using SHA-384 and MGF1 with SHA-384.
*/
const ALGO_PS384 = 'PS384';
public const ALGO_PS384 = 'PS384';

/**
* RSASSA-PSS using SHA-512 and MGF1 with SHA-512.
*/
const ALGO_PS512 = 'PS512';
public const ALGO_PS512 = 'PS512';

/**
* No digital signature or MAC performed.
*/
const ALGO_NONE = 'none';
public const ALGO_NONE = 'none';

/**
* RSAES-PKCS1-v1_5.
*/
const ALGO_RSA1_5 = 'RSA1_5';
public const ALGO_RSA1_5 = 'RSA1_5';

/**
* RSAES OAEP using default parameters.
*/
const ALGO_RSA_OAEP = 'RSA-OAEP';
public const ALGO_RSA_OAEP = 'RSA-OAEP';

/**
* RSAES OAEP using SHA-256 and MGF1 with SHA-256.
*/
const ALGO_RSA_OAEP256 = 'RSA-OAEP-256';
public const ALGO_RSA_OAEP256 = 'RSA-OAEP-256';

/**
* AES Key Wrap using 128-bit key.
*/
const ALGO_A128KW = 'A128KW';
public const ALGO_A128KW = 'A128KW';

/**
* AES Key Wrap using 192-bit key.
*/
const ALGO_A192KW = 'A192KW';
public const ALGO_A192KW = 'A192KW';

/**
* AES Key Wrap using 256-bit key.
*/
const ALGO_A256KW = 'A256KW';
public const ALGO_A256KW = 'A256KW';

/**
* Direct use of a shared symmetric key.
*/
const ALGO_DIR = 'dir';
public const ALGO_DIR = 'dir';

/**
* ECDH-ES using Concat KDF.
*/
const ALGO_ECDH_ES = 'ECDH-ES';
public const ALGO_ECDH_ES = 'ECDH-ES';

/**
* ECDH-ES using Concat KDF and "A128KW" wrapping.
*/
const ALGO_ECDH_ES_A128KW = 'ECDH-ES+A128KW';
public const ALGO_ECDH_ES_A128KW = 'ECDH-ES+A128KW';

/**
* ECDH-ES using Concat KDF and "A192KW" wrapping.
*/
const ALGO_ECDH_ES_A192KW = 'ECDH-ES+A192KW';
public const ALGO_ECDH_ES_A192KW = 'ECDH-ES+A192KW';

/**
* ECDH-ES using Concat KDF and "A256KW" wrapping.
*/
const ALGO_ECDH_ES_A256KW = 'ECDH-ES+A256KW';
public const ALGO_ECDH_ES_A256KW = 'ECDH-ES+A256KW';

/**
* Key wrapping with AES GCM using 128-bit key.
*/
const ALGO_A128GCMKW = 'A128GCMKW';
public const ALGO_A128GCMKW = 'A128GCMKW';

/**
* Key wrapping with AES GCM using 192-bit key.
*/
const ALGO_A192GCMKW = 'A192GCMKW';
public const ALGO_A192GCMKW = 'A192GCMKW';

/**
* Key wrapping with AES GCM using 256-bit key.
*/
const ALGO_A256GCMKW = 'A256GCMKW';
public const ALGO_A256GCMKW = 'A256GCMKW';

/**
* PBES2 with HMAC SHA-256 and "A128KW" wrapping.
*/
const ALGO_PBES2_HS256_A128KW = 'PBES2-HS256+A128KW';
public const ALGO_PBES2_HS256_A128KW = 'PBES2-HS256+A128KW';

/**
* PBES2 with HMAC SHA-384 and "A192KW" wrapping.
*/
const ALGO_PBES2_HS384_A192KW = 'PBES2-HS384+A192KW';
public const ALGO_PBES2_HS384_A192KW = 'PBES2-HS384+A192KW';

/**
* PBES2 with HMAC SHA-512 and "A256KW" wrapping.
*/
const ALGO_PBES2_HS512_A256KW = 'PBES2-HS512+A256KW';
public const ALGO_PBES2_HS512_A256KW = 'PBES2-HS512+A256KW';

/**
* AES_128_CBC_HMAC_SHA_256 authenticated encryption algorithm.
*/
const ALGO_A128CBC_HS256 = 'A128CBC-HS256';
public const ALGO_A128CBC_HS256 = 'A128CBC-HS256';

/**
* AES_192_CBC_HMAC_SHA_384 authenticated encryption algorithm.
*/
const ALGO_A192CBC_HS384 = 'A192CBC-HS384';
public const ALGO_A192CBC_HS384 = 'A192CBC-HS384';

/**
* AES_256_CBC_HMAC_SHA_512 authenticated encryption algorithm.
*/
const ALGO_A256CBC_HS512 = 'A256CBC-HS512';
public const ALGO_A256CBC_HS512 = 'A256CBC-HS512';

/**
* AES GCM using 128-bit key.
*/
const ALGO_A128GCM = 'A128GCM';
public const ALGO_A128GCM = 'A128GCM';

/**
* AES GCM using 192-bit key.
*/
const ALGO_A192GCM = 'A192GCM';
public const ALGO_A192GCM = 'A192GCM';

/**
* AES GCM using 256-bit key.
*/
const ALGO_A256GCM = 'A256GCM';
public const ALGO_A256GCM = 'A256GCM';

/**
* DEFLATE compression.
*/
const ALGO_DEFLATE = 'DEF';
public const ALGO_DEFLATE = 'DEF';

/**
* Derive algorithm name from the header and optionally from the given JWK.
Expand Down
8 changes: 1 addition & 7 deletions lib/JWX/JWE/CompressionAlgorithm/CompressionFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,14 @@ abstract class CompressionFactory
*
* @var array
*/
const MAP_ALGO_TO_CLASS = [
public const MAP_ALGO_TO_CLASS = [
JWA::ALGO_DEFLATE => DeflateAlgorithm::class,
];

/**
* Get the compression algorithm by name.
*
* @param string $name
*
* @throws \UnexpectedValueException If algorithm is not supported
*
* @return CompressionAlgorithm
*/
public static function algoByName(string $name): CompressionAlgorithm
{
Expand All @@ -50,8 +46,6 @@ public static function algoByName(string $name): CompressionAlgorithm
*
* @throws \UnexpectedValueException If compression algorithm parameter is
* not present or algorithm is not supported
*
* @return CompressionAlgorithm
*/
public static function algoByHeader(Header $header): CompressionAlgorithm
{
Expand Down
4 changes: 0 additions & 4 deletions lib/JWX/JWE/ContentEncryptionAlgorithm.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,11 @@ public function decrypt(string $ciphertext, string $key, string $iv,

/**
* Get the required key size in bytes.
*
* @return int
*/
public function keySize(): int;

/**
* Get the required IV size in bytes.
*
* @return int
*/
public function ivSize(): int;
}
Loading

0 comments on commit fb1d89f

Please sign in to comment.