BigPizzaV3/CodexPlusPlus · error
分享会话解密失败
Error message
分享会话解密失败
What it means
decrypt_shared_payload decrypts an AES-256-GCM encrypted session share payload embedded in a share URL. If the ciphertext fails authentication/decryption (wrong key fragment, tampered data, or truncated payload), it returns this error. AES-GCM is authenticated, so any bit change in key, IV, or ciphertext causes failure.
Solutions
- Re-copy the full, unmodified share URL from the sender and retry the import.
- Verify the URL was not line-wrapped or HTML-escaped by the messaging channel; re-share via a file if needed.
- Ensure both sides use compatible app versions (same key derivation).
- Ask the sender to regenerate the share link and re-import.
Defensive patterns
Strategy: try-catch
Validate before calling
// Pre-check: share URL must contain key, iv and ciphertext fragments of expected shape
function shareFragmentsLookValid(url: URL): boolean {
const key = url.searchParams.get('key');
const iv = url.searchParams.get('iv');
return !!key && key.length >= 43 && !!iv && iv.length >= 16; // base64 sizes
} Try / catch
match import_shared_session_url(&url) {
Ok(v) => v,
Err(e) if e.to_string().contains("分享会话解密失败") => {
// prompt user to re-obtain an intact share link
bail!("分享链接无效或已被篡改,请向分享者重新获取")
}
Err(e) => return Err(e),
} Prevention
- Share links via channels that preserve long URLs intact (file export preferred).
- Never manually edit share URL fragments.
- Keep both parties on the same app version for key compatibility.
- Validate base64 fragment lengths before import.
When it happens
Trigger: Importing a share URL whose key fragment was modified or re-generated; the shared URL was truncated by a chat/messaging client; payload copied partially; wrong share version.
Common situations: Messaging apps mangling long URLs (line breaks, HTML escaping); user manually editing the share link; decrypting a share with an app build using different key derivation.
AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19).
Data as JSON: /api/errors/92debf5d534020c3.
Report an issue: GitHub.
Appendix: source
Thrown at crates/codex-plus-core/src/session_share.rs:142
.get(field)
.and_then(Value::as_str)
.with_context(|| format!("分享数据缺少 {field}"))?;
base64::engine::general_purpose::URL_SAFE_NO_PAD
.decode(value)
.with_context(|| format!("分享数据 {field} 无效"))
};
let key = base64::engine::general_purpose::URL_SAFE_NO_PAD
.decode(key_value)
.context("分享链接解密密钥无效")?;
let iv = decode("iv")?;
let ciphertext = decode("ciphertext")?;
if key.len() != 32 || iv.len() != 12 || ciphertext.len() > MAX_ROLLOUT_BYTES + 16 {
bail!("分享数据大小或格式无效");
}
let cipher = Aes256Gcm::new_from_slice(&key).context("创建会话解密器失败")?;
cipher
.decrypt(Nonce::from_slice(&iv), ciphertext.as_ref())
.map_err(|_| anyhow::anyhow!("分享会话解密失败"))
}
pub fn import_rollout_file(home: &Path, source_path: &Path) -> anyhow::Result<Value> {
let bytes = fs::read(source_path)
.with_context(|| format!("读取会话文件失败:{}", source_path.display()))?;
if bytes.len() > MAX_ROLLOUT_BYTES {
bail!("会话文件超过导入大小限制");
}
let content = String::from_utf8(bytes).context("会话文件不是有效的 UTF-8")?;
if let Ok(payload) = serde_json::from_str::<Value>(&content)
&& payload.get("kind").and_then(Value::as_str) == Some("codex-rollout")
{
return import_rollout(home, &payload);
}
let session_id = find_session_id(&content)
.or_else(|| {
source_path
.file_stem()View on GitHub (pinned to b1ed92e5e4)