
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
aipkgs-notifications
Advanced tools
A simple package to send notifications to your devices using Firebase Cloud Messaging.
This Python script allows you to send push notifications to Apple devices manually. It uses the Apple Push Notification service (APNS) to deliver notifications to your application users.
The initialize_apns
function is used to set up the APNS with your application's specific details. This includes your key ID, team ID, bundle ID, and the path to your p8 or pem file. You can also specify whether you want to use the production or sandbox environment (default is sandbox).
First, import the necessary modules:
import apns
Then, initialize the APNS with your application's details:
KEY_ID = ''
TEAM_ID = ''
BUNDLE_ID = 'com.test.app'
IS_PROD = False
P8_KEY_PATH = 'path/to/p8/key'
PEM_FILE_PATH = 'path/to/pem/file'
APNS_PRIORITY = 10
APNS_EXPIRATION = 0
apns.initialize_apns(key_id=KEY_ID,
team_id=TEAM_ID,
bundle_id=BUNDLE_ID,
is_prod=IS_PROD,
p8_key_path=P8_KEY_PATH,
pem_file_path=PEM_FILE_PATH,
apns_priority=APNS_PRIORITY,
apns_expiration=APNS_EXPIRATION)
apns.apns_config().verbose = True
Now, you can send a push notification:
device_token = ""
data = {}
title = "Hello World!"
response: APNSResponse = apns.push(device_token=device_token, title=title, data=data, badge=1, push_type=apns.PushType.alert, collapse_id=None)
Depending on your preference or requirements, you can use either a p8 or pem file for authentication. If you want to use a p8 file, pass the path to the p8_key_path
parameter in the initialize_apns
function. If you want to use a pem file, pass the path to the pem_file_path
parameter.
To get the p8 or pem file for APNS push notification, you can follow these steps:
For p8 file:
For pem file:
openssl pkcs12 -clcerts -legacy -nodes -in Certificates.p12 -out AuthKey.pem
Replace "Certificates.p12" with the path to your .p12 file or keep it if you're in the same directory as your .p12 file.Once you have obtained the p8 or pem file, you can use it in the initialize_apns
function by providing the path to the file in the p8_key_path
or pem_file_path
parameter, respectively.
FAQs
A simple package to send notifications to your devices using Firebase Cloud Messaging.
We found that aipkgs-notifications demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.