apns2
apns2 copied to clipboard
Using a `KeyObject` for `signingKey` option doesn't work
Hi,
Contrary to what the typing describes, giving a KeyObject to the signingKey results in the following error thrown:
Error: The key option must be a string, a buffer, an object containing key/passphrase properties or a function returning the algorithm secret or private key.
at createSigner (/Users/marcghorayeb/Projects/Work/dt-gql-consumer-subgraphs/node_modules/.pnpm/[email protected]/node_modules/fast-jwt/src/signer.js:219:11)
at ApnsClient._getSigningToken (/Users/marcghorayeb/Projects/Work/dt-gql-consumer-subgraphs/node_modules/.pnpm/[email protected]/node_modules/apns2/dist/apns.js:101:52)
at ApnsClient._send (/Users/marcghorayeb/Projects/Work/dt-gql-consumer-subgraphs/node_modules/.pnpm/[email protected]/node_modules/apns2/dist/apns.js:49:47)
at ApnsClient.send (/Users/marcghorayeb/Projects/Work/dt-gql-consumer-subgraphs/node_modules/.pnpm/[email protected]/node_modules/apns2/dist/apns.js:35:21)
at Function.setup (/Users/marcghorayeb/Projects/Work/dt-gql-consumer-subgraphs/apps/vehicle-mobile-notifications/src/modules/notifications/apns/apns.dao.ts:58:33)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
Digging a bit deeper, this is coming from the fast-jwt parsing of that option here: https://github.com/nearform/fast-jwt/blob/master/src/signer.js#L219
Is the typing wrong or was functionality removed?
@marcghorayeb Line 206 does the check for the object syntax. I noticed fast-jwt is up to v4 and I was using v3. I'm going to do a release on latest version
I just published 11.7.0 using latest version of fast-jwt