Conversation
|
Looks like this is going to be a bit of a mess to implement with the current way the code is designed, unfortunately, as the constructor of child classes are being overridden, so the static instantiation isn't guaranteed. The codebase really needs to be refactored with a factory design. Using static methods is problematic currently, particularly due to the inheritance design and multiple versioned key classes. To better understand the issue here. When doing something like: use ParagonIE\Paseto\Keys\SymmetricKey;
$key = SymmetricKey::v4($sharedKey);
assert($key instanceof SymmetricKey);This assertion will fail, as it will return an instance of |
When instantiating a versioned
SymmetricKey, or even anAsymmetric{Public}Key, should those classes be properly refactored, the base class should return a static instance, such that the instantiated version of the class is the one called - not the base class.