Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions jws_verification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class SignedDataVerifier {
* @param enableOnlineChecks Whether to enable revocation checking and check expiration using the current date
* @param environment The App Store environment to target for checks
* @param bundleId The app's bundle identifier
* @param appAppleId The app's identifier, ommitted in the sandbox environment
* @param appAppleId The app's identifier, omitted in the sandbox environment
*/
constructor(appleRootCertificates: Buffer[], enableOnlineChecks: boolean, environment: Environment, bundleId: string, appAppleId?: number) {
this.rootCertificates = appleRootCertificates.map(cert => new X509Certificate(cert))
Expand Down Expand Up @@ -288,9 +288,9 @@ export class SignedDataVerifier {
// This is directly signed by the issuer
} else if (signingCert.verify(issuer.publicKey)) {
// This is issued by the issuer, let's check the dates and purpose
const signingCertAsign = new X509()
signingCertAsign.readCertPEM(signingCert.toString())
if (!signingCertAsign.getExtExtKeyUsage().array.includes("ocspSigning")) {
const signingCertAssign = new X509()
signingCertAssign.readCertPEM(signingCert.toString())
if (!signingCertAssign.getExtExtKeyUsage().array.includes("ocspSigning")) {
throw new VerificationException(VerificationStatus.INVALID_CERTIFICATE)
}
this.checkDates(signingCert, new Date())
Expand Down
4 changes: 2 additions & 2 deletions tests/unit-tests/jws_verification.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ describe("Decoding checks", () => {
it('should fail to verify with an invalid bundle id', async () => {
const verifier = getSignedPayloadVerifierWithDefaultAppAppleId(Environment.SANDBOX, "com.example")
try {
const wrongBundelId = readFile('tests/resources/mock_signed_data/wrongBundleId')
await verifier.verifyAndDecodeNotification(wrongBundelId)
const wrongBundleId = readFile('tests/resources/mock_signed_data/wrongBundleId')
await verifier.verifyAndDecodeNotification(wrongBundleId)
assert(false)
} catch (e) {
expect(e).toBeInstanceOf(VerificationException)
Expand Down