Module notifier_apns_auth

Caches the ES256 provider JWT for Apple's APNs HTTP/2 API.

Behaviours: gen_server.

Description

Caches the ES256 provider JWT for Apple's APNs HTTP/2 API.

The JWT signed with the developer's Auth Key (.p8) IS the bearer token. Apple: valid for at most 1 h, do not regenerate more than once per 20 min — so it is re-minted after 50 min, or immediately after invalidate/0 (APNs 403 ExpiredProviderToken).

Signed by hand rather than with jwerl because APNs requires the kid header, and JOSE ES256 wants the raw 64-byte R||S signature, not the DER ECDSA-Sig-Value that public_key:sign/3 returns.

Boots without credentials: get_token/0 then returns {error, not_configured}.

Function Index

configured/0
get_token/0
handle_call/3
handle_cast/2
handle_info/2
init/1
invalidate/0
sign_token/4Build and sign the provider JWT.
start_link/0
topic/0The app bundle id (APNS_TOPIC); .voip is appended by the sender.

Function Details

configured/0

configured() -> boolean()

get_token/0

get_token() -> {ok, binary()} | {error, not_configured}

handle_call/3

handle_call(Req, From, S) -> any()

handle_cast/2

handle_cast(Msg, S) -> any()

handle_info/2

handle_info(Info, S) -> any()

init/1

init(X1) -> any()

invalidate/0

invalidate() -> ok

sign_token/4

sign_token(Key::term(), KeyId::binary(), TeamId::binary(), Now::integer()) -> binary()

Build and sign the provider JWT. Exported for tests.

start_link/0

start_link() -> gen_server:start_ret()

topic/0

topic() -> binary() | undefined

The app bundle id (APNS_TOPIC); .voip is appended by the sender.


Generated by EDoc