{"id":48867,"library":"otpauth-migration-parser","title":"OTP Auth Migration Parser","description":"A lightweight parser for Google Authenticator Account Export QR code data (otpauth-migration:// URIs). Version 0.1.1 is current, with no active development cadence. It decodes protobuf-encoded migration payloads into structured token information including secret, name, issuer, algorithm, digits, type, and counter. Differentiated by being the only dedicated npm package specifically for decoding the migration format, as opposed to general OTP URI parsers.","status":"active","version":"0.1.1","language":"javascript","source_language":"en","source_url":"https://github.com/taharactrl/otpauth-migration-parser","tags":["javascript","otpauth-migration"],"install":[{"cmd":"npm install otpauth-migration-parser","lang":"bash","label":"npm"},{"cmd":"yarn add otpauth-migration-parser","lang":"bash","label":"yarn"},{"cmd":"pnpm add otpauth-migration-parser","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Decoding protobuf-encoded migration data","package":"protobufjs","optional":false}],"imports":[{"note":"The package uses default export as a Promise function. ESM import is correct; CommonJS require works but may cause issues with TypeScript.","wrong":"const parser = require('otpauth-migration-parser')","symbol":"default","correct":"import parser from 'otpauth-migration-parser'"},{"note":"If using CommonJS require, you must access .default to get the Promise function.","wrong":"const parser = require('otpauth-migration-parser')","symbol":"default","correct":"const parser = require('otpauth-migration-parser').default"},{"note":"The package exports a single default function, not a namespace. Using namespace import will break.","wrong":"import * as parser from 'otpauth-migration-parser'","symbol":"default","correct":"import parser from 'otpauth-migration-parser'"}],"quickstart":{"code":"import parser from 'otpauth-migration-parser';\n\nconst dataUri = 'otpauth-migration://offline?data=ChQKFQgGEAQoEjAIARIQNxY2NzQ2MzEzNTg5NzY1ORoFEgN0ZXN0IAEoATABQAFIAQ==';\n\n(async () => {\n  try {\n    const accounts = await parser(dataUri);\n    accounts.forEach(acc => {\n      console.log(`Issuer: ${acc.issuer}, Name: ${acc.name}, Type: ${acc.type}`);\n    });\n  } catch (err) {\n    console.error('Failed to parse migration data:', err);\n  }\n})();","lang":"typescript","description":"Shows ESM import, parsing a sample Google Authenticator migration URI, and iterating over decoded accounts."},"warnings":[{"fix":"Convert counter to number with: counter.toNumber() or use a bigint library.","message":"The package returns 'counter' as a Long object with low/high/unsigned fields, not a number.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Ensure the URI is a full migration link, not a standard otpauth:// URI.","message":"The parser expects the URI scheme to be exactly 'otpauth-migration://offline?data=...'. Other variations will fail silently or throw.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Use await or .then() when calling the parser.","message":"The default export is a Promise function, not a synchronous parser. Calling it without await returns a Promise.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"search_vec":"'0.1.1':21 'account':11 'activ':26 'algorithm':44 'auth':2 'authent':10 'cadenc':28 'code':14 'counter':48 'current':23 'data':15 'decod':30,59 'dedic':54 'develop':27 'differenti':49 'digit':45 'encod':33 'export':12 'format':62 'general':66 'googl':9 'includ':40 'inform':39 'issuer':43 'javascript':70 'lightweight':6 'migrat':3,18,34,61,73 'name':42 'npm':55 'oppos':64 'otp':1,67 'otpauth':17,72 'otpauth-migr':16,71 'packag':56 'parser':4,7,69 'payload':35 'protobuf':32 'protobuf-encod':31 'qr':13 'secret':41 'specif':57 'structur':37 'token':38 'type':46 'uri':19,68 'version':20","created_at":"2026-06-07T16:58:52.879676+00:00","updated_at":"2026-06-07T16:58:52.879676+00:00","problems":[{"fix":"Use EsModuleInterop: true and import parser from 'otpauth-migration-parser'. If using require, do const parser = require('otpauth-migration-parser').default;","cause":"Using CommonJS require without .default or using namespace import with ESM.","error":"TypeError: parser is not a function"},{"fix":"Verify the URI is a valid 'otpauth-migration://offline?data=...' link from Google Authenticator export.","cause":"The migration URI data parameter is not valid base64 or malformed protobuf payload.","error":"Error: Invalid data"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/taharactrl/otpauth-migration-parser#readme","github":"https://github.com/taharactrl/otpauth-migration-parser","docs":null,"changelog":null,"pypi":null,"npm":"otpauth-migration-parser","openapi_spec":null,"status_page":null,"smithery":null,"categories":["security"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}