Behaviours: gen_server.
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.
get_token/0 then returns
{error, not_configured}.
| configured/0 | |
| get_token/0 | |
| handle_call/3 | |
| handle_cast/2 | |
| handle_info/2 | |
| init/1 | |
| invalidate/0 | |
| sign_token/4 | Build and sign the provider JWT. |
| start_link/0 | |
| topic/0 | The app bundle id (APNS_TOPIC); .voip is appended by the sender. |
configured() -> boolean()
get_token() -> {ok, binary()} | {error, not_configured}
handle_call(Req, From, S) -> any()
handle_cast(Msg, S) -> any()
handle_info(Info, S) -> any()
init(X1) -> any()
invalidate() -> ok
sign_token(Key::term(), KeyId::binary(), TeamId::binary(), Now::integer()) -> binary()
Build and sign the provider JWT. Exported for tests.
start_link() -> gen_server:start_ret()
topic() -> binary() | undefined
The app bundle id (APNS_TOPIC); .voip is appended by the sender.
Generated by EDoc