@odatano/core 2.0.0-rc.6 → 2.0.0-rc.8

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.
@@ -1,93 +1,106 @@
1
- using {odatano.cardano as db} from '../db/schema';
2
-
3
- /**
4
- * Cardano Indexer Service (v2.0)
5
- *
6
- * Control + observability surface for the chain crawler / pre-sync engine:
7
- * - read-only projections of the sync cursor and reorg audit log
8
- * - status function + pause/resume actions delegating to the crawler singleton
9
- *
10
- * Security note: see CardanoODataService (cardano-service.cds) for the rationale on
11
- * service-level auth. pause/resume are operational actions — gate behind a dedicated
12
- * Admin scope. Read-only status and audit data remain available to authenticated users.
13
- */
14
- @requires: 'authenticated-user'
15
- service CardanoIndexerService @(impl: './cardano-indexer-service') {
16
-
17
- @readonly
18
- @title : 'Sync State'
19
- @description: 'Singleton crawl cursor — pre-sync progress, tip lag, status, errors'
20
- entity SyncState as projection on db.CardanoSyncState;
21
-
22
- @readonly
23
- @title : 'Reorg Log'
24
- @description: 'Audit trail of chain rollbacks handled by the crawler'
25
- entity ReorgLog as projection on db.CardanoReorgLog;
26
-
27
- @title : 'Crawler Status'
28
- @description: 'Live crawler status summary (numeric fields as strings, CAP-10 aligned)'
29
- type CrawlerStatus {
30
- running : Boolean;
31
- syncStatus : String;
32
- lastSlot : String;
33
- lastHeight : String;
34
- tipHeight : String;
35
- syncProgress : String;
36
- consecutiveErrors : Integer;
37
- }
38
-
39
- @title : 'Get Crawler Status'
40
- @description: 'Return the current crawler run state and sync progress'
41
- /**
42
- * Emitted AFTER each block is committed. Subscribe instead of polling:
43
- * (await cds.connect.to('CardanoIndexerService')).on('blockIndexed', ({ data }) => …)
44
- * In-process (plugin mode) this needs no messaging service.
45
- */
46
- event blockIndexed {
47
- hash : String(64);
48
- slot : Integer64;
49
- height : Integer64;
50
- txHashes : many String(64);
51
- tipSlot : Integer64;
52
- tipHeight: Integer64;
53
- }
54
-
55
- /** Emitted AFTER a rollback is committed. Everything above `forkSlot` was removed. */
56
- event reorg {
57
- forkSlot : Integer64;
58
- forkHeight : Integer64;
59
- blocksRolledBack : Integer;
60
- }
61
-
62
- function getStatus() returns CrawlerStatus;
63
-
64
- @title : 'Liveness'
65
- type Liveness {
66
- status : String; // 'alive'
67
- timestamp : Timestamp;
68
- uptime : Integer; // seconds since process start
69
- version : String; // @odatano/core version
70
- network : String; // configured network
71
- }
72
-
73
- // Public override (see VerifyDataSignature in cardano-sign-service.cds): a
74
- // liveness probe carries no credentials. 200 as long as the process answers —
75
- // no backend or DB probe, no secrets, no backend names, no API key state. That
76
- // stays with getStatus and the backend health entities, which remain
77
- // authenticated. Mirrors NIGHTGATE's `/api/v1/indexer/getLiveness()`, so a
78
- // gateway probes both products the same way.
79
- @title : 'Get Liveness'
80
- @description: 'Unauthenticated liveness probe: 200 while the process answers. Docker HEALTHCHECK and upstream probes use this instead of the service document.'
81
- @requires : 'any'
82
- function getLiveness() returns Liveness;
83
-
84
- @title : 'Pause Crawler'
85
- @description: 'Stop the crawler (closes the chain-sync stream). Resume continues from the cursor.'
86
- @requires : 'Admin'
87
- action pauseCrawler() returns Boolean;
88
-
89
- @title : 'Resume Crawler'
90
- @description: 'Start/restart the crawler from the persisted cursor using the configured source.'
91
- @requires : 'Admin'
92
- action resumeCrawler() returns Boolean;
93
- }
1
+ using {odatano.cardano as db} from '../db/schema';
2
+
3
+ /**
4
+ * Cardano Indexer Service (v2.0)
5
+ *
6
+ * Control + observability surface for the chain crawler / pre-sync engine:
7
+ * - read-only projections of the sync cursor and reorg audit log
8
+ * - status function + pause/resume actions delegating to the crawler singleton
9
+ *
10
+ * Security note: see CardanoODataService (cardano-service.cds) for the rationale on
11
+ * auth. pause/resume are operational actions — gate behind a dedicated Admin scope.
12
+ * Read-only status and audit data remain available to authenticated users.
13
+ *
14
+ * Deliberately NO service-level @requires: CAP checks a service-level requirement
15
+ * on every request BEFORE the operation's own annotation, so an operation-level
16
+ * `@requires: 'any'` can never open a single function on an otherwise
17
+ * authenticated service (anonymous callers get the 401 challenge first). The
18
+ * requirement therefore sits on each element, and getLiveness() alone is 'any' —
19
+ * the same layout as NIGHTGATE's indexer service.
20
+ */
21
+ // Service-level 'any' on purpose: CAP authorizes the service BEFORE the operation and
22
+ // treats a service without a service-level @requires as authenticated-user under
23
+ // NODE_ENV=production, which would 401 the anonymous operation below despite its own
24
+ // 'any'. Every element carries its requirement; the service itself refuses nothing.
25
+ @requires: 'any'
26
+ service CardanoIndexerService @(impl: './cardano-indexer-service') {
27
+
28
+ @readonly
29
+ @requires : 'authenticated-user'
30
+ @title : 'Sync State'
31
+ @description: 'Singleton crawl cursor — pre-sync progress, tip lag, status, errors'
32
+ entity SyncState as projection on db.CardanoSyncState;
33
+
34
+ @readonly
35
+ @requires : 'authenticated-user'
36
+ @title : 'Reorg Log'
37
+ @description: 'Audit trail of chain rollbacks handled by the crawler'
38
+ entity ReorgLog as projection on db.CardanoReorgLog;
39
+
40
+ @title : 'Crawler Status'
41
+ @description: 'Live crawler status summary (numeric fields as strings, CAP-10 aligned)'
42
+ type CrawlerStatus {
43
+ running : Boolean;
44
+ syncStatus : String;
45
+ lastSlot : String;
46
+ lastHeight : String;
47
+ tipHeight : String;
48
+ syncProgress : String;
49
+ consecutiveErrors : Integer;
50
+ }
51
+
52
+ @title : 'Get Crawler Status'
53
+ @description: 'Return the current crawler run state and sync progress'
54
+ /**
55
+ * Emitted AFTER each block is committed. Subscribe instead of polling:
56
+ * (await cds.connect.to('CardanoIndexerService')).on('blockIndexed', ({ data }) => …)
57
+ * In-process (plugin mode) this needs no messaging service.
58
+ */
59
+ event blockIndexed {
60
+ hash : String(64);
61
+ slot : Integer64;
62
+ height : Integer64;
63
+ txHashes : many String(64);
64
+ tipSlot : Integer64;
65
+ tipHeight: Integer64;
66
+ }
67
+
68
+ /** Emitted AFTER a rollback is committed. Everything above `forkSlot` was removed. */
69
+ event reorg {
70
+ forkSlot : Integer64;
71
+ forkHeight : Integer64;
72
+ blocksRolledBack : Integer;
73
+ }
74
+
75
+ @requires : 'authenticated-user'
76
+ function getStatus() returns CrawlerStatus;
77
+
78
+ @title : 'Liveness'
79
+ type Liveness {
80
+ status : String; // 'alive'
81
+ timestamp : Timestamp;
82
+ uptime : Integer; // seconds since process start
83
+ version : String; // @odatano/core version
84
+ network : String; // configured network
85
+ }
86
+
87
+ // Anonymous on purpose: a liveness probe carries no credentials. 200 as long
88
+ // as the process answers — no backend or DB probe, no secrets, no backend
89
+ // names, no API key state. Readiness stays with getStatus and the worker
90
+ // status, which remain authenticated. Mirrors NIGHTGATE's
91
+ // `/api/v1/indexer/getLiveness()`, so a gateway probes both products the same way.
92
+ @title : 'Get Liveness'
93
+ @description: 'Unauthenticated liveness probe: 200 while the process answers. Docker HEALTHCHECK and upstream probes use this instead of the service document.'
94
+ @requires : 'any'
95
+ function getLiveness() returns Liveness;
96
+
97
+ @title : 'Pause Crawler'
98
+ @description: 'Stop the crawler (closes the chain-sync stream). Resume continues from the cursor.'
99
+ @requires : 'Admin'
100
+ action pauseCrawler() returns Boolean;
101
+
102
+ @title : 'Resume Crawler'
103
+ @description: 'Start/restart the crawler from the persisted cursor using the configured source.'
104
+ @requires : 'Admin'
105
+ action resumeCrawler() returns Boolean;
106
+ }
@@ -1,180 +1,200 @@
1
- using {odatano.cardano as db} from '../db/schema';
2
- using {Bech32} from '../db/types';
3
-
4
- /**
5
- * Cardano Sign Service
6
- *
7
- * Handles the external signing workflow for Cardano transactions, including:
8
- * - Creating signing requests with transaction details and signing instructions
9
- * - Verifying signatures of signed transactions and storing verification results
10
- * - Submitting verified transactions to the blockchain and tracking submission status
11
- * - Providing actions for signing with a Hardware Security Module (HSM) and retrieving HSM status
12
- *
13
- * Security note: see CardanoODataService (cardano-service.cds) for the rationale
14
- * on service-level auth without per-resource ownership enforcement.
15
- */
16
- @requires: 'authenticated-user'
17
- service CardanoSignService @(impl: './cardano-sign-service') {
18
-
19
- // ---------------------------------------------------------------------------
20
- // Signing Workflow Projections
21
- // ---------------------------------------------------------------------------
22
- @readonly
23
- @title : 'Signature Verifications'
24
- @description: 'Projection for Signature Verifications - stores verification results'
25
- entity SignatureVerifications as projection on db.SignatureVerifications;
26
-
27
- @readonly
28
- @title : 'Address Signing Requests'
29
- @description: 'Projection for retrieving signing requests by address'
30
- entity AddressSigningRequests as projection on db.AddressSigningRequests;
31
-
32
- @readonly
33
- @title : 'Transaction Builds'
34
- @description: 'Projection for Transaction Builds - needed by CreateSigningRequest to look up build details'
35
- entity TransactionBuilds as projection on db.TransactionBuilds;
36
-
37
-
38
- @readonly
39
- @title : 'Transaction Submissions'
40
- @description: 'Projection for Transaction Submissions - stores submission results'
41
- entity TransactionSubmissions as projection on db.TransactionSubmissions;
42
-
43
- @readonly
44
- @title : 'Signing Requests'
45
- @description: 'Projection for Signing Requests - tracks signing workflow'
46
- entity SigningRequests as projection on db.SigningRequests;
47
-
48
- @title : 'Verify Signature'
49
- @description: 'Verify the signature of a signed transaction. Stores the verification result for audit trail.'
50
- action VerifySignature(
51
- @title: 'Signing Request ID'
52
- @description: 'The unique identifier of the signing request'
53
- signingRequestId: UUID,
54
- @title: 'Signed Transaction CBOR'
55
- @description: 'The signed transaction CBOR to verify'
56
- signedTxCbor: String,
57
- @title: 'Signer Type'
58
- @description: 'Type of signer used (cardano-cli | browser-wallet | hardware-wallet | custom)'
59
- signerType: String(20),
60
- @title: 'Signer Info'
61
- @description: 'Additional signer information (wallet name, etc.)'
62
- signerInfo: String(100),
63
- @title: 'Sender Address'
64
- @description: 'Optional sender address for ownership verification. When provided, verifies the signing request belongs to this address.'
65
- address: Bech32) returns SignatureVerifications;
66
-
67
- @title : 'Submit Verified Transaction'
68
- @description: 'Verify and submit a signed transaction in one step. Updates the signing request status and creates submission record.'
69
- action SubmitVerifiedTransaction(
70
- @title: 'Signing Request ID'
71
- @description: 'The unique identifier of the signing request'
72
- signingRequestId: UUID,
73
- @title: 'Signed Transaction CBOR'
74
- @description: 'The signed transaction CBOR'
75
- signedTxCbor: String,
76
- @title: 'Signer Type'
77
- @description: 'Type of signer used'
78
- signerType: String(20),
79
- @title: 'Signer Info'
80
- @description: 'Additional signer information'
81
- signerInfo: String(100),
82
- @title: 'Sender Address'
83
- @description: 'Optional sender address for ownership verification. When provided, verifies the signing request belongs to this address.'
84
- address: Bech32,
85
- @title: 'Defer Submit'
86
- @description: 'When true, verify + claim run on the caller''s transaction and the network submit happens detached AFTER the caller''s commit. Returns immediately with the tx hash (= tx body hash) and status ''pending''. Designed for in-process CAP consumers whose request transaction would otherwise deadlock the pooled sqlite connection (KNOWN_ISSUES #11). Track the outcome via the signing request / submission status.'
87
- deferSubmit: Boolean) returns TransactionSubmissions;
88
-
89
-
90
- // ---------------------------------------------------------------------------
91
- // CIP-30 signData (COSE_Sign1) message-signature verification
92
- // ---------------------------------------------------------------------------
93
-
94
- // Public override: this action is the crypto check behind wallet-based LOGIN,
95
- // so the caller is not yet authenticated. It is a stateless verification —
96
- // no DB write, no key access, no state — so exposing it leaks nothing.
97
- @requires : 'any'
98
- @title : 'Verify Data Signature (CIP-30 signData)'
99
- @description: 'Verify a COSE_Sign1 message signature against a bech32 address. Confirms the Ed25519 signature, that the signer key hashes to the address payment credential, and (optionally) that the signed payload matches an expected value.'
100
- action VerifyDataSignature(
101
- @description: 'Bech32 address the wallet claimed to sign with'
102
- address : Bech32,
103
- @description: 'Hex-encoded COSE_Sign1 CBOR (the `signature` field from CIP-30 signData)'
104
- coseSignature : String,
105
- @description: 'Hex-encoded COSE_Key CBOR (the `key` field from CIP-30 signData)'
106
- coseKey : String,
107
- @description: 'Optional expected UTF-8 payload; when set, the signed payload must equal it (anti-replay). When omitted, the decoded payload is returned for the caller to check.'
108
- expectedPayload: String) returns {
109
- @description: 'Whether the signature is valid and all checks passed' valid : Boolean;
110
- @description: 'Failure detail when not valid' reason : String;
111
- @description: 'UTF-8 of the signed payload, echoed back' signedPayload : String;
112
- @description: 'Hex blake2b-224 of the signer public key' signerVkh : String;
113
- };
114
-
115
- // ---------------------------------------------------------------------------
116
- // General Signing Workflow Actions
117
- // ---------------------------------------------------------------------------
118
-
119
- @title : 'Create Signing Request'
120
- @description: 'Create a signing request for external signing. Returns transaction details, signing instructions, and CLI commands. The request is persisted for audit trail.'
121
- action CreateSigningRequest(
122
- @title: 'Build ID'
123
- @description: 'The unique identifier of the transaction build'
124
- buildId: UUID,
125
- @title: 'Message to Signer'
126
- @description: 'A message to include for the signer'
127
- message: String) returns SigningRequests;
128
-
129
- @title : 'Get Signing Request'
130
- @description: 'Retrieve an existing signing request by ID'
131
- action GetSigningRequest(
132
- @title: 'Signing Request ID'
133
- @description: 'The unique identifier of the signing request'
134
- signingRequestId: UUID) returns SigningRequests;
135
-
136
- @title : 'Address Signing Requests'
137
- @description: 'Projection for retrieving signing requests by address'
138
- action GetSigningRequestsByAddress(
139
- @title: 'Bech32 Address'
140
- @description: 'The Bech32 encoded address to retrieve signing requests for'
141
- address: Bech32) returns array of AddressSigningRequests;
142
-
143
- // ---------------------------------------------------------------------------
144
- // HSM (Hardware Security Module) Signing Actions
145
- // ---------------------------------------------------------------------------
146
-
147
- @title : 'Sign with HSM'
148
- @description: 'Sign a transaction using the configured Hardware Security Module. Creates a signing request, signs with the HSM, and verifies the signature. Returns the signing request with status verified.'
149
- action SignWithHsm(
150
- @title: 'Build ID'
151
- @description: 'The unique identifier of the transaction build to sign'
152
- buildId: UUID,
153
- @title: 'Sender Address'
154
- @description: 'Optional sender address for ownership verification. When provided, verifies the build belongs to this address.'
155
- address: Bech32) returns SigningRequests;
156
-
157
- @title : 'Sign and Submit with HSM'
158
- @description: 'Sign a transaction using the HSM and submit it to the blockchain in one atomic operation. Returns the transaction submission details.'
159
- action SignAndSubmitWithHsm(
160
- @title: 'Build ID'
161
- @description: 'The unique identifier of the transaction build to sign and submit'
162
- buildId: UUID,
163
- @title: 'Sender Address'
164
- @description: 'Optional sender address for ownership verification. When provided, verifies the build belongs to this address.'
165
- address: Bech32,
166
- @title: 'Defer Submit'
167
- @description: 'When true, sign + verify + claim run on the caller''s transaction and the network submit happens detached AFTER the caller''s commit (see SubmitVerifiedTransaction.deferSubmit).'
168
- deferSubmit: Boolean) returns TransactionSubmissions;
169
-
170
- @title : 'Get HSM Status'
171
- @description: 'Check the current status of the HSM connection and key availability.'
172
- action GetHsmStatus() returns {
173
- @title: 'Connected' @description: 'Whether the HSM session is active' connected : Boolean;
174
- @title: 'Key ID' @description: 'The PKCS#11 key identifier in use' keyId : String;
175
- @title: 'Key Label' @description: 'The PKCS#11 key label in use' keyLabel : String;
176
- @title: 'Public Key Hash' @description: 'Blake2b-224 hash of the HSM Ed25519 public key (= Cardano verification key hash)' publicKeyHash : String;
177
- @title: 'Cardano Address' @description: 'Enterprise Cardano address derived from the HSM public key' cardanoAddress : String;
178
- };
179
-
180
- }
1
+ using {odatano.cardano as db} from '../db/schema';
2
+ using {Bech32} from '../db/types';
3
+
4
+ /**
5
+ * Cardano Sign Service
6
+ *
7
+ * Handles the external signing workflow for Cardano transactions, including:
8
+ * - Creating signing requests with transaction details and signing instructions
9
+ * - Verifying signatures of signed transactions and storing verification results
10
+ * - Submitting verified transactions to the blockchain and tracking submission status
11
+ * - Providing actions for signing with a Hardware Security Module (HSM) and retrieving HSM status
12
+ *
13
+ * Security note: see CardanoODataService (cardano-service.cds) for the rationale on auth
14
+ * without per-resource ownership enforcement. Deliberately NO service-level @requires:
15
+ * CAP checks it on every request BEFORE the operation annotation, which silenced the
16
+ * `any` on VerifyDataSignature (anonymous callers got the 401 challenge first). The
17
+ * requirement therefore sits on each element; VerifyDataSignature alone is public.
18
+ */
19
+ // Service-level 'any' on purpose: CAP authorizes the service BEFORE the operation and
20
+ // treats a service without a service-level @requires as authenticated-user under
21
+ // NODE_ENV=production, which would 401 the anonymous operation below despite its own
22
+ // 'any'. Every element carries its requirement; the service itself refuses nothing.
23
+ @requires: 'any'
24
+ service CardanoSignService @(impl: './cardano-sign-service') {
25
+
26
+ // ---------------------------------------------------------------------------
27
+ // Signing Workflow Projections
28
+ // ---------------------------------------------------------------------------
29
+ @readonly
30
+ @title : 'Signature Verifications'
31
+ @description: 'Projection for Signature Verifications - stores verification results'
32
+ @requires : 'authenticated-user'
33
+ entity SignatureVerifications as projection on db.SignatureVerifications;
34
+
35
+ @readonly
36
+ @title : 'Address Signing Requests'
37
+ @description: 'Projection for retrieving signing requests by address'
38
+ @requires : 'authenticated-user'
39
+ entity AddressSigningRequests as projection on db.AddressSigningRequests;
40
+
41
+ @readonly
42
+ @title : 'Transaction Builds'
43
+ @description: 'Projection for Transaction Builds - needed by CreateSigningRequest to look up build details'
44
+ @requires : 'authenticated-user'
45
+ entity TransactionBuilds as projection on db.TransactionBuilds;
46
+
47
+
48
+ @readonly
49
+ @title : 'Transaction Submissions'
50
+ @description: 'Projection for Transaction Submissions - stores submission results'
51
+ @requires : 'authenticated-user'
52
+ entity TransactionSubmissions as projection on db.TransactionSubmissions;
53
+
54
+ @readonly
55
+ @title : 'Signing Requests'
56
+ @description: 'Projection for Signing Requests - tracks signing workflow'
57
+ @requires : 'authenticated-user'
58
+ entity SigningRequests as projection on db.SigningRequests;
59
+
60
+ @title : 'Verify Signature'
61
+ @description: 'Verify the signature of a signed transaction. Stores the verification result for audit trail.'
62
+ @requires : 'authenticated-user'
63
+ action VerifySignature(
64
+ @title: 'Signing Request ID'
65
+ @description: 'The unique identifier of the signing request'
66
+ signingRequestId: UUID,
67
+ @title: 'Signed Transaction CBOR'
68
+ @description: 'The signed transaction CBOR to verify'
69
+ signedTxCbor: String,
70
+ @title: 'Signer Type'
71
+ @description: 'Type of signer used (cardano-cli | browser-wallet | hardware-wallet | custom)'
72
+ signerType: String(20),
73
+ @title: 'Signer Info'
74
+ @description: 'Additional signer information (wallet name, etc.)'
75
+ signerInfo: String(100),
76
+ @title: 'Sender Address'
77
+ @description: 'Optional sender address for ownership verification. When provided, verifies the signing request belongs to this address.'
78
+ address: Bech32) returns SignatureVerifications;
79
+
80
+ @title : 'Submit Verified Transaction'
81
+ @description: 'Verify and submit a signed transaction in one step. Updates the signing request status and creates submission record.'
82
+ @requires : 'authenticated-user'
83
+ action SubmitVerifiedTransaction(
84
+ @title: 'Signing Request ID'
85
+ @description: 'The unique identifier of the signing request'
86
+ signingRequestId: UUID,
87
+ @title: 'Signed Transaction CBOR'
88
+ @description: 'The signed transaction CBOR'
89
+ signedTxCbor: String,
90
+ @title: 'Signer Type'
91
+ @description: 'Type of signer used'
92
+ signerType: String(20),
93
+ @title: 'Signer Info'
94
+ @description: 'Additional signer information'
95
+ signerInfo: String(100),
96
+ @title: 'Sender Address'
97
+ @description: 'Optional sender address for ownership verification. When provided, verifies the signing request belongs to this address.'
98
+ address: Bech32,
99
+ @title: 'Defer Submit'
100
+ @description: 'When true, verify + claim run on the caller''s transaction and the network submit happens detached AFTER the caller''s commit. Returns immediately with the tx hash (= tx body hash) and status ''pending''. Designed for in-process CAP consumers whose request transaction would otherwise deadlock the pooled sqlite connection (KNOWN_ISSUES #11). Track the outcome via the signing request / submission status.'
101
+ deferSubmit: Boolean) returns TransactionSubmissions;
102
+
103
+
104
+ // ---------------------------------------------------------------------------
105
+ // CIP-30 signData (COSE_Sign1) message-signature verification
106
+ // ---------------------------------------------------------------------------
107
+
108
+ // Public override: this action is the crypto check behind wallet-based LOGIN,
109
+ // so the caller is not yet authenticated. It is a stateless verification —
110
+ // no DB write, no key access, no state — so exposing it leaks nothing.
111
+ @requires : 'any'
112
+ @title : 'Verify Data Signature (CIP-30 signData)'
113
+ @description: 'Verify a COSE_Sign1 message signature against a bech32 address. Confirms the Ed25519 signature, that the signer key hashes to the address payment credential, and (optionally) that the signed payload matches an expected value.'
114
+ action VerifyDataSignature(
115
+ @description: 'Bech32 address the wallet claimed to sign with'
116
+ address : Bech32,
117
+ @description: 'Hex-encoded COSE_Sign1 CBOR (the `signature` field from CIP-30 signData)'
118
+ coseSignature : String,
119
+ @description: 'Hex-encoded COSE_Key CBOR (the `key` field from CIP-30 signData)'
120
+ coseKey : String,
121
+ @description: 'Optional expected UTF-8 payload; when set, the signed payload must equal it (anti-replay). When omitted, the decoded payload is returned for the caller to check.'
122
+ expectedPayload: String) returns {
123
+ @description: 'Whether the signature is valid and all checks passed' valid : Boolean;
124
+ @description: 'Failure detail when not valid' reason : String;
125
+ @description: 'UTF-8 of the signed payload, echoed back' signedPayload : String;
126
+ @description: 'Hex blake2b-224 of the signer public key' signerVkh : String;
127
+ };
128
+
129
+ // ---------------------------------------------------------------------------
130
+ // General Signing Workflow Actions
131
+ // ---------------------------------------------------------------------------
132
+
133
+ @title : 'Create Signing Request'
134
+ @description: 'Create a signing request for external signing. Returns transaction details, signing instructions, and CLI commands. The request is persisted for audit trail.'
135
+ @requires : 'authenticated-user'
136
+ action CreateSigningRequest(
137
+ @title: 'Build ID'
138
+ @description: 'The unique identifier of the transaction build'
139
+ buildId: UUID,
140
+ @title: 'Message to Signer'
141
+ @description: 'A message to include for the signer'
142
+ message: String) returns SigningRequests;
143
+
144
+ @title : 'Get Signing Request'
145
+ @description: 'Retrieve an existing signing request by ID'
146
+ @requires : 'authenticated-user'
147
+ action GetSigningRequest(
148
+ @title: 'Signing Request ID'
149
+ @description: 'The unique identifier of the signing request'
150
+ signingRequestId: UUID) returns SigningRequests;
151
+
152
+ @title : 'Address Signing Requests'
153
+ @description: 'Projection for retrieving signing requests by address'
154
+ @requires : 'authenticated-user'
155
+ action GetSigningRequestsByAddress(
156
+ @title: 'Bech32 Address'
157
+ @description: 'The Bech32 encoded address to retrieve signing requests for'
158
+ address: Bech32) returns array of AddressSigningRequests;
159
+
160
+ // ---------------------------------------------------------------------------
161
+ // HSM (Hardware Security Module) Signing Actions
162
+ // ---------------------------------------------------------------------------
163
+
164
+ @title : 'Sign with HSM'
165
+ @description: 'Sign a transaction using the configured Hardware Security Module. Creates a signing request, signs with the HSM, and verifies the signature. Returns the signing request with status verified.'
166
+ @requires : 'authenticated-user'
167
+ action SignWithHsm(
168
+ @title: 'Build ID'
169
+ @description: 'The unique identifier of the transaction build to sign'
170
+ buildId: UUID,
171
+ @title: 'Sender Address'
172
+ @description: 'Optional sender address for ownership verification. When provided, verifies the build belongs to this address.'
173
+ address: Bech32) returns SigningRequests;
174
+
175
+ @title : 'Sign and Submit with HSM'
176
+ @description: 'Sign a transaction using the HSM and submit it to the blockchain in one atomic operation. Returns the transaction submission details.'
177
+ @requires : 'authenticated-user'
178
+ action SignAndSubmitWithHsm(
179
+ @title: 'Build ID'
180
+ @description: 'The unique identifier of the transaction build to sign and submit'
181
+ buildId: UUID,
182
+ @title: 'Sender Address'
183
+ @description: 'Optional sender address for ownership verification. When provided, verifies the build belongs to this address.'
184
+ address: Bech32,
185
+ @title: 'Defer Submit'
186
+ @description: 'When true, sign + verify + claim run on the caller''s transaction and the network submit happens detached AFTER the caller''s commit (see SubmitVerifiedTransaction.deferSubmit).'
187
+ deferSubmit: Boolean) returns TransactionSubmissions;
188
+
189
+ @title : 'Get HSM Status'
190
+ @description: 'Check the current status of the HSM connection and key availability.'
191
+ @requires : 'authenticated-user'
192
+ action GetHsmStatus() returns {
193
+ @title: 'Connected' @description: 'Whether the HSM session is active' connected : Boolean;
194
+ @title: 'Key ID' @description: 'The PKCS#11 key identifier in use' keyId : String;
195
+ @title: 'Key Label' @description: 'The PKCS#11 key label in use' keyLabel : String;
196
+ @title: 'Public Key Hash' @description: 'Blake2b-224 hash of the HSM Ed25519 public key (= Cardano verification key hash)' publicKeyHash : String;
197
+ @title: 'Cardano Address' @description: 'Enterprise Cardano address derived from the HSM public key' cardanoAddress : String;
198
+ };
199
+
200
+ }
@@ -52,9 +52,10 @@ export declare function loadAgentGrantsConfig(env?: Record<string, string | unde
52
52
  * middlewares — the last moment `cds.requires.auth.impl` can still change).
53
53
  *
54
54
  * When enabled:
55
- * - the transport auth becomes srv/utils/agent-token-auth, which admits the
56
- * `x-agent-token` header on the six service paths and delegates every other
57
- * request to the strategy that was configured before (kept as the delegate);
55
+ * - the transport auth becomes @odatano/cap-auth (unless the host runs it
56
+ * already) with the `x-agent-token` lane of srv/utils/agent-token-auth
57
+ * registered; every other request goes to the strategy that was configured
58
+ * before (CAP's own for `kind`, or the host's custom impl as `delegateImpl`);
58
59
  * - each of the six services gets the enforcement hook once it is served.
59
60
  *
60
61
  * Never throws: a misconfiguration is logged and the feature stays off, so a