The short version, for everyone: Kengele is a free safety alarm for activists. If captors force an activist to unlock their phone and say "I'm safe", the alarm keeps ringing. A second, secret PIN looks exactly like a normal check-in but quietly calls for help. And once an alarm has started, only 2 of the activist's 3 trusted contacts can switch it off, and only after seeing or hearing them on a call. This post shows exactly how, in Kotlin on the phone and Go on the guardians' side, with tests you can run yourself.
Kengele is an open-source alarm for activists in East Africa. Ukinyamaza, kengele inalia: "if you go quiet, the bell rings." If an activist misses a check-in during a watch window, each guardian's device raises the alarm on its own, with no server in between.
altradits
/
kengele
An alarm for when an activist goes missing. No servers, works through shutdowns. Swahili first.
Kengele
When an activist goes silent, the right people know within minutes, and nobody can switch the alarm off.
Ukinyamaza, kengele inalia. ("If you go quiet, the bell rings.")
Warning
Status: design stage. Not for real use. There is no working app yet. Do not rely on Kengele to protect anyone until an independent security review is complete and published here. People's lives may depend on this tool, so we will not cut corners to ship it sooner.
Why
When an activist disappears, how fast the public finds out often decides how quickly they are freed.
- In Kenya, more than 80 people were abducted or forcibly disappeared after the 2024 protests. In January 2025, abducted young men were released within hours of public outcry.
- Boniface Mwangi and Agather Atuhaire, detained in Tanzania in May 2025, were released after their disappearance became public.
- Governments switch networks off when it…
That design handles the easy case: the phone is taken or switched off, and silence triggers the alarm. This post is about the hard case. The captors don't switch the phone off. They hand it back and say check in.
Kengele is still in design and not for real use until an independent security review is published. Code links are pinned to commit e10d277. The overview of the whole system is here:
Contents
- Why it exists
- Three things captors will try
- Layer 1: the duress PIN on the phone
- Layer 2: on the wire, duress looks like a check-in
- Layer 3: the guardian's deadline engine never downgrades
- Layer 4: only k guardians can stand down
- Voice or video first, enforced in code
- Races: when "safe" and "confirm" arrive together
- Run the tests yourself
- Design choices we did not make
- What it still can't stop
Why it exists
- Amnesty International counts over 83 enforced disappearances around Kenya's 2024 and 2025 Gen Z protests.
- When someone disappears, how fast the public finds out often decides how fast they are released. Today that depends on someone noticing and phoning around.
- The closest tool for human rights defenders, Círculo, says on its own site that its service shut down on 15 November 2026. It depended on one organisation's servers.
Three things captors will try
The threat model separates people who seize the phone (adversary A2) from people who coerce the activist (A3). Coercion is worse, because the activist's real keys and real PIN are in play. From section 4.1 ("Silence the alarm") and 4.5 ("Forge an all-clear"), the moves are:
| Captors' move | What it would achieve | Kengele's answer |
|---|---|---|
| Force a check-in | Keep the clock happy while they move the activist | The duress PIN: a normal screen, a silent top-level alarm |
| Force the activist to reveal which PIN is real | Defeat the duress PIN | Both PINs produce an identical result; nothing on the phone tells them apart |
| Force an "I'm safe" after the alarm started | Call off the guardians and the public alert | The activist's all-clear ends nothing once an alarm is raised; only k guardians can, after a call |
The rest of the post follows a coerced check-in through four layers, from the activist's thumb to the guardians' decision.
Layer 1: the duress PIN on the phone
At setup the activist chooses two PINs. The PinStore interface in the Android app has exactly three outcomes:
/** Which PIN the activist entered. */
enum class PinResult {
REAL,
DURESS,
WRONG,
}
Hashes only, never PINs
The phone never stores either PIN. It stores one random 16-byte salt and two stretched hashes:
fun hashPin(salt: ByteArray, pin: String): ByteArray {
val md = MessageDigest.getInstance("SHA-256")
md.update(salt)
var h = md.digest(pin.toByteArray(Charsets.UTF_8))
repeat(HASH_ROUNDS - 1) { h = md.digest(h) } // HASH_ROUNDS = 100_000
return h
}
setPins refuses PINs shorter than 4 or longer than 32 characters, and refuses a duress PIN equal to the real one. Verification hashes the entered PIN once and compares it with both stored hashes using MessageDigest.isEqual, a constant-time comparison:
override fun verify(pin: String): PinResult {
val salt = unb64(prefs.getString(SALT, null) ?: return PinResult.WRONG)
val h = InMemoryPinStore.hashPin(salt, pin)
val real = unb64(prefs.getString(REAL, null) ?: return PinResult.WRONG)
val duress = unb64(prefs.getString(DURESS, null) ?: return PinResult.WRONG)
return when {
MessageDigest.isEqual(h, real) -> PinResult.REAL
MessageDigest.isEqual(h, duress) -> PinResult.DURESS
else -> PinResult.WRONG
}
}
The hashes themselves live in EncryptedSharedPreferences with an AES-256-GCM master key from the Android Keystore, together with the activist's signing key and the guardians' public keys. Nothing security-sensitive is stored or logged in plain text.
An honest note on the numbers. 100,000 rounds of SHA-256 is cheap on a phone and slows down guessing, but a 4-digit PIN has only 10,000 possibilities. If an attacker could extract the encrypted store and the Keystore key, a 4-digit PIN would fall quickly on a GPU. The protection really comes from the Keystore-backed encryption, and the app allows PINs up to 32 characters for anyone who wants more margin. A memory-hard KDF is a reasonable improvement to ask reviewers about.
The screen must be identical, not just similar
The most important line in the file is not the crypto. It is this:
/** The screen for a verify result. REAL and DURESS give the same object. */
fun uiState(result: PinResult): CheckInUiState = when (result) {
PinResult.REAL, PinResult.DURESS -> CheckInUiState(true, "checked_in")
PinResult.WRONG -> CheckInUiState(false, "wrong_pin")
}
The whole UI state is one value object, and the real and duress PINs map to the same object. Not "a success message in both cases", but literally equal data. That makes the rule testable, and the test compares the entire object, not one field:
@Test
fun duressShowsIdenticalNormalUi() {
// The whole UI state object, not just one field, must be equal:
// nothing on the phone tells the PINs apart (threat model 4.1).
val real = PinStore.uiState(PinResult.REAL)
val duress = PinStore.uiState(PinResult.DURESS)
assertEquals(real, duress)
assertTrue(real.success)
assertEquals("checked_in", real.messageKey)
assertNotEquals(real, PinStore.uiState(PinResult.WRONG))
}
If someone later adds a field to CheckInUiState (a colour, an icon, a vibration pattern) and sets it differently for duress, this test fails. A captor watching over the activist's shoulder sees the same thing either way.
Where the PIN turns into a message
CheckInManager is the only place the two PINs diverge, and they diverge in exactly one value: the event kind.
val ui = PinStore.uiState(pinResult)
if (pinResult == PinResult.WRONG) return CheckInOutcome(ui, null, emptyList())
require(guardians.isNotEmpty()) { "no guardians set up" }
val kind = when (pinResult) {
PinResult.REAL -> KengeleMessage.Kind.CHECK_IN
PinResult.DURESS -> KengeleMessage.Kind.DURESS_CHECK_IN
PinResult.WRONG -> error("unreachable")
}
val event = KengeleMessage.Event(kind, createdSecs, seq, place)
// Same signature for every guardian; only the encryption differs.
val inner = KengeleMessage.sign(event, senderPriv)
val texts = guardians.map { g ->
KengeleMessage.encodeText(KengeleMessage.sealInner(inner, senderPriv, g))
}
sender.send(texts)
Everything else is shared: the typed place, the sequence number, the signing, the per-guardian encryption, the sender. A wrong PIN sends nothing at all, so guessing does not leave a trail of messages.
Layer 2: on the wire, duress looks like a check-in
Kind 2 (duress-check-in) travels inside the encryption. Every Kengele message, whatever its kind, is exactly 228 bytes, or 304 characters in its SMS form. A relay, a telecom or a stranger's phone carrying it over Bluetooth sees the same size, the same alphabet and, over Nostr, a gift wrap signed by a one-time key with a randomised timestamp. The details are in the wire-format post:
The Android test checks the "identical on the wire" half of the rule directly:
@Test
fun duressShowsIdenticalUiButSendsDuress() {
val realOutcome = CheckInManager(RecordingSender()).checkIn(
PinResult.REAL, created, 3, "Kisumu".toByteArray(Charsets.UTF_8),
activistPriv, listOf(guardianPub),
)
val duressOutcome = CheckInManager(RecordingSender()).checkIn(
PinResult.DURESS, created, 3, "Kisumu".toByteArray(Charsets.UTF_8),
activistPriv, listOf(guardianPub),
)
// Identical screen...
assertEquals(realOutcome.ui, duressOutcome.ui)
// ...identical shape on the wire...
for (i in realOutcome.texts.indices) {
assertEquals(realOutcome.texts[i].length, duressOutcome.texts[i].length)
}
// ...but the guardians read a duress check-in.
val opened = openAsGuardian(duressOutcome.texts[0])
assertEquals(KengeleMessage.Kind.DURESS_CHECK_IN, opened.kind)
}
Because the Kotlin and Go implementations share one file of test vectors (internal/message/testdata/vectors.json), the guardian's Go watcher decodes the same bytes the Android app produced.
Layer 3: the guardian's deadline engine never downgrades
On each guardian's device, the deadline engine in internal/schedule receives the opened event. A duress check-in or panic goes straight to the top state:
case message.KindDuressCheckIn, message.KindPanic:
reason := "panic trigger"
if ev.Kind == message.KindDuressCheckIn {
reason = "duress check-in: the activist is being forced"
}
t.state, t.massHold, t.dark = StateAlarm, false, false
out = append(out, Notice{Kind: NoticeAlarm, Activist: t.key, At: e.now,
EventTime: ev.CreatedAt, Reason: reason})
Notice what it clears along the way: any mass-silence hold and any going-dark pause. A duress signal overrides every reason the clock might have been waiting.
Then come two rules that exist only because of coercion.
A later check-in cannot cancel an alarm. Captors who suspect the first check-in "didn't go through" may make the activist check in again, with the real PIN this time. That check-in is ignored:
case t.state == StateInactive, t.state == StateAlarm, t.state == StateCleared:
return nil // a check-in cannot cancel an alarm; only all clear can
The activist's all-clear is shown, but ends nothing, from Level 1 up. Before an alarm (while a check-in is merely due or in its grace period), the activist's own all-clear ends the watch normally. After one, it becomes information for the guardians:
case t.state == StateMissed, t.state == StateAlarm, t.massHold:
t.activistSaysSafe = true
out = append(out, Notice{Kind: NoticeActivistSafe, ...
Reason: "the activist says they are safe; this does not end the alarm: " +
"guardians must check by voice or video and stand down together"})
The engine's table-driven tests spell the promises out in their names: "duress check-in raises the alarm and a later check-in cannot cancel it", "duress during a shutdown still raises the alarm", "duress during going-dark still raises the alarm", and "all clear after duress keeps the alarm":
{
name: "all clear after duress keeps the alarm",
steps: []step{tick(0), ev(30, 0, message.KindDuressCheckIn, 30, 1), ev(45, 0, message.KindAllClear, 45, 2), tick(500)},
notices: []string{"started/0", "alarm/0", "activist-says-safe/0"},
want: []want{{0, StateAlarm, -1}},
},
Layer 4: only k guardians can stand down
The decision to go public, and the decision to stand down, both live in the confirmation tally in internal/confirm, one per watched activist on each guardian's device. The rule is symmetric: it takes k distinct guardians (default 2 of 3) to release the public alert, and k distinct guardians to end an alarm.
| Who says "safe" | What happens |
|---|---|
| The activist alone | Guardians see "the activist says they are safe". The alarm keeps ringing. |
| The activist + 1 guardian | Not enough. The activist's word never counts towards the vote. |
| 2 of 3 guardians | The alarm stands down (or, after a public alert, a signed "found safe" update goes out). |
The code that handles the activist's all-clear records it once, shows it, and returns:
case e.Signer == t.p.activist:
// Every alarm the tally sees is at Level 1 or above (missed,
// panic or duress). Captors holding the activist can force the
// real PIN, so the activist's own all-clear never ends an alarm
// and is not counted towards k. It is recorded and shown to
// guardians, who must verify by voice or video and then send
// their own all-clears. It never blocks or delays a release.
st := t.state(c.epoch)
if !st.activistClear.IsZero() {
return Outcome{}, ErrDuplicate
}
st.activistClear = e.CreatedAt
return Outcome{Epoch: c.epoch, ActivistSaysSafe: true}, nil
The last sentence of that comment matters as much as the rest: it never blocks or delays a release. If one guardian has already confirmed the alarm and the captors force an "I'm safe", the pending confirmation survives, and the second guardian's confirmation still publishes the alert. That is the core test, line for line:
func TestActivistAllClearAloneEndsNothing(t *testing.T) {
// After a panic, captors force the activist to unlock with the real
// PIN and send an all-clear. The alarm must stay, and the release must
// still happen when a second guardian confirms.
f := newFixture(t, 3, 2)
tl := f.tally(t, 0)
...
expect(t, None)(f.confirm(t, tl, 0, 1, t0, t0))
o = expect(t, None)(f.clearFrom(t, tl, f.activist.priv, 1, t0, t0))
if !o.ActivistSaysSafe || o.By != NotCleared || tl.Epoch() != 1 {
t.Fatalf("activist all-clear ended the alarm: %+v epoch=%d", o, tl.Epoch())
}
o, err = f.clearFrom(t, tl, f.activist.priv, 1, t0, t0)
mustErr(t, o, err, ErrDuplicate)
cs := tl.ClearStatus(t0)
if !cs.ActivistSaysSafe || !cs.VerifyFirst || cs.GuardianClears != 0 || cs.Needed != 2 || cs.Epoch != 1 {
t.Fatalf("clear status = %+v", cs)
}
// The pending confirmation survived, and the second one releases.
expect(t, Release)(f.confirm(t, tl, 2, 1, t0.Add(time.Minute), t0.Add(time.Minute)))
}
Every confirmation and all-clear also names an epoch, the number of the alarm. An all-clear captured from last month's false alarm cannot be replayed to end today's real one, and guardian all-clears must be fresh (signed within 24 hours by default) to count.
Voice or video first, enforced in code
A guardian's "safe" must mean something too. A guardian who gets a text from the activist's number saying "all good, sorry!" has learned nothing; the captors have that phone. So the guardian app cannot even build an all-clear without a record of a voice or video call:
// Verification records how a guardian checked that the activist is free
// before sending an all-clear. It stays on the guardian's device and is
// not sent on the wire.
type Verification struct {
// Method is "voice" or "video".
Method string
// At is when the call happened.
At time.Time
}
func GuardianAllClearEvent(activist [32]byte, epoch uint32, seq uint32, now time.Time, v Verification) (message.Event, error) {
if v.Method != "voice" && v.Method != "video" {
return message.Event{}, ErrNotVerified
}
if v.At.IsZero() || v.At.After(now.Add(message.MaxClockSkew)) {
return message.Event{}, ErrNotVerified
}
return AllClearEvent(activist, epoch, seq, now)
}
ErrNotVerified reads, in full: "speak to the activist by voice or video before sending an all-clear." The record stays on the guardian's device and is never sent, so the wire format does not grow and a carrier learns nothing. Tally.ClearStatus reports VerifyFirst: true for every open alarm, which is the app's cue to show that instruction before the button.
Code cannot verify that a call was genuine. What it can do is make the honest path the only path: there is no "skip" in the API, so a guardian app built on it cannot ship a one-tap stand-down by accident.
Races: when "safe" and "confirm" arrive together
Messages travel over several relays, SMS and Bluetooth, so arrival order is not guaranteed. The tally is safe for concurrent use (one mutex around all state), and the epoch makes the ordering rules simple:
- k guardian all-clears first, then a late confirmation: the stand-down moved the epoch on, so the confirmation is stale and ignored. Nothing goes public.
-
Release first, then k guardian all-clears: the outcome is
FoundSafe, and a "found safe" note signed by the same alert key follows the public alert. - The activist's all-clear in either order: changes neither.
TestAllClearRaces and TestConcurrentActivistAllClearAndConfirms run these orderings under the race detector.
Run the tests yourself
Go side (needs Go 1.24 or newer):
git clone https://github.com/altradits/kengele
cd kengele
go test -race -count=1 -v -run 'AllClear|PlusOne|Coerced|Duress' ./internal/confirm
Our run (Go 1.26.5, commit e10d277):
--- PASS: TestSingleCoercedGuardianCannotPublish (0.17s)
--- PASS: TestActivistAllClearAloneEndsNothing (0.09s)
--- PASS: TestActivistPlusOneGuardianIsNotEnough (0.07s)
--- PASS: TestGuardianAllClearNeedsVerification (0.00s)
--- PASS: TestAllClearByTwoGuardians (0.07s)
--- PASS: TestAllClearRaces (0.27s)
--- PASS: TestConcurrentActivistAllClearAndConfirms (0.15s)
--- PASS: TestDuressPath (0.11s)
ok github.com/altradits/kengele/internal/confirm 2.543s
And the deadline engine's duress cases:
go test -race -count=1 -run TestSchedule -v ./internal/schedule
Android side (needs the Android SDK; set ANDROID_HOME):
cd android
./gradlew :app:testDebugUnitTest \
--tests 'com.altradits.kengele.pin.PinTest' \
--tests 'com.altradits.kengele.checkin.CheckInManagerTest'
Our run produced 8 tests, 0 failures: verifyRealDuressWrong, rejectsShortLongAndEqualPins, duressShowsIdenticalNormalUi, realCheckInSealsToEveryGuardian, duressShowsIdenticalUiButSendsDuress, wrongPinSendsNothing, panicSendsEmptyPanic and rejectsMissingGuardiansAndLongPlace.
Without reading code: every change is public. Pull request #31 introduced the coerced all-clear rule, with the written reasoning.
Design choices we did not make
Each of these comes up whenever duress features are discussed, so here is why Kengele does not do them.
- Wipe the phone on the duress PIN. A wiped phone is an obvious signal to captors that something was triggered, which can make things worse for the activist, and it destroys evidence. Kengele's duress path changes nothing visible.
- Show an error on the duress PIN ("network problem, try later"). Any difference from the real PIN is a tell, and a captor will simply demand the other PIN. Identical UI is the only defensible choice.
- Let the activist cancel an alarm after a delay ("if they really are safe, they can call it off in an hour"). A captor can wait an hour. Time does not separate coerced from free; only a human who knows the activist can.
- Let one trusted guardian stand down alone. That guardian becomes the single person captors need to pressure (adversary A4). k guardians make that k people.
What it still can't stop
Being honest about the limits matters more than the feature (threat model §4.5):
- Captors can pressure the activist during the video call too. Pick guardians who know the activist well, and agree a spoken code word in advance.
- A captor who already knows Kengele has a duress PIN may demand both PINs and test them. The app can't stop that; it can only make sure both look identical.
- If 2 of 3 guardians are compromised, they can switch the alarm off. That is the trade-off by design, so pick guardians who don't live, work or get arrested together.
- After a public alert, one guardian holding the spent alert key could sign a false "found safe" update. The guardian confirmation doc lists it as a residual risk.
- A phone already infected with spyware can read the PIN as it is typed. Kengele cannot defend a device that is already compromised.
Status and how to help
Kengele is still being designed and is not for real use until an independent security review is published. We are open to collaboration, guidance and any form of participation:
- No coding needed: digital-security reviewers, Swahili translators, and anyone who works with activists and can tell us what we're missing.
- Android and Kotlin developers: the PIN store and check-in flow above; a memory-hard KDF for the PIN hashes is an open improvement.
- Go developers: try to find an ordering of events that ends an alarm without k guardian all-clears. That is a bug, and we want it.
Start with CONTRIBUTING.md. Report vulnerabilities privately as described in SECURITY.md. Not sponsored.
Top comments (0)