Skip to content

Commit e26d835

Browse files
authored
Added origin parameter to init-sdk api call (#26)
1 parent 9b60d4f commit e26d835

File tree

5 files changed

+50
-4
lines changed

5 files changed

+50
-4
lines changed

docs/Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## X.X.X (TBA)
44

55
- Added `onboardingApproval` to the `WDOStatusCheckReason` when the process is waiting for institution approval.
6+
- SDK now supports server that is configured to support multiple BlinkID applications (bundle IDs/Package Names). The `origin` parameter is now sent to the server to identify the application.
67

78
## 1.2.0 (Jan, 2026)
89

packages/lib-cordova/src/WDOCordovaPlatform.ts

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,41 @@
88
*/
99

1010
import "cordova-powerauth-mobile-sdk"
11-
import { WDOApiEndpoint, WDOCache, WDONetworking, WDONetworkingIntegration } from '../../lib-shared/src/WDOPlatform'
11+
import { WDOApiEndpoint, WDOCache, WDONetworking, WDONetworkingIntegration, WDOPlatformUtils } from '../../lib-shared/src/WDOPlatform'
1212
import { WPNEndpoint, WPNNetworking } from "cordova-powerauth-networking"
1313

14+
/* @internal */
15+
export class WDOCordovaPlatformUtils implements WDOPlatformUtils {
16+
17+
private cachedEnvInfo: PowerAuthEnvironmentInfo | null = null
18+
19+
private async getEnvironmentInfo(): Promise<PowerAuthEnvironmentInfo> {
20+
if (this.cachedEnvInfo === null) {
21+
this.cachedEnvInfo = await PowerAuthUtils.getEnvironmentInfo()
22+
}
23+
return this.cachedEnvInfo
24+
}
25+
26+
crossPlatformName(): "cordova" | "react-native" {
27+
return "cordova"
28+
}
29+
30+
async nativePlatformName(): Promise<"ios" | "android"> {
31+
// lets keep it simple for now
32+
const systemName = (await this.getEnvironmentInfo()).systemName.toLowerCase()
33+
if (systemName === "android") {
34+
return "android"
35+
} else {
36+
return "ios"
37+
}
38+
}
39+
40+
async bundleId(): Promise<string | undefined> {
41+
return (await this.getEnvironmentInfo()).applicationIdentifier
42+
}
43+
}
44+
45+
/* @internal */
1446
export class WDOCordovaCache implements WDOCache {
1547

1648
set(key: string, value: string | undefined): Promise<void> {
@@ -30,6 +62,7 @@ export class WDOCordovaCache implements WDOCache {
3062
}
3163
}
3264

65+
/* @internal */
3366
export class WDONetworkingCordovaIntegration implements WDONetworkingIntegration {
3467

3568
signedEndpoint<TRequest, TResponse>(path: string, uriId: string, responseConfig?: any, e2eeConfig?: any): WDOApiEndpoint<TRequest, TResponse> {
@@ -49,6 +82,7 @@ export class WDONetworkingCordovaIntegration implements WDONetworkingIntegration
4982
}
5083
}
5184

85+
/* @internal */
5286
export class WDOPowerAuthCordovaIntegration {
5387

5488
activationWithActivationCode(activationCode: string, activationName: string, otp: string | undefined): PowerAuthActivation {

packages/lib-cordova/src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@ export * from '../../lib-shared/src/api/WDONetworkingObjects'
1616
export * from '../../lib-shared/src/WDOError'
1717

1818
// setup platform specific implementations
19-
import { WDOCordovaCache, WDONetworkingCordovaIntegration, WDOPowerAuthCordovaIntegration } from './WDOCordovaPlatform'
19+
import { WDOCordovaCache, WDOCordovaPlatformUtils, WDONetworkingCordovaIntegration, WDOPowerAuthCordovaIntegration } from './WDOCordovaPlatform'
2020
import { WDOPlatform } from '../../lib-shared/src/WDOPlatform'
2121
WDOPlatform.cache = new WDOCordovaCache()
2222
WDOPlatform.networking = new WDONetworkingCordovaIntegration()
2323
WDOPlatform.powerAuth = new WDOPowerAuthCordovaIntegration()
24+
WDOPlatform.utils = new WDOCordovaPlatformUtils()
2425

2526
// services that depend on platform implementations
2627
import { WDOBaseActivationService } from '../../lib-shared/src/WDOActivationService'

packages/lib-shared/src/WDOPlatform.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,28 @@
77
* SPDX-License-Identifier: Apache-2.0
88
*/
99

10+
/* @internal */
1011
export class WDOPlatform {
1112
static cache: WDOCache
1213
static networking: WDONetworkingIntegration
1314
static powerAuth: WDOPowerAuthIntegration
15+
static utils: WDOPlatformUtils
1416
}
1517

18+
/* @internal */
1619
export interface WDOCache {
1720
set(key: string, value: string | undefined): Promise<void>
1821
get(key: string): Promise<string | undefined>
1922
has(key: string): Promise<boolean>
2023
}
2124

25+
/* @internal */
26+
export interface WDOPlatformUtils {
27+
crossPlatformName(): "cordova" | "react-native"
28+
nativePlatformName(): Promise<"ios" | "android">
29+
bundleId(): Promise<string | undefined>
30+
}
31+
2232
/* @internal */
2333
export interface WDONetworkingIntegration {
2434
// Endpoint creation methods

packages/lib-shared/src/api/WDOApi.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ export class WDOApi<TPowerAuth extends WDOPowerAuth> {
8282
return this.callApi(requestObject, WDOVerificationEndpoints.consentApprove)
8383
}
8484

85-
verificationInitScanSDK(processId: string, challenge: string): Promise<any> {
86-
const requestObject = { processId: processId, attributes: { 'sdk-init-token': challenge }}
85+
async verificationInitScanSDK(processId: string, challenge: string): Promise<any> {
86+
const requestObject = { processId: processId, attributes: { 'sdk-init-token': challenge, platform: await WDOPlatform.utils.nativePlatformName(), origin: await WDOPlatform.utils.bundleId() } }
8787
return this.callApi(requestObject, WDOVerificationEndpoints.documentScanSdkInit)
8888
}
8989

0 commit comments

Comments
 (0)