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