has_secure_passkey 0.3.2 → 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: 9fe71d038885c8ace21e20f7f1a7e56d808c6793cc25ff19a33aeb40ba1d6bb2
4
- data.tar.gz: 4730632c5eb322aa358e6e94fe4c73b2bbf5d7fa3fc50ea3ae4fa496f33adfdb
3
+ metadata.gz: 3eab5ee70ccfea08186b833b0518cdc01465849e56359884c0833f70749ffcfb
4
+ data.tar.gz: 3dd388e2837c0a5f4778c593b1de856700512f62421d31d3969d1e08fe89ab57
5
5
  SHA512:
6
- metadata.gz: c027e1b23a7d7a66ed0a79a8e431527127a4344473d02640dc9a779ca9a8fa1d6bc2d593c4ffec64776457040e0cf148cffd534a22b3055017c463144e238231
7
- data.tar.gz: fe838b0a15d7e9299278db07397cfa557e3112e833f5ba7bb89c3797cdb789a25f654f03953023a6d328a97ff3ef26f8e9e37adde9123fed7be79d9a5f9d3439
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.run()
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
  }
@@ -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.run();
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
  }
@@ -1,3 +1,3 @@
1
1
  module HasSecurePasskey
2
- VERSION = "0.3.2"
2
+ VERSION = "0.3.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: has_secure_passkey
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Pezza