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