@riocrypto/common-server 1.0.923 → 1.0.925
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
declare class AiPriseClient {
|
|
2
2
|
private apiKey;
|
|
3
|
+
private decafApiKey;
|
|
3
4
|
baseUrl: string;
|
|
4
|
-
constructor(apiKey: string);
|
|
5
|
+
constructor(apiKey: string, decafApiKey: string);
|
|
5
6
|
createVerificationLink(userId: string, firstName: string, lastName: string): Promise<string>;
|
|
6
|
-
getVerificationResult(sessionId: string): Promise<any>;
|
|
7
|
+
getVerificationResult(sessionId: string, partner?: "decaf"): Promise<any>;
|
|
7
8
|
private getCallbackUrl;
|
|
8
9
|
private getRedirectUrl;
|
|
9
10
|
}
|
|
@@ -17,8 +17,9 @@ const axios_1 = __importDefault(require("axios"));
|
|
|
17
17
|
const secret_manager_client_1 = require("./secret-manager-client");
|
|
18
18
|
const common_1 = require("@riocrypto/common");
|
|
19
19
|
class AiPriseClient {
|
|
20
|
-
constructor(apiKey) {
|
|
20
|
+
constructor(apiKey, decafApiKey) {
|
|
21
21
|
this.apiKey = apiKey;
|
|
22
|
+
this.decafApiKey = decafApiKey;
|
|
22
23
|
this.getCallbackUrl = (rioEnv) => {
|
|
23
24
|
switch (rioEnv) {
|
|
24
25
|
case common_1.RioEnv.Development:
|
|
@@ -70,11 +71,12 @@ class AiPriseClient {
|
|
|
70
71
|
return response.data.verification_url;
|
|
71
72
|
});
|
|
72
73
|
}
|
|
73
|
-
getVerificationResult(sessionId) {
|
|
74
|
+
getVerificationResult(sessionId, partner) {
|
|
74
75
|
return __awaiter(this, void 0, void 0, function* () {
|
|
76
|
+
const apiKey = partner === "decaf" ? this.decafApiKey : this.apiKey;
|
|
75
77
|
const response = yield axios_1.default.get(`https://${this.baseUrl}.aiprise.com/api/v1/verify/get_user_verification_result/${sessionId}`, {
|
|
76
78
|
headers: {
|
|
77
|
-
"X-API-KEY":
|
|
79
|
+
"X-API-KEY": apiKey,
|
|
78
80
|
},
|
|
79
81
|
});
|
|
80
82
|
return response.data;
|
|
@@ -83,10 +85,11 @@ class AiPriseClient {
|
|
|
83
85
|
}
|
|
84
86
|
const buildAiPriseClient = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
85
87
|
const AIPRISE_API_KEY = yield secret_manager_client_1.secretManagerClient.getSecretValue("AIPRISE_API_KEY");
|
|
86
|
-
|
|
88
|
+
const DECAF_AIPRISE_API_KEY = yield secret_manager_client_1.secretManagerClient.getSecretValue("DECAF_AIPRISE_API_KEY");
|
|
89
|
+
if (!AIPRISE_API_KEY || !DECAF_AIPRISE_API_KEY) {
|
|
87
90
|
throw new common_1.SecretManagerError();
|
|
88
91
|
}
|
|
89
92
|
// Create FixerClient instance and return
|
|
90
|
-
return new AiPriseClient(AIPRISE_API_KEY);
|
|
93
|
+
return new AiPriseClient(AIPRISE_API_KEY, DECAF_AIPRISE_API_KEY);
|
|
91
94
|
});
|
|
92
95
|
exports.buildAiPriseClient = buildAiPriseClient;
|