Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Polish paste retry copy

Manav Rathi3574d8f25b2b
diff --git a/docs/docs/paste/faq.md b/docs/docs/paste/faq.md
index 15eac27e5e..e9d9bb39e3 100644
--- a/docs/docs/paste/faq.md
+++ b/docs/docs/paste/faq.md
@@ -19,7 +19,13 @@ A paste lasts until Ente serves the ciphertext to a browser, or 24 hours from cr
### Can I open the same paste twice? {#paste-open-twice}
-No. A paste is consumed when Ente serves the ciphertext to a browser. For regular links that is the first open. For password-protected links, a wrong password can be retried in the same tab because the encrypted paste stays in memory there. Reloading the page, opening the link on a second device, or sharing it onward after that all result in "This paste has expired or was already opened."
+No. A paste can be served only once.
+
+More precisely, the paste is consumed when Ente serves the ciphertext to a browser: for a regular link, on the first open; for a password-protected link, when the recipient first enters a password, even an incorrect one.
+
+> [!NOTE]
+>
+> If the password is wrong, they can try again in the same tab, because the encrypted paste stays in memory there. Reloading the page, opening the link on a second device, or sharing it onward all result in "This paste has expired or was already opened."
If you need the recipient to be able to refer back to the text, ask them to copy it once they have opened the paste, or use [Ente Locker](/locker/) for durable storage.
diff --git a/docs/docs/paste/features/security.md b/docs/docs/paste/features/security.md
index 769b8cfdd7..3944d7e1d3 100644
--- a/docs/docs/paste/features/security.md
+++ b/docs/docs/paste/features/security.md
@@ -38,11 +38,10 @@ The server hands back an access token. The page constructs the link by concatena
When the recipient opens the link:
1. The browser parses the URL fragment. If it starts with `p-`, the page shows a password prompt and waits for input.
-2. The browser asks the server for the ciphertext using the access token.
+2. The browser asks the server for the ciphertext using the access token. The server deletes the paste in the same step that returns the ciphertext, so it can only ever be served once.
3. The browser re-runs Argon2id locally on the fragment secret (and password, if applicable) using the salt and parameters stored alongside the ciphertext. This produces the same key-encryption key as during creation.
4. The encrypted paste key is decrypted with the key-encryption key, yielding the original paste key.
5. The paste key is used to decrypt the text.
-6. Ente deletes the paste from its servers.
For a wrong password, step 3 produces the wrong key-encryption key, step 4 fails the authentication tag check, and the page shows "Incorrect paste password". The page keeps the encrypted paste in memory, so the recipient can retry in the same tab. If the page is closed or reloaded, the sender needs to create a new paste.
diff --git a/rust/apps/cli/src/commands/paste.rs b/rust/apps/cli/src/commands/paste.rs
index b75bb47a6f..153e578a17 100644
--- a/rust/apps/cli/src/commands/paste.rs
+++ b/rust/apps/cli/src/commands/paste.rs
@@ -69,7 +69,7 @@ fn read_paste_text(text: Option<String>, file: Option<PathBuf>) -> Result<String
};
if text.trim().is_empty() {
- return Err(Error::InvalidInput("Paste text is empty".to_string()));
+ return Err(Error::InvalidInput("Paste text cannot be empty".to_string()));
}
if text.chars().count() > MAX_PASTE_CHARS {
return Err(Error::InvalidInput(format!(
@@ -154,7 +154,7 @@ fn dialoguer_error(error: dialoguer::Error) -> Error {
fn validate_password(password: &str) -> Result<()> {
if password.is_empty() {
- Err(Error::InvalidInput("Paste password is empty".to_string()))
+ Err(Error::InvalidInput("Paste password cannot be empty".to_string()))
} else {
Ok(())
}
@@ -492,7 +492,7 @@ fn decrypt_consumed_text(paste_key: &[u8], payload: &PastePayload) -> Result<Str
}
fn invalid_paste_payload() -> Error {
- Error::Crypto("Invalid paste payload".to_string())
+ Error::Crypto("The paste data is malformed or corrupted".to_string())
}
fn create_fragment_secret() -> String {
diff --git a/rust/apps/cli/tests/paste.rs b/rust/apps/cli/tests/paste.rs
index 9bb3967b0a..8edb88db39 100644
--- a/rust/apps/cli/tests/paste.rs
+++ b/rust/apps/cli/tests/paste.rs
@@ -218,7 +218,7 @@ fn consumed_password_paste_checks_availability_before_password(fixture: &Fixture
String::from_utf8_lossy(&second.stderr),
);
assert!(
- !String::from_utf8_lossy(&second.stderr).contains("Paste password is empty"),
+ !String::from_utf8_lossy(&second.stderr).contains("Paste password cannot be empty"),
"consumed paste validated password before guard: {}",
String::from_utf8_lossy(&second.stderr),
);
diff --git a/web/apps/paste/src/features/paste/components/PasteViewPanel.tsx b/web/apps/paste/src/features/paste/components/PasteViewPanel.tsx
index 10499e3e40..c00627e095 100644
--- a/web/apps/paste/src/features/paste/components/PasteViewPanel.tsx
+++ b/web/apps/paste/src/features/paste/components/PasteViewPanel.tsx
@@ -84,19 +84,6 @@ export const PasteViewPanel = ({
>
Enter paste password
</Typography>
- <Typography
- variant="mini"
- sx={{
- maxWidth: 420,
- color: tokens.status.loadingBody,
- fontWeight: 500,
- lineHeight: 1.35,
- textAlign: "center",
- }}
- >
- Password is checked in your browser. If it fails,
- retry here instead of reopening the link.
- </Typography>
<TextField
variant="filled"
hiddenLabel
diff --git a/web/apps/paste/src/features/paste/hooks/useConsumePaste.ts b/web/apps/paste/src/features/paste/hooks/useConsumePaste.ts
index e2486f1e46..497c1fcab0 100644
--- a/web/apps/paste/src/features/paste/hooks/useConsumePaste.ts
+++ b/web/apps/paste/src/features/paste/hooks/useConsumePaste.ts
@@ -64,7 +64,7 @@ export const useConsumePaste = (mode: PageMode, accessToken: string | null) => {
setPasswordRequired(false);
} catch (error) {
if (error instanceof IncorrectPastePasswordError) {
- setPasswordError("Incorrect paste password");
+ setPasswordError(error.message);
} else {
setConsumeError(errorMessage(error));
}