Remove deprecated Ramsey\Uuid\Generator\RandomLibAdapter

This commit is contained in:
Ben Ramsey
2022-03-27 13:17:39 -05:00
parent b688545892
commit c2cfd0c4fb
5 changed files with 8 additions and 334 deletions
+7
View File
@@ -8,6 +8,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## Unreleased
### Changed
* Remove deprecated `Ramsey\Uuid\Builder\BuilderCollection`.
* Remove deprecated `Ramsey\Uuid\Generator\RandomLibAdapter`.
* Remove deprecated `Ramsey\Uuid\Provider\Node\NodeProviderCollection`.
* Remove dependency on ramsey/collection package.
### Deprecated
The following will be removed in ramsey/uuid 5.0.0:
-2
View File
@@ -22,7 +22,6 @@
"ergebnis/composer-normalize": "^2.15",
"mockery/mockery": "^1.3",
"moontoast/math": "^1.1",
"paragonie/random-lib": "^2",
"php-mock/php-mock": "^2.2",
"php-mock/php-mock-mockery": "^1.3",
"php-parallel-lint/php-parallel-lint": "^1.1",
@@ -44,7 +43,6 @@
"ext-ctype": "Enables faster processing of character classification using ctype functions.",
"ext-gmp": "Enables faster math with arbitrary-precision integers using GMP.",
"ext-uuid": "Enables the use of PeclUuidTimeGenerator and PeclUuidRandomGenerator.",
"paragonie/random-lib": "Provides RandomLib for use with the RandomLibAdapter",
"ramsey/uuid-doctrine": "Allows the use of Ramsey\\Uuid\\Uuid as Doctrine field type."
},
"minimum-stability": "dev",
Generated
+1 -202
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "ce3cd44d20ba1daf10d5ab2a9631b702",
"content-hash": "750d5b612e8b7071e493692d9caf2a23",
"packages": [
{
"name": "brick/math",
@@ -1419,56 +1419,6 @@
},
"time": "2020-07-09T08:09:16+00:00"
},
{
"name": "ircmaxell/security-lib",
"version": "v1.1.0",
"source": {
"type": "git",
"url": "https://github.com/ircmaxell/SecurityLib.git",
"reference": "f3db6de12c20c9bcd1aa3db4353a1bbe0e44e1b5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ircmaxell/SecurityLib/zipball/f3db6de12c20c9bcd1aa3db4353a1bbe0e44e1b5",
"reference": "f3db6de12c20c9bcd1aa3db4353a1bbe0e44e1b5",
"shasum": ""
},
"require": {
"php": ">=5.3.2"
},
"require-dev": {
"mikey179/vfsstream": "1.1.*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-0": {
"SecurityLib": "lib"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Anthony Ferrara",
"email": "ircmaxell@ircmaxell.com",
"homepage": "http://blog.ircmaxell.com"
}
],
"description": "A Base Security Library",
"homepage": "https://github.com/ircmaxell/SecurityLib",
"support": {
"issues": "https://github.com/ircmaxell/SecurityLib/issues",
"source": "https://github.com/ircmaxell/SecurityLib/tree/master"
},
"time": "2015-03-20T14:31:23+00:00"
},
{
"name": "justinrainbow/json-schema",
"version": "5.2.11",
@@ -2012,71 +1962,6 @@
},
"time": "2022-01-17T05:32:27+00:00"
},
{
"name": "paragonie/random-lib",
"version": "v2.0.1",
"source": {
"type": "git",
"url": "https://github.com/paragonie/RandomLib.git",
"reference": "f0ca6a2859b22f7caea9c343e63ffb3ce9b2ffa7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/paragonie/RandomLib/zipball/f0ca6a2859b22f7caea9c343e63ffb3ce9b2ffa7",
"reference": "f0ca6a2859b22f7caea9c343e63ffb3ce9b2ffa7",
"shasum": ""
},
"require": {
"ircmaxell/security-lib": "^1.1",
"paragonie/random_compat": "^2",
"paragonie/sodium_compat": "^1.3",
"php": ">=5.3.2"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^1.11",
"mikey179/vfsstream": "^1.6",
"phpunit/phpunit": "^4.8 || >=5.0.0 <5.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.1.x-dev"
}
},
"autoload": {
"psr-0": {
"RandomLib": "lib"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Paragon Initiative Enterprises",
"email": "security@paragonie.com",
"homepage": "https://paragonie.com"
},
{
"name": "Anthony Ferrara",
"email": "ircmaxell@ircmaxell.com",
"homepage": "http://blog.ircmaxell.com"
}
],
"description": "A Library For Generating Secure Random Numbers",
"homepage": "https://github.com/ircmaxell/RandomLib",
"keywords": [
"cryptography",
"random",
"random-numbers",
"random-strings"
],
"support": {
"source": "https://github.com/paragonie/RandomLib/tree/v2.0.1"
},
"time": "2019-12-23T23:03:52+00:00"
},
{
"name": "paragonie/random_compat",
"version": "v2.0.21",
@@ -2131,92 +2016,6 @@
},
"time": "2022-02-16T17:07:03+00:00"
},
{
"name": "paragonie/sodium_compat",
"version": "v1.17.0",
"source": {
"type": "git",
"url": "https://github.com/paragonie/sodium_compat.git",
"reference": "c59cac21abbcc0df06a3dd18076450ea4797b321"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/paragonie/sodium_compat/zipball/c59cac21abbcc0df06a3dd18076450ea4797b321",
"reference": "c59cac21abbcc0df06a3dd18076450ea4797b321",
"shasum": ""
},
"require": {
"paragonie/random_compat": ">=1",
"php": "^5.2.4|^5.3|^5.4|^5.5|^5.6|^7|^8"
},
"require-dev": {
"phpunit/phpunit": "^3|^4|^5|^6|^7|^8|^9"
},
"suggest": {
"ext-libsodium": "PHP < 7.0: Better performance, password hashing (Argon2i), secure memory management (memzero), and better security.",
"ext-sodium": "PHP >= 7.0: Better performance, password hashing (Argon2i), secure memory management (memzero), and better security."
},
"type": "library",
"autoload": {
"files": [
"autoload.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"ISC"
],
"authors": [
{
"name": "Paragon Initiative Enterprises",
"email": "security@paragonie.com"
},
{
"name": "Frank Denis",
"email": "jedisct1@pureftpd.org"
}
],
"description": "Pure PHP implementation of libsodium; uses the PHP extension if it exists",
"keywords": [
"Authentication",
"BLAKE2b",
"ChaCha20",
"ChaCha20-Poly1305",
"Chapoly",
"Curve25519",
"Ed25519",
"EdDSA",
"Edwards-curve Digital Signature Algorithm",
"Elliptic Curve Diffie-Hellman",
"Poly1305",
"Pure-PHP cryptography",
"RFC 7748",
"RFC 8032",
"Salpoly",
"Salsa20",
"X25519",
"XChaCha20-Poly1305",
"XSalsa20-Poly1305",
"Xchacha20",
"Xsalsa20",
"aead",
"cryptography",
"ecdh",
"elliptic curve",
"elliptic curve cryptography",
"encryption",
"libsodium",
"php",
"public-key cryptography",
"secret-key cryptography",
"side-channel resistant"
],
"support": {
"issues": "https://github.com/paragonie/sodium_compat/issues",
"source": "https://github.com/paragonie/sodium_compat/tree/v1.17.0"
},
"time": "2021-08-10T02:43:50+00:00"
},
{
"name": "phar-io/manifest",
"version": "2.0.3",
-59
View File
@@ -1,59 +0,0 @@
<?php
/**
* This file is part of the ramsey/uuid library
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
* @license http://opensource.org/licenses/MIT MIT
*/
declare(strict_types=1);
namespace Ramsey\Uuid\Generator;
use RandomLib\Factory;
use RandomLib\Generator;
/**
* RandomLibAdapter generates strings of random binary data using the
* paragonie/random-lib library
*
* @deprecated This class will be removed in 5.0.0. Use the default
* RandomBytesGenerator or implement your own generator that implements
* RandomGeneratorInterface.
*
* @link https://packagist.org/packages/paragonie/random-lib paragonie/random-lib
*/
class RandomLibAdapter implements RandomGeneratorInterface
{
/**
* @var Generator
*/
private $generator;
/**
* Constructs a RandomLibAdapter
*
* By default, if no Generator is passed in, this creates a high-strength
* generator to use when generating random binary data.
*
* @param Generator|null $generator The generator to use when generating binary data
*/
public function __construct(?Generator $generator = null)
{
if ($generator === null) {
$factory = new Factory();
$generator = $factory->getHighStrengthGenerator();
}
$this->generator = $generator;
}
public function generate(int $length): string
{
return $this->generator->generate($length);
}
}
-71
View File
@@ -1,71 +0,0 @@
<?php
declare(strict_types=1);
namespace Ramsey\Uuid\Test\Generator;
use Mockery;
use Ramsey\Uuid\Generator\RandomLibAdapter;
use Ramsey\Uuid\Test\TestCase;
use RandomLib\Factory as RandomLibFactory;
use RandomLib\Generator;
class RandomLibAdapterTest extends TestCase
{
/**
* @runInSeparateProcess
* @preserveGlobalState disabled
*/
public function testAdapterWithGeneratorDoesNotCreateGenerator(): void
{
$factory = Mockery::mock('overload:' . RandomLibFactory::class);
$factory->shouldNotReceive('getHighStrengthGenerator');
$generator = $this->getMockBuilder(Generator::class)
->disableOriginalConstructor()
->getMock();
$this->assertInstanceOf(RandomLibAdapter::class, new RandomLibAdapter($generator));
}
/**
* @runInSeparateProcess
* @preserveGlobalState disabled
*/
public function testAdapterWithoutGeneratorGreatesGenerator(): void
{
$factory = Mockery::mock('overload:' . RandomLibFactory::class);
$factory->shouldReceive('getHighStrengthGenerator')->once();
$this->assertInstanceOf(RandomLibAdapter::class, new RandomLibAdapter());
}
public function testGenerateUsesGenerator(): void
{
$length = 10;
$generator = $this->getMockBuilder(Generator::class)
->disableOriginalConstructor()
->getMock();
$generator->expects($this->once())
->method('generate')
->with($length)
->willReturn('foo');
$adapter = new RandomLibAdapter($generator);
$adapter->generate($length);
}
public function testGenerateReturnsString(): void
{
$generator = $this->getMockBuilder(Generator::class)
->disableOriginalConstructor()
->getMock();
$generator->expects($this->once())
->method('generate')
->willReturn('random-string');
$adapter = new RandomLibAdapter($generator);
$result = $adapter->generate(1);
$this->assertSame('random-string', $result);
}
}