xoonya 3.1.0 → 3.1.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.
Files changed (248) hide show
  1. package/.env.example +10 -2
  2. package/CARRIED_HANDOFF_DEMO.md +60 -60
  3. package/COMPATIBILITY_NOTE.md +27 -27
  4. package/CROSS_RUNTIME_POSTURE.md +77 -77
  5. package/EXAMPLE_PATHS.md +53 -53
  6. package/FINAL_CONTRACT.md +445 -445
  7. package/LICENSE +201 -201
  8. package/NOTICE +3 -3
  9. package/PARTNER_READY_PATH.md +67 -67
  10. package/PUBLIC_DEMO_SCRIPT.md +79 -79
  11. package/README.md +839 -808
  12. package/RELEASE_NOTES.md +18 -15
  13. package/SERVICE_CONTRACT.md +207 -207
  14. package/START_HERE.md +159 -159
  15. package/TERMINOLOGY.md +55 -55
  16. package/WHY_XYTARA_XOONYA.md +43 -43
  17. package/XNYA_CONFORMANCE_MARK.md +78 -78
  18. package/XNYA_REFERENCE_IMPLEMENTATIONS.md +157 -157
  19. package/XOONYA_DEFAULT_PATH_MODEL.md +63 -63
  20. package/XOONYA_FOLLOWTHROUGH_TRUTH_MODEL.md +63 -63
  21. package/XOONYA_NATIVE_ATOM_SPEC.md +184 -184
  22. package/XOONYA_NATIVE_PROOF_FORMAT.md +570 -527
  23. package/XOONYA_NATIVE_STANDARD_GOVERNANCE.md +119 -119
  24. package/XOONYA_PROOF_TRUTH_MODEL.md +58 -58
  25. package/bin/xoonya-first-run.js +184 -184
  26. package/bin/xoonya-release.js +1367 -1367
  27. package/bin/xoonya-review.js +70 -70
  28. package/bin/xoonya.js +82 -82
  29. package/examples/integration_boundary_walkthrough.js +37 -37
  30. package/examples/package_quickstart.js +1007 -1007
  31. package/examples/partner_proof_walkthrough.js +68 -68
  32. package/examples/proof_review_walkthrough.js +66 -66
  33. package/examples/review_carried_handoff.js +72 -72
  34. package/index.js +31 -31
  35. package/integrations/PROOF_INTEGRATION_PROCESS.md +45 -45
  36. package/integrations/examples/example-third-party-verifier-registration.record.json +22 -22
  37. package/integrations/registration-record.schema.json +99 -99
  38. package/integrations/registry-snapshot.schema.json +36 -36
  39. package/integrations/registry.js +636 -636
  40. package/integrations/views.js +36 -36
  41. package/lib/adapter_certification_contract.js +90 -90
  42. package/lib/announcement_pack.js +61 -61
  43. package/lib/artifact_distribution_lane_contract.js +54 -54
  44. package/lib/asyncapi_contract.js +135 -135
  45. package/lib/auth_interop_contract.js +69 -69
  46. package/lib/authority_binding_lifecycle_contract.js +182 -182
  47. package/lib/bridge_intelligence.js +102 -102
  48. package/lib/cloudevents_contract.js +79 -79
  49. package/lib/crypto_agility_matrix.js +125 -125
  50. package/lib/default_path_contract.js +380 -380
  51. package/lib/ecosystem_entry.js +64 -64
  52. package/lib/erc8004_proof_lane_contract.js +64 -64
  53. package/lib/event_system_lane_contract.js +76 -76
  54. package/lib/external_proof_import_lane_contract.js +87 -87
  55. package/lib/feature_control_lane_contract.js +54 -54
  56. package/lib/followthrough_truth_contract.js +214 -214
  57. package/lib/framework_lane_contract.js +76 -76
  58. package/lib/governance_disputes_summary.js +36 -36
  59. package/lib/governance_intelligence.js +108 -108
  60. package/lib/identity_interop_contract.js +83 -83
  61. package/lib/integration_matrix_contract.js +81 -81
  62. package/lib/launch_narrative.js +53 -53
  63. package/lib/machine_identity_registry_contract.js +199 -199
  64. package/lib/major_rails_proof_lane_contract.js +87 -87
  65. package/lib/offline_verifiability_recovery_contract.js +155 -155
  66. package/lib/openapi_contract.js +227 -227
  67. package/lib/operational_receipt_contract.js +165 -165
  68. package/lib/outreach_proof.js +71 -71
  69. package/lib/phase_10_closeout_pack.js +45 -45
  70. package/lib/phase_10_completion_pack.js +76 -76
  71. package/lib/phase_10_decision_record_pack.js +54 -54
  72. package/lib/phase_10_decision_resolution_pack.js +53 -53
  73. package/lib/phase_10_demand_signal_adapters_proof_pack.js +74 -74
  74. package/lib/phase_10_ecosystem_backlog_triage_proof_pack.js +74 -74
  75. package/lib/phase_10_freeze_baseline_pack.js +67 -67
  76. package/lib/phase_10_freeze_review_pack.js +64 -64
  77. package/lib/phase_10_gate_pack.js +57 -57
  78. package/lib/phase_10_long_tail_continuity_pack.js +80 -80
  79. package/lib/phase_10_long_tail_ecosystem_pack.js +68 -68
  80. package/lib/phase_10_niche_extension_registry_proof_pack.js +74 -74
  81. package/lib/phase_1_claude_mcp_pack.js +60 -60
  82. package/lib/phase_1_claude_mcp_proof_pack.js +57 -57
  83. package/lib/phase_1_ecosystem_pack.js +51 -51
  84. package/lib/phase_1_openai_codex_pack.js +60 -60
  85. package/lib/phase_1_openai_codex_proof_pack.js +57 -57
  86. package/lib/phase_2_base_proof_pack.js +71 -71
  87. package/lib/phase_2_base_usdc_proof_pack.js +72 -72
  88. package/lib/phase_2_closeout_pack.js +65 -65
  89. package/lib/phase_2_completion_pack.js +113 -113
  90. package/lib/phase_2_decision_record_pack.js +66 -66
  91. package/lib/phase_2_decision_resolution_pack.js +69 -69
  92. package/lib/phase_2_eth_proof_pack.js +70 -70
  93. package/lib/phase_2_evm_base_proof_pack.js +73 -73
  94. package/lib/phase_2_evm_proof_pack.js +71 -71
  95. package/lib/phase_2_flip_preview_pack.js +60 -60
  96. package/lib/phase_2_freeze_review_pack.js +99 -99
  97. package/lib/phase_2_gate_pack.js +77 -77
  98. package/lib/phase_2_payment_rails_pack.js +71 -71
  99. package/lib/phase_2_usdc_proof_pack.js +71 -71
  100. package/lib/phase_3_brc_proof_pack.js +81 -81
  101. package/lib/phase_3_bsv_teranode_proof_pack.js +81 -81
  102. package/lib/phase_3_closeout_pack.js +62 -62
  103. package/lib/phase_3_completion_pack.js +92 -92
  104. package/lib/phase_3_decision_record_pack.js +64 -64
  105. package/lib/phase_3_decision_resolution_pack.js +69 -69
  106. package/lib/phase_3_freeze_baseline_pack.js +67 -67
  107. package/lib/phase_3_freeze_review_pack.js +80 -80
  108. package/lib/phase_3_gate_pack.js +76 -76
  109. package/lib/phase_3_metanet_proof_pack.js +81 -81
  110. package/lib/phase_3_native_bsv_pack.js +89 -89
  111. package/lib/phase_3_native_continuity_pack.js +82 -82
  112. package/lib/phase_4_attestation_proof_pack.js +75 -75
  113. package/lib/phase_4_closeout_pack.js +45 -45
  114. package/lib/phase_4_completion_pack.js +82 -82
  115. package/lib/phase_4_decision_record_pack.js +54 -54
  116. package/lib/phase_4_decision_resolution_pack.js +45 -45
  117. package/lib/phase_4_erc8004_proof_pack.js +76 -76
  118. package/lib/phase_4_freeze_baseline_pack.js +67 -67
  119. package/lib/phase_4_freeze_review_pack.js +68 -68
  120. package/lib/phase_4_gate_pack.js +58 -58
  121. package/lib/phase_4_identity_registry_proof_pack.js +75 -75
  122. package/lib/phase_4_identity_trust_pack.js +73 -73
  123. package/lib/phase_4_trust_continuity_pack.js +86 -86
  124. package/lib/phase_5_antelope_proof_pack.js +76 -76
  125. package/lib/phase_5_closeout_pack.js +44 -44
  126. package/lib/phase_5_completion_pack.js +82 -82
  127. package/lib/phase_5_decision_record_pack.js +54 -54
  128. package/lib/phase_5_decision_resolution_pack.js +45 -45
  129. package/lib/phase_5_freeze_baseline_pack.js +67 -67
  130. package/lib/phase_5_freeze_review_pack.js +68 -68
  131. package/lib/phase_5_gate_pack.js +58 -58
  132. package/lib/phase_5_major_rails_continuity_pack.js +86 -86
  133. package/lib/phase_5_major_rails_pack.js +74 -74
  134. package/lib/phase_5_proton_xpr_proof_pack.js +76 -76
  135. package/lib/phase_5_solana_proof_pack.js +76 -76
  136. package/lib/phase_6_autogen_proof_pack.js +74 -74
  137. package/lib/phase_6_closeout_pack.js +46 -46
  138. package/lib/phase_6_completion_pack.js +77 -77
  139. package/lib/phase_6_decision_record_pack.js +54 -54
  140. package/lib/phase_6_decision_resolution_pack.js +53 -53
  141. package/lib/phase_6_framework_continuity_pack.js +81 -81
  142. package/lib/phase_6_framework_runtime_pack.js +68 -68
  143. package/lib/phase_6_freeze_baseline_pack.js +68 -68
  144. package/lib/phase_6_freeze_review_pack.js +65 -65
  145. package/lib/phase_6_gate_pack.js +59 -59
  146. package/lib/phase_6_langchain_proof_pack.js +74 -74
  147. package/lib/phase_6_langgraph_proof_pack.js +74 -74
  148. package/lib/phase_6_semantic_kernel_proof_pack.js +74 -74
  149. package/lib/phase_7_closeout_pack.js +45 -45
  150. package/lib/phase_7_completion_pack.js +85 -85
  151. package/lib/phase_7_decision_record_pack.js +53 -53
  152. package/lib/phase_7_decision_resolution_pack.js +53 -53
  153. package/lib/phase_7_event_system_continuity_pack.js +89 -89
  154. package/lib/phase_7_event_system_pack.js +76 -76
  155. package/lib/phase_7_freeze_baseline_pack.js +74 -74
  156. package/lib/phase_7_freeze_review_pack.js +65 -65
  157. package/lib/phase_7_gate_pack.js +58 -58
  158. package/lib/phase_7_kafka_proof_pack.js +76 -76
  159. package/lib/phase_7_mqtt_proof_pack.js +76 -76
  160. package/lib/phase_7_nats_proof_pack.js +76 -76
  161. package/lib/phase_7_webhook_event_bus_proof_pack.js +76 -76
  162. package/lib/phase_8_closeout_pack.js +46 -46
  163. package/lib/phase_8_completion_pack.js +82 -82
  164. package/lib/phase_8_decision_record_pack.js +54 -54
  165. package/lib/phase_8_decision_resolution_pack.js +53 -53
  166. package/lib/phase_8_external_receipt_import_proof_pack.js +74 -74
  167. package/lib/phase_8_external_result_import_proof_pack.js +74 -74
  168. package/lib/phase_8_freeze_baseline_pack.js +71 -71
  169. package/lib/phase_8_freeze_review_pack.js +64 -64
  170. package/lib/phase_8_gate_pack.js +58 -58
  171. package/lib/phase_8_proof_bridge_continuity_pack.js +86 -86
  172. package/lib/phase_8_proof_bridges_pack.js +72 -72
  173. package/lib/phase_8_proof_bundle_normalization_proof_pack.js +74 -74
  174. package/lib/phase_9_closeout_pack.js +46 -46
  175. package/lib/phase_9_completion_pack.js +82 -82
  176. package/lib/phase_9_custody_refs_proof_pack.js +74 -74
  177. package/lib/phase_9_decision_record_pack.js +54 -54
  178. package/lib/phase_9_decision_resolution_pack.js +53 -53
  179. package/lib/phase_9_freeze_baseline_pack.js +71 -71
  180. package/lib/phase_9_freeze_review_pack.js +64 -64
  181. package/lib/phase_9_gate_pack.js +58 -58
  182. package/lib/phase_9_operator_accounting_bridges_proof_pack.js +74 -74
  183. package/lib/phase_9_treasury_connectivity_pack.js +72 -72
  184. package/lib/phase_9_treasury_continuity_pack.js +86 -86
  185. package/lib/phase_9_treasury_destinations_proof_pack.js +74 -74
  186. package/lib/phase_program_pack.js +47 -47
  187. package/lib/proof_bridge_lane_contract.js +82 -82
  188. package/lib/proof_truth_contract.js +224 -224
  189. package/lib/provenance_lane_contract.js +54 -54
  190. package/lib/provider_lane_contract.js +67 -67
  191. package/lib/public_surface_policy_contract.js +111 -111
  192. package/lib/publish_plan.js +51 -51
  193. package/lib/release_candidate.js +50 -50
  194. package/lib/release_center.js +1037 -1037
  195. package/lib/release_history.js +206 -206
  196. package/lib/release_manifest.js +114 -114
  197. package/lib/release_pack.js +391 -391
  198. package/lib/result_package_trust_lane_contract.js +74 -74
  199. package/lib/review_intelligence.js +100 -100
  200. package/lib/role_freeze.js +436 -436
  201. package/lib/shared_signals_lane_contract.js +54 -54
  202. package/lib/signed_audit_provenance_contract.js +93 -93
  203. package/lib/telemetry_lane_contract.js +54 -54
  204. package/lib/treasury_proof_lane_contract.js +83 -83
  205. package/lib/trust_intelligence.js +106 -106
  206. package/lib/trust_portability_boundary_contract.js +66 -66
  207. package/lib/trust_portability_pack.js +224 -224
  208. package/lib/verification_service_pack.js +149 -149
  209. package/package.json +98 -97
  210. package/proof_sdk.js +6561 -6265
  211. package/reference/python/README.md +35 -35
  212. package/reference/python/__pycache__/xnya_reference.cpython-314.pyc +0 -0
  213. package/reference/python/requirements-optional.txt +1 -1
  214. package/reference/python/verify_vectors.py +223 -223
  215. package/reference/python/xnya_reference.py +810 -810
  216. package/reference/rust/Cargo.toml +11 -11
  217. package/reference/rust/README.md +28 -28
  218. package/reference/rust/src/lib.rs +87 -87
  219. package/scripts/registry_cli.js +157 -157
  220. package/scripts/verify_all.js +603 -603
  221. package/scripts/verify_control_plane_contracts.js +34 -34
  222. package/scripts/verify_control_plane_routes.js +70 -70
  223. package/scripts/verify_examples.js +19 -19
  224. package/scripts/verify_external_proof_import_gate.js +84 -84
  225. package/scripts/verify_forgery_resistance.js +281 -0
  226. package/scripts/verify_integrations.js +170 -170
  227. package/scripts/verify_native_hybrid_design_gate.js +114 -114
  228. package/scripts/verify_reference_promotion_gate.js +74 -74
  229. package/scripts/verify_reference_python.js +49 -49
  230. package/scripts/verify_reference_python_crypto.js +87 -87
  231. package/scripts/verify_reference_rust_scaffold.js +50 -50
  232. package/scripts/verify_release_candidate.js +131 -131
  233. package/scripts/verify_service.js +3038 -2940
  234. package/scripts/verify_tooling.js +1251 -1251
  235. package/scripts/verify_trust_portability.js +56 -56
  236. package/scripts/verify_vectors.js +192 -192
  237. package/scripts/verify_verification_services.js +56 -56
  238. package/server.js +4223 -4099
  239. package/vectors/adversarial-vectors.json +552 -552
  240. package/vectors/conformance-vectors.json +446 -446
  241. package/vectors/native-atom-vectors.json +101 -101
  242. package/vectors/native-payload-profile-vectors.json +50 -50
  243. package/OPERATIONS_RUNBOOK.md +0 -50
  244. package/OPERATOR_START_HERE.md +0 -67
  245. package/PROGRAM_COMPLETE_RELEASE.md +0 -52
  246. package/PROGRAM_STATUS.md +0 -57
  247. package/PUBLISH_PLAN.md +0 -25
  248. package/RELEASE_CHECKLIST.md +0 -16
@@ -1,603 +1,603 @@
1
- "use strict";
2
-
3
- const fs = require("fs");
4
- const path = require("path");
5
- const crypto = require("crypto");
6
- const { execFileSync } = require("child_process");
7
- const sdk = require("..");
8
- const packageJson = JSON.parse(fs.readFileSync(path.resolve(__dirname, "..", "package.json"), "utf8"));
9
- const nativeAtomVectors = JSON.parse(fs.readFileSync(path.resolve(__dirname, "..", "vectors", "native-atom-vectors.json"), "utf8"));
10
- const nativePayloadProfileVectors = JSON.parse(fs.readFileSync(path.resolve(__dirname, "..", "vectors", "native-payload-profile-vectors.json"), "utf8"));
11
-
12
- function ensure(condition, message) {
13
- if (!condition) {
14
- throw new Error(message);
15
- }
16
- }
17
-
18
- function tamperCompactSignature(value) {
19
- const text = String(value || "");
20
- if (!text) return "A";
21
- const replacement = text[0] === "A" ? "B" : "A";
22
- return `${replacement}${text.slice(1)}`;
23
- }
24
-
25
- function verifyCanonicalEventConformance() {
26
- const eventA = {
27
- version: "canonical-event-bundle/v1",
28
- domain_id: "proof.verify",
29
- sequence: "7",
30
- actor_id: "agent-123",
31
- adapter_source: "verify_all",
32
- event_type: "proof.event",
33
- event_hash: "ab".repeat(32),
34
- parent_refs: ["parent-2", "parent-1"],
35
- semantic_slots: {
36
- zeta: "last",
37
- alpha: "first"
38
- }
39
- };
40
- const eventB = {
41
- semantic_slots: {
42
- alpha: "first",
43
- zeta: "last"
44
- },
45
- parent_refs: ["parent-2", "parent-1"],
46
- event_hash: "ab".repeat(32),
47
- event_type: "proof.event",
48
- adapter_source: "verify_all",
49
- actor_id: "agent-123",
50
- sequence: "7",
51
- domain_id: "proof.verify",
52
- version: "canonical-event-bundle/v1"
53
- };
54
- const canonicalA = sdk.canonicalizeEvent(eventA);
55
- const canonicalB = sdk.canonicalizeEvent(eventB);
56
- ensure(canonicalA.version === canonicalB.version, "canonicalizeEvent must normalize required fields consistently");
57
- ensure(canonicalA.domain_id === canonicalB.domain_id, "canonicalizeEvent must preserve domain_id");
58
- ensure(canonicalA.semantic_slots.alpha === "first", "canonicalizeEvent must preserve semantic slot values");
59
- ensure(sdk.hashEvent(eventA) === sdk.hashEvent(eventB), "hashEvent must be stable across key order");
60
- }
61
-
62
- function verifyProofBundleConformance() {
63
- const methods = sdk.listProofVerificationMethods();
64
- ensure(methods.some((method) => method.id === "legacy-opreturn-v1"), "legacy proof method missing");
65
- ensure(methods.some((method) => method.id === "detached-assertion-v1"), "detached assertion proof method missing");
66
- ensure(methods.some((method) => method.id === "xoonya-native-sha256-v1"), "native proof method missing");
67
- ensure(methods.some((method) => method.id === "xoonya-native-signed-v1"), "native signed proof method missing");
68
- ensure(methods.some((method) => method.id === "xoonya-native-anchored-v1"), "native anchored proof method missing");
69
- ensure(methods.some((method) => method.id === "jwt-assertion-v1"), "jwt assertion proof method missing");
70
- ensure(methods.some((method) => method.id === "did-vc-v1"), "did vc proof method missing");
71
- ensure(methods.some((method) => method.id === "sd-jwt-vc-v1"), "sd jwt vc proof method missing");
72
- ensure(methods.some((method) => method.id === "signed-envelope-v1"), "signed envelope proof method missing");
73
- ensure(methods.some((method) => method.id === "partner-proof-envelope-v1"), "partner proof envelope method missing");
74
- ensure(sdk.getProofVerificationMethod("none") == null, "none must not be a registered proof method");
75
-
76
- const identityMaterial = sdk.makeIdentityMaterial("01", "cafebabe");
77
- const identity = sdk.createIdentity(identityMaterial);
78
- const event = sdk.canonicalizeEvent({
79
- version: "canonical-event-bundle/v1",
80
- domain_id: "proof.bundle",
81
- sequence: "11",
82
- actor_id: identity.agent_id,
83
- adapter_source: "verify_all",
84
- event_type: "proof.bundle.created",
85
- event_hash: "cd".repeat(32),
86
- capability_refs: ["proof", "bundle"]
87
- });
88
- const receipt = sdk.emitReceipt(event, {
89
- legacy_identity_material_hex: identity.identity_material_hex
90
- });
91
- const bundle = sdk.buildProofBundle({
92
- ceb: event,
93
- receipt,
94
- metadata: {
95
- purpose: "conformance"
96
- }
97
- });
98
- const verification = sdk.verifyProofBundle(bundle);
99
- ensure(verification.valid === true, "verifyProofBundle must accept valid bundle");
100
- ensure(verification.event_commitment === sdk.hashEvent(event), "verifyProofBundle must return expected commitment");
101
-
102
- const tamperedCommitmentBundle = {
103
- ...bundle,
104
- receipt: {
105
- ...bundle.receipt,
106
- event_commitment: "ef".repeat(32)
107
- }
108
- };
109
- const tamperedCommitmentVerification = sdk.verifyProofBundle(tamperedCommitmentBundle);
110
- ensure(tamperedCommitmentVerification.valid === false, "verifyProofBundle must reject tampered commitment");
111
- ensure(tamperedCommitmentVerification.reason === "event_commitment_mismatch", "tampered commitment reason mismatch");
112
-
113
- const tamperedSignatureBundle = {
114
- ...bundle,
115
- receipt: {
116
- ...bundle.receipt,
117
- signature: ""
118
- }
119
- };
120
- const tamperedSignatureVerification = sdk.verifyProofBundle(tamperedSignatureBundle);
121
- ensure(tamperedSignatureVerification.valid === false, "verifyProofBundle must reject missing signature");
122
- ensure(tamperedSignatureVerification.reason === "signature_missing", "missing signature reason mismatch");
123
-
124
- const tamperedLegacyBundle = {
125
- ...bundle,
126
- receipt: {
127
- ...bundle.receipt,
128
- compatibility: {
129
- legacy_receipt: {
130
- ...bundle.receipt.compatibility.legacy_receipt,
131
- opreturn_hex: bundle.receipt.compatibility.legacy_receipt.opreturn_hex.replace(/.$/, "0")
132
- }
133
- }
134
- }
135
- };
136
- const tamperedLegacyVerification = sdk.verifyProofBundle(tamperedLegacyBundle);
137
- ensure(tamperedLegacyVerification.valid === false, "verifyProofBundle must reject tampered legacy compatibility receipt");
138
-
139
- const detachedReceipt = sdk.emitReceipt(event, {
140
- agent_identity: "detached-agent",
141
- signature: "detached-signature"
142
- });
143
- const detachedVerification = sdk.verifyProofBundle(sdk.buildProofBundle({ ceb: event, receipt: detachedReceipt }));
144
- ensure(detachedReceipt.algorithm === "detached-assertion-v1", "detached receipts must use explicit detached method");
145
- ensure(detachedVerification.valid === true, "explicit detached assertion should pass structural verification");
146
- ensure(detachedVerification.verification_state === "accepted_detached_assertion", "detached verification state mismatch");
147
-
148
- const externalMethods = [
149
- "jwt-assertion-v1",
150
- "did-vc-v1",
151
- "sd-jwt-vc-v1",
152
- "signed-envelope-v1",
153
- "partner-proof-envelope-v1"
154
- ];
155
- for (const methodId of externalMethods) {
156
- const externalReceipt = sdk.emitReceipt(event, {
157
- agent_identity: `${methodId}-agent`,
158
- algorithm: methodId,
159
- signature: `${methodId}.external-proof-token`
160
- });
161
- const externalVerification = sdk.verifyProofBundle(sdk.buildProofBundle({ ceb: event, receipt: externalReceipt }));
162
- ensure(externalReceipt.algorithm === methodId, `${methodId} receipt algorithm mismatch`);
163
- ensure(externalVerification.valid === true, `${methodId} should pass structural verification`);
164
- ensure(externalVerification.verification_state === "accepted_external_proof_envelope", `${methodId} verification state mismatch`);
165
- }
166
-
167
- const nativeReceipt = sdk.emitReceipt(event, {
168
- agent_identity: "native-agent"
169
- });
170
- const nativeVerification = sdk.verifyProofBundle(sdk.buildProofBundle({ ceb: event, receipt: nativeReceipt }));
171
- ensure(nativeReceipt.algorithm === "xoonya-native-sha256-v1", "native receipt should default to native method without external signature");
172
- ensure(nativeVerification.valid === true, "native receipt should verify");
173
- ensure(nativeVerification.verification_state === "verified_native_digest", "native verification state mismatch");
174
-
175
- const nativePrivateKeyPem = [
176
- "-----BEGIN PRIVATE KEY-----",
177
- "MC4CAQAwBQYDK2VwBCIEIOPZUHPWLt9QpTQ3ub3+RyJXNZrJYHxfDJEcUZhrXIz7",
178
- "-----END PRIVATE KEY-----",
179
- ""
180
- ].join("\n");
181
- const nativePublicKeyPem = [
182
- "-----BEGIN PUBLIC KEY-----",
183
- "MCowBQYDK2VwAyEArnC5ARNJQFbPtc6pMrFUz2p043Nbds48Dz66+i1R5gk=",
184
- "-----END PUBLIC KEY-----",
185
- ""
186
- ].join("\n");
187
- const nativeSignedReceipt = sdk.emitReceipt(event, {
188
- agent_identity: "native-signed-agent",
189
- algorithm: "xoonya-native-signed-v1",
190
- identity_ref: "did:xoonya:native-signed-agent",
191
- signature_suite: "ed25519",
192
- private_key_pem: nativePrivateKeyPem,
193
- public_key_pem: nativePublicKeyPem
194
- });
195
- const nativeSignedVerification = sdk.verifyProofBundle(sdk.buildProofBundle({ ceb: event, receipt: nativeSignedReceipt }));
196
- ensure(nativeSignedVerification.valid === true, "native signed receipt should verify");
197
- ensure(nativeSignedVerification.verification_state === "verified_native_signature", "native signed verification state mismatch");
198
- ensure(nativeSignedVerification.signature_suite === "ed25519", "native signed suite mismatch");
199
-
200
- for (const suite of [
201
- { id: "secp256k1", namedCurve: "secp256k1" },
202
- { id: "p256", namedCurve: "prime256v1" }
203
- ]) {
204
- const generated = crypto.generateKeyPairSync("ec", {
205
- namedCurve: suite.namedCurve,
206
- privateKeyEncoding: { type: "pkcs8", format: "pem" },
207
- publicKeyEncoding: { type: "spki", format: "pem" }
208
- });
209
- const ecdsaReceipt = sdk.emitReceipt(event, {
210
- agent_identity: `native-${suite.id}-agent`,
211
- algorithm: "xoonya-native-signed-v1",
212
- identity_ref: `did:xoonya:native-${suite.id}-agent`,
213
- signature_suite: suite.id,
214
- private_key_pem: generated.privateKey,
215
- public_key_pem: generated.publicKey
216
- });
217
- const ecdsaVerification = sdk.verifyProofBundle(sdk.buildProofBundle({ ceb: event, receipt: ecdsaReceipt }));
218
- ensure(ecdsaVerification.valid === true, `${suite.id} native signed receipt should verify`);
219
- ensure(ecdsaVerification.verification_state === "verified_native_signature", `${suite.id} native signed verification state mismatch`);
220
- ensure(ecdsaVerification.signature_suite === suite.id, `${suite.id} native signed suite mismatch`);
221
-
222
- const tamperedEcdsaReceipt = {
223
- ...ecdsaReceipt,
224
- native_proof: {
225
- ...ecdsaReceipt.native_proof,
226
- proof_material: {
227
- ...ecdsaReceipt.native_proof.proof_material,
228
- signature: tamperCompactSignature(ecdsaReceipt.native_proof.proof_material.signature)
229
- }
230
- },
231
- signature: `${"xoonya-native-signed-v1"}:${suite.id}:${tamperCompactSignature(ecdsaReceipt.native_proof.proof_material.signature)}`
232
- };
233
- const tamperedEcdsaVerification = sdk.verifyProofBundle(sdk.buildProofBundle({ ceb: event, receipt: tamperedEcdsaReceipt }));
234
- ensure(tamperedEcdsaVerification.valid === false, `${suite.id} native signed tamper must not verify`);
235
- ensure(tamperedEcdsaVerification.reason === "native_signature_invalid", `${suite.id} native signed tamper reason mismatch`);
236
- }
237
-
238
- const ambiguousNoneReceipt = {
239
- ...detachedReceipt,
240
- algorithm: "none"
241
- };
242
- const ambiguousNoneVerification = sdk.verifyProofBundle(sdk.buildProofBundle({ ceb: event, receipt: ambiguousNoneReceipt }));
243
- ensure(ambiguousNoneVerification.valid === false, "algorithm none must not verify");
244
- ensure(ambiguousNoneVerification.reason === "verification_method_none", "algorithm none reason mismatch");
245
-
246
- const unsupportedReceipt = {
247
- ...detachedReceipt,
248
- algorithm: "jwt-vc-demo"
249
- };
250
- const unsupportedVerification = sdk.verifyProofBundle(sdk.buildProofBundle({ ceb: event, receipt: unsupportedReceipt }));
251
- ensure(unsupportedVerification.valid === false, "unknown proof method must not verify");
252
- ensure(unsupportedVerification.reason === "verification_method_unsupported", "unknown proof method reason mismatch");
253
-
254
- const hybridClassical = crypto.generateKeyPairSync("ed25519");
255
- const hybridPq = crypto.generateKeyPairSync("ml-dsa-65");
256
- const hybridReceipt = sdk.emitReceipt(event, {
257
- agent_identity: "native-hybrid-agent",
258
- algorithm: "xoonya-native-hybrid-v1",
259
- identity_ref: "did:xoonya:native-hybrid-agent",
260
- classical_signature_suite: "ed25519",
261
- pq_signature_suite: "ml-dsa-65",
262
- classical_public_key_pem: hybridClassical.publicKey.export({ type: "spki", format: "pem" }),
263
- classical_private_key_pem: hybridClassical.privateKey.export({ type: "pkcs8", format: "pem" }),
264
- pq_public_key_pem: hybridPq.publicKey.export({ type: "spki", format: "pem" }),
265
- pq_private_key_pem: hybridPq.privateKey.export({ type: "pkcs8", format: "pem" })
266
- });
267
- const hybridVerification = sdk.verifyProofBundle(sdk.buildProofBundle({ ceb: event, receipt: hybridReceipt }));
268
- ensure(hybridVerification.valid === true, "native hybrid method must verify");
269
- ensure(hybridVerification.verification_state === "verified_native_hybrid_signature", "native hybrid verification state mismatch");
270
-
271
- const tamperedNativeReceipt = {
272
- ...nativeReceipt,
273
- signature: nativeReceipt.signature.replace(/.$/, "0")
274
- };
275
- const tamperedNativeVerification = sdk.verifyProofBundle(sdk.buildProofBundle({ ceb: event, receipt: tamperedNativeReceipt }));
276
- ensure(tamperedNativeVerification.valid === false, "native signature tamper must not verify");
277
- ensure(tamperedNativeVerification.reason === "signature_native_mismatch", "native tamper reason mismatch");
278
-
279
- const downgradedNativeReceipt = {
280
- ...nativeReceipt,
281
- algorithm: "detached-assertion-v1"
282
- };
283
- const downgradedNativeVerification = sdk.verifyProofBundle(sdk.buildProofBundle({ ceb: event, receipt: downgradedNativeReceipt }));
284
- ensure(downgradedNativeVerification.valid === false, "native signature downgrade must not verify as detached");
285
- ensure(downgradedNativeVerification.reason === "signature_method_mismatch", "native downgrade reason mismatch");
286
-
287
- const tamperedNativeSignedReceipt = {
288
- ...nativeSignedReceipt,
289
- native_proof: {
290
- ...nativeSignedReceipt.native_proof,
291
- proof_material: {
292
- ...nativeSignedReceipt.native_proof.proof_material,
293
- signature: nativeSignedReceipt.native_proof.proof_material.signature.replace(/.$/, "B")
294
- }
295
- },
296
- signature: nativeSignedReceipt.signature.replace(/.$/, "B")
297
- };
298
- const tamperedNativeSignedVerification = sdk.verifyProofBundle(sdk.buildProofBundle({ ceb: event, receipt: tamperedNativeSignedReceipt }));
299
- ensure(tamperedNativeSignedVerification.valid === false, "native signed tamper must not verify");
300
- ensure(tamperedNativeSignedVerification.reason === "native_signature_invalid", "native signed tamper reason mismatch");
301
-
302
- const nativeAnchors = [
303
- {
304
- anchor_id: "anchor-verify-all-demo",
305
- anchor_kind: "finality_ref",
306
- anchor_ref: "bsv:mainnet:tx/9cd77fd24b884b281c819b3e48f6b15ed328b116939b082580924cabb4518d28",
307
- anchor_hash_sha256: sdk.hashEvent({
308
- version: "canonical-event-bundle/v1",
309
- domain_id: "verify.anchor",
310
- sequence: "1",
311
- actor_id: "verify-anchor",
312
- adapter_source: "verify_all",
313
- event_type: "anchor.material",
314
- event_hash: "ab".repeat(32)
315
- }),
316
- network: "bsv-mainnet",
317
- finality_state: "finalized"
318
- }
319
- ];
320
- const nativeAnchoredReceipt = sdk.emitReceipt(event, {
321
- agent_identity: "native-anchored-agent",
322
- algorithm: "xoonya-native-anchored-v1",
323
- anchors: nativeAnchors
324
- });
325
- const nativeAnchoredVerification = sdk.verifyProofBundle(sdk.buildProofBundle({
326
- ceb: event,
327
- receipt: nativeAnchoredReceipt,
328
- anchors: nativeAnchors
329
- }));
330
- ensure(nativeAnchoredVerification.valid === true, "native anchored receipt should verify");
331
- ensure(nativeAnchoredVerification.verification_state === "verified_native_anchor_binding", "native anchored verification state mismatch");
332
- ensure(nativeAnchoredVerification.anchor_count === 1, "native anchored anchor count mismatch");
333
-
334
- const nativeAnchoredMissingBundleVerification = sdk.verifyProofBundle(sdk.buildProofBundle({
335
- ceb: event,
336
- receipt: nativeAnchoredReceipt
337
- }));
338
- ensure(nativeAnchoredMissingBundleVerification.valid === false, "native anchored receipt must require bundle anchors");
339
- ensure(nativeAnchoredMissingBundleVerification.reason === "native_anchor_bundle_missing", "native anchored missing bundle reason mismatch");
340
-
341
- const externalImportRun = sdk.runExternalProofImport({
342
- method: "jwt-assertion-v1",
343
- import_ref: "jwt-import-demo",
344
- issuer_ref: "did:example:issuer",
345
- subject_ref: "txn:xytara:demo",
346
- external_proof: "eyJhbGciOiJFZERTQSJ9.eyJzdWIiOiJ0eG4teHl0YXJhLWRlbW8ifQ.signature",
347
- evidence_refs: ["memory://external/jwt-import-demo"]
348
- });
349
- ensure(externalImportRun.ok === true, "external proof import should produce valid bundle");
350
- ensure(externalImportRun.bundle_verification.valid === true, "external import bundle should verify");
351
- ensure(externalImportRun.bundle_verification.verification_method === "jwt-assertion-v1", "external import method mismatch");
352
- ensure(externalImportRun.import_review.boundary.includes("without_claiming_external_issuer_truth"), "external import boundary missing");
353
-
354
- const externalImportReviewSummary = sdk.summarizeExternalProofImportReview({
355
- method: "did-vc-v1",
356
- external_proof: {
357
- "@context": ["https://www.w3.org/ns/credentials/v2"],
358
- type: ["VerifiableCredential"],
359
- issuer: "did:example:issuer",
360
- credentialSubject: { id: "did:example:agent" }
361
- }
362
- });
363
- ensure(externalImportReviewSummary.ok === true, "external import review summary should pass");
364
- ensure(externalImportReviewSummary.method === "did-vc-v1", "external import review method mismatch");
365
- const externalImportGate = sdk.validateExternalProofImportEvidence({
366
- method: "did-vc-v1",
367
- external_proof: {
368
- proof: "demo"
369
- },
370
- claim_external_issuer_truth: true
371
- });
372
- ensure(externalImportGate.import_allowed === false, "external import truth claim should require external verifier");
373
- ensure(
374
- externalImportGate.rejection_codes.includes("external_issuer_truth_claim_requires_external_verifier"),
375
- "external import truth rejection code mismatch"
376
- );
377
-
378
- let hashMismatchRejected = false;
379
- try {
380
- sdk.runExternalProofImport({
381
- method: "signed-envelope-v1",
382
- external_proof: { proof: "demo" },
383
- declared_hash_sha256: "00".repeat(32)
384
- });
385
- } catch (error) {
386
- hashMismatchRejected = error.message === "external_proof_hash_mismatch";
387
- }
388
- ensure(hashMismatchRejected === true, "external import must reject declared hash mismatch");
389
- }
390
-
391
- function verifyNativeAtomConformance() {
392
- ensure(nativeAtomVectors.version === "xoonya-native-atom-vectors-v1", "native atom vector version mismatch");
393
- const payloadBytes = Buffer.from(nativeAtomVectors.payload_ascii, "utf8");
394
- const generatedV1 = sdk.createxoonyaNativeAtomV1(nativeAtomVectors.identity_material_hex, payloadBytes);
395
- const expectedV1 = nativeAtomVectors.vectors.find((vector) => vector.id === "xnya-v1-with-payload");
396
- ensure(generatedV1.atom_hex === expectedV1.atom_hex, "native atom v1 payload vector mismatch");
397
- const generatedV2 = sdk.createxoonyaNativeAtomV2(nativeAtomVectors.identity_material_hex, payloadBytes);
398
- const expectedV2 = nativeAtomVectors.vectors.find((vector) => vector.id === "xnya-v2-with-payload");
399
- ensure(generatedV2.atom_hex === expectedV2.atom_hex, "native atom v2 payload vector mismatch");
400
-
401
- for (const vector of nativeAtomVectors.vectors) {
402
- const parsed = sdk.parsexoonyaNativeAtom(vector.atom_hex);
403
- ensure(parsed.atom_version === vector.atom_version, `${vector.id} atom version mismatch`);
404
- ensure(parsed.byte_length === vector.byte_length, `${vector.id} byte length mismatch`);
405
- ensure(parsed.agent_id === vector.agent_id, `${vector.id} agent id mismatch`);
406
- ensure(parsed.payload_hash_sha256 === vector.payload_hash_sha256, `${vector.id} payload hash mismatch`);
407
- const hasPayload = vector.payload_hash_sha256 !== "00".repeat(32);
408
- const verification = sdk.verifyxoonyaNativeAtom(vector.atom_hex, {
409
- identity_material_hex: nativeAtomVectors.identity_material_hex,
410
- ...(hasPayload ? { payload_bytes: payloadBytes } : {})
411
- });
412
- ensure(verification.valid === true, `${vector.id} should verify`);
413
- ensure(verification.error_code === null, `${vector.id} should not have error code`);
414
- }
415
-
416
- for (const vector of nativeAtomVectors.adversarial) {
417
- const verification = sdk.verifyxoonyaNativeAtom(vector.atom_hex, {
418
- identity_material_hex: vector.identity_material_hex || nativeAtomVectors.identity_material_hex,
419
- ...(vector.payload_ascii ? { payload_bytes: Buffer.from(vector.payload_ascii, "utf8") } : {})
420
- });
421
- ensure(verification.valid === false, `${vector.id} should fail`);
422
- ensure(verification.reason === vector.expected_reason, `${vector.id} reason mismatch`);
423
- if (vector.expected_error_code) {
424
- ensure(verification.error_code === vector.expected_error_code, `${vector.id} error code mismatch`);
425
- }
426
- }
427
- }
428
-
429
- function verifyNativePayloadProfileConformance() {
430
- ensure(nativePayloadProfileVectors.version === "xoonya-native-payload-profile-vectors-v1", "native payload profile vector version mismatch");
431
- ensure(typeof sdk.encodexoonyaNativePayloadProfileV1 === "function", "missing encodexoonyaNativePayloadProfileV1");
432
- ensure(typeof sdk.parsexoonyaNativePayloadProfileV1 === "function", "missing parsexoonyaNativePayloadProfileV1");
433
- ensure(typeof sdk.verifyxoonyaNativePayloadProfileV1 === "function", "missing verifyxoonyaNativePayloadProfileV1");
434
- ensure(typeof sdk.createxoonyaNativeLineRateFrameV1 === "function", "missing createxoonyaNativeLineRateFrameV1");
435
- ensure(typeof sdk.parsexoonyaNativeLineRateFrameV1 === "function", "missing parsexoonyaNativeLineRateFrameV1");
436
- ensure(typeof sdk.verifyxoonyaNativeLineRateFrameV1 === "function", "missing verifyxoonyaNativeLineRateFrameV1");
437
-
438
- const vector = nativePayloadProfileVectors.profile_vector;
439
- const profile = sdk.encodexoonyaNativePayloadProfileV1(vector.input);
440
- ensure(profile.profile === "xoonya-native-payload-profile/v1", "native payload profile id mismatch");
441
- ensure(profile.canonical_bytes_hex.startsWith(Buffer.from("XNYP", "ascii").toString("hex")), "native payload profile magic mismatch");
442
- ensure(profile.field_count === 4, "native payload profile field count mismatch");
443
- ensure(profile.canonical_bytes_hex === vector.expected.canonical_bytes_hex, "native payload profile canonical vector mismatch");
444
- ensure(profile.payload_hash_sha256 === vector.expected.payload_hash_sha256, "native payload profile payload hash vector mismatch");
445
- ensure(profile.schema_hash_sha256 === vector.expected.schema_hash_sha256, "native payload profile schema hash vector mismatch");
446
- const parsedProfile = sdk.parsexoonyaNativePayloadProfileV1(profile.canonical_bytes_hex);
447
- ensure(parsedProfile.payload_hash_sha256 === profile.payload_hash_sha256, "native payload profile hash mismatch");
448
- ensure(parsedProfile.fields.map((field) => field.field_id).join(",") === "1,2,3,4", "native payload profile canonical ordering mismatch");
449
- ensure(parsedProfile.fields.find((field) => field.field_id === 2).value === "42", "native payload profile uint64 decode mismatch");
450
- ensure(parsedProfile.fields.find((field) => field.field_id === 4).value === true, "native payload profile bool decode mismatch");
451
- const profileVerification = sdk.verifyxoonyaNativePayloadProfileV1(profile.canonical_bytes_hex, {
452
- payload_hash_sha256: profile.payload_hash_sha256,
453
- schema_ref: "xoonya.payload.test.v1",
454
- allowed_field_ids: [1, 2, 3, 4]
455
- });
456
- ensure(profileVerification.valid === true, "native payload profile verification should pass");
457
- const unknownFieldPolicy = sdk.verifyxoonyaNativePayloadProfileV1(profile.canonical_bytes_hex, {
458
- allowed_field_ids: [1, 2, 3]
459
- });
460
- ensure(unknownFieldPolicy.valid === false, "native payload profile policy should reject unknown field ids");
461
- ensure(unknownFieldPolicy.reason === "payload_profile_unknown_field", "native payload profile unknown field reason mismatch");
462
-
463
- const atom = sdk.createxoonyaNativeAtomV1(
464
- "01" + "11".repeat(33),
465
- Buffer.from(profile.canonical_bytes_hex, "hex")
466
- );
467
- const frame = sdk.createxoonyaNativeLineRateFrameV1(atom.atom_hex);
468
- const frameVector = nativePayloadProfileVectors.line_rate_frame_vector;
469
- ensure(frame.profile === "xoonya-native-line-rate-frame/v1", "line-rate frame profile mismatch");
470
- ensure(frame.frame_byte_length === 60, "line-rate frame v1 size mismatch");
471
- ensure(atom.atom_hex === frameVector.atom_hex, "line-rate frame atom vector mismatch");
472
- ensure(frame.frame_hex === frameVector.frame_hex, "line-rate frame vector mismatch");
473
- ensure(frame.checksum_hex === frameVector.checksum_hex, "line-rate frame checksum vector mismatch");
474
- const frameVerification = sdk.verifyxoonyaNativeLineRateFrameV1(frame.frame_hex, {
475
- identity_material_hex: "01" + "11".repeat(33),
476
- payload_bytes: Buffer.from(profile.canonical_bytes_hex, "hex")
477
- });
478
- ensure(frameVerification.valid === true, "line-rate frame should verify");
479
- const tamperedFrameHex = `${frame.frame_hex.slice(0, -1)}${frame.frame_hex.endsWith("0") ? "1" : "0"}`;
480
- const tamperedFrameVerification = sdk.verifyxoonyaNativeLineRateFrameV1(tamperedFrameHex, {
481
- identity_material_hex: "01" + "11".repeat(33),
482
- payload_bytes: Buffer.from(profile.canonical_bytes_hex, "hex")
483
- });
484
- ensure(tamperedFrameVerification.valid === false, "line-rate frame tamper should fail");
485
- ensure(tamperedFrameVerification.reason === "line_rate_frame_checksum_mismatch", "line-rate frame tamper reason mismatch");
486
- }
487
-
488
- function main() {
489
- ensure(packageJson.name === "xoonya", "unexpected package name");
490
- const startHereOutput = execFileSync(process.execPath, [
491
- path.resolve(__dirname, "..", "bin", "xoonya.js"),
492
- "start-here"
493
- ], { encoding: "utf8" });
494
- ensure(startHereOutput.includes("https://www.naxytra.com/v1/first-run-kit"), "xoonya start-here command kit missing");
495
- ensure(startHereOutput.includes("xoonya-native-anchored-v1"), "xoonya start-here anchored mode missing");
496
- const firstRunOutput = execFileSync(process.execPath, [
497
- path.resolve(__dirname, "..", "bin", "xoonya.js"),
498
- "first-run",
499
- "--json",
500
- "--offline",
501
- "--pretty"
502
- ], { encoding: "utf8" });
503
- const firstRunGuide = JSON.parse(firstRunOutput);
504
- ensure(firstRunGuide.category === "xoonya-first-run-proof-guide", "xoonya first-run category mismatch");
505
- ensure(firstRunGuide.proof_modes.some((entry) => entry.method === "xoonya-native-anchored-v1"), "xoonya first-run anchored proof missing");
506
- const nativeFirstRunOutput = execFileSync(process.execPath, [
507
- path.resolve(__dirname, "..", "bin", "xoonya.js"),
508
- "first-run",
509
- "--verify-native",
510
- "--pretty"
511
- ], { encoding: "utf8" });
512
- const nativeFirstRun = JSON.parse(nativeFirstRunOutput);
513
- ensure(nativeFirstRun.category === "xoonya-first-run-native-verification", "xoonya first-run native category mismatch");
514
- ensure(nativeFirstRun.required_native_methods_present === true, "xoonya first-run native methods missing");
515
- ensure(fs.existsSync(path.resolve(__dirname, "..", "vectors", "conformance-vectors.json")), "missing conformance vectors");
516
- ensure(fs.existsSync(path.resolve(__dirname, "..", "vectors", "adversarial-vectors.json")), "missing adversarial vectors");
517
- ensure(fs.existsSync(path.resolve(__dirname, "..", "vectors", "native-atom-vectors.json")), "missing native atom vectors");
518
- ensure(fs.existsSync(path.resolve(__dirname, "..", "vectors", "native-payload-profile-vectors.json")), "missing native payload profile vectors");
519
- ensure(fs.existsSync(path.resolve(__dirname, "..", "CROSS_RUNTIME_POSTURE.md")), "missing cross-runtime posture note");
520
- ensure(typeof sdk.canonicalizeEvent === "function", "missing canonicalizeEvent");
521
- ensure(typeof sdk.hashEvent === "function", "missing hashEvent");
522
- ensure(typeof sdk.emitReceipt === "function", "missing emitReceipt");
523
- ensure(typeof sdk.listProofVerificationMethods === "function", "missing listProofVerificationMethods");
524
- ensure(typeof sdk.getProofVerificationMethod === "function", "missing getProofVerificationMethod");
525
- ensure(typeof sdk.listNativeSignatureSuites === "function", "missing listNativeSignatureSuites");
526
- ensure(typeof sdk.getNativeSignatureSuite === "function", "missing getNativeSignatureSuite");
527
- ensure(typeof sdk.listxoonyaNativeIdentityTypes === "function", "missing listxoonyaNativeIdentityTypes");
528
- ensure(typeof sdk.buildxoonyaNativeAtomSpec === "function", "missing buildxoonyaNativeAtomSpec");
529
- ensure(typeof sdk.buildxoonyaNativeAtomConformancePack === "function", "missing buildxoonyaNativeAtomConformancePack");
530
- ensure(typeof sdk.summarizexoonyaNativeAtomConformancePack === "function", "missing summarizexoonyaNativeAtomConformancePack");
531
- ensure(typeof sdk.createxoonyaNativeAtomV1 === "function", "missing createxoonyaNativeAtomV1");
532
- ensure(typeof sdk.createxoonyaNativeAtomV2 === "function", "missing createxoonyaNativeAtomV2");
533
- ensure(typeof sdk.parsexoonyaNativeAtom === "function", "missing parsexoonyaNativeAtom");
534
- ensure(typeof sdk.verifyxoonyaNativeAtom === "function", "missing verifyxoonyaNativeAtom");
535
- ensure(typeof sdk.buildNativeReceiptSignature === "function", "missing buildNativeReceiptSignature");
536
- ensure(typeof sdk.buildNativeSignedReceiptProof === "function", "missing buildNativeSignedReceiptProof");
537
- ensure(typeof sdk.buildNativeHybridReceiptProof === "function", "missing buildNativeHybridReceiptProof");
538
- ensure(typeof sdk.buildNativeAnchoredReceiptProof === "function", "missing buildNativeAnchoredReceiptProof");
539
- ensure(typeof sdk.buildxoonyaNativeAnchorProfile === "function", "missing buildxoonyaNativeAnchorProfile");
540
- ensure(typeof sdk.summarizexoonyaNativeAnchorProfile === "function", "missing summarizexoonyaNativeAnchorProfile");
541
- ensure(typeof sdk.buildExternalProofImportAdapterPack === "function", "missing buildExternalProofImportAdapterPack");
542
- ensure(typeof sdk.summarizeExternalProofImportAdapterPack === "function", "missing summarizeExternalProofImportAdapterPack");
543
- ensure(typeof sdk.buildxoonyaNativeHybridReadinessPack === "function", "missing buildxoonyaNativeHybridReadinessPack");
544
- ensure(typeof sdk.summarizexoonyaNativeHybridReadinessPack === "function", "missing summarizexoonyaNativeHybridReadinessPack");
545
- ensure(typeof sdk.buildxoonyaNativeStandardizationPack === "function", "missing buildxoonyaNativeStandardizationPack");
546
- ensure(typeof sdk.summarizexoonyaNativeStandardizationPack === "function", "missing summarizexoonyaNativeStandardizationPack");
547
- ensure(typeof sdk.buildxoonyaNativeConformanceMarkPack === "function", "missing buildxoonyaNativeConformanceMarkPack");
548
- ensure(typeof sdk.summarizexoonyaNativeConformanceMarkPack === "function", "missing summarizexoonyaNativeConformanceMarkPack");
549
- ensure(typeof sdk.buildxoonyaNativeReferenceImplementationPack === "function", "missing buildxoonyaNativeReferenceImplementationPack");
550
- ensure(typeof sdk.summarizexoonyaNativeReferenceImplementationPack === "function", "missing summarizexoonyaNativeReferenceImplementationPack");
551
- ensure(typeof sdk.buildxoonyaNativePayloadProfilePack === "function", "missing buildxoonyaNativePayloadProfilePack");
552
- ensure(typeof sdk.summarizexoonyaNativePayloadProfilePack === "function", "missing summarizexoonyaNativePayloadProfilePack");
553
- ensure(typeof sdk.buildxoonyaNativeLineRateFramePack === "function", "missing buildxoonyaNativeLineRateFramePack");
554
- ensure(typeof sdk.summarizexoonyaNativeLineRateFramePack === "function", "missing summarizexoonyaNativeLineRateFramePack");
555
- ensure(typeof sdk.reviewExternalProofImport === "function", "missing reviewExternalProofImport");
556
- ensure(typeof sdk.runExternalProofImport === "function", "missing runExternalProofImport");
557
- ensure(typeof sdk.buildProofBundle === "function", "missing buildProofBundle");
558
- ensure(typeof sdk.verifyProofBundle === "function", "missing verifyProofBundle");
559
- ensure(typeof sdk.listIntegrations === "function", "missing listIntegrations");
560
- ensure(typeof sdk.getIntegration === "function", "missing getIntegration");
561
- ensure(typeof sdk.summarizeIntegrations === "function", "missing summarizeIntegrations");
562
- ensure(typeof sdk.validateIntegrationRegistration === "function", "missing validateIntegrationRegistration");
563
- ensure(typeof sdk.importRegisteredIntegration === "function", "missing importRegisteredIntegration");
564
- ensure(typeof sdk.exportIntegrationRegistrySnapshot === "function", "missing exportIntegrationRegistrySnapshot");
565
- ensure(typeof sdk.validateIntegrationRegistrySnapshot === "function", "missing validateIntegrationRegistrySnapshot");
566
- ensure(typeof sdk.createReceipt === "function", "missing createReceipt");
567
- ensure(typeof sdk.verifyReceipt === "function", "missing verifyReceipt");
568
- ensure(typeof sdk.createReceiptV2 === "function", "missing createReceiptV2");
569
- ensure(typeof sdk.verifyReceiptV2 === "function", "missing verifyReceiptV2");
570
- ensure(typeof sdk.createProofEnvelopeV1 === "function", "missing createProofEnvelopeV1");
571
- ensure(typeof sdk.verifyProofEnvelopeV1 === "function", "missing verifyProofEnvelopeV1");
572
- ensure(typeof sdk.createEconomicReceiptProfileV1 === "function", "missing createEconomicReceiptProfileV1");
573
- ensure(typeof sdk.verifyEconomicReceiptProfileV1 === "function", "missing verifyEconomicReceiptProfileV1");
574
- ensure(typeof sdk.createRegistryProfileV1 === "function", "missing createRegistryProfileV1");
575
- ensure(typeof sdk.verifyRegistryProfileV1 === "function", "missing verifyRegistryProfileV1");
576
- ensure(fs.existsSync(path.resolve(__dirname, "..", "integrations", "registration-record.schema.json")), "missing integration registration schema");
577
- ensure(fs.existsSync(path.resolve(__dirname, "..", "integrations", "registry-snapshot.schema.json")), "missing integration registry snapshot schema");
578
- const hybridReadiness = sdk.summarizexoonyaNativeHybridReadinessPack();
579
- ensure(hybridReadiness.status === "implemented", "native hybrid readiness must be implemented");
580
- ensure(hybridReadiness.implemented_classical_suites.includes("secp256k1"), "native hybrid readiness secp256k1 suite missing");
581
- ensure(hybridReadiness.implemented_classical_suites.includes("p256"), "native hybrid readiness p256 suite missing");
582
- ensure(hybridReadiness.implemented_hybrid_suites.includes("ed25519+ml-dsa-65"), "native hybrid readiness ml-dsa suite missing");
583
- const standardization = sdk.summarizexoonyaNativeStandardizationPack();
584
- ensure(standardization.canonical_magic === "XNYA", "native standardization magic mismatch");
585
- ensure(standardization.conformance_forbidden_condition_count >= 4, "native standardization forbidden conditions missing");
586
- const conformanceMark = sdk.summarizexoonyaNativeConformanceMarkPack();
587
- ensure(conformanceMark.mark === "XNYA-compatible", "native conformance mark mismatch");
588
- ensure(conformanceMark.forbidden_claim_count >= 3, "native conformance mark forbidden claims missing");
589
- ensure(conformanceMark.implemented_signature_suites.includes("secp256k1"), "native conformance mark secp256k1 suite missing");
590
- const referenceImplementations = sdk.summarizexoonyaNativeReferenceImplementationPack();
591
- ensure(referenceImplementations.status === "js_reference_implemented_independent_references_planned", "native reference implementation status mismatch");
592
- ensure(referenceImplementations.implemented_reference_count === 1, "native reference implementation count mismatch");
593
- ensure(referenceImplementations.planned_reference_count >= 2, "native planned reference implementation count mismatch");
594
- ensure(referenceImplementations.verified_candidate_scaffold_count >= 1, "native verified candidate scaffold missing");
595
- ensure(referenceImplementations.deterministic_rejection_code_count >= 11, "native reference promotion rejection codes missing");
596
- verifyCanonicalEventConformance();
597
- verifyProofBundleConformance();
598
- verifyNativeAtomConformance();
599
- verifyNativePayloadProfileConformance();
600
- process.stdout.write("xoonya verify:all passed\n");
601
- }
602
-
603
- main();
1
+ "use strict";
2
+
3
+ const fs = require("fs");
4
+ const path = require("path");
5
+ const crypto = require("crypto");
6
+ const { execFileSync } = require("child_process");
7
+ const sdk = require("..");
8
+ const packageJson = JSON.parse(fs.readFileSync(path.resolve(__dirname, "..", "package.json"), "utf8"));
9
+ const nativeAtomVectors = JSON.parse(fs.readFileSync(path.resolve(__dirname, "..", "vectors", "native-atom-vectors.json"), "utf8"));
10
+ const nativePayloadProfileVectors = JSON.parse(fs.readFileSync(path.resolve(__dirname, "..", "vectors", "native-payload-profile-vectors.json"), "utf8"));
11
+
12
+ function ensure(condition, message) {
13
+ if (!condition) {
14
+ throw new Error(message);
15
+ }
16
+ }
17
+
18
+ function tamperCompactSignature(value) {
19
+ const text = String(value || "");
20
+ if (!text) return "A";
21
+ const replacement = text[0] === "A" ? "B" : "A";
22
+ return `${replacement}${text.slice(1)}`;
23
+ }
24
+
25
+ function verifyCanonicalEventConformance() {
26
+ const eventA = {
27
+ version: "canonical-event-bundle/v1",
28
+ domain_id: "proof.verify",
29
+ sequence: "7",
30
+ actor_id: "agent-123",
31
+ adapter_source: "verify_all",
32
+ event_type: "proof.event",
33
+ event_hash: "ab".repeat(32),
34
+ parent_refs: ["parent-2", "parent-1"],
35
+ semantic_slots: {
36
+ zeta: "last",
37
+ alpha: "first"
38
+ }
39
+ };
40
+ const eventB = {
41
+ semantic_slots: {
42
+ alpha: "first",
43
+ zeta: "last"
44
+ },
45
+ parent_refs: ["parent-2", "parent-1"],
46
+ event_hash: "ab".repeat(32),
47
+ event_type: "proof.event",
48
+ adapter_source: "verify_all",
49
+ actor_id: "agent-123",
50
+ sequence: "7",
51
+ domain_id: "proof.verify",
52
+ version: "canonical-event-bundle/v1"
53
+ };
54
+ const canonicalA = sdk.canonicalizeEvent(eventA);
55
+ const canonicalB = sdk.canonicalizeEvent(eventB);
56
+ ensure(canonicalA.version === canonicalB.version, "canonicalizeEvent must normalize required fields consistently");
57
+ ensure(canonicalA.domain_id === canonicalB.domain_id, "canonicalizeEvent must preserve domain_id");
58
+ ensure(canonicalA.semantic_slots.alpha === "first", "canonicalizeEvent must preserve semantic slot values");
59
+ ensure(sdk.hashEvent(eventA) === sdk.hashEvent(eventB), "hashEvent must be stable across key order");
60
+ }
61
+
62
+ function verifyProofBundleConformance() {
63
+ const methods = sdk.listProofVerificationMethods();
64
+ ensure(methods.some((method) => method.id === "legacy-opreturn-v1"), "legacy proof method missing");
65
+ ensure(methods.some((method) => method.id === "detached-assertion-v1"), "detached assertion proof method missing");
66
+ ensure(methods.some((method) => method.id === "xoonya-native-sha256-v1"), "native proof method missing");
67
+ ensure(methods.some((method) => method.id === "xoonya-native-signed-v1"), "native signed proof method missing");
68
+ ensure(methods.some((method) => method.id === "xoonya-native-anchored-v1"), "native anchored proof method missing");
69
+ ensure(methods.some((method) => method.id === "jwt-assertion-v1"), "jwt assertion proof method missing");
70
+ ensure(methods.some((method) => method.id === "did-vc-v1"), "did vc proof method missing");
71
+ ensure(methods.some((method) => method.id === "sd-jwt-vc-v1"), "sd jwt vc proof method missing");
72
+ ensure(methods.some((method) => method.id === "signed-envelope-v1"), "signed envelope proof method missing");
73
+ ensure(methods.some((method) => method.id === "partner-proof-envelope-v1"), "partner proof envelope method missing");
74
+ ensure(sdk.getProofVerificationMethod("none") == null, "none must not be a registered proof method");
75
+
76
+ const identityMaterial = sdk.makeIdentityMaterial("01", "cafebabe");
77
+ const identity = sdk.createIdentity(identityMaterial);
78
+ const event = sdk.canonicalizeEvent({
79
+ version: "canonical-event-bundle/v1",
80
+ domain_id: "proof.bundle",
81
+ sequence: "11",
82
+ actor_id: identity.agent_id,
83
+ adapter_source: "verify_all",
84
+ event_type: "proof.bundle.created",
85
+ event_hash: "cd".repeat(32),
86
+ capability_refs: ["proof", "bundle"]
87
+ });
88
+ const receipt = sdk.emitReceipt(event, {
89
+ legacy_identity_material_hex: identity.identity_material_hex
90
+ });
91
+ const bundle = sdk.buildProofBundle({
92
+ ceb: event,
93
+ receipt,
94
+ metadata: {
95
+ purpose: "conformance"
96
+ }
97
+ });
98
+ const verification = sdk.verifyProofBundle(bundle);
99
+ ensure(verification.valid === true, "verifyProofBundle must accept valid bundle");
100
+ ensure(verification.event_commitment === sdk.hashEvent(event), "verifyProofBundle must return expected commitment");
101
+
102
+ const tamperedCommitmentBundle = {
103
+ ...bundle,
104
+ receipt: {
105
+ ...bundle.receipt,
106
+ event_commitment: "ef".repeat(32)
107
+ }
108
+ };
109
+ const tamperedCommitmentVerification = sdk.verifyProofBundle(tamperedCommitmentBundle);
110
+ ensure(tamperedCommitmentVerification.valid === false, "verifyProofBundle must reject tampered commitment");
111
+ ensure(tamperedCommitmentVerification.reason === "event_commitment_mismatch", "tampered commitment reason mismatch");
112
+
113
+ const tamperedSignatureBundle = {
114
+ ...bundle,
115
+ receipt: {
116
+ ...bundle.receipt,
117
+ signature: ""
118
+ }
119
+ };
120
+ const tamperedSignatureVerification = sdk.verifyProofBundle(tamperedSignatureBundle);
121
+ ensure(tamperedSignatureVerification.valid === false, "verifyProofBundle must reject missing signature");
122
+ ensure(tamperedSignatureVerification.reason === "signature_missing", "missing signature reason mismatch");
123
+
124
+ const tamperedLegacyBundle = {
125
+ ...bundle,
126
+ receipt: {
127
+ ...bundle.receipt,
128
+ compatibility: {
129
+ legacy_receipt: {
130
+ ...bundle.receipt.compatibility.legacy_receipt,
131
+ opreturn_hex: bundle.receipt.compatibility.legacy_receipt.opreturn_hex.replace(/.$/, "0")
132
+ }
133
+ }
134
+ }
135
+ };
136
+ const tamperedLegacyVerification = sdk.verifyProofBundle(tamperedLegacyBundle);
137
+ ensure(tamperedLegacyVerification.valid === false, "verifyProofBundle must reject tampered legacy compatibility receipt");
138
+
139
+ const detachedReceipt = sdk.emitReceipt(event, {
140
+ agent_identity: "detached-agent",
141
+ signature: "detached-signature"
142
+ });
143
+ const detachedVerification = sdk.verifyProofBundle(sdk.buildProofBundle({ ceb: event, receipt: detachedReceipt }));
144
+ ensure(detachedReceipt.algorithm === "detached-assertion-v1", "detached receipts must use explicit detached method");
145
+ ensure(detachedVerification.valid === true, "explicit detached assertion should pass structural verification");
146
+ ensure(detachedVerification.verification_state === "accepted_detached_assertion", "detached verification state mismatch");
147
+
148
+ const externalMethods = [
149
+ "jwt-assertion-v1",
150
+ "did-vc-v1",
151
+ "sd-jwt-vc-v1",
152
+ "signed-envelope-v1",
153
+ "partner-proof-envelope-v1"
154
+ ];
155
+ for (const methodId of externalMethods) {
156
+ const externalReceipt = sdk.emitReceipt(event, {
157
+ agent_identity: `${methodId}-agent`,
158
+ algorithm: methodId,
159
+ signature: `${methodId}.external-proof-token`
160
+ });
161
+ const externalVerification = sdk.verifyProofBundle(sdk.buildProofBundle({ ceb: event, receipt: externalReceipt }));
162
+ ensure(externalReceipt.algorithm === methodId, `${methodId} receipt algorithm mismatch`);
163
+ ensure(externalVerification.valid === true, `${methodId} should pass structural verification`);
164
+ ensure(externalVerification.verification_state === "accepted_external_proof_envelope", `${methodId} verification state mismatch`);
165
+ }
166
+
167
+ const nativeReceipt = sdk.emitReceipt(event, {
168
+ agent_identity: "native-agent"
169
+ });
170
+ const nativeVerification = sdk.verifyProofBundle(sdk.buildProofBundle({ ceb: event, receipt: nativeReceipt }));
171
+ ensure(nativeReceipt.algorithm === "xoonya-native-sha256-v1", "native receipt should default to native method without external signature");
172
+ ensure(nativeVerification.valid === true, "native receipt should verify");
173
+ ensure(nativeVerification.verification_state === "verified_native_digest", "native verification state mismatch");
174
+
175
+ const nativePrivateKeyPem = [
176
+ "-----BEGIN PRIVATE KEY-----",
177
+ "MC4CAQAwBQYDK2VwBCIEIOPZUHPWLt9QpTQ3ub3+RyJXNZrJYHxfDJEcUZhrXIz7",
178
+ "-----END PRIVATE KEY-----",
179
+ ""
180
+ ].join("\n");
181
+ const nativePublicKeyPem = [
182
+ "-----BEGIN PUBLIC KEY-----",
183
+ "MCowBQYDK2VwAyEArnC5ARNJQFbPtc6pMrFUz2p043Nbds48Dz66+i1R5gk=",
184
+ "-----END PUBLIC KEY-----",
185
+ ""
186
+ ].join("\n");
187
+ const nativeSignedReceipt = sdk.emitReceipt(event, {
188
+ agent_identity: "native-signed-agent",
189
+ algorithm: "xoonya-native-signed-v1",
190
+ identity_ref: "did:xoonya:native-signed-agent",
191
+ signature_suite: "ed25519",
192
+ private_key_pem: nativePrivateKeyPem,
193
+ public_key_pem: nativePublicKeyPem
194
+ });
195
+ const nativeSignedVerification = sdk.verifyProofBundle(sdk.buildProofBundle({ ceb: event, receipt: nativeSignedReceipt }));
196
+ ensure(nativeSignedVerification.valid === true, "native signed receipt should verify");
197
+ ensure(nativeSignedVerification.verification_state === "verified_native_signature", "native signed verification state mismatch");
198
+ ensure(nativeSignedVerification.signature_suite === "ed25519", "native signed suite mismatch");
199
+
200
+ for (const suite of [
201
+ { id: "secp256k1", namedCurve: "secp256k1" },
202
+ { id: "p256", namedCurve: "prime256v1" }
203
+ ]) {
204
+ const generated = crypto.generateKeyPairSync("ec", {
205
+ namedCurve: suite.namedCurve,
206
+ privateKeyEncoding: { type: "pkcs8", format: "pem" },
207
+ publicKeyEncoding: { type: "spki", format: "pem" }
208
+ });
209
+ const ecdsaReceipt = sdk.emitReceipt(event, {
210
+ agent_identity: `native-${suite.id}-agent`,
211
+ algorithm: "xoonya-native-signed-v1",
212
+ identity_ref: `did:xoonya:native-${suite.id}-agent`,
213
+ signature_suite: suite.id,
214
+ private_key_pem: generated.privateKey,
215
+ public_key_pem: generated.publicKey
216
+ });
217
+ const ecdsaVerification = sdk.verifyProofBundle(sdk.buildProofBundle({ ceb: event, receipt: ecdsaReceipt }));
218
+ ensure(ecdsaVerification.valid === true, `${suite.id} native signed receipt should verify`);
219
+ ensure(ecdsaVerification.verification_state === "verified_native_signature", `${suite.id} native signed verification state mismatch`);
220
+ ensure(ecdsaVerification.signature_suite === suite.id, `${suite.id} native signed suite mismatch`);
221
+
222
+ const tamperedEcdsaReceipt = {
223
+ ...ecdsaReceipt,
224
+ native_proof: {
225
+ ...ecdsaReceipt.native_proof,
226
+ proof_material: {
227
+ ...ecdsaReceipt.native_proof.proof_material,
228
+ signature: tamperCompactSignature(ecdsaReceipt.native_proof.proof_material.signature)
229
+ }
230
+ },
231
+ signature: `${"xoonya-native-signed-v1"}:${suite.id}:${tamperCompactSignature(ecdsaReceipt.native_proof.proof_material.signature)}`
232
+ };
233
+ const tamperedEcdsaVerification = sdk.verifyProofBundle(sdk.buildProofBundle({ ceb: event, receipt: tamperedEcdsaReceipt }));
234
+ ensure(tamperedEcdsaVerification.valid === false, `${suite.id} native signed tamper must not verify`);
235
+ ensure(tamperedEcdsaVerification.reason === "native_signature_invalid", `${suite.id} native signed tamper reason mismatch`);
236
+ }
237
+
238
+ const ambiguousNoneReceipt = {
239
+ ...detachedReceipt,
240
+ algorithm: "none"
241
+ };
242
+ const ambiguousNoneVerification = sdk.verifyProofBundle(sdk.buildProofBundle({ ceb: event, receipt: ambiguousNoneReceipt }));
243
+ ensure(ambiguousNoneVerification.valid === false, "algorithm none must not verify");
244
+ ensure(ambiguousNoneVerification.reason === "verification_method_none", "algorithm none reason mismatch");
245
+
246
+ const unsupportedReceipt = {
247
+ ...detachedReceipt,
248
+ algorithm: "jwt-vc-demo"
249
+ };
250
+ const unsupportedVerification = sdk.verifyProofBundle(sdk.buildProofBundle({ ceb: event, receipt: unsupportedReceipt }));
251
+ ensure(unsupportedVerification.valid === false, "unknown proof method must not verify");
252
+ ensure(unsupportedVerification.reason === "verification_method_unsupported", "unknown proof method reason mismatch");
253
+
254
+ const hybridClassical = crypto.generateKeyPairSync("ed25519");
255
+ const hybridPq = crypto.generateKeyPairSync("ml-dsa-65");
256
+ const hybridReceipt = sdk.emitReceipt(event, {
257
+ agent_identity: "native-hybrid-agent",
258
+ algorithm: "xoonya-native-hybrid-v1",
259
+ identity_ref: "did:xoonya:native-hybrid-agent",
260
+ classical_signature_suite: "ed25519",
261
+ pq_signature_suite: "ml-dsa-65",
262
+ classical_public_key_pem: hybridClassical.publicKey.export({ type: "spki", format: "pem" }),
263
+ classical_private_key_pem: hybridClassical.privateKey.export({ type: "pkcs8", format: "pem" }),
264
+ pq_public_key_pem: hybridPq.publicKey.export({ type: "spki", format: "pem" }),
265
+ pq_private_key_pem: hybridPq.privateKey.export({ type: "pkcs8", format: "pem" })
266
+ });
267
+ const hybridVerification = sdk.verifyProofBundle(sdk.buildProofBundle({ ceb: event, receipt: hybridReceipt }));
268
+ ensure(hybridVerification.valid === true, "native hybrid method must verify");
269
+ ensure(hybridVerification.verification_state === "verified_native_hybrid_signature", "native hybrid verification state mismatch");
270
+
271
+ const tamperedNativeReceipt = {
272
+ ...nativeReceipt,
273
+ signature: nativeReceipt.signature.replace(/.$/, "0")
274
+ };
275
+ const tamperedNativeVerification = sdk.verifyProofBundle(sdk.buildProofBundle({ ceb: event, receipt: tamperedNativeReceipt }));
276
+ ensure(tamperedNativeVerification.valid === false, "native signature tamper must not verify");
277
+ ensure(tamperedNativeVerification.reason === "signature_native_mismatch", "native tamper reason mismatch");
278
+
279
+ const downgradedNativeReceipt = {
280
+ ...nativeReceipt,
281
+ algorithm: "detached-assertion-v1"
282
+ };
283
+ const downgradedNativeVerification = sdk.verifyProofBundle(sdk.buildProofBundle({ ceb: event, receipt: downgradedNativeReceipt }));
284
+ ensure(downgradedNativeVerification.valid === false, "native signature downgrade must not verify as detached");
285
+ ensure(downgradedNativeVerification.reason === "signature_method_mismatch", "native downgrade reason mismatch");
286
+
287
+ const tamperedNativeSignedReceipt = {
288
+ ...nativeSignedReceipt,
289
+ native_proof: {
290
+ ...nativeSignedReceipt.native_proof,
291
+ proof_material: {
292
+ ...nativeSignedReceipt.native_proof.proof_material,
293
+ signature: nativeSignedReceipt.native_proof.proof_material.signature.replace(/.$/, "B")
294
+ }
295
+ },
296
+ signature: nativeSignedReceipt.signature.replace(/.$/, "B")
297
+ };
298
+ const tamperedNativeSignedVerification = sdk.verifyProofBundle(sdk.buildProofBundle({ ceb: event, receipt: tamperedNativeSignedReceipt }));
299
+ ensure(tamperedNativeSignedVerification.valid === false, "native signed tamper must not verify");
300
+ ensure(tamperedNativeSignedVerification.reason === "native_signature_invalid", "native signed tamper reason mismatch");
301
+
302
+ const nativeAnchors = [
303
+ {
304
+ anchor_id: "anchor-verify-all-demo",
305
+ anchor_kind: "finality_ref",
306
+ anchor_ref: "bsv:mainnet:tx/9cd77fd24b884b281c819b3e48f6b15ed328b116939b082580924cabb4518d28",
307
+ anchor_hash_sha256: sdk.hashEvent({
308
+ version: "canonical-event-bundle/v1",
309
+ domain_id: "verify.anchor",
310
+ sequence: "1",
311
+ actor_id: "verify-anchor",
312
+ adapter_source: "verify_all",
313
+ event_type: "anchor.material",
314
+ event_hash: "ab".repeat(32)
315
+ }),
316
+ network: "bsv-mainnet",
317
+ finality_state: "finalized"
318
+ }
319
+ ];
320
+ const nativeAnchoredReceipt = sdk.emitReceipt(event, {
321
+ agent_identity: "native-anchored-agent",
322
+ algorithm: "xoonya-native-anchored-v1",
323
+ anchors: nativeAnchors
324
+ });
325
+ const nativeAnchoredVerification = sdk.verifyProofBundle(sdk.buildProofBundle({
326
+ ceb: event,
327
+ receipt: nativeAnchoredReceipt,
328
+ anchors: nativeAnchors
329
+ }));
330
+ ensure(nativeAnchoredVerification.valid === true, "native anchored receipt should verify");
331
+ ensure(nativeAnchoredVerification.verification_state === "verified_native_anchor_binding", "native anchored verification state mismatch");
332
+ ensure(nativeAnchoredVerification.anchor_count === 1, "native anchored anchor count mismatch");
333
+
334
+ const nativeAnchoredMissingBundleVerification = sdk.verifyProofBundle(sdk.buildProofBundle({
335
+ ceb: event,
336
+ receipt: nativeAnchoredReceipt
337
+ }));
338
+ ensure(nativeAnchoredMissingBundleVerification.valid === false, "native anchored receipt must require bundle anchors");
339
+ ensure(nativeAnchoredMissingBundleVerification.reason === "native_anchor_bundle_missing", "native anchored missing bundle reason mismatch");
340
+
341
+ const externalImportRun = sdk.runExternalProofImport({
342
+ method: "jwt-assertion-v1",
343
+ import_ref: "jwt-import-demo",
344
+ issuer_ref: "did:example:issuer",
345
+ subject_ref: "txn:xytara:demo",
346
+ external_proof: "eyJhbGciOiJFZERTQSJ9.eyJzdWIiOiJ0eG4teHl0YXJhLWRlbW8ifQ.signature",
347
+ evidence_refs: ["memory://external/jwt-import-demo"]
348
+ });
349
+ ensure(externalImportRun.ok === true, "external proof import should produce valid bundle");
350
+ ensure(externalImportRun.bundle_verification.valid === true, "external import bundle should verify");
351
+ ensure(externalImportRun.bundle_verification.verification_method === "jwt-assertion-v1", "external import method mismatch");
352
+ ensure(externalImportRun.import_review.boundary.includes("without_claiming_external_issuer_truth"), "external import boundary missing");
353
+
354
+ const externalImportReviewSummary = sdk.summarizeExternalProofImportReview({
355
+ method: "did-vc-v1",
356
+ external_proof: {
357
+ "@context": ["https://www.w3.org/ns/credentials/v2"],
358
+ type: ["VerifiableCredential"],
359
+ issuer: "did:example:issuer",
360
+ credentialSubject: { id: "did:example:agent" }
361
+ }
362
+ });
363
+ ensure(externalImportReviewSummary.ok === true, "external import review summary should pass");
364
+ ensure(externalImportReviewSummary.method === "did-vc-v1", "external import review method mismatch");
365
+ const externalImportGate = sdk.validateExternalProofImportEvidence({
366
+ method: "did-vc-v1",
367
+ external_proof: {
368
+ proof: "demo"
369
+ },
370
+ claim_external_issuer_truth: true
371
+ });
372
+ ensure(externalImportGate.import_allowed === false, "external import truth claim should require external verifier");
373
+ ensure(
374
+ externalImportGate.rejection_codes.includes("external_issuer_truth_claim_requires_external_verifier"),
375
+ "external import truth rejection code mismatch"
376
+ );
377
+
378
+ let hashMismatchRejected = false;
379
+ try {
380
+ sdk.runExternalProofImport({
381
+ method: "signed-envelope-v1",
382
+ external_proof: { proof: "demo" },
383
+ declared_hash_sha256: "00".repeat(32)
384
+ });
385
+ } catch (error) {
386
+ hashMismatchRejected = error.message === "external_proof_hash_mismatch";
387
+ }
388
+ ensure(hashMismatchRejected === true, "external import must reject declared hash mismatch");
389
+ }
390
+
391
+ function verifyNativeAtomConformance() {
392
+ ensure(nativeAtomVectors.version === "xoonya-native-atom-vectors-v1", "native atom vector version mismatch");
393
+ const payloadBytes = Buffer.from(nativeAtomVectors.payload_ascii, "utf8");
394
+ const generatedV1 = sdk.createxoonyaNativeAtomV1(nativeAtomVectors.identity_material_hex, payloadBytes);
395
+ const expectedV1 = nativeAtomVectors.vectors.find((vector) => vector.id === "xnya-v1-with-payload");
396
+ ensure(generatedV1.atom_hex === expectedV1.atom_hex, "native atom v1 payload vector mismatch");
397
+ const generatedV2 = sdk.createxoonyaNativeAtomV2(nativeAtomVectors.identity_material_hex, payloadBytes);
398
+ const expectedV2 = nativeAtomVectors.vectors.find((vector) => vector.id === "xnya-v2-with-payload");
399
+ ensure(generatedV2.atom_hex === expectedV2.atom_hex, "native atom v2 payload vector mismatch");
400
+
401
+ for (const vector of nativeAtomVectors.vectors) {
402
+ const parsed = sdk.parsexoonyaNativeAtom(vector.atom_hex);
403
+ ensure(parsed.atom_version === vector.atom_version, `${vector.id} atom version mismatch`);
404
+ ensure(parsed.byte_length === vector.byte_length, `${vector.id} byte length mismatch`);
405
+ ensure(parsed.agent_id === vector.agent_id, `${vector.id} agent id mismatch`);
406
+ ensure(parsed.payload_hash_sha256 === vector.payload_hash_sha256, `${vector.id} payload hash mismatch`);
407
+ const hasPayload = vector.payload_hash_sha256 !== "00".repeat(32);
408
+ const verification = sdk.verifyxoonyaNativeAtom(vector.atom_hex, {
409
+ identity_material_hex: nativeAtomVectors.identity_material_hex,
410
+ ...(hasPayload ? { payload_bytes: payloadBytes } : {})
411
+ });
412
+ ensure(verification.valid === true, `${vector.id} should verify`);
413
+ ensure(verification.error_code === null, `${vector.id} should not have error code`);
414
+ }
415
+
416
+ for (const vector of nativeAtomVectors.adversarial) {
417
+ const verification = sdk.verifyxoonyaNativeAtom(vector.atom_hex, {
418
+ identity_material_hex: vector.identity_material_hex || nativeAtomVectors.identity_material_hex,
419
+ ...(vector.payload_ascii ? { payload_bytes: Buffer.from(vector.payload_ascii, "utf8") } : {})
420
+ });
421
+ ensure(verification.valid === false, `${vector.id} should fail`);
422
+ ensure(verification.reason === vector.expected_reason, `${vector.id} reason mismatch`);
423
+ if (vector.expected_error_code) {
424
+ ensure(verification.error_code === vector.expected_error_code, `${vector.id} error code mismatch`);
425
+ }
426
+ }
427
+ }
428
+
429
+ function verifyNativePayloadProfileConformance() {
430
+ ensure(nativePayloadProfileVectors.version === "xoonya-native-payload-profile-vectors-v1", "native payload profile vector version mismatch");
431
+ ensure(typeof sdk.encodexoonyaNativePayloadProfileV1 === "function", "missing encodexoonyaNativePayloadProfileV1");
432
+ ensure(typeof sdk.parsexoonyaNativePayloadProfileV1 === "function", "missing parsexoonyaNativePayloadProfileV1");
433
+ ensure(typeof sdk.verifyxoonyaNativePayloadProfileV1 === "function", "missing verifyxoonyaNativePayloadProfileV1");
434
+ ensure(typeof sdk.createxoonyaNativeLineRateFrameV1 === "function", "missing createxoonyaNativeLineRateFrameV1");
435
+ ensure(typeof sdk.parsexoonyaNativeLineRateFrameV1 === "function", "missing parsexoonyaNativeLineRateFrameV1");
436
+ ensure(typeof sdk.verifyxoonyaNativeLineRateFrameV1 === "function", "missing verifyxoonyaNativeLineRateFrameV1");
437
+
438
+ const vector = nativePayloadProfileVectors.profile_vector;
439
+ const profile = sdk.encodexoonyaNativePayloadProfileV1(vector.input);
440
+ ensure(profile.profile === "xoonya-native-payload-profile/v1", "native payload profile id mismatch");
441
+ ensure(profile.canonical_bytes_hex.startsWith(Buffer.from("XNYP", "ascii").toString("hex")), "native payload profile magic mismatch");
442
+ ensure(profile.field_count === 4, "native payload profile field count mismatch");
443
+ ensure(profile.canonical_bytes_hex === vector.expected.canonical_bytes_hex, "native payload profile canonical vector mismatch");
444
+ ensure(profile.payload_hash_sha256 === vector.expected.payload_hash_sha256, "native payload profile payload hash vector mismatch");
445
+ ensure(profile.schema_hash_sha256 === vector.expected.schema_hash_sha256, "native payload profile schema hash vector mismatch");
446
+ const parsedProfile = sdk.parsexoonyaNativePayloadProfileV1(profile.canonical_bytes_hex);
447
+ ensure(parsedProfile.payload_hash_sha256 === profile.payload_hash_sha256, "native payload profile hash mismatch");
448
+ ensure(parsedProfile.fields.map((field) => field.field_id).join(",") === "1,2,3,4", "native payload profile canonical ordering mismatch");
449
+ ensure(parsedProfile.fields.find((field) => field.field_id === 2).value === "42", "native payload profile uint64 decode mismatch");
450
+ ensure(parsedProfile.fields.find((field) => field.field_id === 4).value === true, "native payload profile bool decode mismatch");
451
+ const profileVerification = sdk.verifyxoonyaNativePayloadProfileV1(profile.canonical_bytes_hex, {
452
+ payload_hash_sha256: profile.payload_hash_sha256,
453
+ schema_ref: "xoonya.payload.test.v1",
454
+ allowed_field_ids: [1, 2, 3, 4]
455
+ });
456
+ ensure(profileVerification.valid === true, "native payload profile verification should pass");
457
+ const unknownFieldPolicy = sdk.verifyxoonyaNativePayloadProfileV1(profile.canonical_bytes_hex, {
458
+ allowed_field_ids: [1, 2, 3]
459
+ });
460
+ ensure(unknownFieldPolicy.valid === false, "native payload profile policy should reject unknown field ids");
461
+ ensure(unknownFieldPolicy.reason === "payload_profile_unknown_field", "native payload profile unknown field reason mismatch");
462
+
463
+ const atom = sdk.createxoonyaNativeAtomV1(
464
+ "01" + "11".repeat(33),
465
+ Buffer.from(profile.canonical_bytes_hex, "hex")
466
+ );
467
+ const frame = sdk.createxoonyaNativeLineRateFrameV1(atom.atom_hex);
468
+ const frameVector = nativePayloadProfileVectors.line_rate_frame_vector;
469
+ ensure(frame.profile === "xoonya-native-line-rate-frame/v1", "line-rate frame profile mismatch");
470
+ ensure(frame.frame_byte_length === 60, "line-rate frame v1 size mismatch");
471
+ ensure(atom.atom_hex === frameVector.atom_hex, "line-rate frame atom vector mismatch");
472
+ ensure(frame.frame_hex === frameVector.frame_hex, "line-rate frame vector mismatch");
473
+ ensure(frame.checksum_hex === frameVector.checksum_hex, "line-rate frame checksum vector mismatch");
474
+ const frameVerification = sdk.verifyxoonyaNativeLineRateFrameV1(frame.frame_hex, {
475
+ identity_material_hex: "01" + "11".repeat(33),
476
+ payload_bytes: Buffer.from(profile.canonical_bytes_hex, "hex")
477
+ });
478
+ ensure(frameVerification.valid === true, "line-rate frame should verify");
479
+ const tamperedFrameHex = `${frame.frame_hex.slice(0, -1)}${frame.frame_hex.endsWith("0") ? "1" : "0"}`;
480
+ const tamperedFrameVerification = sdk.verifyxoonyaNativeLineRateFrameV1(tamperedFrameHex, {
481
+ identity_material_hex: "01" + "11".repeat(33),
482
+ payload_bytes: Buffer.from(profile.canonical_bytes_hex, "hex")
483
+ });
484
+ ensure(tamperedFrameVerification.valid === false, "line-rate frame tamper should fail");
485
+ ensure(tamperedFrameVerification.reason === "line_rate_frame_checksum_mismatch", "line-rate frame tamper reason mismatch");
486
+ }
487
+
488
+ function main() {
489
+ ensure(packageJson.name === "xoonya", "unexpected package name");
490
+ const startHereOutput = execFileSync(process.execPath, [
491
+ path.resolve(__dirname, "..", "bin", "xoonya.js"),
492
+ "start-here"
493
+ ], { encoding: "utf8" });
494
+ ensure(startHereOutput.includes("https://www.naxytra.com/v1/first-run-kit"), "xoonya start-here command kit missing");
495
+ ensure(startHereOutput.includes("xoonya-native-anchored-v1"), "xoonya start-here anchored mode missing");
496
+ const firstRunOutput = execFileSync(process.execPath, [
497
+ path.resolve(__dirname, "..", "bin", "xoonya.js"),
498
+ "first-run",
499
+ "--json",
500
+ "--offline",
501
+ "--pretty"
502
+ ], { encoding: "utf8" });
503
+ const firstRunGuide = JSON.parse(firstRunOutput);
504
+ ensure(firstRunGuide.category === "xoonya-first-run-proof-guide", "xoonya first-run category mismatch");
505
+ ensure(firstRunGuide.proof_modes.some((entry) => entry.method === "xoonya-native-anchored-v1"), "xoonya first-run anchored proof missing");
506
+ const nativeFirstRunOutput = execFileSync(process.execPath, [
507
+ path.resolve(__dirname, "..", "bin", "xoonya.js"),
508
+ "first-run",
509
+ "--verify-native",
510
+ "--pretty"
511
+ ], { encoding: "utf8" });
512
+ const nativeFirstRun = JSON.parse(nativeFirstRunOutput);
513
+ ensure(nativeFirstRun.category === "xoonya-first-run-native-verification", "xoonya first-run native category mismatch");
514
+ ensure(nativeFirstRun.required_native_methods_present === true, "xoonya first-run native methods missing");
515
+ ensure(fs.existsSync(path.resolve(__dirname, "..", "vectors", "conformance-vectors.json")), "missing conformance vectors");
516
+ ensure(fs.existsSync(path.resolve(__dirname, "..", "vectors", "adversarial-vectors.json")), "missing adversarial vectors");
517
+ ensure(fs.existsSync(path.resolve(__dirname, "..", "vectors", "native-atom-vectors.json")), "missing native atom vectors");
518
+ ensure(fs.existsSync(path.resolve(__dirname, "..", "vectors", "native-payload-profile-vectors.json")), "missing native payload profile vectors");
519
+ ensure(fs.existsSync(path.resolve(__dirname, "..", "CROSS_RUNTIME_POSTURE.md")), "missing cross-runtime posture note");
520
+ ensure(typeof sdk.canonicalizeEvent === "function", "missing canonicalizeEvent");
521
+ ensure(typeof sdk.hashEvent === "function", "missing hashEvent");
522
+ ensure(typeof sdk.emitReceipt === "function", "missing emitReceipt");
523
+ ensure(typeof sdk.listProofVerificationMethods === "function", "missing listProofVerificationMethods");
524
+ ensure(typeof sdk.getProofVerificationMethod === "function", "missing getProofVerificationMethod");
525
+ ensure(typeof sdk.listNativeSignatureSuites === "function", "missing listNativeSignatureSuites");
526
+ ensure(typeof sdk.getNativeSignatureSuite === "function", "missing getNativeSignatureSuite");
527
+ ensure(typeof sdk.listxoonyaNativeIdentityTypes === "function", "missing listxoonyaNativeIdentityTypes");
528
+ ensure(typeof sdk.buildxoonyaNativeAtomSpec === "function", "missing buildxoonyaNativeAtomSpec");
529
+ ensure(typeof sdk.buildxoonyaNativeAtomConformancePack === "function", "missing buildxoonyaNativeAtomConformancePack");
530
+ ensure(typeof sdk.summarizexoonyaNativeAtomConformancePack === "function", "missing summarizexoonyaNativeAtomConformancePack");
531
+ ensure(typeof sdk.createxoonyaNativeAtomV1 === "function", "missing createxoonyaNativeAtomV1");
532
+ ensure(typeof sdk.createxoonyaNativeAtomV2 === "function", "missing createxoonyaNativeAtomV2");
533
+ ensure(typeof sdk.parsexoonyaNativeAtom === "function", "missing parsexoonyaNativeAtom");
534
+ ensure(typeof sdk.verifyxoonyaNativeAtom === "function", "missing verifyxoonyaNativeAtom");
535
+ ensure(typeof sdk.buildNativeReceiptSignature === "function", "missing buildNativeReceiptSignature");
536
+ ensure(typeof sdk.buildNativeSignedReceiptProof === "function", "missing buildNativeSignedReceiptProof");
537
+ ensure(typeof sdk.buildNativeHybridReceiptProof === "function", "missing buildNativeHybridReceiptProof");
538
+ ensure(typeof sdk.buildNativeAnchoredReceiptProof === "function", "missing buildNativeAnchoredReceiptProof");
539
+ ensure(typeof sdk.buildxoonyaNativeAnchorProfile === "function", "missing buildxoonyaNativeAnchorProfile");
540
+ ensure(typeof sdk.summarizexoonyaNativeAnchorProfile === "function", "missing summarizexoonyaNativeAnchorProfile");
541
+ ensure(typeof sdk.buildExternalProofImportAdapterPack === "function", "missing buildExternalProofImportAdapterPack");
542
+ ensure(typeof sdk.summarizeExternalProofImportAdapterPack === "function", "missing summarizeExternalProofImportAdapterPack");
543
+ ensure(typeof sdk.buildxoonyaNativeHybridReadinessPack === "function", "missing buildxoonyaNativeHybridReadinessPack");
544
+ ensure(typeof sdk.summarizexoonyaNativeHybridReadinessPack === "function", "missing summarizexoonyaNativeHybridReadinessPack");
545
+ ensure(typeof sdk.buildxoonyaNativeStandardizationPack === "function", "missing buildxoonyaNativeStandardizationPack");
546
+ ensure(typeof sdk.summarizexoonyaNativeStandardizationPack === "function", "missing summarizexoonyaNativeStandardizationPack");
547
+ ensure(typeof sdk.buildxoonyaNativeConformanceMarkPack === "function", "missing buildxoonyaNativeConformanceMarkPack");
548
+ ensure(typeof sdk.summarizexoonyaNativeConformanceMarkPack === "function", "missing summarizexoonyaNativeConformanceMarkPack");
549
+ ensure(typeof sdk.buildxoonyaNativeReferenceImplementationPack === "function", "missing buildxoonyaNativeReferenceImplementationPack");
550
+ ensure(typeof sdk.summarizexoonyaNativeReferenceImplementationPack === "function", "missing summarizexoonyaNativeReferenceImplementationPack");
551
+ ensure(typeof sdk.buildxoonyaNativePayloadProfilePack === "function", "missing buildxoonyaNativePayloadProfilePack");
552
+ ensure(typeof sdk.summarizexoonyaNativePayloadProfilePack === "function", "missing summarizexoonyaNativePayloadProfilePack");
553
+ ensure(typeof sdk.buildxoonyaNativeLineRateFramePack === "function", "missing buildxoonyaNativeLineRateFramePack");
554
+ ensure(typeof sdk.summarizexoonyaNativeLineRateFramePack === "function", "missing summarizexoonyaNativeLineRateFramePack");
555
+ ensure(typeof sdk.reviewExternalProofImport === "function", "missing reviewExternalProofImport");
556
+ ensure(typeof sdk.runExternalProofImport === "function", "missing runExternalProofImport");
557
+ ensure(typeof sdk.buildProofBundle === "function", "missing buildProofBundle");
558
+ ensure(typeof sdk.verifyProofBundle === "function", "missing verifyProofBundle");
559
+ ensure(typeof sdk.listIntegrations === "function", "missing listIntegrations");
560
+ ensure(typeof sdk.getIntegration === "function", "missing getIntegration");
561
+ ensure(typeof sdk.summarizeIntegrations === "function", "missing summarizeIntegrations");
562
+ ensure(typeof sdk.validateIntegrationRegistration === "function", "missing validateIntegrationRegistration");
563
+ ensure(typeof sdk.importRegisteredIntegration === "function", "missing importRegisteredIntegration");
564
+ ensure(typeof sdk.exportIntegrationRegistrySnapshot === "function", "missing exportIntegrationRegistrySnapshot");
565
+ ensure(typeof sdk.validateIntegrationRegistrySnapshot === "function", "missing validateIntegrationRegistrySnapshot");
566
+ ensure(typeof sdk.createReceipt === "function", "missing createReceipt");
567
+ ensure(typeof sdk.verifyReceipt === "function", "missing verifyReceipt");
568
+ ensure(typeof sdk.createReceiptV2 === "function", "missing createReceiptV2");
569
+ ensure(typeof sdk.verifyReceiptV2 === "function", "missing verifyReceiptV2");
570
+ ensure(typeof sdk.createProofEnvelopeV1 === "function", "missing createProofEnvelopeV1");
571
+ ensure(typeof sdk.verifyProofEnvelopeV1 === "function", "missing verifyProofEnvelopeV1");
572
+ ensure(typeof sdk.createEconomicReceiptProfileV1 === "function", "missing createEconomicReceiptProfileV1");
573
+ ensure(typeof sdk.verifyEconomicReceiptProfileV1 === "function", "missing verifyEconomicReceiptProfileV1");
574
+ ensure(typeof sdk.createRegistryProfileV1 === "function", "missing createRegistryProfileV1");
575
+ ensure(typeof sdk.verifyRegistryProfileV1 === "function", "missing verifyRegistryProfileV1");
576
+ ensure(fs.existsSync(path.resolve(__dirname, "..", "integrations", "registration-record.schema.json")), "missing integration registration schema");
577
+ ensure(fs.existsSync(path.resolve(__dirname, "..", "integrations", "registry-snapshot.schema.json")), "missing integration registry snapshot schema");
578
+ const hybridReadiness = sdk.summarizexoonyaNativeHybridReadinessPack();
579
+ ensure(hybridReadiness.status === "implemented", "native hybrid readiness must be implemented");
580
+ ensure(hybridReadiness.implemented_classical_suites.includes("secp256k1"), "native hybrid readiness secp256k1 suite missing");
581
+ ensure(hybridReadiness.implemented_classical_suites.includes("p256"), "native hybrid readiness p256 suite missing");
582
+ ensure(hybridReadiness.implemented_hybrid_suites.includes("ed25519+ml-dsa-65"), "native hybrid readiness ml-dsa suite missing");
583
+ const standardization = sdk.summarizexoonyaNativeStandardizationPack();
584
+ ensure(standardization.canonical_magic === "XNYA", "native standardization magic mismatch");
585
+ ensure(standardization.conformance_forbidden_condition_count >= 4, "native standardization forbidden conditions missing");
586
+ const conformanceMark = sdk.summarizexoonyaNativeConformanceMarkPack();
587
+ ensure(conformanceMark.mark === "XNYA-compatible", "native conformance mark mismatch");
588
+ ensure(conformanceMark.forbidden_claim_count >= 3, "native conformance mark forbidden claims missing");
589
+ ensure(conformanceMark.implemented_signature_suites.includes("secp256k1"), "native conformance mark secp256k1 suite missing");
590
+ const referenceImplementations = sdk.summarizexoonyaNativeReferenceImplementationPack();
591
+ ensure(referenceImplementations.status === "js_reference_implemented_independent_references_planned", "native reference implementation status mismatch");
592
+ ensure(referenceImplementations.implemented_reference_count === 1, "native reference implementation count mismatch");
593
+ ensure(referenceImplementations.planned_reference_count >= 2, "native planned reference implementation count mismatch");
594
+ ensure(referenceImplementations.verified_candidate_scaffold_count >= 1, "native verified candidate scaffold missing");
595
+ ensure(referenceImplementations.deterministic_rejection_code_count >= 11, "native reference promotion rejection codes missing");
596
+ verifyCanonicalEventConformance();
597
+ verifyProofBundleConformance();
598
+ verifyNativeAtomConformance();
599
+ verifyNativePayloadProfileConformance();
600
+ process.stdout.write("xoonya verify:all passed\n");
601
+ }
602
+
603
+ main();