Skip to content

armgit / ente

Public Imported from GitHub
0

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

Use hyphen paste password fragment prefix

Manav Rathi55d98f615281
diff --git a/rust/apps/cli/src/cli/paste.rs b/rust/apps/cli/src/cli/paste.rs
index fa590e1c24..36567a553c 100644
--- a/rust/apps/cli/src/cli/paste.rs
+++ b/rust/apps/cli/src/cli/paste.rs
@@ -39,7 +39,7 @@ pub enum PasteSubcommands {
link_or_token: String,
/// Fragment key when passing only an access token.
- /// Password-protected keys include the `p:` prefix.
+ /// Password-protected keys include the `p-` prefix.
#[arg(long)]
key: Option<String>,
diff --git a/rust/apps/cli/src/commands/paste.rs b/rust/apps/cli/src/commands/paste.rs
index 6b67ba8f63..144bcffc9f 100644
--- a/rust/apps/cli/src/commands/paste.rs
+++ b/rust/apps/cli/src/commands/paste.rs
@@ -19,7 +19,7 @@ const FRAGMENT_SECRET_ALPHABET: &[u8] =
b"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
const PASTE_GUARD_COOKIE: &str = "paste_guard";
const PASTE_PASSWORD_ENV: &str = "ENTE_PASTE_PASSWORD";
-const PASSWORD_FRAGMENT_PREFIX: &str = "p:";
+const PASSWORD_FRAGMENT_PREFIX: &str = "p-";
const PASSWORD_KDF_CONTEXT: &str = "ente-paste-password-v1";
pub async fn handle_paste_command(cmd: PasteCommand) -> Result<()> {
@@ -578,7 +578,7 @@ mod tests {
#[test]
fn parse_password_protected_paste_link() {
let (token, paste_key) =
- parse_paste_reference("https://paste.ente.com/ABC123#p:AbCd1234EfGh", None).unwrap();
+ parse_paste_reference("https://paste.ente.com/ABC123#p-AbCd1234EfGh", None).unwrap();
assert_eq!(token, "ABC123");
assert_eq!(
@@ -608,7 +608,7 @@ mod tests {
#[test]
fn parse_token_with_password_key() {
let (token, paste_key) =
- parse_paste_reference("ABC123", Some("p:AbCd1234EfGh".to_string())).unwrap();
+ parse_paste_reference("ABC123", Some("p-AbCd1234EfGh".to_string())).unwrap();
assert_eq!(token, "ABC123");
assert_eq!(
diff --git a/rust/apps/cli/tests/paste.rs b/rust/apps/cli/tests/paste.rs
index a6f1c162ee..e78171e080 100644
--- a/rust/apps/cli/tests/paste.rs
+++ b/rust/apps/cli/tests/paste.rs
@@ -180,7 +180,7 @@ impl PasteLink {
.fragment()
.expect("paste link should include a decryption key fragment")
.to_string();
- let (password_required, fragment_secret) = match key.strip_prefix("p:") {
+ let (password_required, fragment_secret) = match key.strip_prefix("p-") {
Some(fragment_secret) => (true, fragment_secret),
None => (false, key.as_str()),
};
diff --git a/web/apps/paste/src/features/paste/constants.ts b/web/apps/paste/src/features/paste/constants.ts
index 1e365aca97..b46587d33f 100644
--- a/web/apps/paste/src/features/paste/constants.ts
+++ b/web/apps/paste/src/features/paste/constants.ts
@@ -4,6 +4,6 @@ export const FRAGMENT_SECRET_LENGTH = 12;
export const FRAGMENT_SECRET_PATTERN = /^[0-9A-Za-z]{12}$/;
-export const PASSWORD_FRAGMENT_PREFIX = "p:";
+export const PASSWORD_FRAGMENT_PREFIX = "p-";
export const PASSWORD_KDF_CONTEXT = "ente-paste-password-v1";