@explorins/pers-signer 1.0.11 → 1.0.12

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.
package/dist/index.cjs.js CHANGED
@@ -2020,8 +2020,17 @@ class PersSignerSDK {
2020
2020
  */
2021
2021
  async combinedAuthentication(identifier, persAccessToken) {
2022
2022
  try {
2023
- // Authenticate with DFNS only (we already have PERS token)
2024
- const signerAuthToken = await this.loginUser(identifier);
2023
+ // Authenticate with DFNS - try login first, register if user doesn't exist
2024
+ let signerAuthToken;
2025
+ try {
2026
+ signerAuthToken = await this.loginUser(identifier);
2027
+ }
2028
+ catch (loginError) {
2029
+ console.log(`[PersSignerSDK] User not found, registering new user: ${identifier}`);
2030
+ // User doesn't exist - register new user (registerUser already includes login)
2031
+ const registrationResult = await this.registerUser(identifier);
2032
+ signerAuthToken = registrationResult.authToken;
2033
+ }
2025
2034
  return {
2026
2035
  identifier,
2027
2036
  signerAuthToken,