Decodes and verifies an VincentJWT token in string form

This function returns the decoded VincentJWT object only if:

  1. The JWT signature is valid
  2. The JWT is not expired
  3. All time claims (nbf, iat) are valid
  4. The JWT has an audience claim that includes the expected audience

The JWT string to verify

String that should be in the audience claim(s)

The appId that should be in the payload of the JWT. If app is not defined, or app.id is different, this method will throw.

The decoded VincentJWT object if it was verified successfully

 import { verify } from '@lit-protocol/vincent-app-sdk/jwt';

try {
const decodedAndVerifiedVincentJWT = verify({ jwt, expectedAudience: 'https://myapp.com', requiredAppId: 555 });
} catch(e) {
// Handle invalid/expired JWT casew
}