Incorrect typings on JWTHeader interface
In prior version of the Plaid SDK, the JWTHeader interface included properties like kid which are required for webhook verification. Now the JWTHeader definition only includes a single id property and is missing the other header information.
This used to work but now fails:
import jwt_decode from 'jwt-decode';
import { JWTHeader } from 'plaid';
const decodedTokenHeader = jwt_decode<JWTHeader>(signedJwt, {
header: true
});
Property 'alg' does not exist on type 'JWTHeader'.
Property 'kid' does not exist on type 'JWTHeader'.
@kevinohara80 thanks for the report! Honestly, the JWTHeader object possibly should not be in the SDK at all, since it is not directly part of the interface, but rather something that the user has to extract from the verification header. It also does not appear to be heavily used, since I believe it's been defined like this since 2020 and this is the first bug report we've gotten on it :-). However, for compatibility reasons, we can update the definition in the next release.
This has been fixed in yesterday's release of the client library.