SHA256
Доделать смену ключей в новой версии
Добавлена доработка сценариев ротации ключей, закрытия сессий и повторного шифрования DM. Версия пока не проверена полностью, но ожидается рабочей.
This commit is contained in:
@@ -120,6 +120,27 @@ public final class ChannelNameStateDAO {
|
||||
insert(c, entry);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean updateDeletedState(Connection c, String ownerBchName, int rootBlockNumber, boolean deleted, long deletedAtMs, Integer deletedBlockNumber) throws SQLException {
|
||||
String sql = """
|
||||
UPDATE channel_names_state
|
||||
SET is_deleted = ?,
|
||||
deleted_at_ms = ?,
|
||||
deleted_block_number = ?
|
||||
WHERE owner_bch_name = ?
|
||||
AND channel_root_block_number = ?
|
||||
AND is_deleted IS DISTINCT FROM ?
|
||||
""";
|
||||
try (PreparedStatement ps = c.prepareStatement(sql)) {
|
||||
ps.setBoolean(1, deleted);
|
||||
ps.setLong(2, deleted ? Math.max(0L, deletedAtMs) : 0L);
|
||||
if (deleted && deletedBlockNumber != null) ps.setInt(3, deletedBlockNumber); else ps.setNull(3, java.sql.Types.INTEGER);
|
||||
ps.setString(4, ownerBchName);
|
||||
ps.setInt(5, rootBlockNumber);
|
||||
ps.setBoolean(6, deleted);
|
||||
return ps.executeUpdate() > 0;
|
||||
}
|
||||
}
|
||||
public String getSlugByOwnerAndRoot(String ownerBchName, int rootBlockNumber) throws SQLException {
|
||||
String sql = "SELECT slug FROM channel_names_state WHERE LOWER(owner_login)=LOWER(?) AND channel_root_block_number=? LIMIT 1";
|
||||
try (Connection c = db.getConnection(); PreparedStatement ps = c.prepareStatement(sql)) {
|
||||
|
||||
Reference in New Issue
Block a user