canary-kit 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/INTEGRATION.md CHANGED
@@ -15,6 +15,16 @@ insurance, banking, and enterprise use cases.
15
15
  For regulatory alignment analysis — including FCA, RBI, UAE TDRA, EU AI Act,
16
16
  eIDAS, and W3C Confidence Method — see [REGULATORY.md](REGULATORY.md).
17
17
 
18
+ ## Related Documents
19
+
20
+ | Document | Purpose |
21
+ |----------|---------|
22
+ | [CANARY.md](CANARY.md) | Core protocol specification — CANARY-DERIVE, CANARY-DURESS, CANARY-WORDLIST |
23
+ | [THREAT-MODEL.md](THREAT-MODEL.md) | Security properties P1–P8, adversary profiles, attack trees |
24
+ | [GROUPS.md](GROUPS.md) | Transport-agnostic group protocol — the seed patterns in §Seed Establishment Patterns run on top of this |
25
+ | [NIP-XX.md](NIP-XX.md) | Nostr transport binding for the group protocol |
26
+ | [REGULATORY.md](REGULATORY.md) | Regulatory alignment — FCA, RBI, UAE TDRA, EU AI Act, eIDAS, W3C |
27
+
18
28
  ## Seed Establishment Patterns
19
29
 
20
30
  The shared seed is the foundation of CANARY verification. How it gets to both
@@ -85,6 +95,27 @@ Customer calls insurer
85
95
 
86
96
  Weakest pattern (SMS is interceptable). Stepping stone to Pattern 1.
87
97
 
98
+ #### Risk controls for Pattern 3
99
+
100
+ Pattern 3 should be deployed with mandatory controls to bound its exposure:
101
+
102
+ - **Maximum validity:** Bootstrap codes MUST expire within 24 hours. Long-lived
103
+ codes significantly increase the risk of interception and misuse.
104
+ - **Mandatory upgrade:** On first app launch after SMS bootstrap, the app MUST
105
+ prompt the user to complete Pattern 1 enrolment (biometric login, seed sync).
106
+ Pattern 3 must not remain the long-term authentication mechanism.
107
+ - **Rate limiting:** Limit bootstrap code requests to 3 attempts per phone number
108
+ per 24-hour window to prevent bulk enumeration or SIM-swap exploitation.
109
+ - **Bulk enrolment monitoring:** Alert on unusual volumes of bootstrap requests
110
+ from a single IP range or time window — this may indicate a credential stuffing
111
+ or SIM-farm attack.
112
+ - **Conversion tracking:** Log the rate at which Pattern 3 enrolments convert to
113
+ Pattern 1 (app login with seed sync). A low conversion rate indicates users are
114
+ remaining on the weaker pattern — investigate and intervene.
115
+
116
+ Pattern 3 MUST NOT be used as a long-term authentication mechanism in regulated
117
+ financial contexts (UAE, UK FCA, India RBI). See [REGULATORY.md](REGULATORY.md).
118
+
88
119
  ### Pattern 4: Task-Derived Seed (Rideshare / Delivery)
89
120
 
90
121
  For event-based verification where both parties are matched dynamically:
@@ -111,6 +142,23 @@ const session = createSession({
111
142
  })
112
143
  ```
113
144
 
145
+ #### Task secret clarification
146
+
147
+ - **What `task_secret` is:** An operator-generated 256-bit cryptographic secret,
148
+ created fresh per task using a CSPRNG. It is not derived from user identities
149
+ or task IDs — those are inputs to `deriveSeed()`, not to the secret itself.
150
+ - **Delivery mechanism:** The operator platform delivers `task_secret` to both
151
+ matched parties via an encrypted channel (e.g. push notification over TLS to
152
+ the platform's mobile SDK, or a NIP-17 gift-wrapped DM over Nostr).
153
+ - **Trust boundary:** The operator sees the secret — by design. Pattern 4 relies
154
+ on the platform as the trust anchor. This is appropriate for dispatch use cases
155
+ where the platform is already the trusted intermediary for task matching. If the
156
+ platform is untrusted, use a different pattern.
157
+ - **Lifecycle:** The `task_secret` is valid only for the duration of the task.
158
+ On task completion (or cancellation), both parties MUST zero the secret from
159
+ memory. The platform MUST discard its copy after delivery is confirmed. Do not
160
+ reuse `task_secret` across tasks.
161
+
114
162
  ## Call Centre Integration
115
163
 
116
164
  ### Architecture
@@ -212,6 +260,97 @@ if (result.status === 'duress') {
212
260
  | Social engineering | Yes | Bidirectional — attacker must know the secret |
213
261
  | Coercion / duress | Yes | Distinct duress token triggers silent alert |
214
262
 
263
+ ## Audit Logging Guidance
264
+
265
+ Deployers MUST maintain an audit log of CANARY events for compliance and incident
266
+ investigation. The audit log records what happened and when — it must never contain
267
+ secrets.
268
+
269
+ ### What to log
270
+
271
+ | Event | Fields to record |
272
+ |-------|-----------------|
273
+ | **Verification attempt** | Timestamp, outcome (`valid` / `duress` / `invalid`), word count used, whether tolerance window was hit, session identifier (not the seed or word) |
274
+ | **Duress event** | Timestamp, group ID or session ID, alert routing target (e.g. security team endpoint), member identifier |
275
+ | **Seed rotation** | Timestamp, reason (`scheduled` / `compromise` / `member_removed` / `duress`), initiator identifier |
276
+ | **Member change** | Timestamp, action (`add` / `remove`), member public key or identifier |
277
+
278
+ ### What NOT to log
279
+
280
+ - Seeds, derived keys, or verification words
281
+ - Duress words
282
+ - Shared secrets or group seeds in any form
283
+ - Sync message content that contains seeds (reseed, state-snapshot messages)
284
+
285
+ Logging any of the above would allow an attacker who gains log access to
286
+ impersonate group members or reconstruct the verification word sequence.
287
+
288
+ ### Retention guidance
289
+
290
+ Log retention periods depend on regulatory context:
291
+
292
+ - **GDPR Article 5(1)(e) (EU):** Personal data must not be kept longer than
293
+ necessary. Where member identifiers are personal data, apply data minimisation —
294
+ use pseudonymous identifiers and set a deletion schedule.
295
+ - **Financial services (UK, EU, UAE):** Regulators typically require audit records
296
+ to be retained for 5–7 years. Verify the applicable standard for your licence
297
+ category.
298
+ - **Healthcare:** Retention requirements vary by jurisdiction and data category.
299
+ Consult applicable regulations before setting a retention policy.
300
+
301
+ ---
302
+
303
+ ## Incident Response Playbook
304
+
305
+ ### Scenario 1: Suspected master key compromise
306
+
307
+ The master key is the root from which all customer seeds are derived. Compromise
308
+ is the highest-severity event.
309
+
310
+ - [ ] **1. Revoke the HSM key** — prevent any further seed derivation from the
311
+ compromised key material.
312
+ - [ ] **2. Generate a new master key** in the HSM — do not derive the new key
313
+ from the old one.
314
+ - [ ] **3. Re-derive all customer seeds** from the new master key — increment
315
+ `seed_version` to force new seeds for all accounts.
316
+ - [ ] **4. Trigger reseed** for all active CANARY sessions — the customer's app
317
+ will receive the new seed on next login.
318
+ - [ ] **5. Notify affected members** — follow your incident notification policy
319
+ and applicable breach notification regulations.
320
+ - [ ] **6. Review logs** — identify any verification attempts that may have been
321
+ made with tokens derived from the compromised key. Assess exposure window.
322
+
323
+ ### Scenario 2: Suspected seed compromise (individual group or customer)
324
+
325
+ A specific seed (not the master key) is suspected to have been exposed.
326
+
327
+ - [ ] **1. Identify affected groups** — determine which groups share the compromised
328
+ seed.
329
+ - [ ] **2. Trigger immediate reseed** for all affected groups with reason `compromise`.
330
+ Use `removeMemberAndReseed()` if the compromise originated from a specific member's device.
331
+ - [ ] **3. Verify reseed propagation** — confirm all remaining members have received
332
+ the new seed before considering the group secure.
333
+ - [ ] **4. Review the exposure window** — determine what tokens could have been
334
+ derived from the compromised seed and for how long. Assess whether any
335
+ sensitive actions were authorised in that window.
336
+
337
+ ### Scenario 3: Suspected duress false positive
338
+
339
+ A duress alert has fired. Before standing down, follow this checklist.
340
+
341
+ - [ ] **1. Do not dismiss the alert** — treat every duress event as genuine until
342
+ independently confirmed otherwise. False dismissals are more dangerous than
343
+ false positives.
344
+ - [ ] **2. Escalate to your safety or security team** — do not attempt independent
345
+ resolution at the call centre agent level.
346
+ - [ ] **3. Attempt independent contact** — use a pre-established out-of-band channel
347
+ (not the current call) to reach the member directly.
348
+ - [ ] **4. Stand down only after positive confirmation** — confirm the member is safe
349
+ via the independent channel before clearing the alert. Log the confirmation and
350
+ the confirming channel.
351
+
352
+ ---
353
+
215
354
  ## Regulatory Considerations
216
355
 
217
356
  The deployment patterns above align with specific regulatory frameworks. This
package/NIP-CANARY.md CHANGED
@@ -623,6 +623,7 @@ Notes:
623
623
 
624
624
  ## Dependencies
625
625
 
626
+ - **[NIP-XX](NIP-XX.md)**: Simple Shared Secret Groups — the transport layer this NIP profiles
626
627
  - **NIP-44**: Versioned encryption (for all Nostr event `content` fields and seed
627
628
  distribution payloads)
628
629
  - **NIP-40**: Expiration tags (for group auto-dissolution and ephemeral event expiry)
package/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
  [![TypeScript](https://img.shields.io/badge/TypeScript-native-blue)](https://www.typescriptlang.org/)
9
9
  [![Coverage](https://img.shields.io/badge/coverage-95%25-brightgreen)](vitest.config.ts)
10
10
 
11
- **[Interactive Demo](https://canary.trotters.cc/)** · [Protocol Spec](CANARY.md) · [Nostr Binding](NIP-CANARY.md) · [Integration Guide](INTEGRATION.md)
11
+ **[Interactive Demo](https://canary.trotters.cc/)** · [Protocol Spec](CANARY.md) · [Nostr Binding](NIP-CANARY.md) · [Integration Guide](INTEGRATION.md) · [Groups Protocol](GROUPS.md) · [Nostr Transport](NIP-XX.md) · [Threat Model](THREAT-MODEL.md) · [Regulatory](REGULATORY.md)
12
12
 
13
13
  ## Why Now
14
14
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "canary-kit",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Deepfake-proof identity verification. Open protocol, minimal dependencies.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",