shogun-core 6.8.2 → 6.8.3
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.
|
@@ -71259,11 +71259,11 @@ var WebauthnPlugin = /** @class */ (function (_super) {
|
|
|
71259
71259
|
*/
|
|
71260
71260
|
WebauthnPlugin.prototype.signUp = function (username, options) {
|
|
71261
71261
|
return webauthnPlugin_awaiter(this, void 0, void 0, function () {
|
|
71262
|
-
var core, seedPhrase, shouldGenerateSeed, pair, password, derivedKeys, credentials, postRegistrationVerification, result, error_9;
|
|
71262
|
+
var core, seedPhrase, shouldGenerateSeed, pair, password, derivedKeys, credentials, e_1, credentials, postRegistrationVerification, result, error_9;
|
|
71263
71263
|
return webauthnPlugin_generator(this, function (_a) {
|
|
71264
71264
|
switch (_a.label) {
|
|
71265
71265
|
case 0:
|
|
71266
|
-
_a.trys.push([0,
|
|
71266
|
+
_a.trys.push([0, 11, , 12]);
|
|
71267
71267
|
core = this.assertInitialized();
|
|
71268
71268
|
if (!username) {
|
|
71269
71269
|
throw new Error('Username required for WebAuthn registration');
|
|
@@ -71286,7 +71286,7 @@ var WebauthnPlugin = /** @class */ (function (_super) {
|
|
|
71286
71286
|
console.log('[webauthnPlugin] Generated seed phrase for multi-device support');
|
|
71287
71287
|
}
|
|
71288
71288
|
pair = void 0;
|
|
71289
|
-
if (!seedPhrase) return [3 /*break*/,
|
|
71289
|
+
if (!seedPhrase) return [3 /*break*/, 6];
|
|
71290
71290
|
password = deriveCredentialsFromMnemonic(seedPhrase, username).password;
|
|
71291
71291
|
return [4 /*yield*/, deriveWebauthnKeys(username, seedPhrase, true)];
|
|
71292
71292
|
case 1:
|
|
@@ -71297,9 +71297,24 @@ var WebauthnPlugin = /** @class */ (function (_super) {
|
|
|
71297
71297
|
epub: derivedKeys.epub,
|
|
71298
71298
|
epriv: derivedKeys.epriv,
|
|
71299
71299
|
};
|
|
71300
|
-
|
|
71301
|
-
case 2:
|
|
71300
|
+
_a.label = 2;
|
|
71301
|
+
case 2:
|
|
71302
|
+
_a.trys.push([2, 4, , 5]);
|
|
71303
|
+
return [4 /*yield*/, this.generateCredentials(username, null, false)];
|
|
71302
71304
|
case 3:
|
|
71305
|
+
credentials = _a.sent();
|
|
71306
|
+
if (credentials === null || credentials === void 0 ? void 0 : credentials.success) {
|
|
71307
|
+
console.log('[webauthnPlugin] Created passkey for device-bound login');
|
|
71308
|
+
}
|
|
71309
|
+
return [3 /*break*/, 5];
|
|
71310
|
+
case 4:
|
|
71311
|
+
e_1 = _a.sent();
|
|
71312
|
+
// Don't fail signup if passkey creation fails - seed phrase is the backup
|
|
71313
|
+
console.warn('[webauthnPlugin] Could not create passkey, seed-only mode:', e_1);
|
|
71314
|
+
return [3 /*break*/, 5];
|
|
71315
|
+
case 5: return [3 /*break*/, 9];
|
|
71316
|
+
case 6: return [4 /*yield*/, this.generateCredentials(username, null, false)];
|
|
71317
|
+
case 7:
|
|
71303
71318
|
credentials = _a.sent();
|
|
71304
71319
|
if (!(credentials === null || credentials === void 0 ? void 0 : credentials.success)) {
|
|
71305
71320
|
throw new Error((credentials === null || credentials === void 0 ? void 0 : credentials.error) || 'Unable to generate WebAuthn credentials');
|
|
@@ -71307,7 +71322,7 @@ var WebauthnPlugin = /** @class */ (function (_super) {
|
|
|
71307
71322
|
return [4 /*yield*/, this.assertWebauthn().authenticateUser(username, null, {
|
|
71308
71323
|
userVerification: 'required',
|
|
71309
71324
|
})];
|
|
71310
|
-
case
|
|
71325
|
+
case 8:
|
|
71311
71326
|
postRegistrationVerification = _a.sent();
|
|
71312
71327
|
if (!postRegistrationVerification.success) {
|
|
71313
71328
|
throw new Error(postRegistrationVerification.error ||
|
|
@@ -71319,11 +71334,11 @@ var WebauthnPlugin = /** @class */ (function (_super) {
|
|
|
71319
71334
|
throw new Error('Failed to generate SEA pair from WebAuthn credentials');
|
|
71320
71335
|
}
|
|
71321
71336
|
pair = credentials.key;
|
|
71322
|
-
_a.label =
|
|
71323
|
-
case
|
|
71337
|
+
_a.label = 9;
|
|
71338
|
+
case 9:
|
|
71324
71339
|
core.setAuthMethod('webauthn');
|
|
71325
71340
|
return [4 /*yield*/, core.signUp(username, undefined, pair)];
|
|
71326
|
-
case
|
|
71341
|
+
case 10:
|
|
71327
71342
|
result = _a.sent();
|
|
71328
71343
|
// Add seed phrase to result if generated
|
|
71329
71344
|
if (seedPhrase && shouldGenerateSeed) {
|
|
@@ -71332,7 +71347,7 @@ var WebauthnPlugin = /** @class */ (function (_super) {
|
|
|
71332
71347
|
: result.message, seedPhrase: seedPhrase })];
|
|
71333
71348
|
}
|
|
71334
71349
|
return [2 /*return*/, result];
|
|
71335
|
-
case
|
|
71350
|
+
case 11:
|
|
71336
71351
|
error_9 = _a.sent();
|
|
71337
71352
|
console.error("Error during WebAuthn registration: ".concat(error_9));
|
|
71338
71353
|
ErrorHandler.handle(ErrorType.WEBAUTHN, 'WEBAUTHN_SIGNUP_ERROR', error_9.message || 'Error during WebAuthn registration', error_9);
|
|
@@ -71340,7 +71355,7 @@ var WebauthnPlugin = /** @class */ (function (_super) {
|
|
|
71340
71355
|
success: false,
|
|
71341
71356
|
error: error_9.message || 'Error during WebAuthn registration',
|
|
71342
71357
|
}];
|
|
71343
|
-
case
|
|
71358
|
+
case 12: return [2 /*return*/];
|
|
71344
71359
|
}
|
|
71345
71360
|
});
|
|
71346
71361
|
});
|