@aiam/ciba 0.9.1 → 0.9.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/token.mjs +4 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiam/ciba",
3
- "version": "0.9.1",
3
+ "version": "0.9.3",
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": {
package/token.mjs CHANGED
@@ -106,14 +106,13 @@ function decrypt(map) {
106
106
  // ─── tryGet ───────────────────────────────────────────────────────────────────
107
107
 
108
108
  function tryGet(resourcesMap, deviceDoc, res) {
109
- const key = res ? resourcesMap.get(res) : [...resourcesMap.values()][0];
109
+ const key = res
110
+ ? resourcesMap.get(res)
111
+ : [...resourcesMap.values()][0];
110
112
  if (!key) return null;
111
113
  const map = deviceDoc.getMap(key);
112
114
  const expiresAt = map.get('expires_at');
113
- if (expiresAt && expiresAt < Date.now()) {
114
- log(` token for ${res ?? 'default'} found but expired`);
115
- return null;
116
- }
115
+ if (expiresAt && expiresAt < Date.now()) return null; // expired
117
116
  if (!map.get('ciphertext')) return null;
118
117
  return map;
119
118
  }