shogun-core 6.3.2 → 6.3.4
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/browser/shogun-core.js +22 -17
- package/dist/browser/shogun-core.js.map +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/plugins/webauthn/webauthn.js +1 -1
- package/dist/src/plugins/webauthn/webauthnPlugin.js +21 -16
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -76128,7 +76128,7 @@ var MAX_USERNAME_LENGTH = 64;
|
|
|
76128
76128
|
var DEFAULT_CONFIG = {
|
|
76129
76129
|
rpName: "Shogun Wallet",
|
|
76130
76130
|
timeout: 60000,
|
|
76131
|
-
userVerification: "
|
|
76131
|
+
userVerification: "required",
|
|
76132
76132
|
attestation: "none",
|
|
76133
76133
|
authenticatorAttachment: "platform",
|
|
76134
76134
|
requireResidentKey: false,
|
|
@@ -77612,11 +77612,13 @@ var WebauthnPlugin = /** @class */ (function (_super) {
|
|
|
77612
77612
|
*/
|
|
77613
77613
|
WebauthnPlugin.prototype.login = function (username) {
|
|
77614
77614
|
return webauthnPlugin_awaiter(this, void 0, void 0, function () {
|
|
77615
|
-
var core,
|
|
77615
|
+
var core, credentials_1, authenticator, error_8;
|
|
77616
|
+
var _this = this;
|
|
77617
|
+
var _a;
|
|
77616
77618
|
return webauthnPlugin_generator(this, function (_b) {
|
|
77617
77619
|
switch (_b.label) {
|
|
77618
77620
|
case 0:
|
|
77619
|
-
_b.trys.push([0,
|
|
77621
|
+
_b.trys.push([0, 5, , 6]);
|
|
77620
77622
|
core = this.assertInitialized();
|
|
77621
77623
|
if (!username) {
|
|
77622
77624
|
throw new Error("Username required for WebAuthn login");
|
|
@@ -77624,22 +77626,25 @@ var WebauthnPlugin = /** @class */ (function (_super) {
|
|
|
77624
77626
|
if (!this.isSupported()) {
|
|
77625
77627
|
throw new Error("WebAuthn is not supported by this browser");
|
|
77626
77628
|
}
|
|
77627
|
-
return [4 /*yield*/, this.
|
|
77629
|
+
return [4 /*yield*/, this.generateCredentials(username, null, true)];
|
|
77628
77630
|
case 1:
|
|
77629
|
-
|
|
77630
|
-
if (!
|
|
77631
|
-
|
|
77632
|
-
case 2: return [2 /*return*/, _b.sent()];
|
|
77633
|
-
case 3: return [4 /*yield*/, this.generateCredentials(username, null, true)];
|
|
77634
|
-
case 4:
|
|
77635
|
-
credentials = _b.sent();
|
|
77636
|
-
if (!(credentials === null || credentials === void 0 ? void 0 : credentials.success)) {
|
|
77637
|
-
throw new Error((credentials === null || credentials === void 0 ? void 0 : credentials.error) || "WebAuthn verification failed");
|
|
77631
|
+
credentials_1 = _b.sent();
|
|
77632
|
+
if (!(credentials_1 === null || credentials_1 === void 0 ? void 0 : credentials_1.success) || !credentials_1.key) {
|
|
77633
|
+
throw new Error((credentials_1 === null || credentials_1 === void 0 ? void 0 : credentials_1.error) || "WebAuthn verification failed");
|
|
77638
77634
|
}
|
|
77635
|
+
// Ensure we mark the authentication method before attempting login
|
|
77639
77636
|
core.setAuthMethod("webauthn");
|
|
77640
|
-
return [
|
|
77641
|
-
|
|
77642
|
-
|
|
77637
|
+
if (!core.authenticate) return [3 /*break*/, 3];
|
|
77638
|
+
authenticator = function () { return webauthnPlugin_awaiter(_this, void 0, void 0, function () { return webauthnPlugin_generator(this, function (_a) {
|
|
77639
|
+
return [2 /*return*/, credentials_1];
|
|
77640
|
+
}); }); };
|
|
77641
|
+
return [4 /*yield*/, core.authenticate(username, authenticator, (_a = credentials_1.key) === null || _a === void 0 ? void 0 : _a.pub)];
|
|
77642
|
+
case 2: return [2 /*return*/, _b.sent()];
|
|
77643
|
+
case 3: return [4 /*yield*/, core.login(username, "", credentials_1.key)];
|
|
77644
|
+
case 4:
|
|
77645
|
+
// Login using the derived SEA pair, consistent with the signup flow
|
|
77646
|
+
return [2 /*return*/, _b.sent()];
|
|
77647
|
+
case 5:
|
|
77643
77648
|
error_8 = _b.sent();
|
|
77644
77649
|
console.error("Error during WebAuthn login: ".concat(error_8));
|
|
77645
77650
|
// Log but do not depend on handler return value
|
|
@@ -77648,7 +77653,7 @@ var WebauthnPlugin = /** @class */ (function (_super) {
|
|
|
77648
77653
|
success: false,
|
|
77649
77654
|
error: error_8.message || "Error during WebAuthn login",
|
|
77650
77655
|
}];
|
|
77651
|
-
case
|
|
77656
|
+
case 6: return [2 /*return*/];
|
|
77652
77657
|
}
|
|
77653
77658
|
});
|
|
77654
77659
|
});
|