@wowok/agent-mcp 2.7.1 → 2.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/index.js +1 -1
- package/dist/config/runtime.js +1 -238
- package/dist/customer/customer-advice.js +1 -130
- package/dist/customer/index.js +1 -11
- package/dist/customer/industry-risks.js +1 -438
- package/dist/customer/info-puzzle.js +1 -681
- package/dist/customer/order-monitor.js +1 -328
- package/dist/customer/order-strategy.js +1 -373
- package/dist/customer/post-purchase.js +1 -351
- package/dist/customer/preorder-compare.js +1 -34
- package/dist/customer/reminder-system.js +1 -316
- package/dist/customer/risk-assessment.js +1 -397
- package/dist/customer/types.js +1 -13
- package/dist/customer/user-preferences.js +1 -460
- package/dist/evaluation/arbitration-game.d.ts +9 -2
- package/dist/evaluation/arbitration-game.js +1 -48
- package/dist/evaluation/builtins/demand-match.js +1 -153
- package/dist/evaluation/builtins/index.js +1 -10
- package/dist/evaluation/builtins/service-risk.js +1 -55
- package/dist/evaluation/capability.js +1 -13
- package/dist/evaluation/composer.js +1 -40
- package/dist/evaluation/engine.js +1 -175
- package/dist/evaluation/extract.js +1 -115
- package/dist/evaluation/game-strategy.d.ts +27 -0
- package/dist/evaluation/game-strategy.js +1 -0
- package/dist/evaluation/gap.js +1 -100
- package/dist/evaluation/index.d.ts +1 -0
- package/dist/evaluation/index.js +1 -11
- package/dist/evaluation/node-game.d.ts +31 -3
- package/dist/evaluation/node-game.js +1 -57
- package/dist/evaluation/region.js +1 -36
- package/dist/evaluation/types.d.ts +1 -0
- package/dist/evaluation/types.js +1 -1
- package/dist/evaluation/user-injection.js +1 -27
- package/dist/experience/experience-reuse.js +1 -103
- package/dist/experience/index.js +1 -5
- package/dist/experience/intent-distill.js +1 -83
- package/dist/experience/realtime-feedback.js +1 -94
- package/dist/experience/types.js +1 -1
- package/dist/experience/user-profile.js +1 -171
- package/dist/extensions/business-modules.js +1 -287
- package/dist/extensions/capability-manifest.js +1 -781
- package/dist/extensions/constraint-registry.js +1 -198
- package/dist/extensions/index.js +1 -6
- package/dist/extensions/metric-registry.js +1 -257
- package/dist/extensions/mode-evaluator.js +1 -170
- package/dist/extensions/modes.js +1 -499
- package/dist/extensions/registry.js +1 -717
- package/dist/extensions/types.js +1 -1
- package/dist/harness/auto-escalation.js +1 -68
- package/dist/harness/checkpoint.js +1 -129
- package/dist/harness/index.js +1 -78
- package/dist/harness/plan.js +1 -315
- package/dist/harness/recover.js +1 -139
- package/dist/harness/types.js +1 -1
- package/dist/harness/verify.js +1 -237
- package/dist/index.js +1 -273
- package/dist/intent/enrich.js +1 -67
- package/dist/intent/index.js +1 -60
- package/dist/intent/matcher.js +1 -81
- package/dist/intent/store.js +1 -55
- package/dist/intent/types.js +1 -10
- package/dist/knowledge/acquisition-flywheel.js +1 -192
- package/dist/knowledge/allocation-confirm.js +1 -534
- package/dist/knowledge/allocation-context.js +1 -249
- package/dist/knowledge/allocation-ledger.js +1 -463
- package/dist/knowledge/allocation-puzzle.js +1 -298
- package/dist/knowledge/allocation-risk.js +1 -568
- package/dist/knowledge/allocation-templates.js +1 -970
- package/dist/knowledge/allocation-translation.js +1 -585
- package/dist/knowledge/arb-risk.js +1 -210
- package/dist/knowledge/arbitration-confirm.js +1 -559
- package/dist/knowledge/arbitration-context.js +1 -505
- package/dist/knowledge/arbitration-ledger.js +1 -521
- package/dist/knowledge/arbitration-puzzle.js +1 -304
- package/dist/knowledge/arbitration-risk.js +1 -423
- package/dist/knowledge/arbitration-templates.js +1 -276
- package/dist/knowledge/arbitration-translation.js +1 -487
- package/dist/knowledge/arbitration-trust.js +1 -117
- package/dist/knowledge/audit-rules.js +1 -141
- package/dist/knowledge/bridge-risk.js +1 -263
- package/dist/knowledge/contact-risk.js +1 -200
- package/dist/knowledge/contact-templates.js +1 -60
- package/dist/knowledge/demand-confirm.js +1 -206
- package/dist/knowledge/demand-matching.js +1 -132
- package/dist/knowledge/demand-risk.js +1 -240
- package/dist/knowledge/demand-translation.js +1 -354
- package/dist/knowledge/deployment-scanner.js +1 -823
- package/dist/knowledge/dynamic-pricing.js +1 -87
- package/dist/knowledge/examples-scanner-cli.js +1 -26
- package/dist/knowledge/examples-scanner.js +1 -843
- package/dist/knowledge/flywheel-loop.js +1 -404
- package/dist/knowledge/fund-layer.js +1 -973
- package/dist/knowledge/glossary.js +1 -211
- package/dist/knowledge/guard-confirm.js +1 -406
- package/dist/knowledge/guard-context.js +1 -287
- package/dist/knowledge/guard-design-patterns.js +1 -360
- package/dist/knowledge/guard-ledger.js +1 -260
- package/dist/knowledge/guard-lint.js +1 -670
- package/dist/knowledge/guard-migration.js +1 -228
- package/dist/knowledge/guard-puzzle.js +1 -805
- package/dist/knowledge/guard-render.js +1 -700
- package/dist/knowledge/guard-risk.js +1 -1879
- package/dist/knowledge/guard-submission-prompt.js +1 -171
- package/dist/knowledge/guard-templates.js +1 -1105
- package/dist/knowledge/guard-translation.js +1 -1119
- package/dist/knowledge/index.js +1 -436
- package/dist/knowledge/industry-evolution.js +1 -323
- package/dist/knowledge/industry-generalizer.js +1 -381
- package/dist/knowledge/industry-registry.js +1 -174
- package/dist/knowledge/intent-metrics.d.ts +4 -3
- package/dist/knowledge/intent-metrics.js +1 -566
- package/dist/knowledge/machine-confirm.js +1 -559
- package/dist/knowledge/machine-context.js +1 -833
- package/dist/knowledge/machine-ledger.js +1 -338
- package/dist/knowledge/machine-puzzle.js +1 -494
- package/dist/knowledge/machine-render.js +1 -565
- package/dist/knowledge/machine-risk.js +1 -669
- package/dist/knowledge/machine-templates.js +1 -1597
- package/dist/knowledge/machine-topology.js +1 -234
- package/dist/knowledge/machine-translation.js +1 -513
- package/dist/knowledge/mcp-schema-audit-cli.js +1 -45
- package/dist/knowledge/mcp-schema-audit.js +1 -777
- package/dist/knowledge/onchain-constants.js +1 -35
- package/dist/knowledge/order-confirm.js +1 -573
- package/dist/knowledge/order-context.js +1 -390
- package/dist/knowledge/order-ledger.js +1 -341
- package/dist/knowledge/order-puzzle.js +1 -255
- package/dist/knowledge/order-risk.js +1 -653
- package/dist/knowledge/order-templates.js +1 -368
- package/dist/knowledge/order-translation.js +1 -550
- package/dist/knowledge/overrides-loader.js +1 -65
- package/dist/knowledge/passport-confirm.js +1 -531
- package/dist/knowledge/passport-context.js +1 -306
- package/dist/knowledge/passport-ledger.js +1 -282
- package/dist/knowledge/passport-puzzle.js +1 -333
- package/dist/knowledge/passport-risk.js +1 -450
- package/dist/knowledge/passport-templates.js +1 -568
- package/dist/knowledge/passport-translation.js +1 -516
- package/dist/knowledge/payment-risk.js +1 -249
- package/dist/knowledge/permission-confirm.js +1 -426
- package/dist/knowledge/permission-context.js +1 -224
- package/dist/knowledge/permission-ledger.js +1 -403
- package/dist/knowledge/permission-puzzle.js +1 -173
- package/dist/knowledge/permission-risk.js +1 -411
- package/dist/knowledge/permission-templates.js +1 -234
- package/dist/knowledge/permission-translation.js +1 -350
- package/dist/knowledge/personal-risk.js +1 -212
- package/dist/knowledge/process-model.js +1 -160
- package/dist/knowledge/progress-confirm.js +1 -456
- package/dist/knowledge/progress-context.js +1 -452
- package/dist/knowledge/progress-ledger.js +1 -330
- package/dist/knowledge/progress-puzzle.js +1 -219
- package/dist/knowledge/progress-risk.js +1 -461
- package/dist/knowledge/progress-templates.js +1 -228
- package/dist/knowledge/progress-translation.js +1 -405
- package/dist/knowledge/proof-confirm.js +1 -187
- package/dist/knowledge/proof-risk.js +1 -207
- package/dist/knowledge/proof-translation.js +1 -283
- package/dist/knowledge/registrar-risk.js +1 -217
- package/dist/knowledge/repository-confirm.js +1 -286
- package/dist/knowledge/repository-risk.js +1 -373
- package/dist/knowledge/repository-translation.js +1 -445
- package/dist/knowledge/reputation-rules.js +1 -99
- package/dist/knowledge/resource-risk.js +1 -157
- package/dist/knowledge/reward-confirm.js +1 -526
- package/dist/knowledge/reward-context.js +1 -504
- package/dist/knowledge/reward-ledger.js +1 -502
- package/dist/knowledge/reward-puzzle.js +1 -300
- package/dist/knowledge/reward-risk.js +1 -627
- package/dist/knowledge/reward-templates.js +1 -197
- package/dist/knowledge/reward-translation.js +1 -501
- package/dist/knowledge/safety-rules.js +1 -404
- package/dist/knowledge/scenario-modes.js +1 -321
- package/dist/knowledge/service-confirm.js +1 -807
- package/dist/knowledge/service-context.js +1 -403
- package/dist/knowledge/service-ledger.js +1 -609
- package/dist/knowledge/service-puzzle.js +1 -236
- package/dist/knowledge/service-risk.js +1 -651
- package/dist/knowledge/service-templates.js +1 -456
- package/dist/knowledge/service-translation.js +1 -622
- package/dist/knowledge/template-registry.js +1 -353
- package/dist/knowledge/tool-constraints.js +1 -195
- package/dist/knowledge/tools-reference.js +1 -178
- package/dist/knowledge/treasury-confirm.js +1 -512
- package/dist/knowledge/treasury-context.js +1 -363
- package/dist/knowledge/treasury-ledger.js +1 -300
- package/dist/knowledge/treasury-puzzle.js +1 -216
- package/dist/knowledge/treasury-risk.js +1 -440
- package/dist/knowledge/treasury-templates.js +1 -358
- package/dist/knowledge/treasury-translation.js +1 -498
- package/dist/knowledge/trust-metrics.js +1 -198
- package/dist/knowledge/util-risk.js +1 -135
- package/dist/loop-engineering/aggregate.js +1 -132
- package/dist/loop-engineering/context-collect.js +1 -83
- package/dist/loop-engineering/diagnose.js +1 -273
- package/dist/loop-engineering/improve.js +1 -405
- package/dist/loop-engineering/index.js +1 -4
- package/dist/loop-engineering/pipeline.js +1 -56
- package/dist/mode-market/index.js +1 -3
- package/dist/mode-market/registry.js +1 -124
- package/dist/mode-market/review.js +1 -214
- package/dist/mode-market/submission.js +1 -85
- package/dist/participation/collaborator-interest.d.ts +23 -0
- package/dist/participation/collaborator-interest.js +1 -0
- package/dist/participation/customer-interest.d.ts +25 -0
- package/dist/participation/customer-interest.js +1 -0
- package/dist/participation/merchant-interest.js +1 -100
- package/dist/participation/radar-core.d.ts +13 -3
- package/dist/participation/radar-core.js +1 -269
- package/dist/participation/supplier-interest.d.ts +25 -0
- package/dist/participation/supplier-interest.js +1 -0
- package/dist/persona/analyzer.js +1 -66
- package/dist/persona/bridge.js +1 -86
- package/dist/persona/defaults.js +1 -195
- package/dist/persona/experience-bridge.js +1 -23
- package/dist/persona/index.js +1 -71
- package/dist/persona/model.js +1 -111
- package/dist/persona/store.js +1 -62
- package/dist/persona/types.d.ts +3 -1
- package/dist/persona/types.js +1 -5
- package/dist/project/business-puzzle.js +1 -383
- package/dist/project/context-assembly.js +1 -254
- package/dist/project/deployment-bridge.js +1 -120
- package/dist/project/deployment-doc.js +1 -1126
- package/dist/project/edit-planner.js +1 -1342
- package/dist/project/evaluation.js +1 -2011
- package/dist/project/game-theory.js +1 -177
- package/dist/project/graph-builder.js +1 -656
- package/dist/project/graph.js +1 -340
- package/dist/project/handlers.js +1 -1784
- package/dist/project/index.d.ts +1 -0
- package/dist/project/index.js +1 -301
- package/dist/project/intent-analyzer.js +1 -149
- package/dist/project/machine-nodes.js +1 -36
- package/dist/project/merchant-guide.js +1 -264
- package/dist/project/migration.js +1 -125
- package/dist/project/mode-actions.js +1 -309
- package/dist/project/namespace.js +1 -206
- package/dist/project/participation-radar.js +1 -428
- package/dist/project/pipeline-actions.js +1 -109
- package/dist/project/project-store.js +1 -422
- package/dist/project/query.js +1 -153
- package/dist/project/reverse-mapping.d.ts +34 -0
- package/dist/project/reverse-mapping.js +1 -0
- package/dist/project/risk-aggregator.js +1 -295
- package/dist/project/rollback-policy.js +1 -290
- package/dist/project/semantic-assembler.js +1 -345
- package/dist/project/semantic-graph.js +1 -292
- package/dist/project/stage-gate.js +1 -369
- package/dist/project/substep-trace.js +1 -332
- package/dist/project/task-tracker.js +1 -78
- package/dist/role/derivation.d.ts +18 -0
- package/dist/role/derivation.js +1 -0
- package/dist/role/index.d.ts +5 -0
- package/dist/role/index.js +1 -0
- package/dist/role/model.d.ts +8 -0
- package/dist/role/model.js +1 -0
- package/dist/role/resolution.d.ts +11 -0
- package/dist/role/resolution.js +1 -0
- package/dist/role/types.d.ts +11 -0
- package/dist/role/types.js +1 -0
- package/dist/rules.js +1 -52
- package/dist/safety/confirm-gate.js +1 -88
- package/dist/safety/index.js +1 -3
- package/dist/safety/preview.js +1 -52
- package/dist/schema/call/allocation.js +1 -34
- package/dist/schema/call/arbitration.js +1 -113
- package/dist/schema/call/base.d.ts +15 -15
- package/dist/schema/call/base.js +1 -370
- package/dist/schema/call/bridge-handler.js +1 -265
- package/dist/schema/call/bridge.d.ts +7 -7
- package/dist/schema/call/bridge.js +1 -458
- package/dist/schema/call/contact.js +1 -37
- package/dist/schema/call/demand.js +1 -47
- package/dist/schema/call/guard.js +1 -161
- package/dist/schema/call/handler.js +1 -322
- package/dist/schema/call/index.js +1 -20
- package/dist/schema/call/machine.js +1 -193
- package/dist/schema/call/order.js +1 -35
- package/dist/schema/call/payment.js +1 -37
- package/dist/schema/call/permission-handler.js +1 -54
- package/dist/schema/call/permission.js +1 -105
- package/dist/schema/call/personal.js +1 -78
- package/dist/schema/call/progress.js +1 -47
- package/dist/schema/call/proof.js +1 -33
- package/dist/schema/call/repository.js +1 -77
- package/dist/schema/call/reward.js +1 -30
- package/dist/schema/call/semantic.js +1 -1679
- package/dist/schema/call/service.js +1 -184
- package/dist/schema/call/treasury.js +1 -71
- package/dist/schema/common/index.js +1 -407
- package/dist/schema/config/index.js +1 -68
- package/dist/schema/evaluation/index.d.ts +213 -16
- package/dist/schema/evaluation/index.js +1 -356
- package/dist/schema/index.js +1 -17
- package/dist/schema/intent-radar/index.d.ts +13 -13
- package/dist/schema/intent-radar/index.js +1 -89
- package/dist/schema/local/index.d.ts +21 -21
- package/dist/schema/local/index.js +1 -927
- package/dist/schema/local/wip.js +1 -187
- package/dist/schema/messenger/index.d.ts +7 -7
- package/dist/schema/messenger/index.js +1 -475
- package/dist/schema/operations.d.ts +7 -7
- package/dist/schema/operations.js +1 -520
- package/dist/schema/persona/index.d.ts +54 -54
- package/dist/schema/persona/index.js +1 -148
- package/dist/schema/project/index.d.ts +94 -48
- package/dist/schema/project/index.js +1 -2057
- package/dist/schema/query/index.d.ts +423 -7
- package/dist/schema/query/index.js +1 -1646
- package/dist/schema/schema-query/index.js +1 -104
- package/dist/schema/schema-version.js +1 -76
- package/dist/schema/sync-layer4.js +1 -286
- package/dist/schema/task-status.js +1 -36
- package/dist/schema/trust/index.js +1 -314
- package/dist/schema/utils/guard-parser.js +1 -419
- package/dist/schema/utils/guard-query-utils.js +1 -46
- package/dist/schema/utils/node-parser.js +1 -369
- package/dist/schema/utils/object-type-utils.js +1 -35
- package/dist/schema/utils/permission-index-utils.js +1 -7
- package/dist/schema/utils/permission-machine-check.js +1 -121
- package/dist/schema/utils/skills-recommendation.js +1 -77
- package/dist/schema-query/index.js +1 -810
- package/dist/schemas/account_operation.output.json +5 -2
- package/dist/schemas/bridge_operation.output.json +5 -2
- package/dist/schemas/evaluation_operation.output.json +112 -7
- package/dist/schemas/evaluation_operation.schema.json +93 -6
- package/dist/schemas/index.json +1 -1
- package/dist/schemas/intent_radar.output.json +4 -1
- package/dist/schemas/intent_radar.schema.json +4 -1
- package/dist/schemas/local_info_operation.output.json +5 -2
- package/dist/schemas/local_mark_operation.output.json +5 -2
- package/dist/schemas/messenger_operation.output.json +5 -2
- package/dist/schemas/onchain_events.output.json +5 -2
- package/dist/schemas/onchain_operations.output.json +5 -2
- package/dist/schemas/onchain_operations.schema.json +4 -4
- package/dist/schemas/onchain_operations_allocation.schema.json +1 -1
- package/dist/schemas/onchain_operations_machine.schema.json +2 -2
- package/dist/schemas/onchain_operations_service.schema.json +1 -1
- package/dist/schemas/onchain_table_data.output.json +6 -3
- package/dist/schemas/persona_operation.output.json +4 -1
- package/dist/schemas/persona_operation.schema.json +4 -1
- package/dist/schemas/project_operation.output.json +28 -8
- package/dist/schemas/query_toolkit.output.json +8 -5
- package/dist/schemas/wowok_buildin_info.output.json +132 -0
- package/dist/schemas/wowok_buildin_info.schema.json +14 -0
- package/dist/telemetry/index.js +1 -112
- package/dist/telemetry/redact.js +1 -23
- package/dist/telemetry/storage.js +1 -80
- package/dist/tools/handlers/bridge.js +1 -1
- package/dist/tools/handlers/config.js +1 -74
- package/dist/tools/handlers/evaluation.js +1 -123
- package/dist/tools/handlers/file-export.js +1 -90
- package/dist/tools/handlers/intent-radar.js +1 -76
- package/dist/tools/handlers/local.js +1 -53
- package/dist/tools/handlers/messenger.js +1 -188
- package/dist/tools/handlers/onchain.js +1 -1180
- package/dist/tools/handlers/persona.js +1 -89
- package/dist/tools/handlers/project.js +1 -211
- package/dist/tools/handlers/query.js +1 -434
- package/dist/tools/handlers/schema-query.js +1 -176
- package/dist/tools/handlers/task-status.js +1 -26
- package/dist/tools/handlers/trust.js +1 -380
- package/dist/tools/handlers/wip.js +1 -90
- package/dist/tools/index.js +1 -1382
- package/dist/tools/retry.js +1 -85
- package/dist/tools/rules-hook.js +1 -23
- package/dist/tools/shared.js +1 -130
- package/dist/tools/types.js +1 -1
- package/dist/tools/upgrade-check.d.ts +19 -0
- package/dist/tools/upgrade-check.js +1 -0
- package/dist/tools/wip-deploy-assist.js +1 -306
- package/dist/tools/wrap.js +1 -500
- package/package.json +4 -2
|
@@ -1,187 +1 @@
|
|
|
1
|
-
import { MAX_PROOF_SIZE, MAX_SERVER_PUBKEY_SIZE, MAX_SERVER_SIGNATURE_SIZE, WOWOK_WTS_PROOF_TYPE, }
|
|
2
|
-
function checkDescription(input) {
|
|
3
|
-
const passed = !!input.description && input.description.length > 0;
|
|
4
|
-
return {
|
|
5
|
-
id: "C-PROOF-01",
|
|
6
|
-
severity: passed ? "info" : "warn",
|
|
7
|
-
title: "description is provided and non-empty",
|
|
8
|
-
description: "description is a REQUIRED field (PF-D-2=A). Move contract stores it as String; SDK enforces isValidDescription. " +
|
|
9
|
-
"Empty string (\"\") is technically valid but makes the Proof hard to identify in queries.",
|
|
10
|
-
passed,
|
|
11
|
-
evidence: input.description === undefined ? "undefined" : `length=${input.description.length}`,
|
|
12
|
-
fix_hint: "Provide a one-line description like \"KYC attestation for user 0xabc\".",
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
function checkProofContent(input) {
|
|
16
|
-
const len = input.proof?.length ?? 0;
|
|
17
|
-
const passed = len > 0 && len <= MAX_PROOF_SIZE;
|
|
18
|
-
return {
|
|
19
|
-
id: "C-PROOF-02",
|
|
20
|
-
severity: passed ? "info" : "block",
|
|
21
|
-
title: `proof content within MAX_PROOF_SIZE (${MAX_PROOF_SIZE} bytes)`,
|
|
22
|
-
description: "The 'proof' string field must be non-empty and ≤ MAX_PROOF_SIZE bytes. Move aborts with E_MAX_PROOF_SIZE (1) on overflow. " +
|
|
23
|
-
"Typically holds a merkle root or compact digest — large data should go in a Repository.",
|
|
24
|
-
passed,
|
|
25
|
-
evidence: `length=${len}, limit=${MAX_PROOF_SIZE}`,
|
|
26
|
-
fix_hint: `Keep proof content compact. Current overflow: ${Math.max(0, len - MAX_PROOF_SIZE)} bytes.`,
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
function checkServerPubkey(input) {
|
|
30
|
-
const len = input.server_pubkey?.length ?? 0;
|
|
31
|
-
const passed = len > 0 && len <= MAX_SERVER_PUBKEY_SIZE;
|
|
32
|
-
return {
|
|
33
|
-
id: "C-PROOF-03",
|
|
34
|
-
severity: passed ? "info" : "block",
|
|
35
|
-
title: `server_pubkey within MAX_SERVER_PUBKEY_SIZE (${MAX_SERVER_PUBKEY_SIZE} bytes)`,
|
|
36
|
-
description: "server_pubkey must be non-empty and ≤ MAX_SERVER_PUBKEY_SIZE bytes. Move aborts with E_MAX_SERVER_PUBKEY_SIZE (2). " +
|
|
37
|
-
"Submit raw public key bytes (hex-encoded), not a certificate chain.",
|
|
38
|
-
passed,
|
|
39
|
-
evidence: `length=${len}, limit=${MAX_SERVER_PUBKEY_SIZE}`,
|
|
40
|
-
fix_hint: "Submit only the raw public key (Ed25519=32B, RSA-2048=256B, BLS12-381 G1=48B, G2=96B).",
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
function checkServerSignature(input) {
|
|
44
|
-
const len = input.server_signature?.length ?? 0;
|
|
45
|
-
const passed = len > 0 && len <= MAX_SERVER_SIGNATURE_SIZE;
|
|
46
|
-
return {
|
|
47
|
-
id: "C-PROOF-04",
|
|
48
|
-
severity: passed ? "info" : "block",
|
|
49
|
-
title: `server_signature within MAX_SERVER_SIGNATURE_SIZE (${MAX_SERVER_SIGNATURE_SIZE} bytes)`,
|
|
50
|
-
description: "server_signature must be non-empty and ≤ MAX_SERVER_SIGNATURE_SIZE bytes. Move aborts with E_MAX_SERVER_SIGNATURE_SIZE (3). " +
|
|
51
|
-
"Submit raw signature bytes, not bundled metadata.",
|
|
52
|
-
passed,
|
|
53
|
-
evidence: `length=${len}, limit=${MAX_SERVER_SIGNATURE_SIZE}`,
|
|
54
|
-
fix_hint: "Submit only the raw signature (Ed25519=64B, ECDSA=64-72B, BLS12-381=96B, RSA-2048=256B).",
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
function checkProofType(input) {
|
|
58
|
-
if (input.proof_type === undefined || input.proof_type === null) {
|
|
59
|
-
return {
|
|
60
|
-
id: "C-PROOF-05",
|
|
61
|
-
severity: "block",
|
|
62
|
-
title: "proof_type is provided",
|
|
63
|
-
description: `proof_type is a required u64. ${WOWOK_WTS_PROOF_TYPE}=WOWOK_WTS_PROOF_TYPE (WTS proof); 2-100 reserved for Wowok; >100 user-defined.`,
|
|
64
|
-
passed: false,
|
|
65
|
-
evidence: "undefined",
|
|
66
|
-
fix_hint: `Use ${WOWOK_WTS_PROOF_TYPE} for WTS proofs, or >100 for custom types.`,
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
const n = typeof input.proof_type === "string" ? BigInt(input.proof_type) : BigInt(input.proof_type);
|
|
70
|
-
const passed = n >= 1n;
|
|
71
|
-
const severity = passed
|
|
72
|
-
? (n > 1n && n <= 100n ? "warn" : "info")
|
|
73
|
-
: "block";
|
|
74
|
-
return {
|
|
75
|
-
id: "C-PROOF-05",
|
|
76
|
-
severity,
|
|
77
|
-
title: `proof_type valid (${WOWOK_WTS_PROOF_TYPE}=WTS, 2-100 reserved, >100 user-defined)`,
|
|
78
|
-
description: `proof_type must be ≥ 1 (P-PROOF-P2-2). Value ${WOWOK_WTS_PROOF_TYPE}=WOWOK_WTS_PROOF_TYPE (WTS proof signed by off-chain server). ` +
|
|
79
|
-
`Values 2-100 are reserved for future Wowok-defined types — using them without authority creates semantic confusion.`,
|
|
80
|
-
passed,
|
|
81
|
-
evidence: `proof_type=${input.proof_type}`,
|
|
82
|
-
fix_hint: passed ? undefined : `Use ≥ 1. For custom types, use > 100.`,
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
function checkAboutAddress(input) {
|
|
86
|
-
const addr = input.about_address;
|
|
87
|
-
if (addr === null || addr === undefined || addr === "") {
|
|
88
|
-
return {
|
|
89
|
-
id: "C-PROOF-06",
|
|
90
|
-
severity: "info",
|
|
91
|
-
title: "about_address is null → free-standing Proof (no on-chain entity binding)",
|
|
92
|
-
description: "about_address=null is valid (PF-D-1=A, SDK sends Option::none). Use this for free-standing cryptographic statements. " +
|
|
93
|
-
"For entity-bound attestations, set about_address to the on-chain entity address (raw 0x-prefixed, not a name).",
|
|
94
|
-
passed: true,
|
|
95
|
-
evidence: "null/empty → Option::none",
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
const isValid = /^0x[0-9a-fA-F]{64}$/.test(addr);
|
|
99
|
-
return {
|
|
100
|
-
id: "C-PROOF-06",
|
|
101
|
-
severity: isValid ? "info" : "block",
|
|
102
|
-
title: "about_address is a valid raw 0x-prefixed address (or null)",
|
|
103
|
-
description: "When provided, about_address must be a raw address (NOT a name). SDK isValidAddress check enforces 0x-prefixed 64-hex format. " +
|
|
104
|
-
"Name resolution is NOT performed at the SDK layer for this field.",
|
|
105
|
-
passed: isValid,
|
|
106
|
-
evidence: `about_address=${addr.substring(0, 10)}...`,
|
|
107
|
-
fix_hint: "Use 0x-prefixed 64-hex address. Names are not accepted.",
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
function checkItemCount(input) {
|
|
111
|
-
if (input.item_count === undefined || input.item_count === null) {
|
|
112
|
-
return {
|
|
113
|
-
id: "C-PROOF-07",
|
|
114
|
-
severity: "info",
|
|
115
|
-
title: "item_count is optional (null → Option::none)",
|
|
116
|
-
description: "item_count is an optional u64. Use it to indicate the number of items in the off-chain data structure (e.g. merkle tree leaf count). " +
|
|
117
|
-
"When null, SDK sends Option::none to Move.",
|
|
118
|
-
passed: true,
|
|
119
|
-
evidence: "optional/none",
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
const n = typeof input.item_count === "string" ? BigInt(input.item_count) : BigInt(input.item_count);
|
|
123
|
-
const passed = n >= 0n;
|
|
124
|
-
return {
|
|
125
|
-
id: "C-PROOF-07",
|
|
126
|
-
severity: passed ? "info" : "block",
|
|
127
|
-
title: "item_count is a non-negative u64 (or null)",
|
|
128
|
-
description: "When provided, item_count must be ≥ 0. Used to indicate off-chain data structure size (e.g. merkle leaf count).",
|
|
129
|
-
passed,
|
|
130
|
-
evidence: `item_count=${input.item_count}`,
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
function checkNamedNew(input) {
|
|
134
|
-
const has = !!input.namedNew;
|
|
135
|
-
return {
|
|
136
|
-
id: "C-PROOF-08",
|
|
137
|
-
severity: has ? "info" : "warn",
|
|
138
|
-
title: "namedNew is provided (recommended for discoverability)",
|
|
139
|
-
description: "namedNew={name, tag?} is optional but recommended. Without it, the Proof is created without a local mark, " +
|
|
140
|
-
"making it harder to reference in subsequent operations. The 'name' should be descriptive (e.g. \"kyc_user_abc\").",
|
|
141
|
-
passed: has,
|
|
142
|
-
evidence: has ? `name=${input.namedNew.name}` : "not provided",
|
|
143
|
-
fix_hint: "Provide namedNew={name: \"descriptive_name\"} for easier subsequent reference.",
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
export function preCheckProofCreation(input) {
|
|
147
|
-
return [
|
|
148
|
-
checkDescription(input),
|
|
149
|
-
checkProofContent(input),
|
|
150
|
-
checkServerPubkey(input),
|
|
151
|
-
checkServerSignature(input),
|
|
152
|
-
checkProofType(input),
|
|
153
|
-
checkAboutAddress(input),
|
|
154
|
-
checkItemCount(input),
|
|
155
|
-
checkNamedNew(input),
|
|
156
|
-
];
|
|
157
|
-
}
|
|
158
|
-
export function canCreateProof(input) {
|
|
159
|
-
const items = preCheckProofCreation(input);
|
|
160
|
-
return {
|
|
161
|
-
canCreate: items.every(i => i.severity !== "block" || i.passed),
|
|
162
|
-
blockers: items.filter(i => i.severity === "block" && !i.passed),
|
|
163
|
-
warnings: items.filter(i => i.severity === "warn" && !i.passed),
|
|
164
|
-
info: items.filter(i => i.severity === "info"),
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
export function formatProofCreationSummary(input) {
|
|
168
|
-
const { canCreate, blockers, warnings, info } = canCreateProof(input);
|
|
169
|
-
const lines = [];
|
|
170
|
-
lines.push(canCreate ? "✓ Proof creation pre-check PASSED" : "✗ Proof creation pre-check FAILED");
|
|
171
|
-
lines.push("");
|
|
172
|
-
if (blockers.length > 0) {
|
|
173
|
-
lines.push("BLOCKERS (must fix before creation):");
|
|
174
|
-
blockers.forEach(b => lines.push(` [${b.id}] ${b.title} — ${b.evidence ?? ""}`));
|
|
175
|
-
lines.push("");
|
|
176
|
-
}
|
|
177
|
-
if (warnings.length > 0) {
|
|
178
|
-
lines.push("WARNINGS (review recommended):");
|
|
179
|
-
warnings.forEach(w => lines.push(` [${w.id}] ${w.title} — ${w.evidence ?? ""}`));
|
|
180
|
-
lines.push("");
|
|
181
|
-
}
|
|
182
|
-
if (info.length > 0) {
|
|
183
|
-
lines.push("INFO:");
|
|
184
|
-
info.forEach(i => lines.push(` [${i.id}] ${i.title}`));
|
|
185
|
-
}
|
|
186
|
-
return lines.join("\n");
|
|
187
|
-
}
|
|
1
|
+
import{MAX_PROOF_SIZE,MAX_SERVER_PUBKEY_SIZE,MAX_SERVER_SIGNATURE_SIZE,WOWOK_WTS_PROOF_TYPE}from'@wowok/wowok';function checkDescription(a){const b=!!a['description']&&a['description']['length']>0x0;return{'id':'C-PROOF-01','severity':b?'info':'warn','title':'description\x20is\x20provided\x20and\x20non-empty','description':'description\x20is\x20a\x20REQUIRED\x20field\x20(PF-D-2=A).\x20Move\x20contract\x20stores\x20it\x20as\x20String;\x20SDK\x20enforces\x20isValidDescription.\x20'+'Empty\x20string\x20(\x22\x22)\x20is\x20technically\x20valid\x20but\x20makes\x20the\x20Proof\x20hard\x20to\x20identify\x20in\x20queries.','passed':b,'evidence':a['description']===undefined?'undefined':'length='+a['description']['length'],'fix_hint':'Provide\x20a\x20one-line\x20description\x20like\x20\x22KYC\x20attestation\x20for\x20user\x200xabc\x22.'};}function checkProofContent(a){const b=a['proof']?.['length']??0x0,c=b>0x0&&b<=MAX_PROOF_SIZE;return{'id':'C-PROOF-02','severity':c?'info':'block','title':'proof\x20content\x20within\x20MAX_PROOF_SIZE\x20('+MAX_PROOF_SIZE+'\x20bytes)','description':'The\x20\x27proof\x27\x20string\x20field\x20must\x20be\x20non-empty\x20and\x20≤\x20MAX_PROOF_SIZE\x20bytes.\x20Move\x20aborts\x20with\x20E_MAX_PROOF_SIZE\x20(1)\x20on\x20overflow.\x20'+'Typically\x20holds\x20a\x20merkle\x20root\x20or\x20compact\x20digest\x20—\x20large\x20data\x20should\x20go\x20in\x20a\x20Repository.','passed':c,'evidence':'length='+b+',\x20limit='+MAX_PROOF_SIZE,'fix_hint':'Keep\x20proof\x20content\x20compact.\x20Current\x20overflow:\x20'+Math['max'](0x0,b-MAX_PROOF_SIZE)+'\x20bytes.'};}function checkServerPubkey(a){const b=a['server_pubkey']?.['length']??0x0,c=b>0x0&&b<=MAX_SERVER_PUBKEY_SIZE;return{'id':'C-PROOF-03','severity':c?'info':'block','title':'server_pubkey\x20within\x20MAX_SERVER_PUBKEY_SIZE\x20('+MAX_SERVER_PUBKEY_SIZE+'\x20bytes)','description':'server_pubkey\x20must\x20be\x20non-empty\x20and\x20≤\x20MAX_SERVER_PUBKEY_SIZE\x20bytes.\x20Move\x20aborts\x20with\x20E_MAX_SERVER_PUBKEY_SIZE\x20(2).\x20'+'Submit\x20raw\x20public\x20key\x20bytes\x20(hex-encoded),\x20not\x20a\x20certificate\x20chain.','passed':c,'evidence':'length='+b+',\x20limit='+MAX_SERVER_PUBKEY_SIZE,'fix_hint':'Submit\x20only\x20the\x20raw\x20public\x20key\x20(Ed25519=32B,\x20RSA-2048=256B,\x20BLS12-381\x20G1=48B,\x20G2=96B).'};}function checkServerSignature(a){const b=a['server_signature']?.['length']??0x0,c=b>0x0&&b<=MAX_SERVER_SIGNATURE_SIZE;return{'id':'C-PROOF-04','severity':c?'info':'block','title':'server_signature\x20within\x20MAX_SERVER_SIGNATURE_SIZE\x20('+MAX_SERVER_SIGNATURE_SIZE+'\x20bytes)','description':'server_signature\x20must\x20be\x20non-empty\x20and\x20≤\x20MAX_SERVER_SIGNATURE_SIZE\x20bytes.\x20Move\x20aborts\x20with\x20E_MAX_SERVER_SIGNATURE_SIZE\x20(3).\x20'+'Submit\x20raw\x20signature\x20bytes,\x20not\x20bundled\x20metadata.','passed':c,'evidence':'length='+b+',\x20limit='+MAX_SERVER_SIGNATURE_SIZE,'fix_hint':'Submit\x20only\x20the\x20raw\x20signature\x20(Ed25519=64B,\x20ECDSA=64-72B,\x20BLS12-381=96B,\x20RSA-2048=256B).'};}function checkProofType(a){if(a['proof_type']===undefined||a['proof_type']===null)return{'id':'C-PROOF-05','severity':'block','title':'proof_type\x20is\x20provided','description':'proof_type\x20is\x20a\x20required\x20u64.\x20'+WOWOK_WTS_PROOF_TYPE+'=WOWOK_WTS_PROOF_TYPE\x20(WTS\x20proof);\x202-100\x20reserved\x20for\x20Wowok;\x20>100\x20user-defined.','passed':![],'evidence':'undefined','fix_hint':'Use\x20'+WOWOK_WTS_PROOF_TYPE+'\x20for\x20WTS\x20proofs,\x20or\x20>100\x20for\x20custom\x20types.'};const b=typeof a['proof_type']==='string'?BigInt(a['proof_type']):BigInt(a['proof_type']),c=b>=0x1n,d=c?b>0x1n&&b<=0x64n?'warn':'info':'block';return{'id':'C-PROOF-05','severity':d,'title':'proof_type\x20valid\x20('+WOWOK_WTS_PROOF_TYPE+'=WTS,\x202-100\x20reserved,\x20>100\x20user-defined)','description':'proof_type\x20must\x20be\x20≥\x201\x20(P-PROOF-P2-2).\x20Value\x20'+WOWOK_WTS_PROOF_TYPE+'=WOWOK_WTS_PROOF_TYPE\x20(WTS\x20proof\x20signed\x20by\x20off-chain\x20server).\x20'+'Values\x202-100\x20are\x20reserved\x20for\x20future\x20Wowok-defined\x20types\x20—\x20using\x20them\x20without\x20authority\x20creates\x20semantic\x20confusion.','passed':c,'evidence':'proof_type='+a['proof_type'],'fix_hint':c?undefined:'Use\x20≥\x201.\x20For\x20custom\x20types,\x20use\x20>\x20100.'};}function checkAboutAddress(a){const b=a['about_address'];if(b===null||b===undefined||b==='')return{'id':'C-PROOF-06','severity':'info','title':'about_address\x20is\x20null\x20→\x20free-standing\x20Proof\x20(no\x20on-chain\x20entity\x20binding)','description':'about_address=null\x20is\x20valid\x20(PF-D-1=A,\x20SDK\x20sends\x20Option::none).\x20Use\x20this\x20for\x20free-standing\x20cryptographic\x20statements.\x20'+'For\x20entity-bound\x20attestations,\x20set\x20about_address\x20to\x20the\x20on-chain\x20entity\x20address\x20(raw\x200x-prefixed,\x20not\x20a\x20name).','passed':!![],'evidence':'null/empty\x20→\x20Option::none'};const c=/^0x[0-9a-fA-F]{64}$/['test'](b);return{'id':'C-PROOF-06','severity':c?'info':'block','title':'about_address\x20is\x20a\x20valid\x20raw\x200x-prefixed\x20address\x20(or\x20null)','description':'When\x20provided,\x20about_address\x20must\x20be\x20a\x20raw\x20address\x20(NOT\x20a\x20name).\x20SDK\x20isValidAddress\x20check\x20enforces\x200x-prefixed\x2064-hex\x20format.\x20'+'Name\x20resolution\x20is\x20NOT\x20performed\x20at\x20the\x20SDK\x20layer\x20for\x20this\x20field.','passed':c,'evidence':'about_address='+b['substring'](0x0,0xa)+'...','fix_hint':'Use\x200x-prefixed\x2064-hex\x20address.\x20Names\x20are\x20not\x20accepted.'};}function checkItemCount(a){if(a['item_count']===undefined||a['item_count']===null)return{'id':'C-PROOF-07','severity':'info','title':'item_count\x20is\x20optional\x20(null\x20→\x20Option::none)','description':'item_count\x20is\x20an\x20optional\x20u64.\x20Use\x20it\x20to\x20indicate\x20the\x20number\x20of\x20items\x20in\x20the\x20off-chain\x20data\x20structure\x20(e.g.\x20merkle\x20tree\x20leaf\x20count).\x20'+'When\x20null,\x20SDK\x20sends\x20Option::none\x20to\x20Move.','passed':!![],'evidence':'optional/none'};const b=typeof a['item_count']==='string'?BigInt(a['item_count']):BigInt(a['item_count']),c=b>=0x0n;return{'id':'C-PROOF-07','severity':c?'info':'block','title':'item_count\x20is\x20a\x20non-negative\x20u64\x20(or\x20null)','description':'When\x20provided,\x20item_count\x20must\x20be\x20≥\x200.\x20Used\x20to\x20indicate\x20off-chain\x20data\x20structure\x20size\x20(e.g.\x20merkle\x20leaf\x20count).','passed':c,'evidence':'item_count='+a['item_count']};}function checkNamedNew(a){const b=!!a['namedNew'];return{'id':'C-PROOF-08','severity':b?'info':'warn','title':'namedNew\x20is\x20provided\x20(recommended\x20for\x20discoverability)','description':'namedNew={name,\x20tag?}\x20is\x20optional\x20but\x20recommended.\x20Without\x20it,\x20the\x20Proof\x20is\x20created\x20without\x20a\x20local\x20mark,\x20'+'making\x20it\x20harder\x20to\x20reference\x20in\x20subsequent\x20operations.\x20The\x20\x27name\x27\x20should\x20be\x20descriptive\x20(e.g.\x20\x22kyc_user_abc\x22).','passed':b,'evidence':b?'name='+a['namedNew']['name']:'not\x20provided','fix_hint':'Provide\x20namedNew={name:\x20\x22descriptive_name\x22}\x20for\x20easier\x20subsequent\x20reference.'};}export function preCheckProofCreation(a){return[checkDescription(a),checkProofContent(a),checkServerPubkey(a),checkServerSignature(a),checkProofType(a),checkAboutAddress(a),checkItemCount(a),checkNamedNew(a)];}export function canCreateProof(a){const b=preCheckProofCreation(a);return{'canCreate':b['every'](c=>c['severity']!=='block'||c['passed']),'blockers':b['filter'](c=>c['severity']==='block'&&!c['passed']),'warnings':b['filter'](c=>c['severity']==='warn'&&!c['passed']),'info':b['filter'](c=>c['severity']==='info')};}export function formatProofCreationSummary(a){const {canCreate:b,blockers:c,warnings:d,info:e}=canCreateProof(a),f=[];return f['push'](b?'✓\x20Proof\x20creation\x20pre-check\x20PASSED':'✗\x20Proof\x20creation\x20pre-check\x20FAILED'),f['push'](''),c['length']>0x0&&(f['push']('BLOCKERS\x20(must\x20fix\x20before\x20creation):'),c['forEach'](g=>f['push']('\x20\x20['+g['id']+']\x20'+g['title']+'\x20—\x20'+(g['evidence']??''))),f['push']('')),d['length']>0x0&&(f['push']('WARNINGS\x20(review\x20recommended):'),d['forEach'](g=>f['push']('\x20\x20['+g['id']+']\x20'+g['title']+'\x20—\x20'+(g['evidence']??''))),f['push']('')),e['length']>0x0&&(f['push']('INFO:'),e['forEach'](g=>f['push']('\x20\x20['+g['id']+']\x20'+g['title']))),f['join']('\x0a');}
|
|
@@ -1,207 +1 @@
|
|
|
1
|
-
import { MAX_PROOF_SIZE, MAX_SERVER_PUBKEY_SIZE, MAX_SERVER_SIGNATURE_SIZE, WOWOK_WTS_PROOF_TYPE, } from "@wowok/wowok";
|
|
2
|
-
const R_PR_1_01 = {
|
|
3
|
-
rule: {
|
|
4
|
-
id: "R-PROOF-01",
|
|
5
|
-
level: "HIGH",
|
|
6
|
-
category: "structural",
|
|
7
|
-
title: `proof content exceeds MAX_PROOF_SIZE (${MAX_PROOF_SIZE} bytes)`,
|
|
8
|
-
description: `The 'proof' string field is bounded by MAX_PROOF_SIZE=${MAX_PROOF_SIZE} bytes (Move source: proof.move:27). ` +
|
|
9
|
-
`Exceeding this limit aborts with E_MAX_PROOF_SIZE (1). The proof content typically holds a merkle tree root ` +
|
|
10
|
-
`or similar compact cryptographic digest — large data should be stored in a Repository and referenced by address, ` +
|
|
11
|
-
`not inlined into the Proof object.`,
|
|
12
|
-
affected_stakeholders: ["creator"],
|
|
13
|
-
scenario: "Caller submits a proof string longer than 10240 bytes",
|
|
14
|
-
mitigation: `Keep proof content compact (merkle root, hash digest). For larger payloads, store data in a Repository ` +
|
|
15
|
-
`object and set about_address to the Repository address, or use item_count to indicate the off-chain data size.`,
|
|
16
|
-
related_move_error: "E_MAX_PROOF_SIZE (1)",
|
|
17
|
-
auto_fixable: false,
|
|
18
|
-
},
|
|
19
|
-
check: (ctx) => {
|
|
20
|
-
if (!ctx.proof)
|
|
21
|
-
return null;
|
|
22
|
-
if (ctx.proof.length <= MAX_PROOF_SIZE)
|
|
23
|
-
return null;
|
|
24
|
-
return { ...R_PR_1_01.rule, evidence: `proof.length=${ctx.proof.length}, limit=${MAX_PROOF_SIZE}` };
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
const R_PR_1_02 = {
|
|
28
|
-
rule: {
|
|
29
|
-
id: "R-PROOF-02",
|
|
30
|
-
level: "MEDIUM",
|
|
31
|
-
category: "structural",
|
|
32
|
-
title: `server_pubkey exceeds MAX_SERVER_PUBKEY_SIZE (${MAX_SERVER_PUBKEY_SIZE} bytes)`,
|
|
33
|
-
description: `The 'server_pubkey' field is bounded by MAX_SERVER_PUBKEY_SIZE=${MAX_SERVER_PUBKEY_SIZE} bytes (Move source: proof.move:28). ` +
|
|
34
|
-
`Exceeding this limit aborts with E_MAX_SERVER_PUBKEY_SIZE (2). Typical public keys (Ed25519=32 bytes, RSA-2048=256 bytes, ` +
|
|
35
|
-
`BLS12-381 G1=48 bytes, G2=96 bytes) fit comfortably within this limit.`,
|
|
36
|
-
affected_stakeholders: ["creator"],
|
|
37
|
-
scenario: "Caller submits an oversized server public key (e.g. certificate chain instead of raw key)",
|
|
38
|
-
mitigation: "Submit only the raw public key bytes (hex-encoded), not a full certificate or JWK structure.",
|
|
39
|
-
related_move_error: "E_MAX_SERVER_PUBKEY_SIZE (2)",
|
|
40
|
-
auto_fixable: false,
|
|
41
|
-
},
|
|
42
|
-
check: (ctx) => {
|
|
43
|
-
if (!ctx.server_pubkey)
|
|
44
|
-
return null;
|
|
45
|
-
if (ctx.server_pubkey.length <= MAX_SERVER_PUBKEY_SIZE)
|
|
46
|
-
return null;
|
|
47
|
-
return { ...R_PR_1_02.rule, evidence: `server_pubkey.length=${ctx.server_pubkey.length}, limit=${MAX_SERVER_PUBKEY_SIZE}` };
|
|
48
|
-
},
|
|
49
|
-
};
|
|
50
|
-
const R_PR_1_03 = {
|
|
51
|
-
rule: {
|
|
52
|
-
id: "R-PROOF-03",
|
|
53
|
-
level: "MEDIUM",
|
|
54
|
-
category: "structural",
|
|
55
|
-
title: `server_signature exceeds MAX_SERVER_SIGNATURE_SIZE (${MAX_SERVER_SIGNATURE_SIZE} bytes)`,
|
|
56
|
-
description: `The 'server_signature' field is bounded by MAX_SERVER_SIGNATURE_SIZE=${MAX_SERVER_SIGNATURE_SIZE} bytes ` +
|
|
57
|
-
`(Move source: proof.move:29). Exceeding this limit aborts with E_MAX_SERVER_SIGNATURE_SIZE (3). ` +
|
|
58
|
-
`Most signature schemes produce signatures well under this limit (Ed25519=64 bytes, ECDSA=64-72 bytes, ` +
|
|
59
|
-
`BLS12-381=96 bytes, RSA-2048=256 bytes).`,
|
|
60
|
-
affected_stakeholders: ["creator"],
|
|
61
|
-
scenario: "Caller submits an oversized signature (e.g. bundled with metadata)",
|
|
62
|
-
mitigation: "Submit only the raw signature bytes (hex-encoded), not bundled metadata or certificate chains.",
|
|
63
|
-
related_move_error: "E_MAX_SERVER_SIGNATURE_SIZE (3)",
|
|
64
|
-
auto_fixable: false,
|
|
65
|
-
},
|
|
66
|
-
check: (ctx) => {
|
|
67
|
-
if (!ctx.server_signature)
|
|
68
|
-
return null;
|
|
69
|
-
if (ctx.server_signature.length <= MAX_SERVER_SIGNATURE_SIZE)
|
|
70
|
-
return null;
|
|
71
|
-
return { ...R_PR_1_03.rule, evidence: `server_signature.length=${ctx.server_signature.length}, limit=${MAX_SERVER_SIGNATURE_SIZE}` };
|
|
72
|
-
},
|
|
73
|
-
};
|
|
74
|
-
const R_PR_2_01 = {
|
|
75
|
-
rule: {
|
|
76
|
-
id: "R-PROOF-04",
|
|
77
|
-
level: "MEDIUM",
|
|
78
|
-
category: "semantic",
|
|
79
|
-
title: `proof_type in reserved range without authority (1-100 reserved for Wowok)`,
|
|
80
|
-
description: `proof_type=${WOWOK_WTS_PROOF_TYPE} is WOWOK_WTS_PROOF_TYPE (Will-To-Sign). Values 2-100 are reserved for ` +
|
|
81
|
-
`future Wowok-defined proof types. User-defined proof types must use values > 100. While the Move contract ` +
|
|
82
|
-
`does not currently enforce this range at the type level (it accepts any u64), using a reserved value without ` +
|
|
83
|
-
`authority creates semantic confusion: consumers may misinterpret the proof's verification rules.`,
|
|
84
|
-
affected_stakeholders: ["creator", "consumer", "verifier"],
|
|
85
|
-
scenario: "User creates a custom proof with proof_type=5 (a reserved value)",
|
|
86
|
-
mitigation: "Use proof_type > 100 for user-defined proof types. Use proof_type=1 only for WTS proofs signed by an " +
|
|
87
|
-
"off-chain server (with server_pubkey + server_signature). Document the verification rule for custom types.",
|
|
88
|
-
auto_fixable: false,
|
|
89
|
-
},
|
|
90
|
-
check: (ctx) => {
|
|
91
|
-
if (ctx.proof_type === undefined || ctx.proof_type === null)
|
|
92
|
-
return null;
|
|
93
|
-
const n = typeof ctx.proof_type === "string" ? BigInt(ctx.proof_type) : BigInt(ctx.proof_type);
|
|
94
|
-
if (n === BigInt(WOWOK_WTS_PROOF_TYPE) || n > 100n)
|
|
95
|
-
return null;
|
|
96
|
-
return { ...R_PR_2_01.rule, evidence: `proof_type=${ctx.proof_type} (reserved range 2-100)` };
|
|
97
|
-
},
|
|
98
|
-
};
|
|
99
|
-
const R_PR_2_02 = {
|
|
100
|
-
rule: {
|
|
101
|
-
id: "R-PROOF-05",
|
|
102
|
-
level: "LOW",
|
|
103
|
-
category: "semantic",
|
|
104
|
-
title: "about_address not provided — consumers cannot locate the referenced entity",
|
|
105
|
-
description: "about_address is the on-chain address of the entity being proved (e.g. a user, an order, a Repository). " +
|
|
106
|
-
"When null/undefined, the Proof has no on-chain binding — it is a free-standing cryptographic statement. " +
|
|
107
|
-
"Consumers (Repository, Service, etc.) that reference this Proof cannot automatically resolve which entity " +
|
|
108
|
-
"it applies to. This is acceptable for generic proofs but problematic for entity-bound attestations.",
|
|
109
|
-
affected_stakeholders: ["creator", "consumer"],
|
|
110
|
-
scenario: "Caller creates a Proof without about_address, then a Repository tries to bind it to a data entry",
|
|
111
|
-
mitigation: "Set about_address when the Proof attests to a specific on-chain entity. Leave it null only for " +
|
|
112
|
-
"free-standing cryptographic statements (e.g. a server's timestamp attestation).",
|
|
113
|
-
auto_fixable: true,
|
|
114
|
-
},
|
|
115
|
-
check: (ctx) => {
|
|
116
|
-
if (ctx.about_address)
|
|
117
|
-
return null;
|
|
118
|
-
return { ...R_PR_2_02.rule, evidence: "about_address=null/undefined" };
|
|
119
|
-
},
|
|
120
|
-
};
|
|
121
|
-
const R_PR_3_01 = {
|
|
122
|
-
rule: {
|
|
123
|
-
id: "R-PROOF-06",
|
|
124
|
-
level: "LOW",
|
|
125
|
-
category: "lifecycle",
|
|
126
|
-
title: "description missing — Proof hard to identify in queries and audit logs",
|
|
127
|
-
description: "description is a REQUIRED field (PF-D-2=A). The Move contract stores it as a String field and SDK " +
|
|
128
|
-
"passes it to create_wowok_proof. An empty description (\"\") is technically valid but makes the Proof " +
|
|
129
|
-
"hard to identify in query results and audit logs. Non-empty descriptions are strongly recommended.",
|
|
130
|
-
affected_stakeholders: ["creator", "verifier"],
|
|
131
|
-
scenario: "Caller passes description=\"\" to save typing",
|
|
132
|
-
mitigation: "Provide a one-line description like \"KYC attestation for user 0xabc\" or \"merkle root for batch #42\".",
|
|
133
|
-
auto_fixable: false,
|
|
134
|
-
},
|
|
135
|
-
check: (ctx) => {
|
|
136
|
-
if (ctx.description === undefined)
|
|
137
|
-
return null;
|
|
138
|
-
if (ctx.description.length > 0)
|
|
139
|
-
return null;
|
|
140
|
-
return { ...R_PR_3_01.rule, evidence: "description=\"\" (empty)" };
|
|
141
|
-
},
|
|
142
|
-
};
|
|
143
|
-
const R_PR_3_02 = {
|
|
144
|
-
rule: {
|
|
145
|
-
id: "R-PROOF-07",
|
|
146
|
-
level: "HIGH",
|
|
147
|
-
category: "lifecycle",
|
|
148
|
-
title: "Proof is immutable — cannot modify after creation (freeze_object)",
|
|
149
|
-
description: "Proof is created via transfer::freeze_object(obj) in Move (proof.move:65). Once frozen, the object " +
|
|
150
|
-
"cannot be modified, transferred, or deleted. All fields (proof, server_pubkey, server_signature, " +
|
|
151
|
-
"about, proof_type, signer, time, description, item_count) are permanently fixed at the value set " +
|
|
152
|
-
"during create_wowok_proof(). To 'update' a Proof, create a new one and update references.",
|
|
153
|
-
affected_stakeholders: ["creator", "consumer"],
|
|
154
|
-
scenario: "Caller wants to update server_signature after key rotation — cannot, must create new Proof",
|
|
155
|
-
mitigation: "Verify all fields before calling create_wowok_proof. For scenarios requiring key rotation, " +
|
|
156
|
-
"create a new Proof and update the referencing object (Repository data, Service config, etc.) to " +
|
|
157
|
-
"point to the new Proof address.",
|
|
158
|
-
auto_fixable: false,
|
|
159
|
-
},
|
|
160
|
-
check: (ctx) => null,
|
|
161
|
-
};
|
|
162
|
-
const R_PR_4_01 = {
|
|
163
|
-
rule: {
|
|
164
|
-
id: "R-PROOF-08",
|
|
165
|
-
level: "INFO",
|
|
166
|
-
category: "knowledge",
|
|
167
|
-
title: "Knowledge layer & constant sync — RESOLVED",
|
|
168
|
-
description: "All 4 Proof constants (WOWOK_WTS_PROOF_TYPE, MAX_PROOF_SIZE, MAX_SERVER_PUBKEY_SIZE, " +
|
|
169
|
-
"MAX_SERVER_SIGNATURE_SIZE) are now synced to onchain-constants.ts (P-PROOF-P2-5). The MCP Knowledge " +
|
|
170
|
-
"layer now includes proof-risk.ts, proof-confirm.ts, proof-translation.ts (P-PROOF-P2-6). " +
|
|
171
|
-
"This risk rule is retained for historical audit and to detect future regressions.",
|
|
172
|
-
affected_stakeholders: ["system"],
|
|
173
|
-
scenario: "Future regression: someone removes a Proof constant from onchain-constants.ts",
|
|
174
|
-
mitigation: "Run the onchain-constants sync test to detect drift.",
|
|
175
|
-
auto_fixable: false,
|
|
176
|
-
},
|
|
177
|
-
check: (ctx) => {
|
|
178
|
-
if (ctx.constants_synced)
|
|
179
|
-
return null;
|
|
180
|
-
return { ...R_PR_4_01.rule, evidence: "constants_synced=false" };
|
|
181
|
-
},
|
|
182
|
-
};
|
|
183
|
-
export const PROOF_RISK_RULES = [
|
|
184
|
-
R_PR_1_01,
|
|
185
|
-
R_PR_1_02,
|
|
186
|
-
R_PR_1_03,
|
|
187
|
-
R_PR_2_01,
|
|
188
|
-
R_PR_2_02,
|
|
189
|
-
R_PR_3_01,
|
|
190
|
-
R_PR_3_02,
|
|
191
|
-
R_PR_4_01,
|
|
192
|
-
];
|
|
193
|
-
export function checkProofRisks(ctx) {
|
|
194
|
-
const risks = [];
|
|
195
|
-
for (const rule of PROOF_RISK_RULES) {
|
|
196
|
-
const r = rule.check(ctx);
|
|
197
|
-
if (r)
|
|
198
|
-
risks.push(r);
|
|
199
|
-
}
|
|
200
|
-
if (!risks.find(r => r.id === "R-PROOF-07")) {
|
|
201
|
-
risks.push(R_PR_3_02.rule);
|
|
202
|
-
}
|
|
203
|
-
return risks;
|
|
204
|
-
}
|
|
205
|
-
export function getProofRiskById(id) {
|
|
206
|
-
return PROOF_RISK_RULES.find(r => r.rule.id === id)?.rule;
|
|
207
|
-
}
|
|
1
|
+
import{MAX_PROOF_SIZE,MAX_SERVER_PUBKEY_SIZE,MAX_SERVER_SIGNATURE_SIZE,WOWOK_WTS_PROOF_TYPE}from'@wowok/wowok';const R_PR_1_01={'rule':{'id':'R-PROOF-01','level':'HIGH','category':'structural','title':'proof\x20content\x20exceeds\x20MAX_PROOF_SIZE\x20('+MAX_PROOF_SIZE+'\x20bytes)','description':'The\x20\x27proof\x27\x20string\x20field\x20is\x20bounded\x20by\x20MAX_PROOF_SIZE='+MAX_PROOF_SIZE+'\x20bytes\x20(Move\x20source:\x20proof.move:27).\x20'+'Exceeding\x20this\x20limit\x20aborts\x20with\x20E_MAX_PROOF_SIZE\x20(1).\x20The\x20proof\x20content\x20typically\x20holds\x20a\x20merkle\x20tree\x20root\x20'+'or\x20similar\x20compact\x20cryptographic\x20digest\x20—\x20large\x20data\x20should\x20be\x20stored\x20in\x20a\x20Repository\x20and\x20referenced\x20by\x20address,\x20'+'not\x20inlined\x20into\x20the\x20Proof\x20object.','affected_stakeholders':['creator'],'scenario':'Caller\x20submits\x20a\x20proof\x20string\x20longer\x20than\x2010240\x20bytes','mitigation':'Keep\x20proof\x20content\x20compact\x20(merkle\x20root,\x20hash\x20digest).\x20For\x20larger\x20payloads,\x20store\x20data\x20in\x20a\x20Repository\x20'+'object\x20and\x20set\x20about_address\x20to\x20the\x20Repository\x20address,\x20or\x20use\x20item_count\x20to\x20indicate\x20the\x20off-chain\x20data\x20size.','related_move_error':'E_MAX_PROOF_SIZE\x20(1)','auto_fixable':![]},'check':a=>{if(!a['proof'])return null;if(a['proof']['length']<=MAX_PROOF_SIZE)return null;return{...R_PR_1_01['rule'],'evidence':'proof.length='+a['proof']['length']+',\x20limit='+MAX_PROOF_SIZE};}},R_PR_1_02={'rule':{'id':'R-PROOF-02','level':'MEDIUM','category':'structural','title':'server_pubkey\x20exceeds\x20MAX_SERVER_PUBKEY_SIZE\x20('+MAX_SERVER_PUBKEY_SIZE+'\x20bytes)','description':'The\x20\x27server_pubkey\x27\x20field\x20is\x20bounded\x20by\x20MAX_SERVER_PUBKEY_SIZE='+MAX_SERVER_PUBKEY_SIZE+'\x20bytes\x20(Move\x20source:\x20proof.move:28).\x20'+'Exceeding\x20this\x20limit\x20aborts\x20with\x20E_MAX_SERVER_PUBKEY_SIZE\x20(2).\x20Typical\x20public\x20keys\x20(Ed25519=32\x20bytes,\x20RSA-2048=256\x20bytes,\x20'+'BLS12-381\x20G1=48\x20bytes,\x20G2=96\x20bytes)\x20fit\x20comfortably\x20within\x20this\x20limit.','affected_stakeholders':['creator'],'scenario':'Caller\x20submits\x20an\x20oversized\x20server\x20public\x20key\x20(e.g.\x20certificate\x20chain\x20instead\x20of\x20raw\x20key)','mitigation':'Submit\x20only\x20the\x20raw\x20public\x20key\x20bytes\x20(hex-encoded),\x20not\x20a\x20full\x20certificate\x20or\x20JWK\x20structure.','related_move_error':'E_MAX_SERVER_PUBKEY_SIZE\x20(2)','auto_fixable':![]},'check':a=>{if(!a['server_pubkey'])return null;if(a['server_pubkey']['length']<=MAX_SERVER_PUBKEY_SIZE)return null;return{...R_PR_1_02['rule'],'evidence':'server_pubkey.length='+a['server_pubkey']['length']+',\x20limit='+MAX_SERVER_PUBKEY_SIZE};}},R_PR_1_03={'rule':{'id':'R-PROOF-03','level':'MEDIUM','category':'structural','title':'server_signature\x20exceeds\x20MAX_SERVER_SIGNATURE_SIZE\x20('+MAX_SERVER_SIGNATURE_SIZE+'\x20bytes)','description':'The\x20\x27server_signature\x27\x20field\x20is\x20bounded\x20by\x20MAX_SERVER_SIGNATURE_SIZE='+MAX_SERVER_SIGNATURE_SIZE+'\x20bytes\x20'+'(Move\x20source:\x20proof.move:29).\x20Exceeding\x20this\x20limit\x20aborts\x20with\x20E_MAX_SERVER_SIGNATURE_SIZE\x20(3).\x20'+'Most\x20signature\x20schemes\x20produce\x20signatures\x20well\x20under\x20this\x20limit\x20(Ed25519=64\x20bytes,\x20ECDSA=64-72\x20bytes,\x20'+'BLS12-381=96\x20bytes,\x20RSA-2048=256\x20bytes).','affected_stakeholders':['creator'],'scenario':'Caller\x20submits\x20an\x20oversized\x20signature\x20(e.g.\x20bundled\x20with\x20metadata)','mitigation':'Submit\x20only\x20the\x20raw\x20signature\x20bytes\x20(hex-encoded),\x20not\x20bundled\x20metadata\x20or\x20certificate\x20chains.','related_move_error':'E_MAX_SERVER_SIGNATURE_SIZE\x20(3)','auto_fixable':![]},'check':a=>{if(!a['server_signature'])return null;if(a['server_signature']['length']<=MAX_SERVER_SIGNATURE_SIZE)return null;return{...R_PR_1_03['rule'],'evidence':'server_signature.length='+a['server_signature']['length']+',\x20limit='+MAX_SERVER_SIGNATURE_SIZE};}},R_PR_2_01={'rule':{'id':'R-PROOF-04','level':'MEDIUM','category':'semantic','title':'proof_type\x20in\x20reserved\x20range\x20without\x20authority\x20(1-100\x20reserved\x20for\x20Wowok)','description':'proof_type='+WOWOK_WTS_PROOF_TYPE+'\x20is\x20WOWOK_WTS_PROOF_TYPE\x20(Will-To-Sign).\x20Values\x202-100\x20are\x20reserved\x20for\x20'+'future\x20Wowok-defined\x20proof\x20types.\x20User-defined\x20proof\x20types\x20must\x20use\x20values\x20>\x20100.\x20While\x20the\x20Move\x20contract\x20'+'does\x20not\x20currently\x20enforce\x20this\x20range\x20at\x20the\x20type\x20level\x20(it\x20accepts\x20any\x20u64),\x20using\x20a\x20reserved\x20value\x20without\x20'+'authority\x20creates\x20semantic\x20confusion:\x20consumers\x20may\x20misinterpret\x20the\x20proof\x27s\x20verification\x20rules.','affected_stakeholders':['creator','consumer','verifier'],'scenario':'User\x20creates\x20a\x20custom\x20proof\x20with\x20proof_type=5\x20(a\x20reserved\x20value)','mitigation':'Use\x20proof_type\x20>\x20100\x20for\x20user-defined\x20proof\x20types.\x20Use\x20proof_type=1\x20only\x20for\x20WTS\x20proofs\x20signed\x20by\x20an\x20'+'off-chain\x20server\x20(with\x20server_pubkey\x20+\x20server_signature).\x20Document\x20the\x20verification\x20rule\x20for\x20custom\x20types.','auto_fixable':![]},'check':a=>{if(a['proof_type']===undefined||a['proof_type']===null)return null;const b=typeof a['proof_type']==='string'?BigInt(a['proof_type']):BigInt(a['proof_type']);if(b===BigInt(WOWOK_WTS_PROOF_TYPE)||b>0x64n)return null;return{...R_PR_2_01['rule'],'evidence':'proof_type='+a['proof_type']+'\x20(reserved\x20range\x202-100)'};}},R_PR_2_02={'rule':{'id':'R-PROOF-05','level':'LOW','category':'semantic','title':'about_address\x20not\x20provided\x20—\x20consumers\x20cannot\x20locate\x20the\x20referenced\x20entity','description':'about_address\x20is\x20the\x20on-chain\x20address\x20of\x20the\x20entity\x20being\x20proved\x20(e.g.\x20a\x20user,\x20an\x20order,\x20a\x20Repository).\x20'+'When\x20null/undefined,\x20the\x20Proof\x20has\x20no\x20on-chain\x20binding\x20—\x20it\x20is\x20a\x20free-standing\x20cryptographic\x20statement.\x20'+'Consumers\x20(Repository,\x20Service,\x20etc.)\x20that\x20reference\x20this\x20Proof\x20cannot\x20automatically\x20resolve\x20which\x20entity\x20'+'it\x20applies\x20to.\x20This\x20is\x20acceptable\x20for\x20generic\x20proofs\x20but\x20problematic\x20for\x20entity-bound\x20attestations.','affected_stakeholders':['creator','consumer'],'scenario':'Caller\x20creates\x20a\x20Proof\x20without\x20about_address,\x20then\x20a\x20Repository\x20tries\x20to\x20bind\x20it\x20to\x20a\x20data\x20entry','mitigation':'Set\x20about_address\x20when\x20the\x20Proof\x20attests\x20to\x20a\x20specific\x20on-chain\x20entity.\x20Leave\x20it\x20null\x20only\x20for\x20'+'free-standing\x20cryptographic\x20statements\x20(e.g.\x20a\x20server\x27s\x20timestamp\x20attestation).','auto_fixable':!![]},'check':a=>{if(a['about_address'])return null;return{...R_PR_2_02['rule'],'evidence':'about_address=null/undefined'};}},R_PR_3_01={'rule':{'id':'R-PROOF-06','level':'LOW','category':'lifecycle','title':'description\x20missing\x20—\x20Proof\x20hard\x20to\x20identify\x20in\x20queries\x20and\x20audit\x20logs','description':'description\x20is\x20a\x20REQUIRED\x20field\x20(PF-D-2=A).\x20The\x20Move\x20contract\x20stores\x20it\x20as\x20a\x20String\x20field\x20and\x20SDK\x20'+'passes\x20it\x20to\x20create_wowok_proof.\x20An\x20empty\x20description\x20(\x22\x22)\x20is\x20technically\x20valid\x20but\x20makes\x20the\x20Proof\x20'+'hard\x20to\x20identify\x20in\x20query\x20results\x20and\x20audit\x20logs.\x20Non-empty\x20descriptions\x20are\x20strongly\x20recommended.','affected_stakeholders':['creator','verifier'],'scenario':'Caller\x20passes\x20description=\x22\x22\x20to\x20save\x20typing','mitigation':'Provide\x20a\x20one-line\x20description\x20like\x20\x22KYC\x20attestation\x20for\x20user\x200xabc\x22\x20or\x20\x22merkle\x20root\x20for\x20batch\x20#42\x22.','auto_fixable':![]},'check':a=>{if(a['description']===undefined)return null;if(a['description']['length']>0x0)return null;return{...R_PR_3_01['rule'],'evidence':'description=\x22\x22\x20(empty)'};}},R_PR_3_02={'rule':{'id':'R-PROOF-07','level':'HIGH','category':'lifecycle','title':'Proof\x20is\x20immutable\x20—\x20cannot\x20modify\x20after\x20creation\x20(freeze_object)','description':'Proof\x20is\x20created\x20via\x20transfer::freeze_object(obj)\x20in\x20Move\x20(proof.move:65).\x20Once\x20frozen,\x20the\x20object\x20'+'cannot\x20be\x20modified,\x20transferred,\x20or\x20deleted.\x20All\x20fields\x20(proof,\x20server_pubkey,\x20server_signature,\x20'+'about,\x20proof_type,\x20signer,\x20time,\x20description,\x20item_count)\x20are\x20permanently\x20fixed\x20at\x20the\x20value\x20set\x20'+'during\x20create_wowok_proof().\x20To\x20\x27update\x27\x20a\x20Proof,\x20create\x20a\x20new\x20one\x20and\x20update\x20references.','affected_stakeholders':['creator','consumer'],'scenario':'Caller\x20wants\x20to\x20update\x20server_signature\x20after\x20key\x20rotation\x20—\x20cannot,\x20must\x20create\x20new\x20Proof','mitigation':'Verify\x20all\x20fields\x20before\x20calling\x20create_wowok_proof.\x20For\x20scenarios\x20requiring\x20key\x20rotation,\x20'+'create\x20a\x20new\x20Proof\x20and\x20update\x20the\x20referencing\x20object\x20(Repository\x20data,\x20Service\x20config,\x20etc.)\x20to\x20'+'point\x20to\x20the\x20new\x20Proof\x20address.','auto_fixable':![]},'check':a=>null},R_PR_4_01={'rule':{'id':'R-PROOF-08','level':'INFO','category':'knowledge','title':'Knowledge\x20layer\x20&\x20constant\x20sync\x20—\x20RESOLVED','description':'All\x204\x20Proof\x20constants\x20(WOWOK_WTS_PROOF_TYPE,\x20MAX_PROOF_SIZE,\x20MAX_SERVER_PUBKEY_SIZE,\x20'+'MAX_SERVER_SIGNATURE_SIZE)\x20are\x20now\x20synced\x20to\x20onchain-constants.ts\x20(P-PROOF-P2-5).\x20The\x20MCP\x20Knowledge\x20'+'layer\x20now\x20includes\x20proof-risk.ts,\x20proof-confirm.ts,\x20proof-translation.ts\x20(P-PROOF-P2-6).\x20'+'This\x20risk\x20rule\x20is\x20retained\x20for\x20historical\x20audit\x20and\x20to\x20detect\x20future\x20regressions.','affected_stakeholders':['system'],'scenario':'Future\x20regression:\x20someone\x20removes\x20a\x20Proof\x20constant\x20from\x20onchain-constants.ts','mitigation':'Run\x20the\x20onchain-constants\x20sync\x20test\x20to\x20detect\x20drift.','auto_fixable':![]},'check':a=>{if(a['constants_synced'])return null;return{...R_PR_4_01['rule'],'evidence':'constants_synced=false'};}};export const PROOF_RISK_RULES=[R_PR_1_01,R_PR_1_02,R_PR_1_03,R_PR_2_01,R_PR_2_02,R_PR_3_01,R_PR_3_02,R_PR_4_01];export function checkProofRisks(a){const b=[];for(const c of PROOF_RISK_RULES){const d=c['check'](a);if(d)b['push'](d);}return!b['find'](e=>e['id']==='R-PROOF-07')&&b['push'](R_PR_3_02['rule']),b;}export function getProofRiskById(a){return PROOF_RISK_RULES['find'](b=>b['rule']['id']===a)?.['rule'];}
|