@aiam/ciba 0.8.3 → 0.8.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.
Files changed (2) hide show
  1. package/ciba.mjs +1 -15
  2. package/package.json +1 -1
package/ciba.mjs CHANGED
@@ -496,6 +496,7 @@ function startDaemon(provider, deviceDoc, privateKey, serverUrl) {
496
496
  dlog(`cache miss; writing requests[${newRid}] attrs=${JSON.stringify(attrs)}`);
497
497
  requests.set(newRid, { ...attrs, status: 'pending', created_at: new Date().toISOString() });
498
498
 
499
+ dlog(`resources map: ${JSON.stringify([...resourcesMap.entries()])} requested=${requestedResource}`);
499
500
  const prevTokenMapName = resourcesMap.get(requestedResource);
500
501
  const newTokenMap = deviceDoc.getMap(`token:${newRid}`);
501
502
 
@@ -512,24 +513,9 @@ function startDaemon(provider, deviceDoc, privateKey, serverUrl) {
512
513
  .then(() => m).catch(() => m);
513
514
  });
514
515
 
515
- // Poll every 2s — handles updates that arrived during a WS reconnect
516
- // gap where Yjs observers were missed.
517
- const viaPoll = new Promise((resolve, reject) => {
518
- const iv = setInterval(() => {
519
- const name = resourcesMap.get(requestedResource);
520
- if (name && name !== prevTokenMapName) {
521
- const m = deviceDoc.getMap(name);
522
- if (m.get('ciphertext')) { clearInterval(iv); resolve(m); return; }
523
- }
524
- if (newTokenMap.get('ciphertext')) { clearInterval(iv); resolve(newTokenMap); }
525
- }, 2000);
526
- setTimeout(() => { clearInterval(iv); reject(new Error('Timeout')); }, 31_000);
527
- });
528
-
529
516
  Promise.race([
530
517
  viaRid.then((map) => ({ src: 'rid', map })),
531
518
  viaResources.then((map) => ({ src: 'resources', map })),
532
- viaPoll.then((map) => ({ src: 'poll', map })),
533
519
  ])
534
520
  .then(({ src, map }) => {
535
521
  dlog(`token resolved via ${src} for ${requestedResource}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiam/ciba",
3
- "version": "0.8.3",
3
+ "version": "0.8.4",
4
4
  "description": "OAuth 2.0 Device Authorization Grant CLI with cross-device push approval (Yjs sync, ECDH-encrypted token delivery, persistent device id)",
5
5
  "type": "module",
6
6
  "bin": {