Fatal1ty / aioapns

An efficient APNs Client Library for Python/asyncio
Apache License 2.0
122 stars 52 forks source link

Support string value for APNs private key #13

Open cat-bro opened 5 years ago

cat-bro commented 5 years ago

Would be possible in future versions to allow the private key (key argument to APNs) to be a string instead of a file path, or to have a separate argument (e.g. key_string) for this purpose?

The use case for this is an application that keeps all of its private keys in an encrypted file in an external package. We don't want to keep a file containing the private key in the code base, or write temp files.

akalex commented 3 years ago

@Fatal1ty just wondering are there any plans to get it done?

Fatal1ty commented 3 years ago

I'll try my best to implement this soon. If you want this done asap, pull requests are welcome.

arunrejimitsogo commented 2 years ago

Please add option to pass APNs certificate(containing private key) as bytes instead of file path.

rnevius commented 2 years ago

This would be nice to have. I have implemented something like the following in my own project, but it's not ideal:

import tempfile

from aioapns import APNs

keyfile = tempfile.NamedTemporaryFile()
keyfile.write(b"APNS_KEY")
keyfile.seek(0)
client = APNs(
    key=keyfile.name,
    # ...other config
)
keyfile.close()