Files
bitchat/bitchat/Services/PowPolicy.swift
T

18 lines
607 B
Swift

import Foundation
/// Simple default policy for NIP-13 difficulty on geohash chats.
/// Progressive by geohash precision; adjustable later by live activity.
enum PowPolicy {
/// Determine target bits for a given geohash string.
/// Clamped to a sane range to keep UX responsive on phones.
static func requiredBits(forGeohash geohash: String) -> Int {
let precision = geohash.count
// Start at 13 and go down with higher precision (smaller areas)
switch precision {
case ...5: return 13
case 6: return 12
default: return 11
}
}
}