Skip to content

Commit dad23ea

Browse files
authored
Merge pull request #991 from lollerfirst/fix-auth-blind-messages-table
2 parents 6f25620 + ea9b932 commit dad23ea

4 files changed

Lines changed: 14 additions & 8 deletions

File tree

crates/cdk-sql-common/src/mint/auth/migrations.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
/// Auto-generated by build.rs
33
pub static MIGRATIONS: &[(&str, &str, &str)] = &[
44
("postgres", "1_init.sql", include_str!(r#"./migrations/postgres/1_init.sql"#)),
5+
("postgres", "20250822104351_rename_blind_message_y_to_b.sql", include_str!(r#"./migrations/postgres/20250822104351_rename_blind_message_y_to_b.sql"#)),
56
("sqlite", "1_fix_sqlx_migration.sql", include_str!(r#"./migrations/sqlite/1_fix_sqlx_migration.sql"#)),
67
("sqlite", "20250109143347_init.sql", include_str!(r#"./migrations/sqlite/20250109143347_init.sql"#)),
8+
("sqlite", "20250822104351_rename_blind_message_y_to_b.sql", include_str!(r#"./migrations/sqlite/20250822104351_rename_blind_message_y_to_b.sql"#)),
79
];
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-- Rename column y to b
2+
ALTER TABLE blind_signature RENAME COLUMN y TO blinded_message;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-- Rename column y to b
2+
ALTER TABLE blind_signature RENAME COLUMN y TO blinded_message;

crates/cdk-sql-common/src/mint/auth/mod.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -174,12 +174,12 @@ where
174174
r#"
175175
INSERT
176176
INTO blind_signature
177-
(y, amount, keyset_id, c)
177+
(blinded_message, amount, keyset_id, c)
178178
VALUES
179-
(:y, :amount, :keyset_id, :c)
179+
(:blinded_message, :amount, :keyset_id, :c)
180180
"#,
181181
)?
182-
.bind("y", message.to_bytes().to_vec())
182+
.bind("blinded_message", message.to_bytes().to_vec())
183183
.bind("amount", u64::from(signature.amount) as i64)
184184
.bind("keyset_id", signature.keyset_id.to_string())
185185
.bind("c", signature.c.to_bytes().to_vec())
@@ -353,17 +353,17 @@ where
353353
c,
354354
dleq_e,
355355
dleq_s,
356-
y
356+
blinded_message,
357357
FROM
358358
blind_signature
359-
WHERE y IN (:y)
359+
WHERE blinded_message IN (:blinded_message)
360360
"#,
361361
)?
362362
.bind_vec(
363-
"y",
363+
"blinded_message",
364364
blinded_messages
365365
.iter()
366-
.map(|y| y.to_bytes().to_vec())
366+
.map(|bm| bm.to_bytes().to_vec())
367367
.collect(),
368368
)
369369
.fetch_all(&*conn)
@@ -382,7 +382,7 @@ where
382382
.collect::<Result<HashMap<_, _>, Error>>()?;
383383
Ok(blinded_messages
384384
.iter()
385-
.map(|y| blinded_signatures.remove(y))
385+
.map(|bm| blinded_signatures.remove(bm))
386386
.collect())
387387
}
388388

0 commit comments

Comments
 (0)