public static function ensureOnCurve($key)
    {
        $point = self::unserializePoint($key);
        if (!static::curve()->contains($point->getX(), $point->getY())) {
            throw new \InvalidArgumentException(
                'Invalid key. Point is not on the curve.'
            );
        }
    }