Comparing version 3.2.0-alpha.1 to 3.2.0-alpha.2
@@ -109,3 +109,3 @@ /// <reference types="node" /> | ||
readonly options: Required<BankIdClientSettings>; | ||
readonly axios: AxiosInstance; | ||
axios: AxiosInstance; | ||
version: string; | ||
@@ -121,2 +121,3 @@ constructor(options?: BankIdClientSettings); | ||
awaitPendingCollect(orderRef: string): Promise<CollectResponse>; | ||
createAxiosInstance(): AxiosInstance; | ||
} | ||
@@ -128,2 +129,3 @@ interface AuthOptionalRequirementsV6 { | ||
certificatePolicies?: string[]; | ||
personalNumber: string; | ||
} | ||
@@ -130,0 +132,0 @@ export interface AuthRequestV6 { |
@@ -7,3 +7,3 @@ "use strict"; | ||
}; | ||
var _BankIdClient_instances, _BankIdClient_call, _BankIdClient_createAxiosInstance; | ||
var _BankIdClient_instances, _BankIdClient_call; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -93,6 +93,3 @@ exports.BankIdClientV6 = exports.BankIdClient = exports.RequestError = exports.BankIdError = exports.BankIdMethod = exports.REQUEST_FAILED_ERROR = exports.BankIdErrorCode = void 0; | ||
} | ||
const baseUrl = this.options.production | ||
? `https://appapi2.bankid.com/rp/${this.version}/` | ||
: `https://appapi2.test.bankid.com/rp/${this.version}/`; | ||
this.axios = __classPrivateFieldGet(this, _BankIdClient_instances, "m", _BankIdClient_createAxiosInstance).call(this, baseUrl); | ||
this.axios = this.createAxiosInstance(); | ||
return this; | ||
@@ -162,2 +159,21 @@ } | ||
} | ||
createAxiosInstance() { | ||
const baseURL = this.options.production | ||
? `https://appapi2.bankid.com/rp/${this.version}/` | ||
: `https://appapi2.test.bankid.com/rp/${this.version}/`; | ||
const ca = Buffer.isBuffer(this.options.ca) | ||
? this.options.ca | ||
: fs.readFileSync(this.options.ca, "utf-8"); | ||
const pfx = Buffer.isBuffer(this.options.pfx) | ||
? this.options.pfx | ||
: fs.readFileSync(this.options.pfx); | ||
const passphrase = this.options.passphrase; | ||
return axios_1.default.create({ | ||
baseURL, | ||
httpsAgent: new https.Agent({ pfx, passphrase, ca }), | ||
headers: { | ||
"Content-Type": "application/json", | ||
}, | ||
}); | ||
} | ||
} | ||
@@ -185,17 +201,2 @@ exports.BankIdClient = BankIdClient; | ||
}); | ||
}, _BankIdClient_createAxiosInstance = function _BankIdClient_createAxiosInstance(baseURL) { | ||
const ca = Buffer.isBuffer(this.options.ca) | ||
? this.options.ca | ||
: fs.readFileSync(this.options.ca, "utf-8"); | ||
const pfx = Buffer.isBuffer(this.options.pfx) | ||
? this.options.pfx | ||
: fs.readFileSync(this.options.pfx); | ||
const passphrase = this.options.passphrase; | ||
return axios_1.default.create({ | ||
baseURL, | ||
httpsAgent: new https.Agent({ pfx, passphrase, ca }), | ||
headers: { | ||
"Content-Type": "application/json", | ||
}, | ||
}); | ||
}; | ||
@@ -210,3 +211,4 @@ /** | ||
super(options); | ||
this.version = "v6"; | ||
this.version = "v6.0"; | ||
this.axios = this.createAxiosInstance(); | ||
this.options = { | ||
@@ -213,0 +215,0 @@ // @ts-expect-error this.options not typed after super() call. |
@@ -9,3 +9,3 @@ { | ||
], | ||
"version": "3.2.0-alpha.1", | ||
"version": "3.2.0-alpha.2", | ||
"main": "lib/index.js", | ||
@@ -12,0 +12,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
57994
903