Contracts: event, event feed, church, identity, sign-in return, Hub protocol v2
- crosscode.event/1 and crosscode.event-feed/1 (feed, event.changed webhook), with session and registration rules; parseEventFeed skips and reports bad events instead of failing the whole feed. - crosscode.church/1: branding, campuses, service times, contact, links. - crosscode.identity/1: sign-in claims and the user.updated / user.deleted / user.export back-channel calls and replies. - Sign-in return helpers (isSafeReturnPath, encodeState/decodeState, isRegisteredRedirectUri) so every product returns people to the page they came from in the same safe way. - Hub protocol v2: product on register/heartbeat, stats per product, install public key, linked products, customerId/product in licences. - @crosscode/contracts/signing (Node only): the Hub's HMAC scheme. - Samples for every contract in samples/, checked by the tests (120). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
{
|
||||
"schema": "crosscode.church/1",
|
||||
"customerId": "c7a1e2d3-4b5c-4d6e-8f70-81a2b3c4d5e6",
|
||||
"updatedAt": "2026-11-01T09:00:00.000Z",
|
||||
"name": "Hope Family Church",
|
||||
"shortName": "Hope Family",
|
||||
"timezone": "Africa/Johannesburg",
|
||||
"locale": "en-ZA",
|
||||
"branding": {
|
||||
"logoUrl": "https://www.hopefamily.co.za/uploads/logo.png",
|
||||
"iconUrl": "https://www.hopefamily.co.za/uploads/icon-512.png",
|
||||
"colours": { "primary": "#1f4e79", "accent": "#f2a900" }
|
||||
},
|
||||
"campuses": [
|
||||
{
|
||||
"slug": "meyerton",
|
||||
"name": "Meyerton",
|
||||
"address": {
|
||||
"line1": "12 Church Street",
|
||||
"line2": null,
|
||||
"suburb": "Meyerton Central",
|
||||
"city": "Meyerton",
|
||||
"province": "Gauteng",
|
||||
"postalCode": "1961",
|
||||
"country": "ZA",
|
||||
"geo": { "lat": -26.5559, "lng": 28.0141 }
|
||||
}
|
||||
}
|
||||
],
|
||||
"serviceTimes": [
|
||||
{ "day": "sunday", "time": "09:00", "label": "Morning service", "campus": "meyerton", "note": "Kids church during the service" },
|
||||
{ "day": "wednesday", "time": "18:30", "label": "Prayer evening", "campus": "meyerton", "note": null }
|
||||
],
|
||||
"contact": {
|
||||
"email": "office@hopefamily.co.za",
|
||||
"phone": "+27161234567",
|
||||
"whatsapp": "+27821234567",
|
||||
"address": null
|
||||
},
|
||||
"social": [
|
||||
{ "network": "facebook", "url": "https://www.facebook.com/hopefamilychurch" },
|
||||
{ "network": "youtube", "url": "https://www.youtube.com/@hopefamilychurch" }
|
||||
],
|
||||
"links": {
|
||||
"website": "https://www.hopefamily.co.za",
|
||||
"events": "https://events.hopefamily.co.za",
|
||||
"app": null,
|
||||
"accounts": "https://accounts.hopefamily.co.za"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"schema": "crosscode.event-feed/1",
|
||||
"type": "event.changed",
|
||||
"occurredAt": "2026-11-03T10:00:01.000Z",
|
||||
"eventIds": ["8f1c2a4e-5b6d-4c7e-9f80-a1b2c3d4e5f6"]
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"schema": "crosscode.event-feed/1",
|
||||
"generatedAt": "2026-11-03T10:05:00.000Z",
|
||||
"events": [
|
||||
{
|
||||
"schema": "crosscode.event/1",
|
||||
"id": "8f1c2a4e-5b6d-4c7e-9f80-a1b2c3d4e5f6",
|
||||
"origin": { "product": "events", "installId": "3b0f6a52-6c1e-4b7a-9d0e-2f1a8c4b7e01", "url": "https://events.hopefamily.co.za/events/youth-camp" },
|
||||
"status": "published",
|
||||
"updatedAt": "2026-11-03T10:00:00.000Z",
|
||||
"title": "Youth Camp 2027",
|
||||
"summary": "Three days at Camp Wartburg",
|
||||
"description": null,
|
||||
"imageUrl": null,
|
||||
"timezone": "Africa/Johannesburg",
|
||||
"startsAt": "2027-03-14T06:00:00.000Z",
|
||||
"endsAt": "2027-03-16T12:00:00.000Z",
|
||||
"allDay": false,
|
||||
"sessions": [],
|
||||
"location": null,
|
||||
"campus": null,
|
||||
"series": null,
|
||||
"tags": [],
|
||||
"registration": { "mode": "origin", "url": "https://events.hopefamily.co.za/events/youth-camp", "status": "full", "opensAt": null, "closesAt": null, "priceFrom": { "amountCents": 45000, "currency": "ZAR" } }
|
||||
}
|
||||
],
|
||||
"deleted": [
|
||||
{ "id": "0f9e8d7c-6b5a-4493-8271-605f4e3d2c1b", "deletedAt": "2026-11-02T08:00:00.000Z" }
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"schema": "crosscode.event/1",
|
||||
"id": "6e5d4c3b-2a19-4807-b6f5-e4d3c2b1a090",
|
||||
"origin": {
|
||||
"product": "website",
|
||||
"installId": "3b0f6a52-6c1e-4b7a-9d0e-2f1a8c4b7e02",
|
||||
"url": "https://www.hopefamily.co.za/events/carols-by-candlelight"
|
||||
},
|
||||
"status": "published",
|
||||
"updatedAt": "2026-11-02T14:30:00.000Z",
|
||||
"title": "Carols by Candlelight",
|
||||
"summary": null,
|
||||
"description": "Bring a blanket and the family. No booking needed; ask the church office about parking for the elderly.",
|
||||
"imageUrl": null,
|
||||
"timezone": "Africa/Johannesburg",
|
||||
"startsAt": "2026-12-20T16:00:00.000Z",
|
||||
"endsAt": "2026-12-20T18:00:00.000Z",
|
||||
"allDay": false,
|
||||
"sessions": [],
|
||||
"location": { "name": "Church lawn", "address": null, "onlineUrl": null },
|
||||
"campus": null,
|
||||
"series": null,
|
||||
"tags": ["christmas", "family"],
|
||||
"registration": {
|
||||
"mode": "contact",
|
||||
"url": null,
|
||||
"status": "open",
|
||||
"opensAt": null,
|
||||
"closesAt": null,
|
||||
"priceFrom": null
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"schema": "crosscode.event/1",
|
||||
"id": "8f1c2a4e-5b6d-4c7e-9f80-a1b2c3d4e5f6",
|
||||
"origin": {
|
||||
"product": "events",
|
||||
"installId": "3b0f6a52-6c1e-4b7a-9d0e-2f1a8c4b7e01",
|
||||
"url": "https://events.hopefamily.co.za/events/youth-camp"
|
||||
},
|
||||
"status": "published",
|
||||
"updatedAt": "2026-11-03T10:00:00.000Z",
|
||||
"title": "Youth Camp 2027",
|
||||
"summary": "Three days at Camp Wartburg",
|
||||
"description": "Three days of worship, teaching and adventure for grades 8 to 12.\n\n**Bring:** a sleeping bag and a Bible.",
|
||||
"imageUrl": "https://events.hopefamily.co.za/uploads/youth-camp-2027.jpg",
|
||||
"timezone": "Africa/Johannesburg",
|
||||
"startsAt": "2027-03-14T06:00:00.000Z",
|
||||
"endsAt": "2027-03-16T12:00:00.000Z",
|
||||
"allDay": false,
|
||||
"sessions": [
|
||||
{ "id": "1a2b3c4d-0001-4a00-8a00-000000000001", "label": "Day 1", "startsAt": "2027-03-14T06:00:00.000Z", "endsAt": "2027-03-14T19:00:00.000Z", "location": null, "cancelled": false },
|
||||
{ "id": "1a2b3c4d-0001-4a00-8a00-000000000002", "label": "Day 2", "startsAt": "2027-03-15T06:00:00.000Z", "endsAt": "2027-03-15T19:00:00.000Z", "location": null, "cancelled": false },
|
||||
{ "id": "1a2b3c4d-0001-4a00-8a00-000000000003", "label": "Day 3", "startsAt": "2027-03-16T06:00:00.000Z", "endsAt": "2027-03-16T12:00:00.000Z", "location": null, "cancelled": false }
|
||||
],
|
||||
"location": { "name": "Camp Wartburg", "address": "R103, Wartburg, KwaZulu-Natal", "onlineUrl": null },
|
||||
"campus": { "slug": "meyerton", "name": "Meyerton" },
|
||||
"series": { "id": "2b3c4d5e-6f70-4a81-9b92-a3b4c5d6e7f8", "name": "Youth Camp" },
|
||||
"tags": ["youth"],
|
||||
"registration": {
|
||||
"mode": "origin",
|
||||
"url": "https://events.hopefamily.co.za/events/youth-camp",
|
||||
"status": "open",
|
||||
"opensAt": null,
|
||||
"closesAt": "2027-03-10T22:00:00.000Z",
|
||||
"priceFrom": { "amountCents": 45000, "currency": "ZAR" }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"protocolVersion": 2,
|
||||
"product": "accounts",
|
||||
"version": "1.0.0",
|
||||
"health": {
|
||||
"uptimeSeconds": 7200,
|
||||
"db": true,
|
||||
"jobs": { "mode": "queue", "failedLast24h": 0 },
|
||||
"lastBackupAt": "2026-11-03T00:00:02.000Z",
|
||||
"disk": null,
|
||||
"errorsLast24h": 0,
|
||||
"pendingMigrations": 0
|
||||
},
|
||||
"stats": {
|
||||
"accounts": { "total": 640, "active90d": 288 },
|
||||
"twoFactor": { "email": 30, "whatsapp": 12, "totp": 6, "off": 592 },
|
||||
"linkedProducts": 3
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"protocolVersion": 2,
|
||||
"product": "app",
|
||||
"version": "1.0.0",
|
||||
"health": {
|
||||
"uptimeSeconds": 7200,
|
||||
"db": true,
|
||||
"jobs": { "mode": "queue", "failedLast24h": 1 },
|
||||
"lastBackupAt": "2026-11-03T00:00:09.000Z",
|
||||
"disk": null,
|
||||
"errorsLast24h": 2,
|
||||
"pendingMigrations": 0
|
||||
},
|
||||
"stats": {
|
||||
"activeMembers90d": "101–300",
|
||||
"modules": ["house-of-prayer", "announcements", "devotionals", "events"],
|
||||
"prayer": { "coverageLast7dPercent": 62.5, "activeCommitments": 87 },
|
||||
"announcements": { "last30d": 6 },
|
||||
"messages": { "email30d": 410, "whatsapp30d": 1290 }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"protocolVersion": 2,
|
||||
"product": "events",
|
||||
"version": "2.3.0",
|
||||
"health": {
|
||||
"uptimeSeconds": 86400,
|
||||
"db": true,
|
||||
"jobs": { "mode": "queue", "failedLast24h": 0 },
|
||||
"lastBackupAt": "2026-11-03T00:00:12.000Z",
|
||||
"disk": { "freeBytes": 21474836480, "totalBytes": 53687091200 },
|
||||
"errorsLast24h": 0,
|
||||
"pendingMigrations": 0
|
||||
},
|
||||
"stats": {
|
||||
"users": 412,
|
||||
"events": { "active": 3, "upcoming": 5, "total": 61 },
|
||||
"registrations": { "last30d": 88, "total": 2310 },
|
||||
"tickets": { "last30d": 140, "total": 3901 },
|
||||
"checkIns": { "last30d": 96 },
|
||||
"messages": null,
|
||||
"paymentProviders": ["yoco", "payfast"],
|
||||
"campuses": true,
|
||||
"campusCount": 2,
|
||||
"income": { "last30d": "R5 001–R20 000", "allTime": "R150 001–R250 000", "eventIncome12m": "R100 001–R150 000" }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"licence": "hel1.eyJ2IjoxfQ.c2lnbmF0dXJl",
|
||||
"latestVersion": "2.3.1",
|
||||
"releases": [
|
||||
{ "version": "2.3.1", "releasedAt": "2026-11-10T10:00:00.000Z", "urgent": false, "notes": "- Fixed: feed sync after a campus is renamed" }
|
||||
],
|
||||
"notices": [
|
||||
{
|
||||
"id": "notice-1",
|
||||
"level": "maintenance",
|
||||
"title": "Planned maintenance",
|
||||
"message": "The Hub will be offline for about 30 minutes. Your site keeps working.",
|
||||
"startsAt": "2026-11-15T16:00:00.000Z",
|
||||
"endsAt": "2026-11-15T16:30:00.000Z",
|
||||
"updatedAt": "2026-11-03T08:00:00.000Z"
|
||||
}
|
||||
],
|
||||
"linkedProducts": [
|
||||
{
|
||||
"product": "website",
|
||||
"installId": "3b0f6a52-6c1e-4b7a-9d0e-2f1a8c4b7e02",
|
||||
"url": "https://www.hopefamily.co.za",
|
||||
"publicKey": "-----BEGIN PUBLIC KEY-----\nMCowBQYDK2VwAyEARF8kVdPtJTKGFGxkcYFGy9lIB+ccsZGH4cTWlJSyGAc=\n-----END PUBLIC KEY-----\n"
|
||||
},
|
||||
{
|
||||
"product": "accounts",
|
||||
"installId": "3b0f6a52-6c1e-4b7a-9d0e-2f1a8c4b7e04",
|
||||
"url": "https://accounts.hopefamily.co.za",
|
||||
"publicKey": "-----BEGIN PUBLIC KEY-----\nMCowBQYDK2VwAyEAsQbIsjVsJY9k9jLjMSbscXdD9wONmLw90MrMHptfmSQ=\n-----END PUBLIC KEY-----\n"
|
||||
}
|
||||
],
|
||||
"serverTime": "2026-11-03T10:15:00.120Z"
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"protocolVersion": 2,
|
||||
"product": "website",
|
||||
"version": "1.0.0",
|
||||
"health": {
|
||||
"uptimeSeconds": 3600,
|
||||
"db": true,
|
||||
"jobs": { "mode": "queue", "failedLast24h": 0 },
|
||||
"lastBackupAt": "2026-11-03T00:00:05.000Z",
|
||||
"disk": null,
|
||||
"errorsLast24h": null,
|
||||
"pendingMigrations": 0
|
||||
},
|
||||
"stats": {
|
||||
"pages": { "published": 14, "drafts": 2 },
|
||||
"messages": { "total": 120, "last30d": 4 },
|
||||
"events": { "upcomingSimple": 1, "imported": 5 },
|
||||
"editors": 3,
|
||||
"storage": { "usedBytes": 1288490188, "includedBytes": 5368709120 }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"v": 1,
|
||||
"licenceId": "4a5b6c7d-8e9f-4a0b-9c1d-2e3f4a5b6c7d",
|
||||
"installId": "3b0f6a52-6c1e-4b7a-9d0e-2f1a8c4b7e01",
|
||||
"customerId": "c7a1e2d3-4b5c-4d6e-8f70-81a2b3c4d5e6",
|
||||
"product": "events",
|
||||
"customer": "Hope Family Church",
|
||||
"plan": "grow",
|
||||
"status": "active",
|
||||
"licenceExpiresAt": "2027-10-31T21:59:59.000Z",
|
||||
"graceDays": 14,
|
||||
"issuedAt": "2026-11-03T10:15:00.000Z",
|
||||
"validUntil": "2026-12-03T10:15:00.000Z",
|
||||
"limits": { "aiMonthlyCapCents": 5000 }
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"protocolVersion": 2,
|
||||
"licenceKey": "CEH-7K2M-9QXA-P4RT-WD8C",
|
||||
"product": "events",
|
||||
"install": {
|
||||
"name": "Hope Family Church",
|
||||
"url": "https://events.hopefamily.co.za",
|
||||
"adminContact": { "name": "Jane Admin", "email": "jane@hopefamily.co.za" },
|
||||
"version": "2.3.0",
|
||||
"timezone": "Africa/Johannesburg",
|
||||
"server": { "node": "20.18.0", "postgres": "16.4", "os": "linux 6.8" },
|
||||
"features": { "whatsapp": true, "paymentProviders": ["yoco", "payfast"], "campuses": true },
|
||||
"publicKey": "-----BEGIN PUBLIC KEY-----\nMCowBQYDK2VwAyEAWWClNYLC0mJBNO3fvZEKVWwN2zzUonnbxGtNxP5Aw6w=\n-----END PUBLIC KEY-----\n"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"installId": "3b0f6a52-6c1e-4b7a-9d0e-2f1a8c4b7e01",
|
||||
"installSecret": "q8V3m1xT9bK2pL7wR4nZ6cY0dF5hJ8sA2gE1uI3oP9k",
|
||||
"licence": "hel1.eyJ2IjoxfQ.c2lnbmF0dXJl",
|
||||
"heartbeatIntervalMinutes": 15,
|
||||
"latestVersion": "2.3.0",
|
||||
"releases": [],
|
||||
"notices": [],
|
||||
"linkedProducts": [
|
||||
{
|
||||
"product": "website",
|
||||
"installId": "3b0f6a52-6c1e-4b7a-9d0e-2f1a8c4b7e02",
|
||||
"url": "https://www.hopefamily.co.za",
|
||||
"publicKey": "-----BEGIN PUBLIC KEY-----\nMCowBQYDK2VwAyEARF8kVdPtJTKGFGxkcYFGy9lIB+ccsZGH4cTWlJSyGAc=\n-----END PUBLIC KEY-----\n"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"schema": "crosscode.identity/1",
|
||||
"sub": "5d2e8f10-3a4b-4c5d-8e6f-7a8b9c0d1e2f",
|
||||
"name": "Thandi Mokoena",
|
||||
"given_name": "Thandi",
|
||||
"family_name": "Mokoena",
|
||||
"email": "thandi@example.com",
|
||||
"email_verified": true,
|
||||
"phone_number": "+27831234567",
|
||||
"phone_number_verified": true,
|
||||
"news_consent": { "email": true, "whatsapp": false },
|
||||
"amr": ["pwd", "otp", "mfa"],
|
||||
"two_factor": "totp",
|
||||
"privacy_notice_version": 3
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"schema": "crosscode.identity/1",
|
||||
"status": "deferred",
|
||||
"reason": "Has a registration for Youth Camp 2027 (14 March 2027)",
|
||||
"retryAfter": "2027-03-17T00:00:00.000Z"
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"schema": "crosscode.identity/1",
|
||||
"type": "user.deleted",
|
||||
"callId": "8d7c6b5a-4938-4271-a605-e4d3c2b1a09f",
|
||||
"occurredAt": "2026-11-03T12:00:00.000Z",
|
||||
"sub": "5d2e8f10-3a4b-4c5d-8e6f-7a8b9c0d1e2f",
|
||||
"approvedAt": "2026-11-03T12:00:00.000Z"
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"schema": "crosscode.identity/1",
|
||||
"exportId": "7c6b5a49-3827-4165-b4e3-d2c1b0a9f8e7",
|
||||
"sub": "5d2e8f10-3a4b-4c5d-8e6f-7a8b9c0d1e2f",
|
||||
"product": "events",
|
||||
"generatedAt": "2026-11-03T13:00:04.000Z",
|
||||
"sections": [
|
||||
{
|
||||
"key": "registrations",
|
||||
"title": "Registrations",
|
||||
"records": [
|
||||
{ "event": "Youth Camp 2027", "registeredAt": "2026-10-20T08:12:00.000Z", "tickets": 2, "status": "paid" }
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "check_ins",
|
||||
"title": "Check-ins",
|
||||
"records": []
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"schema": "crosscode.identity/1",
|
||||
"type": "user.export",
|
||||
"callId": "7b6a5948-3726-4150-9f4e-d3c2b1a09f8e",
|
||||
"occurredAt": "2026-11-03T13:00:00.000Z",
|
||||
"sub": "5d2e8f10-3a4b-4c5d-8e6f-7a8b9c0d1e2f",
|
||||
"exportId": "7c6b5a49-3827-4165-b4e3-d2c1b0a9f8e7"
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"schema": "crosscode.identity/1",
|
||||
"type": "user.updated",
|
||||
"callId": "9e8d7c6b-5a49-4382-a716-f5e4d3c2b1a0",
|
||||
"occurredAt": "2026-11-03T11:00:00.000Z",
|
||||
"sub": "5d2e8f10-3a4b-4c5d-8e6f-7a8b9c0d1e2f",
|
||||
"profile": {
|
||||
"name": "Thandi Mokoena",
|
||||
"given_name": "Thandi",
|
||||
"family_name": "Mokoena",
|
||||
"email": "thandi.mokoena@example.com",
|
||||
"email_verified": true,
|
||||
"phone_number": "+27831234567",
|
||||
"phone_number_verified": true,
|
||||
"news_consent": { "email": true, "whatsapp": true }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user