{"record":{"id":"ba90b1ea4a6ef869","repo":"beemdevelopment/Aegis","slug":"unsupported-protocol","errorCode":null,"errorMessage":"Unsupported protocol","messagePattern":"Unsupported protocol","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/src/main/java/com/beemdevelopment/aegis/otp/GoogleAuthInfo.java","lineNumber":182,"sourceCode":"     * Decodes the given base 32 secret, while being tolerant of whitespace and dashes.\n     */\n    public static byte[] parseSecret(String s) throws EncodingException {\n        s = s.trim().replace(\"-\", \"\").replace(\" \", \"\");\n        return Base32.decode(s);\n    }\n\n    public static Export parseExportUri(String s) throws GoogleAuthInfoException {\n        Uri uri = Uri.parse(s);\n        if (uri == null) {\n            throw new GoogleAuthInfoException(uri, \"Bad URI format\");\n        }\n        return GoogleAuthInfo.parseExportUri(uri);\n    }\n\n    public static Export parseExportUri(Uri uri) throws GoogleAuthInfoException {\n        String scheme = uri.getScheme();\n        if (scheme == null || !scheme.equals(SCHEME_EXPORT)) {\n            throw new GoogleAuthInfoException(uri, \"Unsupported protocol\");\n        }\n\n        String host = uri.getHost();\n        if (host == null || !host.equals(\"offline\")) {\n            throw new GoogleAuthInfoException(uri, \"Unsupported host\");\n        }\n\n        String data = uri.getQueryParameter(\"data\");\n        if (data == null) {\n            throw new GoogleAuthInfoException(uri, \"Parameter 'data' is not set\");\n        }\n\n        GoogleAuthProtos.MigrationPayload payload;\n        try {\n            byte[] bytes = Base64.decode(data);\n            payload = GoogleAuthProtos.MigrationPayload.parseFrom(bytes);\n        } catch (EncodingException | InvalidProtocolBufferException e) {\n            throw new GoogleAuthInfoException(uri, e);","sourceCodeStart":164,"sourceCodeEnd":200,"githubUrl":"https://github.com/beemdevelopment/Aegis/blob/d6f4e5925a97e4e91593f1542085eae03432a759/app/src/main/java/com/beemdevelopment/aegis/otp/GoogleAuthInfo.java#L164-L200","documentation":"Generic guard in parseExportUri(Uri): thrown when the parsed export URI's scheme is not an accepted value (e.g. content:// or file://). It fires when a user selects a source Android cannot handle for exports/imports, and signals the URI does not point at readable local content.","triggerScenarios":"parseExportUri(Uri) called with a URI whose scheme is not the Aegis export scheme (e.g. an ordinary otpauth:// URI or an https link).","commonSituations":"Passing a normal otpauth URI to the export parser by mistake, handling a generic ACTION_VIEW intent that isn't an Aegis export, or a version mismatch where the scheme constant changed.","solutions":["Ensure the input URI uses the Aegis export scheme (GoogleAuthInfo.SCHEME_EXPORT)","Route regular otpauth:// URIs to GoogleAuthInfo.parseUri instead of parseExportUri","Check the intent filter/mime handling so only export URIs reach this parser"],"exampleFix":"// before\nUri uri = Uri.parse(exportText);\nGoogleAuthInfo.Export export = GoogleAuthInfo.parseExportUri(uri);\n// after\nUri uri = Uri.parse(exportText);\nif (uri.getScheme() != null && uri.getScheme().equals(GoogleAuthInfo.SCHEME_EXPORT)) {\n    GoogleAuthInfo.Export export = GoogleAuthInfo.parseExportUri(uri);\n} else {\n    GoogleAuthInfo info = GoogleAuthInfo.parseUri(uri); // single-entry URI path\n}","handlingStrategy":"validation","validationCode":"Uri uri = Uri.parse(s); if (!GoogleAuthInfo.SCHEME_EXPORT.equals(uri.getScheme())) return null;","typeGuard":"boolean isExportUri(Uri u) { return GoogleAuthInfo.SCHEME_EXPORT.equals(u.getScheme()); }","tryCatchPattern":"try { return GoogleAuthInfo.parseExportUri(uri); } catch (GoogleAuthInfoException e) { if (isExportUri(uri)) throw e; return GoogleAuthInfo.parseUri(uri); }","preventionTips":["Route by scheme: export URIs to parseExportUri, otpauth URIs to parseUri","Keep intent filters restricted to the export scheme/mime","Reference the SCHEME_EXPORT constant instead of hardcoding the scheme string"],"tags":["android","otp","export","uri-scheme","unsupported-protocol"],"backgroundTag":"invalid-url-format","analyzedSha":"d6f4e5925a97e4e91593f1542085eae03432a759","analyzedAt":"2026-09-08T00:46:31.111Z","contentChangedAt":"2026-09-08T00:46:31.111Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}