mirror of
https://github.com/profullstack/logicsrc.git
synced 2026-10-03 05:07:10 +00:00
Propose OpenWall broadcasts and direct messaging contracts
This commit is contained in:
parent
b6cd7cfde2
commit
b68109fd46
15 changed files with 968 additions and 1 deletions
|
|
@ -3,7 +3,7 @@
|
|||
Canonical JSON Schemas (draft 2020-12) for the LogicSRC open coordination
|
||||
standards, maintained by Profullstack, Inc.
|
||||
|
||||
Two schema families ship from this package:
|
||||
Schema families include:
|
||||
|
||||
- **LogicSRC core** — `logicsrc-*.schema.json`: tasks, agents, runs, events,
|
||||
plugins, connected accounts, email messages, social posts.
|
||||
|
|
@ -11,6 +11,10 @@ Two schema families ship from this package:
|
|||
contract for CLI tools and AI agents (ads, placements, requests, responses,
|
||||
impressions, clicks, campaigns). See `docs/agentad.md` in the repo;
|
||||
[cl1s.tech](https://github.com/profullstack/cl1s.tech) is the reference network.
|
||||
- **OpenWall draft** — `openwall-message` and `openwall-receipt` exports define
|
||||
sender-side audience jobs and private delivery events. Fixtures are in
|
||||
`fixtures/openwall`. See `docs/openwall.md` for consent, routing, and runtime
|
||||
requirements beyond structural validation; no OpenWall delivery runtime ships.
|
||||
|
||||
## Install
|
||||
|
||||
|
|
|
|||
16
packages/schemas/fixtures/openwall/announcement.json
Normal file
16
packages/schemas/fixtures/openwall/announcement.json
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"openwall": "0.1-draft",
|
||||
"id": "urn:uuid:5bb154dd-edb3-47b7-8fc6-4cb65a19a9f8",
|
||||
"sender": "did:web:ops.example",
|
||||
"createdAt": "2026-09-13T12:00:00Z",
|
||||
"expiresAt": "2026-09-20T12:00:00Z",
|
||||
"visibility": "public",
|
||||
"topic": "releases",
|
||||
"audience": {
|
||||
"kind": "public"
|
||||
},
|
||||
"content": {
|
||||
"mediaType": "text/plain",
|
||||
"text": "Version 1.2 is available."
|
||||
}
|
||||
}
|
||||
27
packages/schemas/fixtures/openwall/broadcast.json
Normal file
27
packages/schemas/fixtures/openwall/broadcast.json
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"openwall": "0.1-draft",
|
||||
"id": "urn:uuid:94d908df-2876-48f1-bec8-c931f5c847d4",
|
||||
"sender": "did:web:ops.example",
|
||||
"createdAt": "2026-09-13T12:00:00Z",
|
||||
"expiresAt": "2026-09-13T12:10:00Z",
|
||||
"visibility": "private",
|
||||
"topic": "maintenance",
|
||||
"audience": {
|
||||
"kind": "relationships",
|
||||
"selectors": [
|
||||
{
|
||||
"source": "https://dev.example/contacts",
|
||||
"actor": "did:web:ops.example",
|
||||
"groups": [
|
||||
"users"
|
||||
],
|
||||
"scope": "https://dev.example/workspaces/main"
|
||||
}
|
||||
],
|
||||
"exclude": []
|
||||
},
|
||||
"content": {
|
||||
"mediaType": "text/plain",
|
||||
"text": "SERVER NOTICE\nMaintenance starts in 10 minutes.\nPlease save your work and pause running jobs."
|
||||
}
|
||||
}
|
||||
17
packages/schemas/fixtures/openwall/direct.json
Normal file
17
packages/schemas/fixtures/openwall/direct.json
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"openwall": "0.1-draft",
|
||||
"id": "urn:uuid:07b2b83e-27f6-4d59-bdfa-cdcd42548678",
|
||||
"sender": "did:web:ops.example",
|
||||
"createdAt": "2026-09-13T12:00:00Z",
|
||||
"expiresAt": "2026-09-13T12:10:00Z",
|
||||
"visibility": "private",
|
||||
"topic": "maintenance",
|
||||
"audience": {
|
||||
"kind": "direct",
|
||||
"recipient": "did:web:ada.example"
|
||||
},
|
||||
"content": {
|
||||
"mediaType": "text/plain",
|
||||
"text": "Ready when you are."
|
||||
}
|
||||
}
|
||||
13
packages/schemas/fixtures/openwall/receipt-accepted.json
Normal file
13
packages/schemas/fixtures/openwall/receipt-accepted.json
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"openwall": "0.1-draft",
|
||||
"id": "urn:uuid:963f9109-803f-4f0c-8506-10c70ec47ee6",
|
||||
"messageId": "urn:uuid:94d908df-2876-48f1-bec8-c931f5c847d4",
|
||||
"recipient": "did:web:ada.example",
|
||||
"sequence": 3,
|
||||
"state": "accepted",
|
||||
"at": "2026-09-13T12:00:03Z",
|
||||
"attempt": 1,
|
||||
"route": "https://chat.example",
|
||||
"providerMessageId": "provider-msg-123",
|
||||
"deliveryId": "urn:uuid:db925d64-4e1a-4e5a-83c1-e37b68aa5eef"
|
||||
}
|
||||
14
packages/schemas/fixtures/openwall/receipt-retrying.json
Normal file
14
packages/schemas/fixtures/openwall/receipt-retrying.json
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"openwall": "0.1-draft",
|
||||
"id": "urn:uuid:211bb615-90e1-4773-b7c0-49d59d7cd6bc",
|
||||
"messageId": "urn:uuid:94d908df-2876-48f1-bec8-c931f5c847d4",
|
||||
"recipient": "did:web:ada.example",
|
||||
"sequence": 3,
|
||||
"state": "retrying",
|
||||
"at": "2026-09-13T12:00:03Z",
|
||||
"attempt": 1,
|
||||
"route": "https://chat.example",
|
||||
"reason": "rate-limited",
|
||||
"nextAttemptAt": "2026-09-13T12:01:00Z",
|
||||
"deliveryId": "urn:uuid:db925d64-4e1a-4e5a-83c1-e37b68aa5eef"
|
||||
}
|
||||
|
|
@ -85,6 +85,8 @@
|
|||
"./openontology-review": "./schemas/logicsrc-openontology-review.schema.json",
|
||||
"./openontology-source": "./schemas/logicsrc-openontology-source.schema.json",
|
||||
"./openprd-prd": "./schemas/openprd-prd.schema.json",
|
||||
"./openwall-message": "./schemas/logicsrc-openwall-message.schema.json",
|
||||
"./openwall-receipt": "./schemas/logicsrc-openwall-receipt.schema.json",
|
||||
"./plugin": "./schemas/logicsrc-plugin.schema.json",
|
||||
"./pull-request": "./schemas/logicsrc-pull-request.schema.json",
|
||||
"./repo": "./schemas/logicsrc-repo.schema.json",
|
||||
|
|
|
|||
246
packages/schemas/schemas/logicsrc-openwall-message.schema.json
Normal file
246
packages/schemas/schemas/logicsrc-openwall-message.schema.json
Normal file
|
|
@ -0,0 +1,246 @@
|
|||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://schemas.logicsrc.com/logicsrc-openwall-message.schema.json",
|
||||
"title": "OpenWall Message (0.1 draft)",
|
||||
"description": "Private sender-side job document. Structural validation does not authorize delivery or enforce the semantic rules in docs/openwall.md.",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"openwall",
|
||||
"id",
|
||||
"sender",
|
||||
"createdAt",
|
||||
"expiresAt",
|
||||
"visibility",
|
||||
"topic",
|
||||
"audience",
|
||||
"content"
|
||||
],
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"openwall": {
|
||||
"const": "0.1-draft"
|
||||
},
|
||||
"id": {
|
||||
"type": "string",
|
||||
"format": "uri",
|
||||
"pattern": "^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
|
||||
},
|
||||
"sender": {
|
||||
"$ref": "#/$defs/identity"
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"notBefore": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"expiresAt": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"visibility": {
|
||||
"enum": [
|
||||
"private",
|
||||
"public"
|
||||
]
|
||||
},
|
||||
"topic": {
|
||||
"type": "string",
|
||||
"minLength": 1,
|
||||
"maxLength": 128,
|
||||
"pattern": "^[a-z0-9][a-z0-9._-]*$"
|
||||
},
|
||||
"audience": {
|
||||
"oneOf": [
|
||||
{
|
||||
"$ref": "#/$defs/relationships"
|
||||
},
|
||||
{
|
||||
"$ref": "#/$defs/direct"
|
||||
},
|
||||
{
|
||||
"$ref": "#/$defs/public"
|
||||
}
|
||||
]
|
||||
},
|
||||
"content": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"mediaType",
|
||||
"text"
|
||||
],
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"mediaType": {
|
||||
"const": "text/plain"
|
||||
},
|
||||
"text": {
|
||||
"type": "string",
|
||||
"minLength": 1,
|
||||
"maxLength": 4000
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"allOf": [
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"visibility": {
|
||||
"const": "public"
|
||||
}
|
||||
}
|
||||
},
|
||||
"then": {
|
||||
"properties": {
|
||||
"audience": {
|
||||
"$ref": "#/$defs/public"
|
||||
}
|
||||
}
|
||||
},
|
||||
"else": {
|
||||
"properties": {
|
||||
"audience": {
|
||||
"oneOf": [
|
||||
{
|
||||
"$ref": "#/$defs/relationships"
|
||||
},
|
||||
{
|
||||
"$ref": "#/$defs/direct"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"$defs": {
|
||||
"identity": {
|
||||
"type": "string",
|
||||
"format": "uri",
|
||||
"pattern": "^(did:|https://)",
|
||||
"maxLength": 2048
|
||||
},
|
||||
"selector": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"source",
|
||||
"actor",
|
||||
"groups"
|
||||
],
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"source": {
|
||||
"type": "string",
|
||||
"format": "uri",
|
||||
"pattern": "^https://",
|
||||
"maxLength": 2048
|
||||
},
|
||||
"actor": {
|
||||
"$ref": "#/$defs/identity"
|
||||
},
|
||||
"groups": {
|
||||
"type": "array",
|
||||
"minItems": 1,
|
||||
"maxItems": 4,
|
||||
"uniqueItems": true,
|
||||
"items": {
|
||||
"enum": [
|
||||
"connections",
|
||||
"followers",
|
||||
"following",
|
||||
"users"
|
||||
]
|
||||
}
|
||||
},
|
||||
"scope": {
|
||||
"type": "string",
|
||||
"format": "uri",
|
||||
"pattern": "^https://",
|
||||
"maxLength": 2048
|
||||
}
|
||||
},
|
||||
"allOf": [
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"groups": {
|
||||
"contains": {
|
||||
"const": "users"
|
||||
},
|
||||
"type": "array"
|
||||
}
|
||||
}
|
||||
},
|
||||
"then": {
|
||||
"required": [
|
||||
"scope"
|
||||
],
|
||||
"properties": {
|
||||
"scope": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"relationships": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"kind",
|
||||
"selectors"
|
||||
],
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"kind": {
|
||||
"const": "relationships"
|
||||
},
|
||||
"selectors": {
|
||||
"type": "array",
|
||||
"minItems": 1,
|
||||
"maxItems": 32,
|
||||
"uniqueItems": true,
|
||||
"items": {
|
||||
"$ref": "#/$defs/selector"
|
||||
}
|
||||
},
|
||||
"exclude": {
|
||||
"type": "array",
|
||||
"uniqueItems": true,
|
||||
"items": {
|
||||
"$ref": "#/$defs/identity"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"direct": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"kind",
|
||||
"recipient"
|
||||
],
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"kind": {
|
||||
"const": "direct"
|
||||
},
|
||||
"recipient": {
|
||||
"$ref": "#/$defs/identity"
|
||||
}
|
||||
}
|
||||
},
|
||||
"public": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"kind"
|
||||
],
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"kind": {
|
||||
"const": "public"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
229
packages/schemas/schemas/logicsrc-openwall-receipt.schema.json
Normal file
229
packages/schemas/schemas/logicsrc-openwall-receipt.schema.json
Normal file
|
|
@ -0,0 +1,229 @@
|
|||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://schemas.logicsrc.com/logicsrc-openwall-receipt.schema.json",
|
||||
"title": "OpenWall Receipt (0.1 draft)",
|
||||
"description": "Private coordinator event. Authenticity, event ordering and valid state transitions require runtime checks.",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"openwall",
|
||||
"id",
|
||||
"messageId",
|
||||
"deliveryId",
|
||||
"recipient",
|
||||
"sequence",
|
||||
"state",
|
||||
"at",
|
||||
"attempt"
|
||||
],
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"openwall": {
|
||||
"const": "0.1-draft"
|
||||
},
|
||||
"id": {
|
||||
"type": "string",
|
||||
"format": "uri",
|
||||
"pattern": "^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
|
||||
},
|
||||
"messageId": {
|
||||
"type": "string",
|
||||
"format": "uri",
|
||||
"pattern": "^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
|
||||
},
|
||||
"recipient": {
|
||||
"type": "string",
|
||||
"format": "uri",
|
||||
"pattern": "^(did:|https://)",
|
||||
"maxLength": 2048
|
||||
},
|
||||
"sequence": {
|
||||
"type": "integer",
|
||||
"minimum": 1
|
||||
},
|
||||
"state": {
|
||||
"enum": [
|
||||
"queued",
|
||||
"sending",
|
||||
"retrying",
|
||||
"accepted",
|
||||
"delivered",
|
||||
"read",
|
||||
"unknown",
|
||||
"failed",
|
||||
"expired",
|
||||
"cancelled"
|
||||
]
|
||||
},
|
||||
"at": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"attempt": {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"maximum": 8
|
||||
},
|
||||
"route": {
|
||||
"type": "string",
|
||||
"format": "uri",
|
||||
"pattern": "^https://",
|
||||
"maxLength": 2048
|
||||
},
|
||||
"providerMessageId": {
|
||||
"type": "string",
|
||||
"minLength": 1,
|
||||
"maxLength": 2048
|
||||
},
|
||||
"reason": {
|
||||
"enum": [
|
||||
"not-permitted",
|
||||
"identity-unverified",
|
||||
"unsupported",
|
||||
"rate-limited",
|
||||
"provider-failure",
|
||||
"acceptance-unknown",
|
||||
"retry-exhausted",
|
||||
"deadline-passed",
|
||||
"sender-cancelled"
|
||||
]
|
||||
},
|
||||
"nextAttemptAt": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"deliveryId": {
|
||||
"type": "string",
|
||||
"format": "uri",
|
||||
"pattern": "^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
|
||||
}
|
||||
},
|
||||
"allOf": [
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"state": {
|
||||
"const": "retrying"
|
||||
}
|
||||
}
|
||||
},
|
||||
"then": {
|
||||
"required": [
|
||||
"nextAttemptAt",
|
||||
"reason"
|
||||
],
|
||||
"properties": {
|
||||
"nextAttemptAt": {},
|
||||
"reason": {}
|
||||
}
|
||||
},
|
||||
"else": {
|
||||
"not": {
|
||||
"required": [
|
||||
"nextAttemptAt"
|
||||
],
|
||||
"properties": {
|
||||
"nextAttemptAt": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"state": {
|
||||
"enum": [
|
||||
"failed",
|
||||
"unknown",
|
||||
"expired",
|
||||
"cancelled"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"then": {
|
||||
"required": [
|
||||
"reason"
|
||||
],
|
||||
"properties": {
|
||||
"reason": {}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"state": {
|
||||
"enum": [
|
||||
"sending",
|
||||
"retrying",
|
||||
"accepted",
|
||||
"delivered",
|
||||
"read",
|
||||
"unknown"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"then": {
|
||||
"required": [
|
||||
"route"
|
||||
],
|
||||
"properties": {
|
||||
"attempt": {
|
||||
"minimum": 1,
|
||||
"type": "integer"
|
||||
},
|
||||
"route": {}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"state": {
|
||||
"const": "unknown"
|
||||
}
|
||||
}
|
||||
},
|
||||
"then": {
|
||||
"properties": {
|
||||
"reason": {
|
||||
"const": "acceptance-unknown"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"state": {
|
||||
"const": "expired"
|
||||
}
|
||||
}
|
||||
},
|
||||
"then": {
|
||||
"properties": {
|
||||
"reason": {
|
||||
"const": "deadline-passed"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"state": {
|
||||
"const": "cancelled"
|
||||
}
|
||||
}
|
||||
},
|
||||
"then": {
|
||||
"properties": {
|
||||
"reason": {
|
||||
"const": "sender-cancelled"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
120
packages/validators/src/openwall.test.ts
Normal file
120
packages/validators/src/openwall.test.ts
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
import { readFileSync } from "node:fs";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { validate } from "./index.js";
|
||||
|
||||
function fixture(name: string) {
|
||||
return JSON.parse(readFileSync(new URL(`../../schemas/fixtures/openwall/${name}.json`, import.meta.url), "utf8"));
|
||||
}
|
||||
|
||||
describe("OpenWall draft structural contracts", () => {
|
||||
it.each(["broadcast", "direct", "announcement"])("accepts the %s message fixture", (name) => {
|
||||
expect(validate("openwall-message", fixture(name))).toMatchObject({ ok: true });
|
||||
});
|
||||
|
||||
it.each(["receipt-accepted", "receipt-retrying"])("accepts the %s fixture", (name) => {
|
||||
expect(validate("openwall-receipt", fixture(name))).toMatchObject({ ok: true });
|
||||
});
|
||||
|
||||
it("requires a service scope for every users selector", () => {
|
||||
const message = fixture("broadcast");
|
||||
delete message.audience.selectors[0].scope;
|
||||
expect(validate("openwall-message", message).ok).toBe(false);
|
||||
});
|
||||
|
||||
it("permits a union of relationship groups and sources", () => {
|
||||
const message = fixture("broadcast");
|
||||
message.audience.selectors.push({
|
||||
source: "https://social.example/graph",
|
||||
actor: "did:web:ops.example",
|
||||
groups: ["connections", "followers", "following"]
|
||||
});
|
||||
expect(validate("openwall-message", message).ok).toBe(true);
|
||||
});
|
||||
|
||||
it.each(["broadcast", "direct"])("rejects changing a %s to public while retaining recipients", (name) => {
|
||||
const message = fixture(name);
|
||||
message.visibility = "public";
|
||||
expect(validate("openwall-message", message).ok).toBe(false);
|
||||
});
|
||||
|
||||
it("rejects a private message with an unrestricted public audience", () => {
|
||||
const message = fixture("announcement");
|
||||
message.visibility = "private";
|
||||
expect(validate("openwall-message", message).ok).toBe(false);
|
||||
});
|
||||
|
||||
it("rejects recipient metadata in a public audience", () => {
|
||||
const message = fixture("announcement");
|
||||
message.audience.recipient = "did:web:ada.example";
|
||||
expect(validate("openwall-message", message).ok).toBe(false);
|
||||
});
|
||||
|
||||
it("requires explicit groups and rejects an implicit all audience", () => {
|
||||
const message = fixture("broadcast");
|
||||
message.audience.selectors[0].groups = [];
|
||||
expect(validate("openwall-message", message).ok).toBe(false);
|
||||
message.audience.selectors[0].groups = ["all"];
|
||||
expect(validate("openwall-message", message).ok).toBe(false);
|
||||
});
|
||||
|
||||
it("requires a resolved recipient identity rather than a display handle", () => {
|
||||
const message = fixture("direct");
|
||||
message.audience.recipient = "ada.example";
|
||||
expect(validate("openwall-message", message).ok).toBe(false);
|
||||
});
|
||||
|
||||
it("rejects absent expiry, malformed timestamps and oversized text", () => {
|
||||
const message = fixture("direct");
|
||||
delete message.expiresAt;
|
||||
expect(validate("openwall-message", message).ok).toBe(false);
|
||||
message.expiresAt = "tomorrow";
|
||||
expect(validate("openwall-message", message).ok).toBe(false);
|
||||
message.expiresAt = "2026-09-13T13:00:00Z";
|
||||
message.content.text = "x".repeat(4001);
|
||||
expect(validate("openwall-message", message).ok).toBe(false);
|
||||
});
|
||||
|
||||
it("requires receipt delivery correlation and disallows audience disclosure", () => {
|
||||
const receipt = fixture("receipt-accepted");
|
||||
delete receipt.deliveryId;
|
||||
expect(validate("openwall-receipt", receipt).ok).toBe(false);
|
||||
receipt.deliveryId = "unscoped-message-id";
|
||||
expect(validate("openwall-receipt", receipt).ok).toBe(false);
|
||||
receipt.deliveryId = "urn:uuid:db925d64-4e1a-4e5a-83c1-e37b68aa5eef";
|
||||
receipt.recipients = ["did:web:other.example"];
|
||||
expect(validate("openwall-receipt", receipt).ok).toBe(false);
|
||||
});
|
||||
|
||||
it("requires retry timing and a reason and disallows retry timing on acceptance", () => {
|
||||
const receipt = fixture("receipt-retrying");
|
||||
delete receipt.nextAttemptAt;
|
||||
expect(validate("openwall-receipt", receipt).ok).toBe(false);
|
||||
receipt.nextAttemptAt = "2026-09-13T12:01:00Z";
|
||||
delete receipt.reason;
|
||||
expect(validate("openwall-receipt", receipt).ok).toBe(false);
|
||||
receipt.reason = "rate-limited";
|
||||
receipt.state = "accepted";
|
||||
expect(validate("openwall-receipt", receipt).ok).toBe(false);
|
||||
});
|
||||
|
||||
it("represents ambiguous provider acceptance separately from a known failure", () => {
|
||||
const receipt = fixture("receipt-accepted");
|
||||
receipt.state = "unknown";
|
||||
receipt.reason = "acceptance-unknown";
|
||||
expect(validate("openwall-receipt", receipt).ok).toBe(true);
|
||||
receipt.reason = "rate-limited";
|
||||
expect(validate("openwall-receipt", receipt).ok).toBe(false);
|
||||
delete receipt.reason;
|
||||
receipt.state = "failed";
|
||||
expect(validate("openwall-receipt", receipt).ok).toBe(false);
|
||||
});
|
||||
|
||||
it("requires a real route and attempt for provider acceptance", () => {
|
||||
const receipt = fixture("receipt-accepted");
|
||||
receipt.attempt = 0;
|
||||
expect(validate("openwall-receipt", receipt).ok).toBe(false);
|
||||
receipt.attempt = 1;
|
||||
delete receipt.route;
|
||||
expect(validate("openwall-receipt", receipt).ok).toBe(false);
|
||||
});
|
||||
});
|
||||
|
|
@ -69,7 +69,12 @@ import credsManifestSchema from "@logicsrc/schemas/opencreds-manifest" with { ty
|
|||
import credsDatabaseSchema from "@logicsrc/schemas/opencreds-database" with { type: "json" };
|
||||
import credsAuditEventSchema from "@logicsrc/schemas/opencreds-audit-event" with { type: "json" };
|
||||
|
||||
import openwallMessageSchema from "@logicsrc/schemas/openwall-message" with { type: "json" };
|
||||
import openwallReceiptSchema from "@logicsrc/schemas/openwall-receipt" with { type: "json" };
|
||||
|
||||
export const schemas = {
|
||||
"openwall-message": openwallMessageSchema,
|
||||
"openwall-receipt": openwallReceiptSchema,
|
||||
agent: agentSchema,
|
||||
openfleet: openfleetSchema,
|
||||
"account-audit-event": accountAuditEventSchema,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue