Giter VIP home page Giter VIP logo

Comments (7)

ishwara-bhat avatar ishwara-bhat commented on August 30, 2024 1

from pywebpush.

cmesas avatar cmesas commented on August 30, 2024

@ishwara-bhat I have the same problem, how could you solve it?

from pywebpush.

jrconlin avatar jrconlin commented on August 30, 2024

Reading the dump, it appears that the problem is that http_ece can't encrypt content.
content comes from data in self.encode(data, content_encoding)

from a very quick view, I'm going to guess that the data being passed in is not a byte array. You may need to serialize the object content into a string or byte array before passing it to webpush.encode

from pywebpush.

cmesas avatar cmesas commented on August 30, 2024

Reading the dump, it appears that the problem is that http_ece can't encrypt content. content comes from data in self.encode(data, content_encoding)

from a very quick view, I'm going to guess that the data being passed in is not a byte array. You may need to serialize the object content into a string or byte array before passing it to webpush.encode

An example of a key pair that I am using are the following. I am using string strings directly.

{
"subject": "mailto: [email protected]",
"publicKey": "BLR4PgElXtaeu16JlFEfVuOZkyub-Y36w1XRDYvl7-gNOKUpW-YadhR0Yv6vnrz5h4HhJG5jq0arBRuIrJdWXtQ",
"privateKey": "LqUduWL7V0F7pOrYep5oTgZJaCXLl7eRvMZMpAE6DCA"
}

Is it necessary to use PEM certificates or can I use string keys?

from pywebpush.

jrconlin avatar jrconlin commented on August 30, 2024

String keys can be in either raw or DER format: https://github.com/web-push-libs/vapid/blob/main/python/py_vapid/__init__.py#L134-L147. If you provide a path, py_vapid will try to read the file as either PEM or DER formatted https://github.com/web-push-libs/vapid/blob/main/python/py_vapid/__init__.py#L134-L147

from pywebpush.

cmesas avatar cmesas commented on August 30, 2024

Las claves de cadena pueden estar en formato raw o DER: https://github.com/web-push-libs/vapid/blob/main/python/py_vapid/__init__.py#L134-L147 . Si proporciona una ruta, py_vapid intentará leer el archivo con formato PEM o DER https://github.com/web-push-libs/vapid/blob/main/python/py_vapid/__init__.py#L134-L147

Ok, I will try to work with the private key in PEM format from the file directly.

from pywebpush.

treygilliland avatar treygilliland commented on August 30, 2024

Just ran into this same issue. Make sure your data payload is JSON string encoded and not just a raw python dictionary.

from pywebpush.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.