final public static function fromString(string $token): self
    {
        if (Binary::safeStrlen($token) < self::TOKEN_CHAR_LENGTH) {
            // Don't zero memory as the value is invalid.
            throw new \RuntimeException('Invalid token provided.');
        }

        $instance = new static();
        $instance->token = new HiddenString($token);
        $instance->selector = Binary::safeSubstr($token, 0, 32);
        $instance->verifier = Binary::safeSubstr($token, 32);

        // Don't (re)generate as this needs the salt of the stored hash.
        $instance->verifierHash = null;

        \sodium_memzero($token);

        return $instance;
    }