apns2 | ⚡ HTTP/2 Apple Push Notification Service | Notification library

 by   sideshow Go Version: v0.23.0 License: MIT

kandi X-RAY | apns2 Summary

kandi X-RAY | apns2 Summary

apns2 is a Go library typically used in Messaging, Notification applications. apns2 has no bugs, it has no vulnerabilities, it has a Permissive License and it has medium support. You can download it from GitHub.

HTTP/2 Apple Push Notification Service (APNs) push provider for Go — Send push notifications to iOS, tvOS, Safari and OSX apps, using the APNs HTTP/2 protocol.

            kandi-support Support

              apns2 has a medium active ecosystem.
              It has 2810 star(s) with 326 fork(s). There are 75 watchers for this library.
              It had no major release in the last 12 months.
              There are 22 open issues and 80 have been closed. On average issues are closed in 138 days. There are 13 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of apns2 is v0.23.0

            kandi-Quality Quality

              apns2 has no bugs reported.

            kandi-Security Security

              apns2 has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              apns2 is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              apns2 releases are available to install and integrate.
              Installation instructions, examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of apns2
            Get all kandi verified functions for this library.

            apns2 Key Features

            No Key Features are available at this moment for apns2.

            apns2 Examples and Code Snippets

            No Code Snippets are available at this moment for apns2.

            Community Discussions


            Pipenv install fails on cryptography package: "Disabling PEP 517 processing is invalid" error
            Asked 2021-Apr-14 at 16:29

            Without being aware of it, I've been using the cryptography package for many months now without issue, but suddenly it won't build and it's brought development on my project to a halt.

            It turns out cryptography is a dependency of one of the other packages in my Pipfile: apns2. As I said, it's been working fine, but something must have changed in my environment. Here is my Pipfile with just that package isolated:



            Answered 2021-Jan-11 at 01:10

            It seems the cryptography package can only be installed with pip, not pipenv, so by doing this first...

            Source https://stackoverflow.com/questions/65658570


            Sending iOS Push Notifications using Django: HTTP/2-based APNs provider API and binary protocol
            Asked 2021-Mar-14 at 10:16

            We need to send iOS push notifications using our Django based backend. Currently, we use this library https://github.com/jazzband/django-push-notifications for sending notifications. Recently, received this mail from Apple Developers.

            The HTTP/2‑based Apple Push Notification service (APNs) provider API lets you take advantage of great features, such as authentication with a JSON Web Token, improved error messaging, and per‑notification feedback. If you still send push notifications with the legacy binary protocol, make sure to upgrade to the APNs provider API as soon as possible. APNs will no longer support the legacy binary protocol after March 31, 2021.

            I saw that this library uses apns2 (https://pypi.org/project/apns2/) for sending push notifications on iOS and that uses HTTP/2 protocol for sending notifications. So, this library can continue to be used for sending iOS notifications right? Can anybody clarify that for me? Also, it would be great if someone could explain the meaning of legacy binary protocol, that would be great.



            Answered 2021-Mar-14 at 10:16

            After posting the question here, I had also raised Github Issue on Django-Push-Notifications Repository.

            I have got a reply from maintainers and it looks like we would be able to continue using this library. Posting his reply here,

            For what I understand this should not be an issue nor for this package nor for apns2 (which is used to send Apple-Push-Notifications).

            Apple is dismantling the legacy binary protocol (which was announced on October 9 2020) in favor of the HTTP one. However since apns2 implements the latter this would not be an issue here since it already uses the preferred protocol.

            For the record: here is the specification of the legacy binary protocol for APNS.


            Source https://stackoverflow.com/questions/66517902


            heroku pip requirements.txt google-cloud-speech fails
            Asked 2020-Jul-23 at 18:39

            I have a requirements.txt in my python/django project. Everything has worked fine, locally as well, until I tried to include google-cloud-speech in my requirements and deploying to heroku. It has failed since then and I'm not sure why. (I have deployed to heroku numerous times before this)

            I'm following this example here: https://cloud.google.com/speech-to-text/docs/libraries

            Test locally, everything compiles and endpoints work correctly with the imports of:



            Answered 2020-Jul-23 at 18:39

            I ended up having to downgrade my versions of grpcio and google-core-api to resolve this. Lots of trial and error so I don't really have a root cause to share unfortunately.

            Source https://stackoverflow.com/questions/63006419


            Get a push PAYLOAD, after user tap-on-notification, actually in userNotificationCenter?
            Asked 2020-Mar-08 at 16:50

            In your app delegate



            Answered 2020-Mar-08 at 16:50

            Answer kindly provided by the crew at npm-apns2

            For data like

            Source https://stackoverflow.com/questions/60582663


            Docker & Python, Speed up when your requirements.pip list is huge?
            Asked 2019-Dec-01 at 18:41

            Say you have a rather large requirements.pip

            when you modify a requirements.pip, it takes ages to build Docker image because it has to download and install all packages in requirements.pip

            Is there a way to speed up the docker image building process when you modify a length requirements.pip ?

            MY docker



            Answered 2019-Oct-31 at 15:05

            You can divide by yourself in different files the requirements that are less likely to change and those that are most likely to change.

            Then you have two different RUN stages like

            Source https://stackoverflow.com/questions/58645433


            APNS2 error 400: DeviceTokenNotForTopic - Getting this error when sending Push Notification via PubNub
            Asked 2018-Nov-19 at 19:49

            As the title says, I am getting



            Answered 2018-Nov-19 at 19:49

            Just so we have an answer for this, the issue was PubNub account config related and likely not something that will affect anyone else using PubNub for push notifications.

            Source https://stackoverflow.com/questions/52781192


            How can I convert a .p12 to a .pem containing an unencrypted PKCS#1 private key block?
            Asked 2017-Dec-02 at 00:33

            I have a Certificates.p12 file that I wish to convert to a certificates.pem containing an unencrypted private key in PKCS#1 format. I have previously been able to do this by running:



            Answered 2017-Dec-02 at 00:33

            Wow, that library assumes any PEM ending with PRIVATE KEY must be PKCS1?? That is horribly wrong. There are several xx PRIVATE KEY formats and only one of them is PKCS1, see below.

            Meta: I think this is a dupe but I can't find it, so answering anyway.

            OpenSSL supports FOUR different PEM formats for RSA private keys:

            • 'traditional' or 'legacy' unencrypted which is the PKCS1 format you want (https://tools.ietf.org/html/rfc8017#appendix-A.1.2) with PEM type RSA PRIVATE KEY (NOT just PRIVATE KEY)

            • 'traditional' or 'legacy' encrypted at PEM level with OpenSSL's (SSLeay's) custom scheme which uses quite poor (and unfixable) PBKDF; this has the same PEM type RSA PRIVATE KEY but added headers Proc-type and DEK-info

            • PKCS8 standard/generic unencrypted (https://tools.ietf.org/html/rfc5208#section-5) with PEM type PRIVATE KEY; this is a simple ASN.1 wrapper containing an identifier for the algorithm (i.e. an OID for RSA) plus an OCTET STRING containing the algorithm-dependent part which for RSA is PKCS1

            • PKCS8 standard/generic encrypted (https://tools.ietf.org/html/rfc5208#section-6) with PEM type ENCRYPTED PRIVATE KEY; this encrypts the PKCS8 data within the ASN.1 with an algorithm that normally defaults to at least PBKDF2-SHA1-2048 which is decent

            Because PKCS8 is more flexible, and is standard (and fairly commonly used e.g. Java), and has better encryption, it is generally preferred; see the Notes section of the manpage for the PEM_read/write functions for keys and some but not all other things.

            All OpenSSL functions that read a PEM private key can read any of these (given the correct password when necessary) but which they write varies depending on the function and to an extent options. As you note pkcs12 (import) (currently) writes PKCS8, but rsa (always) writes traditional/PKCS1.

            Your options are:

            • use rsa (as you did), or in 1.1.0 pkey -traditional, to convert to traditional

            • use pkcs12 in a release before 1.0.0, like 0.9.8, when it wrote traditional formats (for multiple algorithms not just RSA). Of course using an obsolete and unsupported release may expose you to flaws and even vulnerabilities that were fixed in later releases.

            • extract the PKCS1 part out of the (unencrypted or decrypted) PKCS8. OpenSSL uses DER for keys which means the algorithm-dependent blob, which is the value of the last field in the last group, is always the contiguous last part of the data. As an example:

              $ openssl pkcs12 -in SO47599544.p12 -passin pass:sekrit -nocerts -nodes MAC verified OK Bag Attributes friendlyName: mykey localKeyID: 54 69 6D 65 20 31 35 31 32 31 37 30 38 39 39 33 33 37 Key Attributes: -----BEGIN PRIVATE KEY----- MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCnWIGH4p1FHOP2 wtVbxuyvSHpBGd2v+7AyVHG4EJ/9WRoWN4+aGYUOGxzdTyDxk9e7DCTjuY6ciNTh Ph74LADfQQ0B8yGkRtKer3vO1Dg7+6ErCcIGgsfrhZqpuUfod4nSU/LnHXoAAgN5 07LVvohrJMSRTA55jn356EDv31sz/dew1ThzHjYTShGbXh0/baqLxpmm4e8OixAL YV1glHnIdr4h6wrwkJ6TtNexc3xTLwtRf9k7pJPvg+viGh7RTqhbUcGSV+dLelNe 653LbElHtAByz4Ti9e4vUKFuzxqsaWaSYGpzxF/pdthQawV/fTa9CjLG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3jtvo849KeXW O6U1QlxdmWS6h/La1iVRHoE2U3pxAj39IDx4P6GMrgc9VLqRKLTO1Cu9giimO2jH 8iryT5VTlrrINL3M4vXAFjSN/xwVsrLaw/mAQPOKBwNlDwxcCrlxnANnYXdrhk8n uNmZ2VH8flBFRpSbm9aisgMr -----END PRIVATE KEY----- $ openssl pkcs12 -in SO47599544.p12 -passin pass:sekrit -nocerts -nodes \ | sed -e 1,/-BEGIN/d -e /-END/,\$d | openssl asn1parse MAC verified OK 0:d=0 hl=4 l=1214 cons: SEQUENCE 4:d=1 hl=2 l= 1 prim: INTEGER :00 7:d=1 hl=2 l= 13 cons: SEQUENCE 9:d=2 hl=2 l= 9 prim: OBJECT :rsaEncryption 20:d=2 hl=2 l= 0 prim: NULL 22:d=1 hl=4 l=1192 prim: OCTET STRING [HEX DUMP]:308204A4[rest snipped] [that's PKCS8 with algo-dependent part in the OCTET STRING at offset 22] [with a tag-length header length of 4 (the hl=4)]

              You can extract the PKCS1 part using asn1parse -strparse: $ openssl pkcs12 -in SO47599544.p12 -passin pass:sekrit -nocerts -nodes \ | sed -e 1,/-BEGIN/d -e /-END/,\$d \ | openssl asn1parse -strparse 22 -out SO47599544.raw -noout MAC verified OK $ openssl asn1parse -in SO47599544.raw -inform der 0:d=0 hl=4 l=1188 cons: SEQUENCE 4:d=1 hl=2 l= 1 prim: INTEGER :00 7:d=1 hl=4 l= 257 prim: INTEGER :[snipped] 268:d=1 hl=2 l= 3 prim: INTEGER :010001 273:d=1 hl=4 l= 256 prim: INTEGER :[snipped] [rest snipped -- that's your PKCS1 format but in der so convert to pem] $ (echo -----BEGIN RSA PRIVATE KEY-----; openssl base64 -in SO47599544.raw; \ echo -----END RSA PRIVATE KEY-----) | tee SO47599544.pem -----BEGIN RSA PRIVATE KEY----- MIIEpAIBAAKCAQEAp1iBh+KdRRzj9sLVW8bsr0h6QRndr/uwMlRxuBCf/VkaFjeP mhmFDhsc3U8g8ZPXuwwk47mOnIjU4T4e+CwA30ENA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oyaXEU8mSX80U7fclYN5iHvZx5Z8ZNy dD8hXe9EX77/X/AWEuTnHUkCgYAZ28boNCE60puWX7ZVpGLkufG2EP/gKj7U8KBU 8fZ4c5a/TMcsoitN2PNl8qQQUs3TGBY1MgC4B/nNohhdqk8t72mkQ2jZFoMUs7dO MLgrdHzVfaQcTqcqxHYXg4zLA6ggCFl6F3anjZAzDGqKU34hG+JIEdItcIj+ZFsK 89s7wQKBgQDxC7tCB947b6POPSnl1julNUJcXZlkuofy2tYlUR6BNlN6cQI9/SA8 eD+hjK4HPVS6kSi0ztQrvYIopjtox/Iq8k+VU5a6yDS9zOL1wBY0jf8cFbKy2sP5 gEDzigcDZQ8MXAq5cZwDZ2F3a4ZPJ7jZmdlR/H5QRUaUm5vWorIDKw== -----END RSA PRIVATE KEY-----

              Or you can convert the PKCS8 body to binary and just discard the first 22+4=26 bytes (since header len hl=4 from first asn1parse above): $ openssl pkcs12 -in SO47599544.p12 -passin pass:sekrit -nocerts -nodes \ | sed -e 1,/-BEGIN/d -e /-END/,\$d \ | openssl base64 -d | dd bs=1 skip=26 >SO47599544.raw MAC verified OK 1192+0 records in 1192+0 records out 1192 bytes (1.2 kB) copied, 0.00892462 s, 134 kB/s [then convert to PEM with echo BEGIN;base64(encode);echo END as above]

            PS: If it's important to only read the PKCS12 once, for example to avoid retyping the password, you can use awk like

            Source https://stackoverflow.com/questions/47599544

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network


            No vulnerabilities reported

            Install apns2

            If you are running the test suite you will also need to install testify:.
            Make sure you have Go installed and have set your GOPATH.
            Install apns2:


            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries

            Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link