Registry / security / otpauth-migration

otpauth-migration

JSON →
library1.0.0jsnpmunverified

Library for converting between otpauth-migration URIs (Google Authenticator transfer format) and standard otpauth URIs. Current version 1.0.0. Provides bidirectional conversion: decode migration URIs into individual otpauth URI strings, and encode a list of otpauth URIs back into a migration URI. Uses TypeScript with full type definitions. Designed for browser and Node.js (ESM/CJS). No runtime dependencies. Key differentiator: dedicated converter for the migration format used by Google Authenticator and compatible apps, filling a gap not covered by more general OTP libraries.

npm install otpauth-migration
INSTALL
IMPORT
SIG · OTPAUTH-MIGRATION
O
otpauth-migration
securityjavascriptv1.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

URI
import { URI } from 'otpauth-migration'
const URI = require('otpauth-migration')
This package is ESM-only; CJS require will fail. Use ESM import.
toOTPAuthURIs
URI.toOTPAuthURIs(migrationURI)
toOTPAuthURIs(migrationURI)
toOTPAuthURIs is a static method on the URI class, not a standalone function.
toOTPAuthMigrationURI
URI.toOTPAuthMigrationURI(urls)
toOTPAuthMigrationURI(urls)
Same as above: static method on URI.

Shows bidirectional conversion: decode a migration URI into otpauth URIs, then encode back to migration URI.

import { URI } from 'otpauth-migration'; const migrationData = 'otpauth-migration://offline?data=CjEKCkhlbGxvId6tvu8SGEV4YW1wbGU6YWxpY2VAZ29vZ2xlLmNvbQoHEgR0b3RwIAEoATACEAEYASAAKAAwAjjIAQ=='; const uris = URI.toOTPAuthURIs(migrationData); console.log(uris); // [ 'otpauth://totp/Example:alice@google.com?secret=JBSWY3DPEHPK3PXP&issuer=Example&algorithm=SHA1&digits=6&period=30' ] const backToMigration = URI.toOTPAuthMigrationURI(uris); console.log(backToMigration); // otpauth-migration://offline?data=...
Debug
Known issues
gotchaOnly supports TOTP with specific defaults (SHA1, 6 digits, 30s period). Other algorithms or settings may produce unexpected results.
fix
Check otpauth-migration specification for supported parameters; validate decoded URIs.
affects: >=1.0.0
gotchaInput migration URI must use 'otpauth-migration://offline?data=...' format. Malformed URIs or different schemes will throw errors.
fix
Ensure the migration URI is properly base64-encoded and follows the expected format.
affects: >=1.0.0
gotchatoOTPAuthMigrationURI expects an array of valid otpauth:// URIs; non-URI strings or invalid OTP URIs may cause silent failures or errors.
fix
Validate each URI before passing to toOTPAuthMigrationURI. Use otpauth library for parsing if needed.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: URI.toOTPAuthURIs is not a function
Importing the default export instead of named export 'URI', or using CJS require
fix
Use import { URI } from 'otpauth-migration' (ESM). If using CommonJS, consider dynamic import.
Error: Cannot find module 'otpauth-migration'
Package not installed or missing from node_modules
fix
Run 'npm install otpauth-migration' or 'yarn add otpauth-migration'.
SyntaxError: Unexpected token 'export'
Node.js version does not support ESM or project is configured for CommonJS
fix
Use Node.js >=14, add 'type': 'module' to package.json, or use dynamic import.
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
15 hits · last 30 days
node
14
OpenAI (training)
1
Resources
otpauth-migration — npm install otpauth-migration · libregistry