@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,283 +1 @@
|
|
|
1
|
-
import { WOWOK_WTS_PROOF_TYPE } from "@wowok/wowok";
|
|
2
|
-
export const SEMANTIC_TO_PROOF_SCHEMA_RULES = [
|
|
3
|
-
{
|
|
4
|
-
id: "P-PROOF-01",
|
|
5
|
-
pattern_name: "Wowok WTS (Will-To-Sign) proof",
|
|
6
|
-
proof_type_classification: "wts",
|
|
7
|
-
semantic_intent: "An off-chain server attests to a fact (identity, timestamp, merkle root) and signs it with server_pubkey. " +
|
|
8
|
-
"On-chain consumers verify the signature off-chain and trust the Proof record as evidence.",
|
|
9
|
-
match_keywords: ["wts", "server-signed", "attestation", "kyc", "merkle root", "timestamp"],
|
|
10
|
-
schema_elements: {
|
|
11
|
-
proof_type_value: WOWOK_WTS_PROOF_TYPE,
|
|
12
|
-
required_fields: ["proof", "server_pubkey", "server_signature", "description"],
|
|
13
|
-
optional_fields: ["item_count", "about_address", "namedNew"],
|
|
14
|
-
about_address_recommendation: "Set about_address when the WTS proof attests to a specific on-chain entity (user address, Repository, etc.). " +
|
|
15
|
-
"Leave null for free-standing attestations (e.g. server timestamp).",
|
|
16
|
-
},
|
|
17
|
-
constraints: [
|
|
18
|
-
`proof_type must equal ${WOWOK_WTS_PROOF_TYPE} (WOWOK_WTS_PROOF_TYPE)`,
|
|
19
|
-
"server_pubkey must be the raw public key (hex-encoded), not a certificate",
|
|
20
|
-
"server_signature must sign the exact bytes of the 'proof' field (or a documented pre-image)",
|
|
21
|
-
"Off-chain verification logic must be documented for consumers",
|
|
22
|
-
],
|
|
23
|
-
example: {
|
|
24
|
-
proof_type: WOWOK_WTS_PROOF_TYPE,
|
|
25
|
-
proof: "0xabc123...merkle_root_hex...",
|
|
26
|
-
server_pubkey: "0x04a1b2c3...ed25519_or_ecdsa_pubkey_hex...",
|
|
27
|
-
server_signature: "0x9d8e7f6...signature_hex...",
|
|
28
|
-
description: "KYC attestation for user 0xabc (merkle root of 1024 leaves)",
|
|
29
|
-
item_count: 1024,
|
|
30
|
-
about_address: "0xabc...user_address...",
|
|
31
|
-
namedNew: { name: "kyc_user_abc" },
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
id: "P-PROOF-02",
|
|
36
|
-
pattern_name: "Custom proof in Wowok reserved range (NOT recommended)",
|
|
37
|
-
proof_type_classification: "custom_reserved",
|
|
38
|
-
semantic_intent: "A custom proof type using a value in the reserved range 2-100. This is NOT recommended because future " +
|
|
39
|
-
"Wowok protocol upgrades may claim these values, breaking semantic compatibility. Use only if you have " +
|
|
40
|
-
"explicit Wowok authority to claim a reserved value.",
|
|
41
|
-
match_keywords: ["reserved", "custom reserved", "wowok-defined"],
|
|
42
|
-
schema_elements: {
|
|
43
|
-
proof_type_value: "2-100 (specific value documented by creator)",
|
|
44
|
-
required_fields: ["proof", "server_pubkey", "server_signature", "description", "proof_type"],
|
|
45
|
-
optional_fields: ["item_count", "about_address", "namedNew"],
|
|
46
|
-
about_address_recommendation: "Same as P-PROOF-01: set about_address for entity-bound attestations.",
|
|
47
|
-
},
|
|
48
|
-
constraints: [
|
|
49
|
-
"Caller must have explicit Wowok authority to claim a reserved proof_type value",
|
|
50
|
-
"Verification logic must be documented and stable across protocol upgrades",
|
|
51
|
-
"Future Wowok upgrades may reassign this value — callers must handle migration",
|
|
52
|
-
],
|
|
53
|
-
example: {
|
|
54
|
-
proof_type: 5,
|
|
55
|
-
proof: "0x...custom_proof_format...",
|
|
56
|
-
server_pubkey: "0x...pubkey...",
|
|
57
|
-
server_signature: "0x...sig...",
|
|
58
|
-
description: "Custom reserved proof type (documented by authority X)",
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
id: "P-PROOF-03",
|
|
63
|
-
pattern_name: "User-defined proof type (>100)",
|
|
64
|
-
proof_type_classification: "custom_user",
|
|
65
|
-
semantic_intent: "A fully custom proof type using a value > 100. The creator defines the verification logic (off-chain). " +
|
|
66
|
-
"This is the recommended range for application-specific proof semantics that Wowok protocol does not cover.",
|
|
67
|
-
match_keywords: ["custom", "user-defined", "application-specific", "custom proof type"],
|
|
68
|
-
schema_elements: {
|
|
69
|
-
proof_type_value: ">100 (user-chosen, must be unique within application scope)",
|
|
70
|
-
required_fields: ["proof", "server_pubkey", "server_signature", "description", "proof_type"],
|
|
71
|
-
optional_fields: ["item_count", "about_address", "namedNew"],
|
|
72
|
-
about_address_recommendation: "Set about_address when the proof is bound to a specific on-chain entity. Leave null for off-chain-only proofs.",
|
|
73
|
-
},
|
|
74
|
-
constraints: [
|
|
75
|
-
"proof_type must be > 100 (user-defined range)",
|
|
76
|
-
"Application must document the verification logic and proof format",
|
|
77
|
-
"Ensure proof_type does not collide with other user-defined types in the same consumer scope",
|
|
78
|
-
],
|
|
79
|
-
example: {
|
|
80
|
-
proof_type: 200,
|
|
81
|
-
proof: "0x...application_specific_proof_format...",
|
|
82
|
-
server_pubkey: "0x...pubkey...",
|
|
83
|
-
server_signature: "0x...sig...",
|
|
84
|
-
description: "Application-specific attestation (format documented at https://...)",
|
|
85
|
-
about_address: null,
|
|
86
|
-
namedNew: { name: "custom_attestation_001" },
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
];
|
|
90
|
-
export const PROOF_FIELD_TRANSLATIONS = [
|
|
91
|
-
{
|
|
92
|
-
field_name: "proof",
|
|
93
|
-
value_type: "string (hex-encoded)",
|
|
94
|
-
semantic: "The cryptographic proof content. Typically a merkle tree root, a hash digest, or a compact serialized attestation. " +
|
|
95
|
-
"Off-chain verifiers use this together with server_pubkey and server_signature to verify the proof's authenticity.",
|
|
96
|
-
format_example: "0xabc123...merkle_root_64hex...",
|
|
97
|
-
validation_rules: [
|
|
98
|
-
"Non-empty string",
|
|
99
|
-
"Length ≤ MAX_PROOF_SIZE (10240 bytes)",
|
|
100
|
-
"Move aborts with E_MAX_PROOF_SIZE (1) on overflow",
|
|
101
|
-
],
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
field_name: "server_pubkey",
|
|
105
|
-
value_type: "string (hex-encoded)",
|
|
106
|
-
semantic: "The public key of the off-chain server that signed this proof. Consumers use this to verify server_signature " +
|
|
107
|
-
"off-chain. Submit the raw public key bytes, not a certificate chain or JWK structure.",
|
|
108
|
-
format_example: "0x04a1b2c3...ed25519_pubkey_64hex...",
|
|
109
|
-
validation_rules: [
|
|
110
|
-
"Non-empty string",
|
|
111
|
-
"Length ≤ MAX_SERVER_PUBKEY_SIZE (2048 bytes)",
|
|
112
|
-
"Move aborts with E_MAX_SERVER_PUBKEY_SIZE (2) on overflow",
|
|
113
|
-
"Must be a valid public key for the signature scheme used",
|
|
114
|
-
],
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
field_name: "server_signature",
|
|
118
|
-
value_type: "string (hex-encoded)",
|
|
119
|
-
semantic: "The signature produced by the off-chain server using its private key. Verifiers check this against " +
|
|
120
|
-
"server_pubkey and the proof content (or a documented pre-image).",
|
|
121
|
-
format_example: "0x9d8e7f6...signature_hex...",
|
|
122
|
-
validation_rules: [
|
|
123
|
-
"Non-empty string",
|
|
124
|
-
"Length ≤ MAX_SERVER_SIGNATURE_SIZE (40480 bytes)",
|
|
125
|
-
"Move aborts with E_MAX_SERVER_SIGNATURE_SIZE (3) on overflow",
|
|
126
|
-
],
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
field_name: "proof_type",
|
|
130
|
-
value_type: "u64 (number | bigint | numeric string)",
|
|
131
|
-
semantic: `Classifies the proof's verification logic. ${WOWOK_WTS_PROOF_TYPE}=WOWOK_WTS_PROOF_TYPE (Wowok Will-To-Sign, ` +
|
|
132
|
-
`signed by off-chain server). Values 2-100 are reserved for future Wowok-defined types. Values >100 are user-defined.`,
|
|
133
|
-
format_example: `1 (WTS), 200 (custom)`,
|
|
134
|
-
validation_rules: [
|
|
135
|
-
"Required field",
|
|
136
|
-
"Must be ≥ 1 (P-PROOF-P2-2: schema rejects 0 and non-numeric strings)",
|
|
137
|
-
"Value 1 = WOWOK_WTS_PROOF_TYPE",
|
|
138
|
-
"Values 2-100 require explicit Wowok authority",
|
|
139
|
-
"Values >100 are user-defined",
|
|
140
|
-
],
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
field_name: "about_address",
|
|
144
|
-
move_field: "about",
|
|
145
|
-
value_type: "Option<address> (string | null)",
|
|
146
|
-
semantic: "The on-chain address of the entity being proved (e.g. a user, order, Repository). When null, the Proof is a " +
|
|
147
|
-
"free-standing cryptographic statement with no on-chain binding. SDK sends Option::none to Move when null/undefined.",
|
|
148
|
-
format_example: "0xabc...64hex_address... or null",
|
|
149
|
-
validation_rules: [
|
|
150
|
-
"Optional (null/undefined → Option::none) [PF-D-1=A]",
|
|
151
|
-
"When provided, must be a raw 0x-prefixed 64-hex address (NOT a name)",
|
|
152
|
-
"SDK isValidAddress check enforces format",
|
|
153
|
-
],
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
field_name: "description",
|
|
157
|
-
value_type: "string",
|
|
158
|
-
semantic: "Human-readable description of this Proof. Required field (PF-D-2=A). Helps identify the Proof in query results " +
|
|
159
|
-
"and audit logs. Should be a one-line summary (e.g. \"KYC attestation for user 0xabc\").",
|
|
160
|
-
format_example: "KYC attestation for user 0xabc (merkle root of 1024 leaves)",
|
|
161
|
-
validation_rules: [
|
|
162
|
-
"Required field [PF-D-2=A]",
|
|
163
|
-
"Length ≤ MAX_DESCRIPTION_LENGTH (defined in common.ts)",
|
|
164
|
-
"SDK isValidDescription check enforces max length",
|
|
165
|
-
],
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
field_name: "item_count",
|
|
169
|
-
move_field: "item_count",
|
|
170
|
-
value_type: "Option<u64> (number | bigint | numeric string | null)",
|
|
171
|
-
semantic: "Optional count of items in the off-chain data structure (e.g. number of leaves in a merkle tree). " +
|
|
172
|
-
"Used by consumers to interpret the proof content. When null, SDK sends Option::none to Move.",
|
|
173
|
-
format_example: "1024 or null",
|
|
174
|
-
validation_rules: [
|
|
175
|
-
"Optional (null/undefined → Option::none)",
|
|
176
|
-
"When provided, must be ≥ 0",
|
|
177
|
-
],
|
|
178
|
-
},
|
|
179
|
-
];
|
|
180
|
-
export const PROOF_CONSTRAINT_RULES = [
|
|
181
|
-
{
|
|
182
|
-
id: "PROOF_C_01",
|
|
183
|
-
name: "proof content non-empty",
|
|
184
|
-
description: "The 'proof' field must be a non-empty string.",
|
|
185
|
-
validation_logic: "proof.length > 0",
|
|
186
|
-
failure_message: "proof field is empty",
|
|
187
|
-
related_field: "proof",
|
|
188
|
-
},
|
|
189
|
-
{
|
|
190
|
-
id: "PROOF_C_02",
|
|
191
|
-
name: "proof content within size limit",
|
|
192
|
-
description: `The 'proof' field must be ≤ MAX_PROOF_SIZE (10240 bytes).`,
|
|
193
|
-
validation_logic: "proof.length <= MAX_PROOF_SIZE",
|
|
194
|
-
failure_message: "proof exceeds MAX_PROOF_SIZE (10240 bytes) — E_MAX_PROOF_SIZE (1)",
|
|
195
|
-
related_field: "proof",
|
|
196
|
-
},
|
|
197
|
-
{
|
|
198
|
-
id: "PROOF_C_03",
|
|
199
|
-
name: "server_pubkey within size limit",
|
|
200
|
-
description: "The 'server_pubkey' field must be ≤ MAX_SERVER_PUBKEY_SIZE (2048 bytes).",
|
|
201
|
-
validation_logic: "server_pubkey.length <= MAX_SERVER_PUBKEY_SIZE",
|
|
202
|
-
failure_message: "server_pubkey exceeds MAX_SERVER_PUBKEY_SIZE (2048 bytes) — E_MAX_SERVER_PUBKEY_SIZE (2)",
|
|
203
|
-
related_field: "server_pubkey",
|
|
204
|
-
},
|
|
205
|
-
{
|
|
206
|
-
id: "PROOF_C_04",
|
|
207
|
-
name: "server_signature within size limit",
|
|
208
|
-
description: "The 'server_signature' field must be ≤ MAX_SERVER_SIGNATURE_SIZE (40480 bytes).",
|
|
209
|
-
validation_logic: "server_signature.length <= MAX_SERVER_SIGNATURE_SIZE",
|
|
210
|
-
failure_message: "server_signature exceeds MAX_SERVER_SIGNATURE_SIZE (40480 bytes) — E_MAX_SERVER_SIGNATURE_SIZE (3)",
|
|
211
|
-
related_field: "server_signature",
|
|
212
|
-
},
|
|
213
|
-
{
|
|
214
|
-
id: "PROOF_C_05",
|
|
215
|
-
name: "proof_type valid range",
|
|
216
|
-
description: `proof_type must be ≥ 1 (WOWOK_WTS_PROOF_TYPE=${WOWOK_WTS_PROOF_TYPE} is the minimum).`,
|
|
217
|
-
validation_logic: "proof_type >= 1",
|
|
218
|
-
failure_message: "proof_type must be ≥ 1 — schema rejects 0 and non-numeric strings",
|
|
219
|
-
related_field: "proof_type",
|
|
220
|
-
},
|
|
221
|
-
{
|
|
222
|
-
id: "PROOF_C_06",
|
|
223
|
-
name: "about_address format (when provided)",
|
|
224
|
-
description: "When about_address is non-null, it must be a valid 0x-prefixed 64-hex address.",
|
|
225
|
-
validation_logic: "about_address == null || /^0x[0-9a-fA-F]{64}$/.test(about_address)",
|
|
226
|
-
failure_message: "about_address is not a valid 0x-prefixed 64-hex address",
|
|
227
|
-
related_field: "about_address",
|
|
228
|
-
},
|
|
229
|
-
];
|
|
230
|
-
export function explainProof(input) {
|
|
231
|
-
const warnings = [];
|
|
232
|
-
const recommendations = [];
|
|
233
|
-
let classification = "unknown";
|
|
234
|
-
if (input.proof_type !== undefined && input.proof_type !== null) {
|
|
235
|
-
const n = typeof input.proof_type === "string" ? BigInt(input.proof_type) : BigInt(input.proof_type);
|
|
236
|
-
if (n === BigInt(WOWOK_WTS_PROOF_TYPE)) {
|
|
237
|
-
classification = `WTS proof (proof_type=${WOWOK_WTS_PROOF_TYPE}) — signed by off-chain server`;
|
|
238
|
-
}
|
|
239
|
-
else if (n > 1n && n <= 100n) {
|
|
240
|
-
classification = `Custom proof in reserved range (proof_type=${input.proof_type}) — NOT recommended without Wowok authority`;
|
|
241
|
-
warnings.push(`proof_type=${input.proof_type} is in reserved range 2-100 — future Wowok upgrades may reassign this value`);
|
|
242
|
-
}
|
|
243
|
-
else if (n > 100n) {
|
|
244
|
-
classification = `User-defined proof (proof_type=${input.proof_type}) — application-specific verification logic`;
|
|
245
|
-
}
|
|
246
|
-
else {
|
|
247
|
-
classification = `INVALID proof_type=${input.proof_type} (must be ≥ 1)`;
|
|
248
|
-
warnings.push("proof_type is < 1 — schema validation will reject");
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
const binding = input.about_address
|
|
252
|
-
? `Entity-bound: about_address=${input.about_address.substring(0, 10)}... (proof attests to this on-chain entity)`
|
|
253
|
-
: "Free-standing: no on-chain entity binding (about_address=null)";
|
|
254
|
-
const sizeStatus = [];
|
|
255
|
-
if (input.proof) {
|
|
256
|
-
sizeStatus.push(`proof=${input.proof.length} bytes (limit 10240)`);
|
|
257
|
-
}
|
|
258
|
-
if (input.server_pubkey) {
|
|
259
|
-
sizeStatus.push(`server_pubkey=${input.server_pubkey.length} bytes (limit 2048)`);
|
|
260
|
-
}
|
|
261
|
-
if (input.server_signature) {
|
|
262
|
-
sizeStatus.push(`server_signature=${input.server_signature.length} bytes (limit 40480)`);
|
|
263
|
-
}
|
|
264
|
-
if (!input.description || input.description.length === 0) {
|
|
265
|
-
recommendations.push("Provide a non-empty description for audit log discoverability");
|
|
266
|
-
}
|
|
267
|
-
if (!input.about_address) {
|
|
268
|
-
recommendations.push("Consider setting about_address if this Proof attests to a specific on-chain entity");
|
|
269
|
-
}
|
|
270
|
-
if (input.item_count === undefined || input.item_count === null) {
|
|
271
|
-
recommendations.push("Consider setting item_count if the proof references a multi-item data structure");
|
|
272
|
-
}
|
|
273
|
-
const summary = `Proof is a ${classification}. ${binding}. ` +
|
|
274
|
-
(sizeStatus.length > 0 ? `Sizes: ${sizeStatus.join(", ")}.` : "");
|
|
275
|
-
return {
|
|
276
|
-
summary,
|
|
277
|
-
proof_type_classification: classification,
|
|
278
|
-
binding,
|
|
279
|
-
size_status: sizeStatus.join(", "),
|
|
280
|
-
warnings,
|
|
281
|
-
recommendations,
|
|
282
|
-
};
|
|
283
|
-
}
|
|
1
|
+
import{WOWOK_WTS_PROOF_TYPE}from'@wowok/wowok';export const SEMANTIC_TO_PROOF_SCHEMA_RULES=[{'id':'P-PROOF-01','pattern_name':'Wowok\x20WTS\x20(Will-To-Sign)\x20proof','proof_type_classification':'wts','semantic_intent':'An\x20off-chain\x20server\x20attests\x20to\x20a\x20fact\x20(identity,\x20timestamp,\x20merkle\x20root)\x20and\x20signs\x20it\x20with\x20server_pubkey.\x20'+'On-chain\x20consumers\x20verify\x20the\x20signature\x20off-chain\x20and\x20trust\x20the\x20Proof\x20record\x20as\x20evidence.','match_keywords':['wts','server-signed','attestation','kyc','merkle\x20root','timestamp'],'schema_elements':{'proof_type_value':WOWOK_WTS_PROOF_TYPE,'required_fields':['proof','server_pubkey','server_signature','description'],'optional_fields':['item_count','about_address','namedNew'],'about_address_recommendation':'Set\x20about_address\x20when\x20the\x20WTS\x20proof\x20attests\x20to\x20a\x20specific\x20on-chain\x20entity\x20(user\x20address,\x20Repository,\x20etc.).\x20'+'Leave\x20null\x20for\x20free-standing\x20attestations\x20(e.g.\x20server\x20timestamp).'},'constraints':['proof_type\x20must\x20equal\x20'+WOWOK_WTS_PROOF_TYPE+'\x20(WOWOK_WTS_PROOF_TYPE)','server_pubkey\x20must\x20be\x20the\x20raw\x20public\x20key\x20(hex-encoded),\x20not\x20a\x20certificate','server_signature\x20must\x20sign\x20the\x20exact\x20bytes\x20of\x20the\x20\x27proof\x27\x20field\x20(or\x20a\x20documented\x20pre-image)','Off-chain\x20verification\x20logic\x20must\x20be\x20documented\x20for\x20consumers'],'example':{'proof_type':WOWOK_WTS_PROOF_TYPE,'proof':'0xabc123...merkle_root_hex...','server_pubkey':'0x04a1b2c3...ed25519_or_ecdsa_pubkey_hex...','server_signature':'0x9d8e7f6...signature_hex...','description':'KYC\x20attestation\x20for\x20user\x200xabc\x20(merkle\x20root\x20of\x201024\x20leaves)','item_count':0x400,'about_address':'0xabc...user_address...','namedNew':{'name':'kyc_user_abc'}}},{'id':'P-PROOF-02','pattern_name':'Custom\x20proof\x20in\x20Wowok\x20reserved\x20range\x20(NOT\x20recommended)','proof_type_classification':'custom_reserved','semantic_intent':'A\x20custom\x20proof\x20type\x20using\x20a\x20value\x20in\x20the\x20reserved\x20range\x202-100.\x20This\x20is\x20NOT\x20recommended\x20because\x20future\x20'+'Wowok\x20protocol\x20upgrades\x20may\x20claim\x20these\x20values,\x20breaking\x20semantic\x20compatibility.\x20Use\x20only\x20if\x20you\x20have\x20'+'explicit\x20Wowok\x20authority\x20to\x20claim\x20a\x20reserved\x20value.','match_keywords':['reserved','custom\x20reserved','wowok-defined'],'schema_elements':{'proof_type_value':'2-100\x20(specific\x20value\x20documented\x20by\x20creator)','required_fields':['proof','server_pubkey','server_signature','description','proof_type'],'optional_fields':['item_count','about_address','namedNew'],'about_address_recommendation':'Same\x20as\x20P-PROOF-01:\x20set\x20about_address\x20for\x20entity-bound\x20attestations.'},'constraints':['Caller\x20must\x20have\x20explicit\x20Wowok\x20authority\x20to\x20claim\x20a\x20reserved\x20proof_type\x20value','Verification\x20logic\x20must\x20be\x20documented\x20and\x20stable\x20across\x20protocol\x20upgrades','Future\x20Wowok\x20upgrades\x20may\x20reassign\x20this\x20value\x20—\x20callers\x20must\x20handle\x20migration'],'example':{'proof_type':0x5,'proof':'0x...custom_proof_format...','server_pubkey':'0x...pubkey...','server_signature':'0x...sig...','description':'Custom\x20reserved\x20proof\x20type\x20(documented\x20by\x20authority\x20X)'}},{'id':'P-PROOF-03','pattern_name':'User-defined\x20proof\x20type\x20(>100)','proof_type_classification':'custom_user','semantic_intent':'A\x20fully\x20custom\x20proof\x20type\x20using\x20a\x20value\x20>\x20100.\x20The\x20creator\x20defines\x20the\x20verification\x20logic\x20(off-chain).\x20'+'This\x20is\x20the\x20recommended\x20range\x20for\x20application-specific\x20proof\x20semantics\x20that\x20Wowok\x20protocol\x20does\x20not\x20cover.','match_keywords':['custom','user-defined','application-specific','custom\x20proof\x20type'],'schema_elements':{'proof_type_value':'>100\x20(user-chosen,\x20must\x20be\x20unique\x20within\x20application\x20scope)','required_fields':['proof','server_pubkey','server_signature','description','proof_type'],'optional_fields':['item_count','about_address','namedNew'],'about_address_recommendation':'Set\x20about_address\x20when\x20the\x20proof\x20is\x20bound\x20to\x20a\x20specific\x20on-chain\x20entity.\x20Leave\x20null\x20for\x20off-chain-only\x20proofs.'},'constraints':['proof_type\x20must\x20be\x20>\x20100\x20(user-defined\x20range)','Application\x20must\x20document\x20the\x20verification\x20logic\x20and\x20proof\x20format','Ensure\x20proof_type\x20does\x20not\x20collide\x20with\x20other\x20user-defined\x20types\x20in\x20the\x20same\x20consumer\x20scope'],'example':{'proof_type':0xc8,'proof':'0x...application_specific_proof_format...','server_pubkey':'0x...pubkey...','server_signature':'0x...sig...','description':'Application-specific\x20attestation\x20(format\x20documented\x20at\x20https://...)','about_address':null,'namedNew':{'name':'custom_attestation_001'}}}];export const PROOF_FIELD_TRANSLATIONS=[{'field_name':'proof','value_type':'string\x20(hex-encoded)','semantic':'The\x20cryptographic\x20proof\x20content.\x20Typically\x20a\x20merkle\x20tree\x20root,\x20a\x20hash\x20digest,\x20or\x20a\x20compact\x20serialized\x20attestation.\x20'+'Off-chain\x20verifiers\x20use\x20this\x20together\x20with\x20server_pubkey\x20and\x20server_signature\x20to\x20verify\x20the\x20proof\x27s\x20authenticity.','format_example':'0xabc123...merkle_root_64hex...','validation_rules':['Non-empty\x20string','Length\x20≤\x20MAX_PROOF_SIZE\x20(10240\x20bytes)','Move\x20aborts\x20with\x20E_MAX_PROOF_SIZE\x20(1)\x20on\x20overflow']},{'field_name':'server_pubkey','value_type':'string\x20(hex-encoded)','semantic':'The\x20public\x20key\x20of\x20the\x20off-chain\x20server\x20that\x20signed\x20this\x20proof.\x20Consumers\x20use\x20this\x20to\x20verify\x20server_signature\x20'+'off-chain.\x20Submit\x20the\x20raw\x20public\x20key\x20bytes,\x20not\x20a\x20certificate\x20chain\x20or\x20JWK\x20structure.','format_example':'0x04a1b2c3...ed25519_pubkey_64hex...','validation_rules':['Non-empty\x20string','Length\x20≤\x20MAX_SERVER_PUBKEY_SIZE\x20(2048\x20bytes)','Move\x20aborts\x20with\x20E_MAX_SERVER_PUBKEY_SIZE\x20(2)\x20on\x20overflow','Must\x20be\x20a\x20valid\x20public\x20key\x20for\x20the\x20signature\x20scheme\x20used']},{'field_name':'server_signature','value_type':'string\x20(hex-encoded)','semantic':'The\x20signature\x20produced\x20by\x20the\x20off-chain\x20server\x20using\x20its\x20private\x20key.\x20Verifiers\x20check\x20this\x20against\x20'+'server_pubkey\x20and\x20the\x20proof\x20content\x20(or\x20a\x20documented\x20pre-image).','format_example':'0x9d8e7f6...signature_hex...','validation_rules':['Non-empty\x20string','Length\x20≤\x20MAX_SERVER_SIGNATURE_SIZE\x20(40480\x20bytes)','Move\x20aborts\x20with\x20E_MAX_SERVER_SIGNATURE_SIZE\x20(3)\x20on\x20overflow']},{'field_name':'proof_type','value_type':'u64\x20(number\x20|\x20bigint\x20|\x20numeric\x20string)','semantic':'Classifies\x20the\x20proof\x27s\x20verification\x20logic.\x20'+WOWOK_WTS_PROOF_TYPE+'=WOWOK_WTS_PROOF_TYPE\x20(Wowok\x20Will-To-Sign,\x20'+'signed\x20by\x20off-chain\x20server).\x20Values\x202-100\x20are\x20reserved\x20for\x20future\x20Wowok-defined\x20types.\x20Values\x20>100\x20are\x20user-defined.','format_example':'1\x20(WTS),\x20200\x20(custom)','validation_rules':['Required\x20field','Must\x20be\x20≥\x201\x20(P-PROOF-P2-2:\x20schema\x20rejects\x200\x20and\x20non-numeric\x20strings)','Value\x201\x20=\x20WOWOK_WTS_PROOF_TYPE','Values\x202-100\x20require\x20explicit\x20Wowok\x20authority','Values\x20>100\x20are\x20user-defined']},{'field_name':'about_address','move_field':'about','value_type':'Option<address>\x20(string\x20|\x20null)','semantic':'The\x20on-chain\x20address\x20of\x20the\x20entity\x20being\x20proved\x20(e.g.\x20a\x20user,\x20order,\x20Repository).\x20When\x20null,\x20the\x20Proof\x20is\x20a\x20'+'free-standing\x20cryptographic\x20statement\x20with\x20no\x20on-chain\x20binding.\x20SDK\x20sends\x20Option::none\x20to\x20Move\x20when\x20null/undefined.','format_example':'0xabc...64hex_address...\x20or\x20null','validation_rules':['Optional\x20(null/undefined\x20→\x20Option::none)\x20[PF-D-1=A]','When\x20provided,\x20must\x20be\x20a\x20raw\x200x-prefixed\x2064-hex\x20address\x20(NOT\x20a\x20name)','SDK\x20isValidAddress\x20check\x20enforces\x20format']},{'field_name':'description','value_type':'string','semantic':'Human-readable\x20description\x20of\x20this\x20Proof.\x20Required\x20field\x20(PF-D-2=A).\x20Helps\x20identify\x20the\x20Proof\x20in\x20query\x20results\x20'+'and\x20audit\x20logs.\x20Should\x20be\x20a\x20one-line\x20summary\x20(e.g.\x20\x22KYC\x20attestation\x20for\x20user\x200xabc\x22).','format_example':'KYC\x20attestation\x20for\x20user\x200xabc\x20(merkle\x20root\x20of\x201024\x20leaves)','validation_rules':['Required\x20field\x20[PF-D-2=A]','Length\x20≤\x20MAX_DESCRIPTION_LENGTH\x20(defined\x20in\x20common.ts)','SDK\x20isValidDescription\x20check\x20enforces\x20max\x20length']},{'field_name':'item_count','move_field':'item_count','value_type':'Option<u64>\x20(number\x20|\x20bigint\x20|\x20numeric\x20string\x20|\x20null)','semantic':'Optional\x20count\x20of\x20items\x20in\x20the\x20off-chain\x20data\x20structure\x20(e.g.\x20number\x20of\x20leaves\x20in\x20a\x20merkle\x20tree).\x20'+'Used\x20by\x20consumers\x20to\x20interpret\x20the\x20proof\x20content.\x20When\x20null,\x20SDK\x20sends\x20Option::none\x20to\x20Move.','format_example':'1024\x20or\x20null','validation_rules':['Optional\x20(null/undefined\x20→\x20Option::none)','When\x20provided,\x20must\x20be\x20≥\x200']}];export const PROOF_CONSTRAINT_RULES=[{'id':'PROOF_C_01','name':'proof\x20content\x20non-empty','description':'The\x20\x27proof\x27\x20field\x20must\x20be\x20a\x20non-empty\x20string.','validation_logic':'proof.length\x20>\x200','failure_message':'proof\x20field\x20is\x20empty','related_field':'proof'},{'id':'PROOF_C_02','name':'proof\x20content\x20within\x20size\x20limit','description':'The\x20\x27proof\x27\x20field\x20must\x20be\x20≤\x20MAX_PROOF_SIZE\x20(10240\x20bytes).','validation_logic':'proof.length\x20<=\x20MAX_PROOF_SIZE','failure_message':'proof\x20exceeds\x20MAX_PROOF_SIZE\x20(10240\x20bytes)\x20—\x20E_MAX_PROOF_SIZE\x20(1)','related_field':'proof'},{'id':'PROOF_C_03','name':'server_pubkey\x20within\x20size\x20limit','description':'The\x20\x27server_pubkey\x27\x20field\x20must\x20be\x20≤\x20MAX_SERVER_PUBKEY_SIZE\x20(2048\x20bytes).','validation_logic':'server_pubkey.length\x20<=\x20MAX_SERVER_PUBKEY_SIZE','failure_message':'server_pubkey\x20exceeds\x20MAX_SERVER_PUBKEY_SIZE\x20(2048\x20bytes)\x20—\x20E_MAX_SERVER_PUBKEY_SIZE\x20(2)','related_field':'server_pubkey'},{'id':'PROOF_C_04','name':'server_signature\x20within\x20size\x20limit','description':'The\x20\x27server_signature\x27\x20field\x20must\x20be\x20≤\x20MAX_SERVER_SIGNATURE_SIZE\x20(40480\x20bytes).','validation_logic':'server_signature.length\x20<=\x20MAX_SERVER_SIGNATURE_SIZE','failure_message':'server_signature\x20exceeds\x20MAX_SERVER_SIGNATURE_SIZE\x20(40480\x20bytes)\x20—\x20E_MAX_SERVER_SIGNATURE_SIZE\x20(3)','related_field':'server_signature'},{'id':'PROOF_C_05','name':'proof_type\x20valid\x20range','description':'proof_type\x20must\x20be\x20≥\x201\x20(WOWOK_WTS_PROOF_TYPE='+WOWOK_WTS_PROOF_TYPE+'\x20is\x20the\x20minimum).','validation_logic':'proof_type\x20>=\x201','failure_message':'proof_type\x20must\x20be\x20≥\x201\x20—\x20schema\x20rejects\x200\x20and\x20non-numeric\x20strings','related_field':'proof_type'},{'id':'PROOF_C_06','name':'about_address\x20format\x20(when\x20provided)','description':'When\x20about_address\x20is\x20non-null,\x20it\x20must\x20be\x20a\x20valid\x200x-prefixed\x2064-hex\x20address.','validation_logic':'about_address\x20==\x20null\x20||\x20/^0x[0-9a-fA-F]{64}$/.test(about_address)','failure_message':'about_address\x20is\x20not\x20a\x20valid\x200x-prefixed\x2064-hex\x20address','related_field':'about_address'}];export function explainProof(a){const b=[],c=[];let d='unknown';if(a['proof_type']!==undefined&&a['proof_type']!==null){const h=typeof a['proof_type']==='string'?BigInt(a['proof_type']):BigInt(a['proof_type']);if(h===BigInt(WOWOK_WTS_PROOF_TYPE))d='WTS\x20proof\x20(proof_type='+WOWOK_WTS_PROOF_TYPE+')\x20—\x20signed\x20by\x20off-chain\x20server';else{if(h>0x1n&&h<=0x64n)d='Custom\x20proof\x20in\x20reserved\x20range\x20(proof_type='+a['proof_type']+')\x20—\x20NOT\x20recommended\x20without\x20Wowok\x20authority',b['push']('proof_type='+a['proof_type']+'\x20is\x20in\x20reserved\x20range\x202-100\x20—\x20future\x20Wowok\x20upgrades\x20may\x20reassign\x20this\x20value');else h>0x64n?d='User-defined\x20proof\x20(proof_type='+a['proof_type']+')\x20—\x20application-specific\x20verification\x20logic':(d='INVALID\x20proof_type='+a['proof_type']+'\x20(must\x20be\x20≥\x201)',b['push']('proof_type\x20is\x20<\x201\x20—\x20schema\x20validation\x20will\x20reject'));}}const e=a['about_address']?'Entity-bound:\x20about_address='+a['about_address']['substring'](0x0,0xa)+'...\x20(proof\x20attests\x20to\x20this\x20on-chain\x20entity)':'Free-standing:\x20no\x20on-chain\x20entity\x20binding\x20(about_address=null)',f=[];a['proof']&&f['push']('proof='+a['proof']['length']+'\x20bytes\x20(limit\x2010240)');a['server_pubkey']&&f['push']('server_pubkey='+a['server_pubkey']['length']+'\x20bytes\x20(limit\x202048)');a['server_signature']&&f['push']('server_signature='+a['server_signature']['length']+'\x20bytes\x20(limit\x2040480)');(!a['description']||a['description']['length']===0x0)&&c['push']('Provide\x20a\x20non-empty\x20description\x20for\x20audit\x20log\x20discoverability');!a['about_address']&&c['push']('Consider\x20setting\x20about_address\x20if\x20this\x20Proof\x20attests\x20to\x20a\x20specific\x20on-chain\x20entity');(a['item_count']===undefined||a['item_count']===null)&&c['push']('Consider\x20setting\x20item_count\x20if\x20the\x20proof\x20references\x20a\x20multi-item\x20data\x20structure');const g='Proof\x20is\x20a\x20'+d+'.\x20'+e+'.\x20'+(f['length']>0x0?'Sizes:\x20'+f['join'](',\x20')+'.':'');return{'summary':g,'proof_type_classification':d,'binding':e,'size_status':f['join'](',\x20'),'warnings':b,'recommendations':c};}
|
|
@@ -1,217 +1 @@
|
|
|
1
|
-
import { MAX_ADDRESS_COUNT, MAX_RECORD_COUNT_REGISTRAR, MAX_RECORD_LENGTH, } from "@wowok/wowok";
|
|
2
|
-
const BIT_NO_INFO = 0x00;
|
|
3
|
-
const BIT_LIKE = 0x02;
|
|
4
|
-
const BIT_DISLIKE = 0x04;
|
|
5
|
-
const BIT_AFFILIATION = 0x08;
|
|
6
|
-
const R_REG_01 = {
|
|
7
|
-
rule: {
|
|
8
|
-
id: "R-REG-01",
|
|
9
|
-
level: "HIGH",
|
|
10
|
-
category: "lifecycle",
|
|
11
|
-
title: "Entity and Registrar are system singletons — cannot be migrated post-deploy",
|
|
12
|
-
description: "Entity and Registrar are created once at package init by @0x0 (registrar.move:152-166) " +
|
|
13
|
-
"and are globally unique. They cannot be re-created, migrated, or re-initialized. If " +
|
|
14
|
-
"the singleton's storage layout needs to change (e.g. ParentTable schema), the only " +
|
|
15
|
-
"option is a new package version with a migration path. There is no in-place migration " +
|
|
16
|
-
"API. All 22 objects depend on these singletons via affiliation, so a migration would " +
|
|
17
|
-
"cascade to every object.",
|
|
18
|
-
affected_stakeholders: ["system", "user"],
|
|
19
|
-
scenario: "Operator wants to migrate Entity to a new schema; no migration API exists",
|
|
20
|
-
mitigation: "Confirm the schema before deployment. For schema evolution, plan a new package " +
|
|
21
|
-
"version with an explicit migration script. Never assume the singleton can be 'reset'.",
|
|
22
|
-
auto_fixable: false,
|
|
23
|
-
},
|
|
24
|
-
check: (ctx) => {
|
|
25
|
-
if (!ctx.expects_singleton_migration)
|
|
26
|
-
return null;
|
|
27
|
-
return { ...R_REG_01.rule, evidence: "expects_singleton_migration=true (no migration API)" };
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
const R_REG_02 = {
|
|
31
|
-
rule: {
|
|
32
|
-
id: "R-REG-02",
|
|
33
|
-
level: "MEDIUM",
|
|
34
|
-
category: "structural",
|
|
35
|
-
title: `MAX_ADDRESS_COUNT=${MAX_ADDRESS_COUNT} may be insufficient for large deployments`,
|
|
36
|
-
description: `The Entity and Registrar ParentTables are bounded by MAX_ADDRESS_COUNT=${MAX_ADDRESS_COUNT} ` +
|
|
37
|
-
`(registrar.move). Exceeding the cap aborts address registration. For mass-market ` +
|
|
38
|
-
`applications, ${MAX_ADDRESS_COUNT} entries may be too few; the limit is a single ` +
|
|
39
|
-
`Move constant that requires a package upgrade to change.`,
|
|
40
|
-
affected_stakeholders: ["system", "user"],
|
|
41
|
-
scenario: "Popular service reaches 5200 registered users; new registrations abort",
|
|
42
|
-
mitigation: "Monitor address_count. Plan a package upgrade that raises MAX_ADDRESS_COUNT before " +
|
|
43
|
-
"hitting the cap. For shardable workloads, consider multiple Entity tables in a future " +
|
|
44
|
-
"package version.",
|
|
45
|
-
auto_fixable: false,
|
|
46
|
-
},
|
|
47
|
-
check: (ctx) => {
|
|
48
|
-
if (ctx.address_count === undefined)
|
|
49
|
-
return null;
|
|
50
|
-
if (ctx.address_count < MAX_ADDRESS_COUNT)
|
|
51
|
-
return null;
|
|
52
|
-
return { ...R_REG_02.rule, evidence: `address_count=${ctx.address_count}, limit=${MAX_ADDRESS_COUNT}` };
|
|
53
|
-
},
|
|
54
|
-
};
|
|
55
|
-
const R_REG_03 = {
|
|
56
|
-
rule: {
|
|
57
|
-
id: "R-REG-03",
|
|
58
|
-
level: "MEDIUM",
|
|
59
|
-
category: "semantic",
|
|
60
|
-
title: `Vote.info uses u8 bitmask — bits 4-7 reserved, future expansion must stay compatible`,
|
|
61
|
-
description: `Vote.info is a u8 bitmask: BIT_NO_INFO=${BIT_NO_INFO}, BIT_LIKE=${BIT_LIKE}, ` +
|
|
62
|
-
`BIT_DISLIKE=${BIT_DISLIKE}, BIT_AFFILIATION=${BIT_AFFILIATION}. Bits 4-7 are reserved. ` +
|
|
63
|
-
`A future version that repurposes bits 4-7 would conflict with any off-chain code that ` +
|
|
64
|
-
`reads the raw byte. The reserved bits MUST be treated as zero today; non-zero values ` +
|
|
65
|
-
`in bits 4-7 indicate a forward-incompatible voter.`,
|
|
66
|
-
affected_stakeholders: ["voter", "system"],
|
|
67
|
-
scenario: "Future version assigns bit 4 to a new flag; old indexers misread the byte",
|
|
68
|
-
mitigation: "Off-chain code must mask to bits 0-3 today and ignore bits 4-7. When a new flag is " +
|
|
69
|
-
"assigned, ship a coordinated Move + SDK + indexer update.",
|
|
70
|
-
auto_fixable: false,
|
|
71
|
-
},
|
|
72
|
-
check: (ctx) => {
|
|
73
|
-
if (!ctx.uses_reserved_vote_bits)
|
|
74
|
-
return null;
|
|
75
|
-
return { ...R_REG_03.rule, evidence: "uses_reserved_vote_bits=true (bits 4-7 are reserved)" };
|
|
76
|
-
},
|
|
77
|
-
};
|
|
78
|
-
const R_REG_05 = {
|
|
79
|
-
rule: {
|
|
80
|
-
id: "R-REG-05",
|
|
81
|
-
level: "MEDIUM",
|
|
82
|
-
category: "cross_object",
|
|
83
|
-
title: "affiliation / disaffiliation emit no events — indexers must poll Registrar.table",
|
|
84
|
-
description: "affiliation, disaffiliation, and affiliation_change (registrar.move) mutate the " +
|
|
85
|
-
"Registrar dependency graph but emit no events. External indexers that track the " +
|
|
86
|
-
"object-dependency graph cannot rely on an event stream; they must poll the " +
|
|
87
|
-
"ParentTable, which is expensive as the graph grows.",
|
|
88
|
-
affected_stakeholders: ["system"],
|
|
89
|
-
scenario: "Indexer expects an AffiliationEvent; none is emitted, dependency graph is stale",
|
|
90
|
-
mitigation: "Indexers should poll Registrar.table on a cadence and diff. Future versions may add " +
|
|
91
|
-
"AffiliationEvent; until then, do not build critical UX on affiliation event streams.",
|
|
92
|
-
auto_fixable: false,
|
|
93
|
-
},
|
|
94
|
-
check: (ctx) => {
|
|
95
|
-
if (!ctx.expects_affiliation_event)
|
|
96
|
-
return null;
|
|
97
|
-
return { ...R_REG_05.rule, evidence: "expects_affiliation_event=true (no events)" };
|
|
98
|
-
},
|
|
99
|
-
};
|
|
100
|
-
const R_REG_04 = {
|
|
101
|
-
rule: {
|
|
102
|
-
id: "R-REG-04",
|
|
103
|
-
level: "LOW",
|
|
104
|
-
category: "lifecycle",
|
|
105
|
-
title: "entity_register is idempotent — returns existing Resource, not a fresh one",
|
|
106
|
-
description: "entity_register (registrar.move:177-187) checks whether the sender already has an " +
|
|
107
|
-
"Entity record. If so, it returns the existing Resource address without creating a new " +
|
|
108
|
-
"one. Callers who expect a fresh Resource on each call (e.g. after a forced destroy) " +
|
|
109
|
-
"will silently receive the old one. Use entity_register_with_resource_forced to " +
|
|
110
|
-
"force-reallocate, and only when the old Resource is truly gone.",
|
|
111
|
-
affected_stakeholders: ["user"],
|
|
112
|
-
scenario: "User destroys their Resource then calls entity_register; gets the old (now-invalid) address",
|
|
113
|
-
mitigation: "Document the idempotent behavior. After a forced destroy, callers MUST use " +
|
|
114
|
-
"entity_register_with_resource_forced. SDK should detect destroyed Resource and route " +
|
|
115
|
-
"accordingly.",
|
|
116
|
-
auto_fixable: false,
|
|
117
|
-
},
|
|
118
|
-
check: (ctx) => {
|
|
119
|
-
if (!ctx.expects_fresh_resource_on_register)
|
|
120
|
-
return null;
|
|
121
|
-
return { ...R_REG_04.rule, evidence: "expects_fresh_resource_on_register=true (idempotent)" };
|
|
122
|
-
},
|
|
123
|
-
};
|
|
124
|
-
const R_REG_06 = {
|
|
125
|
-
rule: {
|
|
126
|
-
id: "R-REG-06",
|
|
127
|
-
level: "LOW",
|
|
128
|
-
category: "semantic",
|
|
129
|
-
title: "Record.typed_value first byte is a ValueType — convention enforced only by docs",
|
|
130
|
-
description: "Record.typed_value is a vector<u8> whose first byte encodes the ValueType (registrar.move:111). " +
|
|
131
|
-
"The Move layer validates that the vector is non-empty and within MAX_RECORD_LENGTH=" +
|
|
132
|
-
`${MAX_RECORD_LENGTH}, but it does not validate that the first byte is a known ValueType. ` +
|
|
133
|
-
`Off-chain consumers must agree on the ValueType byte layout; a misencoded record will ` +
|
|
134
|
-
`deserialize to garbage without an on-chain abort. Record count is bounded by ` +
|
|
135
|
-
`MAX_RECORD_COUNT_REGISTRAR=${MAX_RECORD_COUNT_REGISTRAR}.`,
|
|
136
|
-
affected_stakeholders: ["user", "system"],
|
|
137
|
-
scenario: "Caller writes a record with first byte 0xFF; no on-chain error, but consumers cannot decode",
|
|
138
|
-
mitigation: "SDK must validate the first byte against the ValueType enum before submitting. " +
|
|
139
|
-
"Document the ValueType byte layout in both Move and SDK. Add a sync test that " +
|
|
140
|
-
"asserts the ValueType enum matches across layers.",
|
|
141
|
-
related_move_error: "ERecordTypeEmpty (3) — only catches empty typed_value",
|
|
142
|
-
auto_fixable: false,
|
|
143
|
-
},
|
|
144
|
-
check: (ctx) => {
|
|
145
|
-
if (!ctx.relies_on_typed_value_convention)
|
|
146
|
-
return null;
|
|
147
|
-
return { ...R_REG_06.rule, evidence: "relies_on_typed_value_convention=true (docs-only enforcement)" };
|
|
148
|
-
},
|
|
149
|
-
};
|
|
150
|
-
const R_REG_07 = {
|
|
151
|
-
rule: {
|
|
152
|
-
id: "R-REG-07",
|
|
153
|
-
level: "MEDIUM",
|
|
154
|
-
category: "cross_object",
|
|
155
|
-
title: "entity_resource_transfer detaches Resource from the source address",
|
|
156
|
-
description: "entity_resource_transfer(resource, new_address, ctx) moves the Resource backing a " +
|
|
157
|
-
"user's identity mark to a new address. After transfer, the source address has no " +
|
|
158
|
-
"Resource — any downstream service that keyed identity on the source address loses " +
|
|
159
|
-
"the binding. There is no automatic forwarding stub left behind.",
|
|
160
|
-
affected_stakeholders: ["user", "system"],
|
|
161
|
-
scenario: "User transfers Resource to a new wallet; old-wallet-based services break",
|
|
162
|
-
mitigation: "Surface a 'transfer will detach the Resource from this address' warning. Consumers " +
|
|
163
|
-
"should track users by Resource address, not by user address. Provide a migration " +
|
|
164
|
-
"window where both addresses are valid.",
|
|
165
|
-
auto_fixable: false,
|
|
166
|
-
},
|
|
167
|
-
check: (ctx) => {
|
|
168
|
-
if (!ctx.is_resource_transfer)
|
|
169
|
-
return null;
|
|
170
|
-
return { ...R_REG_07.rule, evidence: "is_resource_transfer=true (source loses Resource)" };
|
|
171
|
-
},
|
|
172
|
-
};
|
|
173
|
-
const R_REG_08 = {
|
|
174
|
-
rule: {
|
|
175
|
-
id: "R-REG-08",
|
|
176
|
-
level: "LOW",
|
|
177
|
-
category: "semantic",
|
|
178
|
-
title: "Vote.time updates on every toggle — including like→no-like",
|
|
179
|
-
description: "Vote.time (registrar.move) is set to clock.timestamp_ms() on every like/dislike " +
|
|
180
|
-
"operation, including toggles that remove a like (like→no-like). Consumers who " +
|
|
181
|
-
"interpret Vote.time as 'last liked at' will be confused when it advances on an " +
|
|
182
|
-
"un-like. The field semantically means 'last vote op time', not 'last positive vote'.",
|
|
183
|
-
affected_stakeholders: ["voter", "system"],
|
|
184
|
-
scenario: "User un-likes; Vote.time advances; indexer reads it as 'recently liked'",
|
|
185
|
-
mitigation: "Document Vote.time as 'last vote operation time'. For 'last liked at' semantics, " +
|
|
186
|
-
"track the previous Vote.info state and only record time when BIT_LIKE transitions to set.",
|
|
187
|
-
auto_fixable: false,
|
|
188
|
-
},
|
|
189
|
-
check: (ctx) => {
|
|
190
|
-
if (!ctx.expects_vote_time_only_on_like)
|
|
191
|
-
return null;
|
|
192
|
-
return { ...R_REG_08.rule, evidence: "expects_vote_time_only_on_like=true (updates on toggle)" };
|
|
193
|
-
},
|
|
194
|
-
};
|
|
195
|
-
export const REGISTRAR_RISK_RULES = [
|
|
196
|
-
R_REG_01,
|
|
197
|
-
R_REG_02,
|
|
198
|
-
R_REG_03,
|
|
199
|
-
R_REG_04,
|
|
200
|
-
R_REG_05,
|
|
201
|
-
R_REG_06,
|
|
202
|
-
R_REG_07,
|
|
203
|
-
R_REG_08,
|
|
204
|
-
];
|
|
205
|
-
export const REGISTRAR_RISK_VERSION = "1.0.0";
|
|
206
|
-
export function checkRegistrarRisks(ctx) {
|
|
207
|
-
const risks = [];
|
|
208
|
-
for (const rule of REGISTRAR_RISK_RULES) {
|
|
209
|
-
const r = rule.check(ctx);
|
|
210
|
-
if (r)
|
|
211
|
-
risks.push(r);
|
|
212
|
-
}
|
|
213
|
-
return risks;
|
|
214
|
-
}
|
|
215
|
-
export function getRegistrarRiskById(id) {
|
|
216
|
-
return REGISTRAR_RISK_RULES.find(r => r.rule.id === id)?.rule;
|
|
217
|
-
}
|
|
1
|
+
import{MAX_ADDRESS_COUNT,MAX_RECORD_COUNT_REGISTRAR,MAX_RECORD_LENGTH}from'@wowok/wowok';const BIT_NO_INFO=0x0,BIT_LIKE=0x2,BIT_DISLIKE=0x4,BIT_AFFILIATION=0x8,R_REG_01={'rule':{'id':'R-REG-01','level':'HIGH','category':'lifecycle','title':'Entity\x20and\x20Registrar\x20are\x20system\x20singletons\x20—\x20cannot\x20be\x20migrated\x20post-deploy','description':'Entity\x20and\x20Registrar\x20are\x20created\x20once\x20at\x20package\x20init\x20by\x20@0x0\x20(registrar.move:152-166)\x20'+'and\x20are\x20globally\x20unique.\x20They\x20cannot\x20be\x20re-created,\x20migrated,\x20or\x20re-initialized.\x20If\x20'+'the\x20singleton\x27s\x20storage\x20layout\x20needs\x20to\x20change\x20(e.g.\x20ParentTable\x20schema),\x20the\x20only\x20'+'option\x20is\x20a\x20new\x20package\x20version\x20with\x20a\x20migration\x20path.\x20There\x20is\x20no\x20in-place\x20migration\x20'+'API.\x20All\x2022\x20objects\x20depend\x20on\x20these\x20singletons\x20via\x20affiliation,\x20so\x20a\x20migration\x20would\x20'+'cascade\x20to\x20every\x20object.','affected_stakeholders':['system','user'],'scenario':'Operator\x20wants\x20to\x20migrate\x20Entity\x20to\x20a\x20new\x20schema;\x20no\x20migration\x20API\x20exists','mitigation':'Confirm\x20the\x20schema\x20before\x20deployment.\x20For\x20schema\x20evolution,\x20plan\x20a\x20new\x20package\x20'+'version\x20with\x20an\x20explicit\x20migration\x20script.\x20Never\x20assume\x20the\x20singleton\x20can\x20be\x20\x27reset\x27.','auto_fixable':![]},'check':a=>{if(!a['expects_singleton_migration'])return null;return{...R_REG_01['rule'],'evidence':'expects_singleton_migration=true\x20(no\x20migration\x20API)'};}},R_REG_02={'rule':{'id':'R-REG-02','level':'MEDIUM','category':'structural','title':'MAX_ADDRESS_COUNT='+MAX_ADDRESS_COUNT+'\x20may\x20be\x20insufficient\x20for\x20large\x20deployments','description':'The\x20Entity\x20and\x20Registrar\x20ParentTables\x20are\x20bounded\x20by\x20MAX_ADDRESS_COUNT='+MAX_ADDRESS_COUNT+'\x20'+'(registrar.move).\x20Exceeding\x20the\x20cap\x20aborts\x20address\x20registration.\x20For\x20mass-market\x20'+('applications,\x20'+MAX_ADDRESS_COUNT+'\x20entries\x20may\x20be\x20too\x20few;\x20the\x20limit\x20is\x20a\x20single\x20')+'Move\x20constant\x20that\x20requires\x20a\x20package\x20upgrade\x20to\x20change.','affected_stakeholders':['system','user'],'scenario':'Popular\x20service\x20reaches\x205200\x20registered\x20users;\x20new\x20registrations\x20abort','mitigation':'Monitor\x20address_count.\x20Plan\x20a\x20package\x20upgrade\x20that\x20raises\x20MAX_ADDRESS_COUNT\x20before\x20'+'hitting\x20the\x20cap.\x20For\x20shardable\x20workloads,\x20consider\x20multiple\x20Entity\x20tables\x20in\x20a\x20future\x20'+'package\x20version.','auto_fixable':![]},'check':a=>{if(a['address_count']===undefined)return null;if(a['address_count']<MAX_ADDRESS_COUNT)return null;return{...R_REG_02['rule'],'evidence':'address_count='+a['address_count']+',\x20limit='+MAX_ADDRESS_COUNT};}},R_REG_03={'rule':{'id':'R-REG-03','level':'MEDIUM','category':'semantic','title':'Vote.info\x20uses\x20u8\x20bitmask\x20—\x20bits\x204-7\x20reserved,\x20future\x20expansion\x20must\x20stay\x20compatible','description':'Vote.info\x20is\x20a\x20u8\x20bitmask:\x20BIT_NO_INFO='+BIT_NO_INFO+',\x20BIT_LIKE='+BIT_LIKE+',\x20'+('BIT_DISLIKE='+BIT_DISLIKE+',\x20BIT_AFFILIATION='+BIT_AFFILIATION+'.\x20Bits\x204-7\x20are\x20reserved.\x20')+'A\x20future\x20version\x20that\x20repurposes\x20bits\x204-7\x20would\x20conflict\x20with\x20any\x20off-chain\x20code\x20that\x20'+'reads\x20the\x20raw\x20byte.\x20The\x20reserved\x20bits\x20MUST\x20be\x20treated\x20as\x20zero\x20today;\x20non-zero\x20values\x20'+'in\x20bits\x204-7\x20indicate\x20a\x20forward-incompatible\x20voter.','affected_stakeholders':['voter','system'],'scenario':'Future\x20version\x20assigns\x20bit\x204\x20to\x20a\x20new\x20flag;\x20old\x20indexers\x20misread\x20the\x20byte','mitigation':'Off-chain\x20code\x20must\x20mask\x20to\x20bits\x200-3\x20today\x20and\x20ignore\x20bits\x204-7.\x20When\x20a\x20new\x20flag\x20is\x20'+'assigned,\x20ship\x20a\x20coordinated\x20Move\x20+\x20SDK\x20+\x20indexer\x20update.','auto_fixable':![]},'check':a=>{if(!a['uses_reserved_vote_bits'])return null;return{...R_REG_03['rule'],'evidence':'uses_reserved_vote_bits=true\x20(bits\x204-7\x20are\x20reserved)'};}},R_REG_05={'rule':{'id':'R-REG-05','level':'MEDIUM','category':'cross_object','title':'affiliation\x20/\x20disaffiliation\x20emit\x20no\x20events\x20—\x20indexers\x20must\x20poll\x20Registrar.table','description':'affiliation,\x20disaffiliation,\x20and\x20affiliation_change\x20(registrar.move)\x20mutate\x20the\x20'+'Registrar\x20dependency\x20graph\x20but\x20emit\x20no\x20events.\x20External\x20indexers\x20that\x20track\x20the\x20'+'object-dependency\x20graph\x20cannot\x20rely\x20on\x20an\x20event\x20stream;\x20they\x20must\x20poll\x20the\x20'+'ParentTable,\x20which\x20is\x20expensive\x20as\x20the\x20graph\x20grows.','affected_stakeholders':['system'],'scenario':'Indexer\x20expects\x20an\x20AffiliationEvent;\x20none\x20is\x20emitted,\x20dependency\x20graph\x20is\x20stale','mitigation':'Indexers\x20should\x20poll\x20Registrar.table\x20on\x20a\x20cadence\x20and\x20diff.\x20Future\x20versions\x20may\x20add\x20'+'AffiliationEvent;\x20until\x20then,\x20do\x20not\x20build\x20critical\x20UX\x20on\x20affiliation\x20event\x20streams.','auto_fixable':![]},'check':a=>{if(!a['expects_affiliation_event'])return null;return{...R_REG_05['rule'],'evidence':'expects_affiliation_event=true\x20(no\x20events)'};}},R_REG_04={'rule':{'id':'R-REG-04','level':'LOW','category':'lifecycle','title':'entity_register\x20is\x20idempotent\x20—\x20returns\x20existing\x20Resource,\x20not\x20a\x20fresh\x20one','description':'entity_register\x20(registrar.move:177-187)\x20checks\x20whether\x20the\x20sender\x20already\x20has\x20an\x20'+'Entity\x20record.\x20If\x20so,\x20it\x20returns\x20the\x20existing\x20Resource\x20address\x20without\x20creating\x20a\x20new\x20'+'one.\x20Callers\x20who\x20expect\x20a\x20fresh\x20Resource\x20on\x20each\x20call\x20(e.g.\x20after\x20a\x20forced\x20destroy)\x20'+'will\x20silently\x20receive\x20the\x20old\x20one.\x20Use\x20entity_register_with_resource_forced\x20to\x20'+'force-reallocate,\x20and\x20only\x20when\x20the\x20old\x20Resource\x20is\x20truly\x20gone.','affected_stakeholders':['user'],'scenario':'User\x20destroys\x20their\x20Resource\x20then\x20calls\x20entity_register;\x20gets\x20the\x20old\x20(now-invalid)\x20address','mitigation':'Document\x20the\x20idempotent\x20behavior.\x20After\x20a\x20forced\x20destroy,\x20callers\x20MUST\x20use\x20'+'entity_register_with_resource_forced.\x20SDK\x20should\x20detect\x20destroyed\x20Resource\x20and\x20route\x20'+'accordingly.','auto_fixable':![]},'check':a=>{if(!a['expects_fresh_resource_on_register'])return null;return{...R_REG_04['rule'],'evidence':'expects_fresh_resource_on_register=true\x20(idempotent)'};}},R_REG_06={'rule':{'id':'R-REG-06','level':'LOW','category':'semantic','title':'Record.typed_value\x20first\x20byte\x20is\x20a\x20ValueType\x20—\x20convention\x20enforced\x20only\x20by\x20docs','description':'Record.typed_value\x20is\x20a\x20vector<u8>\x20whose\x20first\x20byte\x20encodes\x20the\x20ValueType\x20(registrar.move:111).\x20'+'The\x20Move\x20layer\x20validates\x20that\x20the\x20vector\x20is\x20non-empty\x20and\x20within\x20MAX_RECORD_LENGTH='+(MAX_RECORD_LENGTH+',\x20but\x20it\x20does\x20not\x20validate\x20that\x20the\x20first\x20byte\x20is\x20a\x20known\x20ValueType.\x20')+'Off-chain\x20consumers\x20must\x20agree\x20on\x20the\x20ValueType\x20byte\x20layout;\x20a\x20misencoded\x20record\x20will\x20'+'deserialize\x20to\x20garbage\x20without\x20an\x20on-chain\x20abort.\x20Record\x20count\x20is\x20bounded\x20by\x20'+('MAX_RECORD_COUNT_REGISTRAR='+MAX_RECORD_COUNT_REGISTRAR+'.'),'affected_stakeholders':['user','system'],'scenario':'Caller\x20writes\x20a\x20record\x20with\x20first\x20byte\x200xFF;\x20no\x20on-chain\x20error,\x20but\x20consumers\x20cannot\x20decode','mitigation':'SDK\x20must\x20validate\x20the\x20first\x20byte\x20against\x20the\x20ValueType\x20enum\x20before\x20submitting.\x20'+'Document\x20the\x20ValueType\x20byte\x20layout\x20in\x20both\x20Move\x20and\x20SDK.\x20Add\x20a\x20sync\x20test\x20that\x20'+'asserts\x20the\x20ValueType\x20enum\x20matches\x20across\x20layers.','related_move_error':'ERecordTypeEmpty\x20(3)\x20—\x20only\x20catches\x20empty\x20typed_value','auto_fixable':![]},'check':a=>{if(!a['relies_on_typed_value_convention'])return null;return{...R_REG_06['rule'],'evidence':'relies_on_typed_value_convention=true\x20(docs-only\x20enforcement)'};}},R_REG_07={'rule':{'id':'R-REG-07','level':'MEDIUM','category':'cross_object','title':'entity_resource_transfer\x20detaches\x20Resource\x20from\x20the\x20source\x20address','description':'entity_resource_transfer(resource,\x20new_address,\x20ctx)\x20moves\x20the\x20Resource\x20backing\x20a\x20'+'user\x27s\x20identity\x20mark\x20to\x20a\x20new\x20address.\x20After\x20transfer,\x20the\x20source\x20address\x20has\x20no\x20'+'Resource\x20—\x20any\x20downstream\x20service\x20that\x20keyed\x20identity\x20on\x20the\x20source\x20address\x20loses\x20'+'the\x20binding.\x20There\x20is\x20no\x20automatic\x20forwarding\x20stub\x20left\x20behind.','affected_stakeholders':['user','system'],'scenario':'User\x20transfers\x20Resource\x20to\x20a\x20new\x20wallet;\x20old-wallet-based\x20services\x20break','mitigation':'Surface\x20a\x20\x27transfer\x20will\x20detach\x20the\x20Resource\x20from\x20this\x20address\x27\x20warning.\x20Consumers\x20'+'should\x20track\x20users\x20by\x20Resource\x20address,\x20not\x20by\x20user\x20address.\x20Provide\x20a\x20migration\x20'+'window\x20where\x20both\x20addresses\x20are\x20valid.','auto_fixable':![]},'check':a=>{if(!a['is_resource_transfer'])return null;return{...R_REG_07['rule'],'evidence':'is_resource_transfer=true\x20(source\x20loses\x20Resource)'};}},R_REG_08={'rule':{'id':'R-REG-08','level':'LOW','category':'semantic','title':'Vote.time\x20updates\x20on\x20every\x20toggle\x20—\x20including\x20like→no-like','description':'Vote.time\x20(registrar.move)\x20is\x20set\x20to\x20clock.timestamp_ms()\x20on\x20every\x20like/dislike\x20'+'operation,\x20including\x20toggles\x20that\x20remove\x20a\x20like\x20(like→no-like).\x20Consumers\x20who\x20'+'interpret\x20Vote.time\x20as\x20\x27last\x20liked\x20at\x27\x20will\x20be\x20confused\x20when\x20it\x20advances\x20on\x20an\x20'+'un-like.\x20The\x20field\x20semantically\x20means\x20\x27last\x20vote\x20op\x20time\x27,\x20not\x20\x27last\x20positive\x20vote\x27.','affected_stakeholders':['voter','system'],'scenario':'User\x20un-likes;\x20Vote.time\x20advances;\x20indexer\x20reads\x20it\x20as\x20\x27recently\x20liked\x27','mitigation':'Document\x20Vote.time\x20as\x20\x27last\x20vote\x20operation\x20time\x27.\x20For\x20\x27last\x20liked\x20at\x27\x20semantics,\x20'+'track\x20the\x20previous\x20Vote.info\x20state\x20and\x20only\x20record\x20time\x20when\x20BIT_LIKE\x20transitions\x20to\x20set.','auto_fixable':![]},'check':a=>{if(!a['expects_vote_time_only_on_like'])return null;return{...R_REG_08['rule'],'evidence':'expects_vote_time_only_on_like=true\x20(updates\x20on\x20toggle)'};}};export const REGISTRAR_RISK_RULES=[R_REG_01,R_REG_02,R_REG_03,R_REG_04,R_REG_05,R_REG_06,R_REG_07,R_REG_08];export const REGISTRAR_RISK_VERSION='1.0.0';export function checkRegistrarRisks(a){const b=[];for(const c of REGISTRAR_RISK_RULES){const d=c['check'](a);if(d)b['push'](d);}return b;}export function getRegistrarRiskById(a){return REGISTRAR_RISK_RULES['find'](b=>b['rule']['id']===a)?.['rule'];}
|