Skip to content
Open
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
5 changes: 3 additions & 2 deletions index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) 2023 Apple Inc. Licensed under MIT License.

import fetch from 'node-fetch';
import type { KeyObject } from 'crypto';
import { CheckTestNotificationResponse, CheckTestNotificationResponseValidator } from './models/CheckTestNotificationResponse';
import { ConsumptionRequest } from './models/ConsumptionRequest';
import { UpdateAppAccountTokenRequest } from './models/UpdateAppAccountTokenRequest'
Expand Down Expand Up @@ -114,7 +115,7 @@ export class AppStoreServerAPIClient {

private issuerId: string
private keyId: string
private signingKey: string
private signingKey: string | KeyObject
private bundleId: string
private urlBase: string

Expand All @@ -126,7 +127,7 @@ export class AppStoreServerAPIClient {
* @param bundleId Your app’s bundle ID
* @param environment The environment to target
*/
public constructor(signingKey: string, keyId: string, issuerId: string, bundleId: string, environment: Environment) {
public constructor(signingKey: string | KeyObject, keyId: string, issuerId: string, bundleId: string, environment: Environment) {
this.issuerId = issuerId
this.keyId = keyId
this.bundleId = bundleId
Expand Down
5 changes: 3 additions & 2 deletions tests/unit-tests/api_client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { InAppOwnershipType } from "../../models/InAppOwnershipType";
import { RefundPreference } from "../../models/RefundPreference";
import { APIError, APIException, AppStoreServerAPIClient, ExtendReasonCode, ExtendRenewalDateRequest, GetTransactionHistoryVersion, MassExtendRenewalDateRequest, NotificationHistoryRequest, NotificationHistoryResponseItem, Order, OrderLookupStatus, ProductType, SendAttemptResult, TransactionHistoryRequest } from "../../index";
import { Response } from "node-fetch";
import type { KeyObject } from "crypto";

import jsonwebtoken = require('jsonwebtoken');

Expand All @@ -30,7 +31,7 @@ class AppStoreServerAPIClientForTest extends AppStoreServerAPIClient {
private body: string
private statusCode: number

public constructor(signingKey: string, keyId: string, issuerId: string, bundleId: string, environment: Environment, callback: callbackType, body: string, statusCode: number) {
public constructor(signingKey: string | KeyObject, keyId: string, issuerId: string, bundleId: string, environment: Environment, callback: callbackType, body: string, statusCode: number) {
super(signingKey, keyId, issuerId, bundleId, environment)
this.callback = callback
this.body = body
Expand Down Expand Up @@ -872,4 +873,4 @@ describe('The api client ', () => {
expect(error.errorMessage).toBe("Transaction id not found.")
}
})
})
})