@circle-fin/w3s-pw-react-native-sdk 1.1.7 → 2.0.0

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.
Files changed (114) hide show
  1. package/BARE_REACT_NATIVE_GUIDE.md +397 -0
  2. package/LICENSE +1 -1
  3. package/README.md +196 -90
  4. package/android/build.gradle +43 -126
  5. package/android/src/main/AndroidManifest.xml +12 -16
  6. package/android/src/main/java/com/circlefin/programmablewalletrnsdk/ProgrammablewalletRnSdkModule.kt +414 -244
  7. package/android/src/main/java/com/circlefin/programmablewalletrnsdk/PromiseCallback.kt +76 -74
  8. package/android/src/main/java/com/circlefin/programmablewalletrnsdk/RecordsHelper.kt +602 -0
  9. package/android/src/main/java/com/circlefin/programmablewalletrnsdk/models/Records.kt +43 -0
  10. package/android/src/main/java/com/circlefin/programmablewalletrnsdk/pwcustom/RnImageSetter.kt +55 -33
  11. package/android/src/main/java/com/circlefin/programmablewalletrnsdk/pwcustom/RnLayoutProvider.kt +81 -79
  12. package/android/src/main/java/com/circlefin/programmablewalletrnsdk/pwcustom/RnViewSetterProvider.kt +93 -63
  13. package/app.json +8 -0
  14. package/build/ProgrammablewalletRnSdkModule.d.ts +44 -0
  15. package/build/ProgrammablewalletRnSdkModule.d.ts.map +1 -0
  16. package/build/ProgrammablewalletRnSdkModule.js +21 -0
  17. package/build/ProgrammablewalletRnSdkModule.js.map +1 -0
  18. package/build/WalletSdk.d.ts +20 -0
  19. package/build/WalletSdk.d.ts.map +1 -0
  20. package/build/WalletSdk.js +303 -0
  21. package/build/WalletSdk.js.map +1 -0
  22. package/build/bridgeSafe.d.ts +50 -0
  23. package/build/bridgeSafe.d.ts.map +1 -0
  24. package/build/bridgeSafe.js +136 -0
  25. package/build/bridgeSafe.js.map +1 -0
  26. package/build/index.d.ts +21 -0
  27. package/build/index.d.ts.map +1 -0
  28. package/build/index.js +21 -0
  29. package/build/index.js.map +1 -0
  30. package/{lib/typescript/src → build}/types.d.ts +72 -43
  31. package/build/types.d.ts.map +1 -0
  32. package/build/types.js +331 -0
  33. package/build/types.js.map +1 -0
  34. package/build/utils/securityQuestionUtils.d.ts +43 -0
  35. package/build/utils/securityQuestionUtils.d.ts.map +1 -0
  36. package/build/utils/securityQuestionUtils.js +109 -0
  37. package/build/utils/securityQuestionUtils.js.map +1 -0
  38. package/expo-module.config.json +11 -0
  39. package/ios/Array+Extension.swift +17 -15
  40. package/ios/BridgeHelper.swift +71 -92
  41. package/ios/{RnWalletSdk+CustomizeAdapter.swift → CustomizeAdapter.swift} +19 -29
  42. package/ios/ProgrammablewalletRnSdk.podspec +30 -0
  43. package/ios/ProgrammablewalletRnSdkModule.swift +384 -0
  44. package/ios/TextConfig.swift +17 -15
  45. package/ios/TextKey.swift +17 -15
  46. package/ios/UIApplication+Extension.swift +26 -17
  47. package/ios/UIColor+Extension.swift +34 -28
  48. package/ios/UITextField+Extension.swift +31 -0
  49. package/ios/UIView+Extension.swift +24 -17
  50. package/package.json +70 -116
  51. package/plugins/apple-signin-entitlements.js +16 -0
  52. package/plugins/infoplist-config.js +77 -0
  53. package/plugins/infoplist-config.md +72 -0
  54. package/plugins/podfile-modifier.js +84 -0
  55. package/plugins/podfile-modifier.md +33 -0
  56. package/plugins/withCopyFiles.js +132 -0
  57. package/plugins/withCopyFiles.md +81 -0
  58. package/src/ProgrammablewalletRnSdkModule.ts +68 -38
  59. package/src/WalletSdk.ts +297 -159
  60. package/src/bridgeSafe.ts +156 -0
  61. package/src/index.ts +21 -0
  62. package/src/types.ts +133 -110
  63. package/src/utils/securityQuestionUtils.ts +121 -0
  64. package/COPYRIGHT +0 -10
  65. package/android/gradle.properties +0 -21
  66. package/android/src/main/AndroidManifestNew.xml +0 -22
  67. package/android/src/main/java/com/circlefin/programmablewalletrnsdk/BridgeHelper.kt +0 -399
  68. package/android/src/main/java/com/circlefin/programmablewalletrnsdk/ProgrammablewalletRnSdkPackage.kt +0 -49
  69. package/android/src/main/java/com/circlefin/programmablewalletrnsdk/PromiseCallback2.kt +0 -65
  70. package/android/src/main/java/com/circlefin/programmablewalletrnsdk/PromiseLogoutCallback.kt +0 -47
  71. package/android/src/main/java/com/circlefin/programmablewalletrnsdk/PromiseSocialCallback.kt +0 -53
  72. package/android/src/main/java/com/circlefin/programmablewalletrnsdk/TestHelper.kt +0 -37
  73. package/android/src/main/java/com/circlefin/programmablewalletrnsdk/annotation/ExcludeFromGeneratedCCReport.kt +0 -33
  74. package/android/src/newarch/ProgrammablewalletRnSdkSpec.kt +0 -29
  75. package/android/src/oldarch/ProgrammablewalletRnSdkSpec.kt +0 -76
  76. package/circlefin-w3s-pw-react-native-sdk.podspec +0 -41
  77. package/ios/EventEmitter.swift +0 -49
  78. package/ios/ProgrammablewalletRnSdk.h +0 -29
  79. package/ios/ProgrammablewalletRnSdk.mm +0 -162
  80. package/ios/ReactNativeEventEmitter.m +0 -27
  81. package/ios/ReactNativeEventEmitter.swift +0 -37
  82. package/ios/RnWalletSdk.swift +0 -390
  83. package/ios/programmablewallet-rn-sdk-Bridging-Header.h +0 -22
  84. package/lib/commonjs/NativeProgrammablewalletRnSdk.js +0 -24
  85. package/lib/commonjs/NativeProgrammablewalletRnSdk.js.map +0 -1
  86. package/lib/commonjs/ProgrammablewalletRnSdkModule.js +0 -38
  87. package/lib/commonjs/ProgrammablewalletRnSdkModule.js.map +0 -1
  88. package/lib/commonjs/WalletSdk.js +0 -211
  89. package/lib/commonjs/WalletSdk.js.map +0 -1
  90. package/lib/commonjs/index.js +0 -74
  91. package/lib/commonjs/index.js.map +0 -1
  92. package/lib/commonjs/types.js +0 -342
  93. package/lib/commonjs/types.js.map +0 -1
  94. package/lib/module/NativeProgrammablewalletRnSdk.js +0 -19
  95. package/lib/module/NativeProgrammablewalletRnSdk.js.map +0 -1
  96. package/lib/module/ProgrammablewalletRnSdkModule.js +0 -31
  97. package/lib/module/ProgrammablewalletRnSdkModule.js.map +0 -1
  98. package/lib/module/WalletSdk.js +0 -203
  99. package/lib/module/WalletSdk.js.map +0 -1
  100. package/lib/module/index.js +0 -18
  101. package/lib/module/index.js.map +0 -1
  102. package/lib/module/types.js +0 -334
  103. package/lib/module/types.js.map +0 -1
  104. package/lib/typescript/src/NativeProgrammablewalletRnSdk.d.ts +0 -28
  105. package/lib/typescript/src/NativeProgrammablewalletRnSdk.d.ts.map +0 -1
  106. package/lib/typescript/src/ProgrammablewalletRnSdkModule.d.ts +0 -3
  107. package/lib/typescript/src/ProgrammablewalletRnSdkModule.d.ts.map +0 -1
  108. package/lib/typescript/src/WalletSdk.d.ts +0 -3
  109. package/lib/typescript/src/WalletSdk.d.ts.map +0 -1
  110. package/lib/typescript/src/index.d.ts +0 -4
  111. package/lib/typescript/src/index.d.ts.map +0 -1
  112. package/lib/typescript/src/types.d.ts.map +0 -1
  113. package/src/NativeProgrammablewalletRnSdk.ts +0 -77
  114. package/src/index.tsx +0 -29
@@ -0,0 +1,156 @@
1
+ /**
2
+ * Copyright 2025 Circle Internet Group, Inc. All rights reserved.
3
+ *
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+
19
+ /**
20
+ * Bridge-safe utilities for React Native/Expo
21
+ * - bridgeSafe: Converts values to JSON-safe format
22
+ * - bridgeDiff: Detects data loss or unexpected transformations
23
+ */
24
+
25
+ export type BridgePrimitive = string | number | boolean | null;
26
+ export type BridgeValue = BridgePrimitive | { [k: string]: BridgeValue } | BridgeValue[];
27
+
28
+ type TypeName =
29
+ | 'null' | 'boolean' | 'number' | 'string'
30
+ | 'array' | 'object'
31
+ | 'date' | 'bigint' | 'map' | 'set'
32
+ | 'function' | 'symbol' | 'undefined'
33
+ | 'nan' | 'infinity';
34
+
35
+ function typeOf(x: unknown): TypeName {
36
+ if (x === null) return 'null'
37
+ const t = typeof x
38
+ if (t === 'number') {
39
+ if (Number.isNaN(x as number)) return 'nan'
40
+ if (!Number.isFinite(x as number)) return 'infinity'
41
+ return 'number'
42
+ }
43
+ if (t === 'bigint') return 'bigint'
44
+ if (t === 'function') return 'function'
45
+ if (t === 'symbol') return 'symbol'
46
+ if (t === 'undefined') return 'undefined'
47
+ if (t === 'string' || t === 'boolean') return t
48
+ // Check complex types
49
+ if (x instanceof Date) return 'date'
50
+ if (Array.isArray(x)) return 'array'
51
+ if (x instanceof Map) return 'map'
52
+ if (x instanceof Set) return 'set'
53
+ return 'object'
54
+ }
55
+
56
+ export function bridgeSafe<T = unknown>(input: T): BridgeValue {
57
+ const seen = new WeakSet<object>()
58
+ const replacer = (_k: string, v: unknown) => {
59
+ const ty = typeOf(v)
60
+ if (ty === 'undefined' || ty === 'function' || ty === 'symbol') return undefined
61
+ if (ty === 'nan' || ty === 'infinity') return String(v)
62
+ if (ty === 'bigint') return String(v)
63
+ if (ty === 'date') return (v as Date).toISOString()
64
+ if (ty === 'map') {
65
+ return Object.fromEntries(Array.from((v as Map<unknown, unknown>).entries(), ([k, val]) => [String(k), val]))
66
+ }
67
+ if (ty === 'set') {
68
+ return Array.from((v as Set<unknown>).values())
69
+ }
70
+ if (v && typeof v === 'object') {
71
+ if (seen.has(v)) return '[Circular]'
72
+ seen.add(v)
73
+ }
74
+ return v
75
+ }
76
+ return JSON.parse(JSON.stringify(input, replacer)) as BridgeValue
77
+ }
78
+
79
+ export interface BridgeDiff {
80
+ lostPaths: string[]; // paths that disappeared after serialization
81
+ transformed: Array<{ path: string; from: TypeName; to: TypeName; note?: string }>;
82
+ }
83
+
84
+ export interface DiffPolicy {
85
+ /** allow typical transforms without flagging */
86
+ allow?: Partial<Record<`${TypeName}->${TypeName}`, boolean>>;
87
+ /** treat dropping undefined/function/symbol as allowed (default true) */
88
+ allowDropSpecial?: boolean;
89
+ }
90
+
91
+ /**
92
+ * Compare original and bridged values to identify transformations and data loss
93
+ * @note This is a best-effort detector that cannot guarantee perfect bijection
94
+ */
95
+ export function bridgeDiff(original: unknown, bridged: BridgeValue, policy?: DiffPolicy): BridgeDiff {
96
+ const allow = new Set<string>(Object.entries({
97
+ 'date->string': true,
98
+ 'bigint->string': true,
99
+ 'map->object': true,
100
+ 'set->array': true,
101
+ 'nan->string': true,
102
+ 'infinity->string': true,
103
+ ...(policy?.allow ?? {}),
104
+ }).filter(([, v]) => v).map(([k]) => k))
105
+
106
+ const allowDropSpecial = policy?.allowDropSpecial ?? true
107
+
108
+ const lostPaths: string[] = []
109
+ const transformed: Array<{ path: string; from: TypeName; to: TypeName; note?: string }> = []
110
+
111
+ function walk(o: unknown, b: unknown, path: string) {
112
+ const to = typeOf(b)
113
+ const fo = typeOf(o)
114
+
115
+ // record transform
116
+ if (!(fo === to || allow.has(`${fo}->${to}`))) {
117
+ // exclude expected object/array shape diffs handled below
118
+ if (!(fo === 'object' && to === 'object') && !(fo === 'array' && to === 'array')) {
119
+ transformed.push({ path, from: fo, to })
120
+ }
121
+ }
122
+
123
+ // if bridged is undefined, nothing to recurse
124
+ if (b === undefined) return
125
+
126
+ if (to === 'object') {
127
+ const oKeys = (o && typeof o === 'object') ? Object.keys(o) : []
128
+ const bKeys = (b && typeof b === 'object') ? Object.keys(b) : []
129
+ // find missing keys
130
+ for (const k of oKeys) {
131
+ if (!(k in (b as Record<string, unknown>))) {
132
+ const child = (o as Record<string, unknown>)[k]
133
+ const tChild = typeOf(child)
134
+ const droppedSpecial = (tChild === 'undefined' || tChild === 'function' || tChild === 'symbol')
135
+ if (!(allowDropSpecial && droppedSpecial)) {
136
+ lostPaths.push(path ? `${path}.${k}` : k)
137
+ }
138
+ }
139
+ }
140
+ // recurse
141
+ for (const k of bKeys) {
142
+ walk((o as Record<string, unknown>)?.[k], (b as Record<string, unknown>)[k], path ? `${path}.${k}` : k)
143
+ }
144
+ } else if (to === 'array') {
145
+ const len = Array.isArray(b) ? (b as unknown[]).length : 0
146
+ for (let i = 0; i < len; i++) {
147
+ walk((o as unknown[])?.[i], (b as unknown[])[i], `${path}[${i}]`)
148
+ }
149
+ }
150
+ }
151
+
152
+ walk(original, bridged, '')
153
+
154
+ return { lostPaths, transformed }
155
+ }
156
+
package/src/index.ts ADDED
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Copyright 2025 Circle Internet Group, Inc. All rights reserved.
3
+ *
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+
19
+ export { default } from './ProgrammablewalletRnSdkModule'
20
+ export * from './types'
21
+ export { WalletSdk } from './WalletSdk'
package/src/types.ts CHANGED
@@ -1,73 +1,117 @@
1
- // Copyright (c) 2024, Circle Internet Financial, LTD. All rights reserved.
2
- //
3
- // SPDX-License-Identifier: Apache-2.0
4
- //
5
- // Licensed under the Apache License, Version 2.0 (the "License");
6
- // you may not use this file except in compliance with the License.
7
- // You may obtain a copy of the License at
8
- //
9
- // http://www.apache.org/licenses/LICENSE-2.0
10
- //
11
- // Unless required by applicable law or agreed to in writing, software
12
- // distributed under the License is distributed on an "AS IS" BASIS,
13
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- // See the License for the specific language governing permissions and
15
- // limitations under the License.
16
- import type { ImageSourcePropType } from 'react-native/Libraries/Image/Image'
1
+ /**
2
+ * Copyright 2025 Circle Internet Group, Inc. All rights reserved.
3
+ *
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+ import { ImageSourcePropType } from 'react-native'
19
+
20
+ export type ProgrammablewalletRnSdkModuleEvents = {
21
+ CirclePwOnEvent: (params: CirclePwEventPayload) => void
22
+ CirclePwOnSuccess: (params: CirclePwSuccessPayload) => void
23
+ CirclePwOnError: (params: CirclePwErrorPayload) => void
24
+ }
25
+
26
+ export const CIRCLE_PW_ON_EVENT = 'CirclePwOnEvent'
27
+
28
+ export type CirclePwEventPayload = {
29
+ name: ExecuteEvent
30
+ }
31
+
32
+ export type CirclePwSuccessPayload = {
33
+ [key: string]: SuccessResult
34
+ }
35
+
36
+ export type CirclePwErrorPayload = {
37
+ [key: string]: unknown
38
+ }
17
39
 
18
40
  export interface IWalletSdk {
19
- sdkVersion: SdkVersion;
20
- deviceId: string;
21
- init: (configuration: Configuration) => Promise<void>;
22
- setSecurityQuestions: (securityQuestions: SecurityQuestion[]) => void;
23
- addListener: (listener: EventListener) => void;
24
- removeAllListeners: () => void;
25
- getDeviceId: () => string;
41
+ sdkVersion: SdkVersion
42
+ deviceId: string
43
+ getDeviceId: () => string
44
+ init: (configuration: Configuration) => Promise<void>
45
+ setSecurityQuestions: (securityQuestions: SecurityQuestion[]) => void
26
46
  execute: (
27
47
  userToken: string,
28
48
  encryptionKey: string,
29
49
  challengeIds: string[],
30
50
  successCallback: SuccessCallback,
31
51
  errorCallback: ErrorCallback,
32
- ) => void;
33
- setBiometricsPin: (
34
- userToken: string,
35
- encryptionKey: string,
36
- successCallback: SuccessCallback,
37
- errorCallback: ErrorCallback,
38
- ) => void;
39
- performLogin: (
40
- provider: SocialProvider,
52
+ ) => void
53
+ verifyOTP: (
54
+ otpToken: string,
41
55
  deviceToken: string,
42
56
  deviceEncryptionKey: string,
43
57
  successCallback: LoginSuccessCallback,
44
58
  errorCallback: ErrorCallback,
45
- ) => void;
46
- verifyOTP: (
47
- otpToken: string,
59
+ ) => void
60
+ performLogin: (
61
+ provider: SocialProvider,
48
62
  deviceToken: string,
49
63
  deviceEncryptionKey: string,
50
64
  successCallback: LoginSuccessCallback,
51
65
  errorCallback: ErrorCallback,
52
- ) => void;
66
+ ) => void
53
67
  performLogout: (
54
68
  provider: SocialProvider,
55
- completeCallback: CompleteCallback,
69
+ completedCallback: CompletedCallback,
70
+ errorCallback: ErrorCallback,
71
+ ) => void
72
+ setBiometricsPin: (
73
+ userToken: string,
74
+ encryptionKey: string,
75
+ successCallback: SuccessCallback,
56
76
  errorCallback: ErrorCallback,
57
- ) => void;
58
- setDismissOnCallbackMap: (map: Map<ErrorCode, boolean>) => void;
59
- moveTaskToFront: () => void;
60
- moveRnTaskToFront: () => void;
61
- setTextConfigsMap: (map: Map<TextsKey, TextConfig[]>) => void;
62
- setIconTextConfigsMap: (
63
- map: Map<IconTextsKey, Array<IconTextConfig>>,
64
- ) => void;
65
- setTextConfigMap: (map: Map<TextKey, TextConfig>) => void;
66
- setImageMap: (map: Map<ImageKey, ImageSourcePropType>) => void;
67
- setDateFormat: (format: DateFormat) => void;
68
- setDebugging: (debugging: boolean) => void;
69
- setCustomUserAgent: (userAgent: string) => void;
70
- setErrorStringMap: (map: Map<ErrorCode, string>) => void;
77
+ ) => void
78
+
79
+ setDismissOnCallbackMap: (map: Map<ErrorCode, boolean>) => void
80
+ moveTaskToFront: () => void
81
+ moveRnTaskToFront: () => void
82
+ setTextConfigsMap: (map: Map<TextsKey, TextConfig[]>) => void
83
+ setIconTextConfigsMap: (map: Map<IconTextsKey, Array<IconTextConfig>>) => void
84
+ setTextConfigMap: (map: Map<TextKey, TextConfig>) => void
85
+ setImageMap: (map: Map<ImageKey, ImageSourcePropType>) => void
86
+ setDateFormat: (format: DateFormat) => void
87
+ setDebugging: (debugging: boolean) => void
88
+ setCustomUserAgent: (userAgent: string) => void
89
+ setErrorStringMap: (map: Map<ErrorCode, string>) => void
90
+ }
91
+
92
+ export interface SdkVersion {
93
+ native: string
94
+ rn?: string
95
+ }
96
+
97
+ export interface Configuration {
98
+ endpoint: string
99
+ appId: string
100
+ settingsManagement?: SettingsManagement
101
+ }
102
+
103
+ export interface SettingsManagement {
104
+ enableBiometricsPin: boolean
105
+ }
106
+
107
+ export class SecurityQuestion {
108
+ title: string
109
+ inputType?: InputType
110
+
111
+ constructor(title: string, inputType?: InputType) {
112
+ this.title = title
113
+ this.inputType = inputType
114
+ }
71
115
  }
72
116
 
73
117
  export enum TextsKey {
@@ -322,81 +366,36 @@ export enum ErrorCode {
322
366
  loginInfoMissing = '155721',
323
367
  }
324
368
 
325
- export class SecurityQuestion {
326
- title: string
327
- inputType?: InputType
328
-
329
- constructor(title: string, inputType?: InputType) {
330
- this.title = title
331
- this.inputType = inputType
332
- }
333
- }
334
-
335
- export interface Configuration {
336
- endpoint: string;
337
- appId: string;
338
- settingsManagement?: SettingsManagement;
339
- }
340
-
341
- export type EventListener = (event: ExecuteEvent) => void
342
369
  export type SuccessCallback = (result: SuccessResult) => void
343
370
  export type LoginSuccessCallback = (result: LoginResult) => void
344
- export type CompleteCallback = () => void
371
+ export type CompletedCallback = () => void
345
372
  export type ErrorCallback = (error: Error) => void
346
- export interface SdkVersion {
347
- native: string;
348
- rn?: string;
349
- }
350
373
 
351
374
  export interface SuccessResult {
352
- result: ExecuteResult;
353
- warning?: ExecuteWarning;
375
+ result: ExecuteResult
376
+ warning?: ExecuteWarning
354
377
  }
355
378
 
356
379
  export interface Error {
357
- code?: string;
358
- message: string;
359
- }
360
-
361
- export interface LoginResult {
362
- userToken?: string;
363
- encryptionKey?: string;
364
- refreshToken?: string;
365
- oauthInfo?: OauthInfo;
366
- }
367
-
368
- export interface OauthInfo {
369
- provider?: string;
370
- scope?: string[];
371
- socialUserUUID?: string;
372
- socialUserInfo?: SocialUserInfo;
373
- }
374
-
375
- export interface SocialUserInfo {
376
- name?: string;
377
- email?: string;
378
- phone?: string;
380
+ code?: string
381
+ message: string
379
382
  }
380
383
 
381
384
  export interface ExecuteResult {
382
- resultType: ExecuteResultType;
383
- status: ExecuteResultStatus;
384
- data?: ExecuteResultData;
385
+ resultType: ExecuteResultType
386
+ status: ExecuteResultStatus
387
+ data?: ExecuteResultData
385
388
  }
386
389
 
387
390
  export interface ExecuteWarning {
388
- warningType: ErrorCode;
389
- warningString: string;
391
+ warningType: ErrorCode
392
+ warningString: string
390
393
  }
391
394
 
392
395
  export interface ExecuteResultData {
393
- signature?: string;
394
- signedTransaction?: string;
395
- txHash?: string;
396
- }
397
-
398
- export interface SettingsManagement {
399
- enableBiometricsPin: boolean;
396
+ signature?: string
397
+ signedTransaction?: string
398
+ txHash?: string
400
399
  }
401
400
 
402
401
  export class IconTextConfig {
@@ -420,7 +419,7 @@ export class TextConfig {
420
419
  font?: string,
421
420
  ) {
422
421
  this.text = text
423
- if(Array.isArray(gradientColorsOrTextColor)){
422
+ if (Array.isArray(gradientColorsOrTextColor)) {
424
423
  this.gradientColors = gradientColorsOrTextColor
425
424
  } else {
426
425
  this.textColor = gradientColorsOrTextColor
@@ -465,8 +464,32 @@ export enum InputType {
465
464
  datePicker = 'datePicker',
466
465
  }
467
466
 
467
+ // ==========================
468
+ // MARK: Social Login
469
+ // ==========================
470
+
468
471
  export enum SocialProvider {
469
472
  Google = 'Google',
470
473
  Facebook = 'Facebook',
471
474
  Apple = 'Apple',
472
475
  }
476
+
477
+ export interface LoginResult {
478
+ userToken?: string
479
+ encryptionKey?: string
480
+ refreshToken?: string
481
+ oauthInfo?: OauthInfo
482
+ }
483
+
484
+ export interface OauthInfo {
485
+ provider?: string
486
+ scope?: string[]
487
+ socialUserUUID?: string
488
+ socialUserInfo?: SocialUserInfo
489
+ }
490
+
491
+ export interface SocialUserInfo {
492
+ name?: string
493
+ email?: string
494
+ phone?: string
495
+ }
@@ -0,0 +1,121 @@
1
+ /**
2
+ * Copyright 2025 Circle Internet Group, Inc. All rights reserved.
3
+ *
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+
19
+ import { SecurityQuestion, InputType } from '../types'
20
+
21
+ /**
22
+ * Extract string representation from unknown value
23
+ * @param value - Value to convert to string
24
+ * @returns String representation
25
+ */
26
+ export function getStringFromUnknown(value: unknown): string {
27
+ if (value === null || value === undefined) return ''
28
+
29
+ if (typeof value === 'object' && value !== null) {
30
+ const obj = value as Record<string, unknown>
31
+ if ('name' in obj && typeof obj.name === 'string') {
32
+ return obj.name
33
+ }
34
+ }
35
+ return typeof value?.toString === 'function' ? value.toString() : ''
36
+ }
37
+
38
+ /**
39
+ * Normalize various input types to InputType enum values
40
+ * @param v - Input value to normalize
41
+ * @returns Normalized InputType or undefined
42
+ */
43
+ export function normalizeInputType(v: unknown): InputType | undefined {
44
+ if (v == null) return undefined
45
+
46
+ if (v === InputType.text || v === InputType.datePicker) {
47
+ return v
48
+ }
49
+
50
+ if (typeof v === 'string') {
51
+ const s = v.toLowerCase()
52
+ if (s.includes('date') || s.includes('birth')) return InputType.datePicker
53
+ if (s !== 'text' && s !== '') {
54
+ console.warn(`[WalletSdk] Unexpected inputType string: "${v}", using default "text"`)
55
+ }
56
+ return InputType.text
57
+ }
58
+
59
+ if (typeof v === 'number') {
60
+ if (v === 1) return InputType.datePicker
61
+ if (v !== 0) {
62
+ console.warn(`[WalletSdk] Unexpected inputType number: ${v}, using default "text"`)
63
+ }
64
+ return InputType.text
65
+ }
66
+
67
+ const hint = getStringFromUnknown(v).toLowerCase()
68
+ if (hint.includes('date')) return InputType.datePicker
69
+
70
+ if (v !== null && v !== undefined) {
71
+ console.warn(`[WalletSdk] Unexpected inputType: ${typeof v}, using default "text"`)
72
+ }
73
+
74
+ return InputType.text
75
+ }
76
+
77
+ /**
78
+ * Convert security question input to standardized SecurityQuestion object
79
+ *
80
+ * Supports three input formats:
81
+ * 1. Tuple [title, inputType]
82
+ * 2. Object {title, inputType}
83
+ * 3. String or other primitive
84
+ *
85
+ * @param q - Security question input (any type)
86
+ * @returns Standardized SecurityQuestion instance
87
+ */
88
+ export function toPlainSecurityQuestion(q: unknown): SecurityQuestion {
89
+ const securityQuestion = new SecurityQuestion('', InputType.text)
90
+
91
+ if (Array.isArray(q)) {
92
+ // Handle array/tuple format: [title, inputType]
93
+ const [title, it] = q
94
+ securityQuestion.title = String(title || '')
95
+ securityQuestion.inputType = normalizeInputType(it) ?? InputType.text
96
+ }
97
+ else if (q && typeof q === 'object') {
98
+ // Handle object/class instances
99
+ const o = q as Record<string, unknown>
100
+ securityQuestion.title = String(
101
+ o.title ||
102
+ o.Title ||
103
+ (typeof o.getTitle === 'function' ? o.getTitle() : undefined) ||
104
+ '',
105
+ )
106
+
107
+ const inputTypeRaw =
108
+ o.inputType ||
109
+ o.InputType ||
110
+ (typeof o.getInputType === 'function' ? o.getInputType() : undefined)
111
+
112
+ securityQuestion.inputType = normalizeInputType(inputTypeRaw) ?? InputType.text
113
+ }
114
+ else {
115
+ // Handle string or other primitive
116
+ securityQuestion.title = String(q || '')
117
+ securityQuestion.inputType = InputType.text
118
+ }
119
+
120
+ return securityQuestion
121
+ }
package/COPYRIGHT DELETED
@@ -1,10 +0,0 @@
1
- Copyright (c) 2024, Circle Internet Financial, LTD. All rights reserved.
2
-
3
- This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License. You may obtain a copy
5
- of the License at <http://www.apache.org/licenses/LICENSE-2.0>
6
-
7
- Unless required by applicable law or agreed to in writing, software distributed under
8
- the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
- OF ANY KIND, either express or implied. See the License for the specific language
10
- governing permissions and limitations under the License.
@@ -1,21 +0,0 @@
1
- # Copyright (c) 2024, Circle Internet Financial, LTD. All rights reserved.
2
- #
3
- # SPDX-License-Identifier: Apache-2.0
4
- #
5
- # Licensed under the Apache License, Version 2.0 (the "License");
6
- # you may not use this file except in compliance with the License.
7
- # You may obtain a copy of the License at
8
- #
9
- # http://www.apache.org/licenses/LICENSE-2.0
10
- #
11
- # Unless required by applicable law or agreed to in writing, software
12
- # distributed under the License is distributed on an "AS IS" BASIS,
13
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- # See the License for the specific language governing permissions and
15
- # limitations under the License.
16
-
17
- ProgrammablewalletRnSdk_kotlinVersion=1.7.0
18
- ProgrammablewalletRnSdk_minSdkVersion=21
19
- ProgrammablewalletRnSdk_targetSdkVersion=31
20
- ProgrammablewalletRnSdk_compileSdkVersion=31
21
- ProgrammablewalletRnSdk_ndkversion=21.4.7075529
@@ -1,22 +0,0 @@
1
- <!--
2
- Copyright (c) 2024, Circle Internet Financial, LTD. All rights reserved.
3
-
4
- SPDX-License-Identifier: Apache-2.0
5
-
6
- Licensed under the Apache License, Version 2.0 (the "License");
7
- you may not use this file except in compliance with the License.
8
- You may obtain a copy of the License at
9
-
10
- http://www.apache.org/licenses/LICENSE-2.0
11
-
12
- Unless required by applicable law or agreed to in writing, software
13
- distributed under the License is distributed on an "AS IS" BASIS,
14
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- See the License for the specific language governing permissions and
16
- limitations under the License.
17
- -->
18
-
19
- <manifest xmlns:android="http://schemas.android.com/apk/res/android">
20
-
21
- <uses-permission android:name="android.permission.REORDER_TASKS" />
22
- </manifest>