has_secure_passkey 0.3.1 → 0.3.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.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3eab5ee70ccfea08186b833b0518cdc01465849e56359884c0833f70749ffcfb
|
|
4
|
+
data.tar.gz: 3dd388e2837c0a5f4778c593b1de856700512f62421d31d3969d1e08fe89ab57
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cf56aac96bbc8be0b1e8b3b2d563ce7641af0f3da39f7e31237f5a0fd9e3e983d4a21c1e7ed6a4d527729bbf07e2a090302ca8e8679934f2dee99fb58780563d
|
|
7
|
+
data.tar.gz: 0aa13ccf4937a16b28577efbbe608d23c7a457b33a430abf630173161ad72005ce1c8dc08d2e1036027135bf2d86e86be9eaed257d7dad847ac49a240cd947cf
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { post } from "@rails/request.js"
|
|
2
2
|
|
|
3
3
|
export default class WebAuthn extends HTMLElement {
|
|
4
|
-
static observedAttributes = ["action", "callback", "options"];
|
|
4
|
+
static observedAttributes = ["action", "callback", "options", "delay"];
|
|
5
5
|
|
|
6
6
|
constructor() {
|
|
7
7
|
super();
|
|
@@ -11,7 +11,11 @@ export default class WebAuthn extends HTMLElement {
|
|
|
11
11
|
this.progressBar = Turbo.navigator.delegate.adapter.progressBar
|
|
12
12
|
this.setAttribute("data-turbo-temporary", 1)
|
|
13
13
|
this.setAttribute("data-turbo-track", "reload")
|
|
14
|
-
this.
|
|
14
|
+
if (this.delay) {
|
|
15
|
+
setTimeout(() => this.run(), Number(this.delay))
|
|
16
|
+
} else {
|
|
17
|
+
this.run()
|
|
18
|
+
}
|
|
15
19
|
}
|
|
16
20
|
|
|
17
21
|
run() {
|
|
@@ -70,6 +74,10 @@ export default class WebAuthn extends HTMLElement {
|
|
|
70
74
|
return this.getAttribute('callback');
|
|
71
75
|
}
|
|
72
76
|
|
|
77
|
+
get delay() {
|
|
78
|
+
return this.getAttribute('delay');
|
|
79
|
+
}
|
|
80
|
+
|
|
73
81
|
get options() {
|
|
74
82
|
return JSON.parse(this.getAttribute('options'));
|
|
75
83
|
}
|
|
@@ -80,7 +88,7 @@ export default class WebAuthn extends HTMLElement {
|
|
|
80
88
|
|
|
81
89
|
get publicKey() {
|
|
82
90
|
if (this.action === "create") {
|
|
83
|
-
return PublicKeyCredential.parseCreationOptionsFromJSON(this.options);
|
|
91
|
+
return PublicKeyCredential.parseCreationOptionsFromJSON(this.options.publicKey);
|
|
84
92
|
} else {
|
|
85
93
|
return PublicKeyCredential.parseRequestOptionsFromJSON(this.options);
|
|
86
94
|
}
|
|
@@ -286,7 +286,7 @@ async function post(url, options) {
|
|
|
286
286
|
|
|
287
287
|
// app/assets/javascripts/components/web_authn.js
|
|
288
288
|
class WebAuthn extends HTMLElement {
|
|
289
|
-
static observedAttributes = ["action", "callback", "options"];
|
|
289
|
+
static observedAttributes = ["action", "callback", "options", "delay"];
|
|
290
290
|
constructor() {
|
|
291
291
|
super();
|
|
292
292
|
}
|
|
@@ -294,7 +294,11 @@ class WebAuthn extends HTMLElement {
|
|
|
294
294
|
this.progressBar = Turbo.navigator.delegate.adapter.progressBar;
|
|
295
295
|
this.setAttribute("data-turbo-temporary", 1);
|
|
296
296
|
this.setAttribute("data-turbo-track", "reload");
|
|
297
|
-
this.
|
|
297
|
+
if (this.delay) {
|
|
298
|
+
setTimeout(() => this.run(), Number(this.delay));
|
|
299
|
+
} else {
|
|
300
|
+
this.run();
|
|
301
|
+
}
|
|
298
302
|
}
|
|
299
303
|
run() {
|
|
300
304
|
navigator.credentials[this.action]({ publicKey: this.publicKey }).then(async (credential) => {
|
|
@@ -343,6 +347,9 @@ class WebAuthn extends HTMLElement {
|
|
|
343
347
|
get callback() {
|
|
344
348
|
return this.getAttribute("callback");
|
|
345
349
|
}
|
|
350
|
+
get delay() {
|
|
351
|
+
return this.getAttribute("delay");
|
|
352
|
+
}
|
|
346
353
|
get options() {
|
|
347
354
|
return JSON.parse(this.getAttribute("options"));
|
|
348
355
|
}
|
|
@@ -351,7 +358,7 @@ class WebAuthn extends HTMLElement {
|
|
|
351
358
|
}
|
|
352
359
|
get publicKey() {
|
|
353
360
|
if (this.action === "create") {
|
|
354
|
-
return PublicKeyCredential.parseCreationOptionsFromJSON(this.options);
|
|
361
|
+
return PublicKeyCredential.parseCreationOptionsFromJSON(this.options.publicKey);
|
|
355
362
|
} else {
|
|
356
363
|
return PublicKeyCredential.parseRequestOptionsFromJSON(this.options);
|
|
357
364
|
}
|