Comparing version 3.0.0 to 3.1.0
/// <reference types="node" /> | ||
import { AxiosInstance } from "axios"; | ||
import type { AxiosInstance } from "axios"; | ||
export interface AuthRequest { | ||
@@ -23,2 +23,3 @@ endUserIp: string; | ||
userVisibleData: string; | ||
userVisibleDataFormat?: "simpleMarkdownV1"; | ||
userNonVisibleData?: string; | ||
@@ -25,0 +26,0 @@ } |
@@ -61,5 +61,2 @@ "use strict"; | ||
refreshInterval: 2000, | ||
// defaults for test environment | ||
passphrase: "qwerty123", | ||
pfx: path.resolve(__dirname, "../cert/", "FPTestcert3_20200618.p12"), | ||
...options, | ||
@@ -69,5 +66,14 @@ }; | ||
if (!(options === null || options === void 0 ? void 0 : options.pfx) || !(options === null || options === void 0 ? void 0 : options.passphrase)) { | ||
throw Error("BankId requires the pfx and passphrase in production mode"); | ||
throw new Error("BankId requires the pfx and passphrase in production mode"); | ||
} | ||
} | ||
else { | ||
// Provide default PFX & passphrase in test | ||
if (this.options.pfx === undefined) { | ||
this.options.pfx = path.resolve(__dirname, "../cert/", "FPTestcert3_20200618.p12"); | ||
} | ||
if (this.options.passphrase === undefined) { | ||
this.options.passphrase = "qwerty123"; | ||
} | ||
} | ||
// Provide certificate by default | ||
@@ -86,3 +92,3 @@ if (this.options.ca === undefined) { | ||
if (!parameters.endUserIp) { | ||
throw Error("Missing required argument endUserIp."); | ||
throw new Error("Missing required argument endUserIp."); | ||
} | ||
@@ -93,4 +99,8 @@ return this._call(BankIdMethod.auth, parameters); | ||
if (!parameters.endUserIp || !parameters.userVisibleData) { | ||
throw Error("Missing required arguments: endUserIp, userVisibleData."); | ||
throw new Error("Missing required arguments: endUserIp, userVisibleData."); | ||
} | ||
if (parameters.userVisibleDataFormat != null && | ||
parameters.userVisibleDataFormat !== "simpleMarkdownV1") { | ||
throw new Error("userVisibleDataFormat can only be simpleMarkdownV1."); | ||
} | ||
parameters = { | ||
@@ -148,13 +158,11 @@ ...parameters, | ||
.catch((error) => { | ||
let thrownError; | ||
if (error.response) { | ||
console.log(error.response.data.errorCode); | ||
thrownError = new BankIdError(error.response.data.errorCode, error.response.data.details); | ||
let thrownError = error; | ||
if (axios_1.default.isAxiosError(error)) { | ||
if (error.response) { | ||
thrownError = new BankIdError(error.response.data.errorCode, error.response.data.details); | ||
} | ||
else if (error.request) { | ||
thrownError = new RequestError(error.request); | ||
} | ||
} | ||
else if (error.request) { | ||
thrownError = new RequestError(error.request); | ||
} | ||
else { | ||
thrownError = error; | ||
} | ||
reject(thrownError); | ||
@@ -161,0 +169,0 @@ }); |
@@ -9,3 +9,3 @@ { | ||
], | ||
"version": "3.0.0", | ||
"version": "3.1.0", | ||
"main": "lib/bankid.js", | ||
@@ -28,7 +28,7 @@ "repository": { | ||
"dependencies": { | ||
"axios": "^0.21.1" | ||
"axios": "^0.26.1" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^14.14.22", | ||
"typescript": "^4.1.3", | ||
"@types/node": "^14.18.12", | ||
"typescript": "4.6.3", | ||
"prettier": "^2.2.1" | ||
@@ -35,0 +35,0 @@ }, |
@@ -31,3 +31,3 @@ # bankid | ||
As outlined in the [relying party guidelines](https://www.bankid.com/assets/bankid/rp/bankid-relying-party-guidelines-v3.4.pdf), | ||
As outlined in the [relying party guidelines](https://www.bankid.com/assets/bankid/rp/bankid-relying-party-guidelines-v3.5.pdf), | ||
there' four main methods (arguments marked with `*` are required) | ||
@@ -63,4 +63,3 @@ | ||
const done = () => clearInterval(timer); | ||
bankid | ||
client | ||
.collect(res.orderRef) | ||
@@ -67,0 +66,0 @@ .then(res => { |
@@ -12,4 +12,4 @@ { | ||
}, | ||
"include": ["src/**/*"], | ||
"include": ["src"], | ||
"exclude": ["node_modules", "**/*.spec.ts"] | ||
} |
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
34624
458
134
+ Addedaxios@0.26.1(transitive)
- Removedaxios@0.21.4(transitive)
Updatedaxios@^0.26.1