MCPcopy Create free account
hub / github.com/AandStep/ResultV / resolveEncryptedSubscriptionURL

Function resolveEncryptedSubscriptionURL

app.go:1971–1988  ·  view source on GitHub ↗

resolveEncryptedSubscriptionURL unwraps an RVSUB1-encrypted URL paste. Returns the decrypted URL when the input is encrypted; an empty string when the input is plaintext (caller keeps the original); an error when the payload decrypts to something that isn't a single http(s) URL.

(input string)

Source from the content-addressed store, hash-verified

1969// is plaintext (caller keeps the original); an error when the payload decrypts
1970// to something that isn't a single http(s) URL.
1971func resolveEncryptedSubscriptionURL(input string) (string, error) {
1972 if !proxy.IsEncryptedSubscription(input) {
1973 return "", nil
1974 }
1975 plain, err := proxy.DecryptSubscription(input)
1976 if err != nil {
1977 return "", fmt.Errorf("decrypting subscription URL: %w", err)
1978 }
1979 plain = strings.TrimSpace(plain)
1980 if strings.ContainsAny(plain, "\r\n") {
1981 return "", fmt.Errorf("decrypted payload contains multiple lines — paste it in the content field, not the URL field")
1982 }
1983 lower := strings.ToLower(plain)
1984 if !strings.HasPrefix(lower, "http://") && !strings.HasPrefix(lower, "https://") {
1985 return "", fmt.Errorf("decrypted payload is not a URL — paste it in the content field instead")
1986 }
1987 return plain, nil
1988}
1989
1990// impioSubscriptionHost is the impio panel host whose subscription endpoint
1991// historically required a "/json" path suffix. The panel later dropped the

Callers 2

ParseSubscriptionTextMethod · 0.85

Calls 2

IsEncryptedSubscriptionFunction · 0.92
DecryptSubscriptionFunction · 0.92

Tested by

no test coverage detected