public function decode($jwsString)
    {
        $components = explode('.', $jwsString);
        if (count($components) !== 3) {
            throw new MalformedSignatureException('JWS string must contain 3 dot separated component.');
        }

        try {
            $headers = Json::decode(Base64Url::decode($components[0]));
            $payload = Json::decode(Base64Url::decode($components[1]));
        } catch (\InvalidArgumentException $e) {
            throw new MalformedSignatureException("Cannot decode signature headers and/or payload");
        }

        return [
            'headers' => $headers,
            'payload' => $payload
        ];
    }