@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.
@@ -1899,8 +1899,17 @@ class PersSignerSDK {
1899
1899
  */
1900
1900
  async combinedAuthentication(identifier, persAccessToken) {
1901
1901
  try {
1902
- // Authenticate with DFNS only (we already have PERS token)
1903
- const signerAuthToken = await this.loginUser(identifier);
1902
+ // Authenticate with DFNS - try login first, register if user doesn't exist
1903
+ let signerAuthToken;
1904
+ try {
1905
+ signerAuthToken = await this.loginUser(identifier);
1906
+ }
1907
+ catch (loginError) {
1908
+ console.log(`[PersSignerSDK] User not found, registering new user: ${identifier}`);
1909
+ // User doesn't exist - register new user (registerUser already includes login)
1910
+ const registrationResult = await this.registerUser(identifier);
1911
+ signerAuthToken = registrationResult.authToken;
1912
+ }
1904
1913
  return {
1905
1914
  identifier,
1906
1915
  signerAuthToken,