@odatano/core 2.0.0-rc.49 → 2.0.0-rc.50
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/@cds-models/CardanoAgentService/index.d.ts +6 -12
- package/@cds-models/CardanoIndexerService/index.d.ts +200 -2
- package/@cds-models/CardanoIndexerService/index.js +24 -0
- package/@cds-models/CardanoODataService/index.d.ts +49 -6
- package/@cds-models/CardanoODataService/index.js +4 -0
- package/@cds-models/CardanoSignService/index.d.ts +3 -3
- package/@cds-models/CardanoWorkerService/index.d.ts +4 -3
- package/@cds-models/index.d.ts +9 -1
- package/@cds-models/index.js +2 -1
- package/@cds-models/odatano/cardano/index.d.ts +59 -5
- package/@cds-models/odatano/cardano/index.js +6 -0
- package/README.md +29 -17
- package/db/schema.cds +117 -24
- package/db/types.cds +8 -0
- package/package.json +17 -15
- package/scripts/migrate-schema.mjs +334 -0
- package/src/index.d.ts +7 -5
- package/src/index.js +12 -10
- package/src/plugin.js +6 -7
- package/srv/blockchain/backends/blockfrost-backend.js +9 -1
- package/srv/blockchain/backends/cardano-backend.d.ts +15 -0
- package/srv/blockchain/backends/cardano-backend.js +5 -0
- package/srv/blockchain/backends/koios-backend.js +16 -10
- package/srv/blockchain/backends/ogmios-backend.d.ts +9 -3
- package/srv/blockchain/backends/ogmios-backend.js +60 -18
- package/srv/blockchain/cardano-client.d.ts +5 -4
- package/srv/blockchain/cardano-client.js +46 -13
- package/srv/blockchain/cardano-indexer.d.ts +116 -9
- package/srv/blockchain/cardano-indexer.js +436 -189
- package/srv/blockchain/crawler/account-snapshots.d.ts +29 -0
- package/srv/blockchain/crawler/account-snapshots.js +153 -0
- package/srv/blockchain/crawler/asset-registry-backfill.d.ts +23 -1
- package/srv/blockchain/crawler/asset-registry-backfill.js +91 -1
- package/srv/blockchain/crawler/certificate-backfill.d.ts +2 -0
- package/srv/blockchain/crawler/certificate-backfill.js +10 -3
- package/srv/blockchain/crawler/crawler.d.ts +15 -0
- package/srv/blockchain/crawler/crawler.js +68 -3
- package/srv/blockchain/crawler/input-asset-copies.d.ts +34 -0
- package/srv/blockchain/crawler/input-asset-copies.js +171 -0
- package/srv/blockchain/crawler/metadata-position-backfill.d.ts +16 -0
- package/srv/blockchain/crawler/metadata-position-backfill.js +55 -0
- package/srv/blockchain/crawler/output-datum-backfill.d.ts +39 -0
- package/srv/blockchain/crawler/output-datum-backfill.js +110 -0
- package/srv/blockchain/crawler/transaction-backfill.d.ts +2 -0
- package/srv/blockchain/crawler/transaction-backfill.js +12 -8
- package/srv/blockchain/pool-metadata.d.ts +15 -0
- package/srv/blockchain/pool-metadata.js +132 -0
- package/srv/blockchain/signing/cose-verifier.d.ts +3 -1
- package/srv/blockchain/signing/cose-verifier.js +144 -56
- package/srv/blockchain/signing/hsm-signer.js +2 -1
- package/srv/blockchain/signing/submission-finalizer.d.ts +15 -4
- package/srv/blockchain/signing/submission-finalizer.js +201 -69
- package/srv/blockchain/stored-chain.js +1 -1
- package/srv/blockchain/transaction-building/buildooor-tx.d.ts +1 -3
- package/srv/blockchain/transaction-building/buildooor-tx.js +34 -54
- package/srv/blockchain/transaction-presence.d.ts +5 -0
- package/srv/blockchain/transaction-presence.js +29 -0
- package/srv/blockchain/transaction-rows.js +1 -1
- package/srv/blockchain/wallet-worker/build-request.d.ts +4 -1
- package/srv/blockchain/wallet-worker/build-request.js +25 -0
- package/srv/blockchain/wallet-worker/confirmation-tracker.js +1 -1
- package/srv/blockchain/wallet-worker/job-store.d.ts +17 -7
- package/srv/blockchain/wallet-worker/job-store.js +0 -0
- package/srv/blockchain/wallet-worker/signers.d.ts +2 -0
- package/srv/blockchain/wallet-worker/wallet-worker.d.ts +2 -0
- package/srv/blockchain/wallet-worker/wallet-worker.js +42 -32
- package/srv/cardano-agent-service.cds +11 -12
- package/srv/cardano-agent-service.js +2 -0
- package/srv/cardano-backend-service.cds +34 -1
- package/srv/cardano-backend-service.js +20 -17
- package/srv/cardano-indexer-service.cds +153 -12
- package/srv/cardano-indexer-service.js +175 -29
- package/srv/cardano-service.cds +67 -3
- package/srv/cardano-service.js +132 -67
- package/srv/cardano-sign-service.cds +30 -20
- package/srv/cardano-sign-service.js +13 -10
- package/srv/cardano-tx-service.cds +15 -1
- package/srv/cardano-tx-service.js +4 -1
- package/srv/cardano-worker-service.cds +16 -7
- package/srv/cardano-worker-service.js +31 -22
- package/srv/cbor/parse.js +11 -34
- package/srv/config.d.ts +113 -0
- package/srv/config.js +409 -0
- package/srv/server.d.ts +9 -14
- package/srv/server.js +32 -316
- package/srv/utils/agent-access.d.ts +9 -0
- package/srv/utils/agent-access.js +67 -0
- package/srv/utils/agent-grants-config.d.ts +0 -17
- package/srv/utils/agent-grants-config.js +6 -81
- package/srv/utils/agent-grants.d.ts +6 -19
- package/srv/utils/agent-grants.js +69 -130
- package/srv/utils/const.d.ts +4 -0
- package/srv/utils/const.js +5 -1
- package/srv/utils/db-indexes.js +11 -3
- package/srv/utils/error-codes.d.ts +4 -0
- package/srv/utils/error-codes.js +4 -0
- package/srv/utils/errors.d.ts +6 -0
- package/srv/utils/errors.js +23 -1
- package/srv/utils/liveness.js +2 -5
- package/srv/utils/mappers.d.ts +5 -7
- package/srv/utils/mappers.js +22 -9
- package/srv/utils/pg-order-nulls.js +4 -3
- package/srv/utils/readiness.d.ts +12 -0
- package/srv/utils/readiness.js +29 -0
- package/srv/utils/result-numbers.d.ts +15 -0
- package/srv/utils/result-numbers.js +61 -0
- package/srv/utils/tx-request-parsers.d.ts +1 -1
- package/srv/utils/tx-request-parsers.js +3 -3
- package/srv/utils/tx-utils.d.ts +3 -0
- package/srv/utils/tx-utils.js +17 -3
- package/srv/utils/types.d.ts +16 -3
- package/scripts/migrate-txseq.mjs +0 -138
- package/srv/blockchain/transaction-building/buildooor-fee-patch.d.ts +0 -13
- package/srv/blockchain/transaction-building/buildooor-fee-patch.js +0 -71
- package/srv/blockchain/transaction-building/caller-datums.d.ts +0 -15
- package/srv/blockchain/transaction-building/caller-datums.js +0 -133
- package/srv/cbor/redeemer-tag-patch.d.ts +0 -3
- package/srv/cbor/redeemer-tag-patch.js +0 -61
- package/srv/utils/legacy-service-paths.d.ts +0 -11
- package/srv/utils/legacy-service-paths.js +0 -58
|
@@ -8,24 +8,45 @@ const cds_1 = __importDefault(require("@sap/cds"));
|
|
|
8
8
|
const cbor_1 = require("@harmoniclabs/cbor");
|
|
9
9
|
const uint8array_utils_1 = require("@harmoniclabs/uint8array-utils");
|
|
10
10
|
const crypto_1 = require("@harmoniclabs/crypto");
|
|
11
|
-
const
|
|
11
|
+
const bech32_1 = require("bech32");
|
|
12
|
+
const node_util_1 = require("node:util");
|
|
13
|
+
const const_1 = require("../../utils/const");
|
|
12
14
|
const logger = cds_1.default.log('CoseVerifier');
|
|
13
15
|
/** CBOR tag 18 = COSE_Sign1 (RFC 8152). signData may or may not wrap in it. */
|
|
14
16
|
const COSE_SIGN1_TAG = 18;
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
+
// The one algorithm CIP-30 signData allows: EdDSA with an Ed25519 key.
|
|
18
|
+
const ALG_EDDSA = -8;
|
|
19
|
+
const KTY_OKP = 1;
|
|
20
|
+
const CRV_ED25519 = 6;
|
|
17
21
|
const ED25519_PUBKEY_LEN = 32;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
const ED25519_SIGNATURE_LEN = 64;
|
|
23
|
+
const BLAKE2B_224_LEN = 28;
|
|
24
|
+
/** Entries of a COSE map by label. Throws on a repeated label, which COSE forbids. */
|
|
25
|
+
function readLabels(obj, what) {
|
|
26
|
+
if (!(obj instanceof cbor_1.CborMap))
|
|
27
|
+
throw new Error(`${what} must be a CBOR map`);
|
|
28
|
+
const labels = new Map();
|
|
29
|
+
for (const { k, v } of obj.map) {
|
|
30
|
+
const label = k instanceof cbor_1.CborUInt || k instanceof cbor_1.CborNegInt ? Number(k.num) : k instanceof cbor_1.CborText ? k.text : undefined;
|
|
31
|
+
if (label === undefined)
|
|
32
|
+
throw new Error(`${what} has a label that is neither an integer nor a text`);
|
|
33
|
+
if (labels.has(label))
|
|
34
|
+
throw new Error(`${what} repeats the label ${label}`);
|
|
35
|
+
labels.set(label, v);
|
|
36
|
+
}
|
|
37
|
+
return labels;
|
|
38
|
+
}
|
|
39
|
+
function intValue(obj) {
|
|
40
|
+
return obj instanceof cbor_1.CborUInt || obj instanceof cbor_1.CborNegInt ? Number(obj.num) : undefined;
|
|
28
41
|
}
|
|
42
|
+
function optionalBytes(obj, what) {
|
|
43
|
+
if (obj === undefined)
|
|
44
|
+
return undefined;
|
|
45
|
+
if (!(obj instanceof cbor_1.CborBytes))
|
|
46
|
+
throw new Error(`${what} must be a byte string`);
|
|
47
|
+
return obj.bytes;
|
|
48
|
+
}
|
|
49
|
+
const sameBytes = (a, b) => Buffer.from(a).equals(Buffer.from(b));
|
|
29
50
|
function parseCoseSign1(hex) {
|
|
30
51
|
let obj = cbor_1.Cbor.parse((0, uint8array_utils_1.fromHex)(hex));
|
|
31
52
|
// CIP-30 signData may emit the COSE_Sign1 wrapped in tag 18 or bare.
|
|
@@ -34,27 +55,56 @@ function parseCoseSign1(hex) {
|
|
|
34
55
|
if (!(obj instanceof cbor_1.CborArray) || obj.array.length !== 4) {
|
|
35
56
|
throw new Error('COSE_Sign1 must be a 4-element array [protected, unprotected, payload, signature]');
|
|
36
57
|
}
|
|
37
|
-
const [prot, , payload, signature] = obj.array;
|
|
58
|
+
const [prot, unprot, payload, signature] = obj.array;
|
|
38
59
|
if (!(prot instanceof cbor_1.CborBytes))
|
|
39
60
|
throw new Error('COSE_Sign1 protected header must be a byte string');
|
|
40
61
|
if (!(payload instanceof cbor_1.CborBytes))
|
|
41
62
|
throw new Error('COSE_Sign1 payload must be a byte string (detached payloads are not supported)');
|
|
42
|
-
if (!(signature instanceof cbor_1.CborBytes))
|
|
43
|
-
throw new Error(
|
|
44
|
-
|
|
63
|
+
if (!(signature instanceof cbor_1.CborBytes) || signature.bytes.length !== ED25519_SIGNATURE_LEN) {
|
|
64
|
+
throw new Error(`COSE_Sign1 signature must be a byte string of ${ED25519_SIGNATURE_LEN} bytes`);
|
|
65
|
+
}
|
|
66
|
+
if (prot.bytes.length === 0)
|
|
67
|
+
throw new Error('COSE_Sign1 protected header is empty; alg and address are required');
|
|
68
|
+
const signed = readLabels(cbor_1.Cbor.parse(prot.bytes), 'COSE_Sign1 protected header');
|
|
69
|
+
const unsigned = readLabels(unprot, 'COSE_Sign1 unprotected header');
|
|
70
|
+
for (const label of unsigned.keys()) {
|
|
71
|
+
if (signed.has(label))
|
|
72
|
+
throw new Error(`COSE_Sign1 carries the header ${label} twice`);
|
|
73
|
+
}
|
|
74
|
+
if (intValue(signed.get(1)) !== ALG_EDDSA)
|
|
75
|
+
throw new Error('COSE_Sign1 protected header alg (1) must be EdDSA (-8)');
|
|
76
|
+
const address = optionalBytes(signed.get('address'), 'COSE_Sign1 address header');
|
|
77
|
+
if (!address)
|
|
78
|
+
throw new Error('COSE_Sign1 protected header carries no address');
|
|
79
|
+
const hashed = unsigned.get('hashed') ?? signed.get('hashed');
|
|
80
|
+
if (hashed !== undefined && !(hashed instanceof cbor_1.CborSimple && typeof hashed.simple === 'boolean')) {
|
|
81
|
+
throw new Error('COSE_Sign1 header hashed must be a boolean');
|
|
82
|
+
}
|
|
83
|
+
return {
|
|
84
|
+
protectedBytes: prot.bytes,
|
|
85
|
+
payload: payload.bytes,
|
|
86
|
+
signature: signature.bytes,
|
|
87
|
+
address,
|
|
88
|
+
kid: optionalBytes(signed.get(4), 'COSE_Sign1 kid (4)'),
|
|
89
|
+
hashed: hashed instanceof cbor_1.CborSimple && hashed.simple === true,
|
|
90
|
+
};
|
|
45
91
|
}
|
|
46
|
-
/**
|
|
92
|
+
/** The Ed25519 public key of a COSE_Key, after its key type, algorithm and curve are checked. */
|
|
47
93
|
function parseCoseKey(hex) {
|
|
48
|
-
const
|
|
49
|
-
if (
|
|
50
|
-
throw new Error('COSE_Key must be
|
|
51
|
-
|
|
94
|
+
const key = readLabels(cbor_1.Cbor.parse((0, uint8array_utils_1.fromHex)(hex)), 'COSE_Key');
|
|
95
|
+
if (intValue(key.get(1)) !== KTY_OKP)
|
|
96
|
+
throw new Error('COSE_Key kty (1) must be OKP (1)');
|
|
97
|
+
if (intValue(key.get(3)) !== ALG_EDDSA)
|
|
98
|
+
throw new Error('COSE_Key alg (3) must be EdDSA (-8)');
|
|
99
|
+
if (intValue(key.get(-1)) !== CRV_ED25519)
|
|
100
|
+
throw new Error('COSE_Key crv (-1) must be Ed25519 (6)');
|
|
101
|
+
const x = key.get(-2);
|
|
52
102
|
if (!(x instanceof cbor_1.CborBytes))
|
|
53
103
|
throw new Error('COSE_Key is missing the Ed25519 public key (label -2)');
|
|
54
104
|
if (x.bytes.length !== ED25519_PUBKEY_LEN) {
|
|
55
105
|
throw new Error(`COSE_Key public key must be ${ED25519_PUBKEY_LEN} bytes, got ${x.bytes.length}`);
|
|
56
106
|
}
|
|
57
|
-
return x.bytes;
|
|
107
|
+
return { publicKey: x.bytes, kid: optionalBytes(key.get(2), 'COSE_Key kid (2)') };
|
|
58
108
|
}
|
|
59
109
|
// The signed COSE Sig_structure: ["Signature1", protected, external_aad, payload].
|
|
60
110
|
// external_aad is empty for CIP-8 and CIP-30 signData.
|
|
@@ -67,50 +117,88 @@ function buildSigStructure(protectedBytes, payload) {
|
|
|
67
117
|
]);
|
|
68
118
|
return cbor_1.Cbor.encode(sigStruct);
|
|
69
119
|
}
|
|
70
|
-
// The
|
|
71
|
-
//
|
|
120
|
+
// The credential whose key signs for an address (CIP-30): the payment credential of a base, pointer
|
|
121
|
+
// or enterprise address, the stake credential of a reward address. Null for anything else.
|
|
122
|
+
function signingCredential(address) {
|
|
123
|
+
let bytes;
|
|
124
|
+
try {
|
|
125
|
+
bytes = Buffer.from(bech32_1.bech32.fromWords(bech32_1.bech32.decode(address, const_1.BECH32_MAX_LENGTH).words));
|
|
126
|
+
}
|
|
127
|
+
catch {
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
if (bytes.length < 1 + BLAKE2B_224_LEN)
|
|
131
|
+
return null;
|
|
132
|
+
const type = bytes[0] >> 4;
|
|
133
|
+
const hash = bytes.subarray(1, 1 + BLAKE2B_224_LEN).toString('hex');
|
|
134
|
+
if (type <= 7)
|
|
135
|
+
return { bytes, hash, isScript: (type & 1) === 1 };
|
|
136
|
+
if (type === 14 || type === 15)
|
|
137
|
+
return { bytes, hash, isScript: type === 15 };
|
|
138
|
+
return null;
|
|
139
|
+
}
|
|
140
|
+
/** The bytes as text when they are valid UTF-8, else an empty string. */
|
|
141
|
+
function utf8OrEmpty(bytes) {
|
|
142
|
+
try {
|
|
143
|
+
return new node_util_1.TextDecoder('utf-8', { fatal: true }).decode(bytes);
|
|
144
|
+
}
|
|
145
|
+
catch {
|
|
146
|
+
return '';
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
// Checks one CIP-30 signData result: structure, address, signer key, payload, then the signature.
|
|
150
|
+
// Stateless: a caller using it for login must issue the message itself, with a nonce and an expiry.
|
|
151
|
+
// Never throws; a failure returns `valid: false` with the reason.
|
|
72
152
|
function verifyDataSignature(input) {
|
|
73
|
-
const result = { valid: false, reason: '', signedPayload: '', signerVkh: '' };
|
|
153
|
+
const result = { valid: false, reason: '', signedPayload: '', signedPayloadHex: '', signerVkh: '' };
|
|
154
|
+
const fail = (reason) => {
|
|
155
|
+
result.reason = reason;
|
|
156
|
+
return result;
|
|
157
|
+
};
|
|
74
158
|
try {
|
|
75
|
-
const
|
|
76
|
-
const
|
|
77
|
-
result.
|
|
78
|
-
result.signerVkh = (0, uint8array_utils_1.toHex)((0, crypto_1.blake2b_224)(
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
if (!
|
|
82
|
-
|
|
83
|
-
|
|
159
|
+
const sign1 = parseCoseSign1(input.coseSignature);
|
|
160
|
+
const key = parseCoseKey(input.coseKey);
|
|
161
|
+
result.signedPayloadHex = (0, uint8array_utils_1.toHex)(sign1.payload);
|
|
162
|
+
result.signerVkh = (0, uint8array_utils_1.toHex)((0, crypto_1.blake2b_224)(key.publicKey));
|
|
163
|
+
if (!sign1.hashed)
|
|
164
|
+
result.signedPayload = utf8OrEmpty(sign1.payload);
|
|
165
|
+
if (sign1.kid && key.kid && !sameBytes(sign1.kid, key.kid))
|
|
166
|
+
return fail('COSE_Sign1 kid and COSE_Key kid differ');
|
|
167
|
+
const signer = signingCredential(input.address);
|
|
168
|
+
if (!signer)
|
|
169
|
+
return fail('Address could not be decoded (a bech32 payment or reward address is required)');
|
|
170
|
+
if (!sameBytes(sign1.address, signer.bytes))
|
|
171
|
+
return fail('The address in the signed header is not the given address');
|
|
172
|
+
if (signer.isScript)
|
|
173
|
+
return fail('Address credential is a script hash; a key-hash address is required');
|
|
174
|
+
if (signer.hash !== result.signerVkh) {
|
|
175
|
+
return fail(`Signer key hash ${result.signerVkh} does not match the address credential ${signer.hash}`);
|
|
84
176
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
177
|
+
// The message is compared byte for byte; a hashed payload by its blake2b-224.
|
|
178
|
+
const expected = input.expectedPayload ?? undefined;
|
|
179
|
+
if (sign1.hashed) {
|
|
180
|
+
if (sign1.payload.length !== BLAKE2B_224_LEN)
|
|
181
|
+
return fail(`A hashed payload must be ${BLAKE2B_224_LEN} bytes (blake2b-224)`);
|
|
182
|
+
if (expected === undefined)
|
|
183
|
+
return fail('The wallet signed the hash of the message; pass expectedPayload to compare it');
|
|
184
|
+
if (!sameBytes((0, crypto_1.blake2b_224)(Buffer.from(expected, 'utf8')), sign1.payload))
|
|
185
|
+
return fail('Signed payload does not match the expected payload');
|
|
186
|
+
result.signedPayload = expected;
|
|
88
187
|
}
|
|
89
|
-
if (
|
|
90
|
-
|
|
91
|
-
return result;
|
|
188
|
+
else if (expected !== undefined && !sameBytes(Buffer.from(expected, 'utf8'), sign1.payload)) {
|
|
189
|
+
return fail('Signed payload does not match the expected payload');
|
|
92
190
|
}
|
|
93
|
-
|
|
94
|
-
if (
|
|
95
|
-
|
|
96
|
-
result.reason = 'Signed payload does not match the expected payload';
|
|
97
|
-
return result;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
// Ed25519 signature over the rebuilt Sig_structure
|
|
101
|
-
const sigStructure = buildSigStructure(protectedBytes, payload);
|
|
102
|
-
if (!(0, crypto_1.verifyEd25519Signature_sync)(signature, sigStructure, pubKey)) {
|
|
103
|
-
result.reason = 'Ed25519 signature does not verify against the signed message';
|
|
104
|
-
return result;
|
|
191
|
+
const sigStructure = buildSigStructure(sign1.protectedBytes, sign1.payload);
|
|
192
|
+
if (!(0, crypto_1.verifyEd25519Signature_sync)(sign1.signature, sigStructure, key.publicKey)) {
|
|
193
|
+
return fail('Ed25519 signature does not verify against the signed message');
|
|
105
194
|
}
|
|
106
195
|
result.valid = true;
|
|
107
196
|
logger.debug({ signerVkh: result.signerVkh }, 'COSE_Sign1 data signature verified');
|
|
108
197
|
return result;
|
|
109
198
|
}
|
|
110
199
|
catch (err) {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
return result;
|
|
200
|
+
logger.warn(`Data signature not verified: ${err instanceof Error ? err.message : String(err)}`);
|
|
201
|
+
return fail(`Failed to verify data signature: ${err instanceof Error ? err.message : String(err)}`);
|
|
114
202
|
}
|
|
115
203
|
}
|
|
116
204
|
//# sourceMappingURL=cose-verifier.js.map
|
|
@@ -9,6 +9,7 @@ exports.getHsmSigner = getHsmSigner;
|
|
|
9
9
|
exports.setHsmSigner = setHsmSigner;
|
|
10
10
|
const cds_1 = __importDefault(require("@sap/cds"));
|
|
11
11
|
const errors_1 = require("../../utils/errors");
|
|
12
|
+
const config_1 = require("../../config");
|
|
12
13
|
const error_codes_1 = require("../../utils/error-codes");
|
|
13
14
|
const cbor_1 = require("@harmoniclabs/cbor");
|
|
14
15
|
const uint8array_utils_1 = require("@harmoniclabs/uint8array-utils");
|
|
@@ -69,7 +70,7 @@ class HsmSigner {
|
|
|
69
70
|
if (process.env.HSM_PIN)
|
|
70
71
|
delete process.env.HSM_PIN;
|
|
71
72
|
try {
|
|
72
|
-
const hsmCds =
|
|
73
|
+
const hsmCds = (0, config_1.coreCdsConfig)().hsm;
|
|
73
74
|
if (hsmCds && 'pin' in hsmCds)
|
|
74
75
|
hsmCds.pin = '';
|
|
75
76
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import cds, { Request } from '@sap/cds';
|
|
2
|
+
import { type TransactionLookup } from '../transaction-presence';
|
|
2
3
|
import type { CardanoIndexer } from '../cardano-indexer';
|
|
3
4
|
import type { CardanoClient } from '../cardano-client';
|
|
4
5
|
import { type TransactionSubmission } from '#cds-models/CardanoTransactionService';
|
|
6
|
+
/** An open submit is sent again for this long. After it only the chain is read. */
|
|
7
|
+
export declare const RESUBMIT_WINDOW_MS: number;
|
|
5
8
|
/** Shape persisted by indexVerifiedTransactionSubmission. */
|
|
6
9
|
export interface FinalizeParams {
|
|
7
10
|
signingRequestId: string;
|
|
@@ -17,14 +20,22 @@ export interface FinalizeParams {
|
|
|
17
20
|
signerType?: string;
|
|
18
21
|
signerInfo?: string;
|
|
19
22
|
}
|
|
20
|
-
type SubmissionIndexer = Pick<CardanoIndexer, 'persistTransactionSubmission' | 'updateSubmissionStatus' | 'dropDuplicateSubmission' | 'invalidateUtxoCacheForTx'>;
|
|
21
|
-
|
|
23
|
+
type SubmissionIndexer = Pick<CardanoIndexer, 'persistTransactionSubmission' | 'updateSubmissionStatus' | 'dropDuplicateSubmission' | 'invalidateUtxoCacheForTx' | 'findIndexedTransaction'>;
|
|
24
|
+
type SubmissionClient = Pick<CardanoClient, 'submitTransaction'> & TransactionLookup;
|
|
25
|
+
interface SubmissionDeps {
|
|
26
|
+
indexer: SubmissionIndexer & Pick<CardanoIndexer, 'indexVerifiedTransactionSubmission'>;
|
|
27
|
+
client: SubmissionClient;
|
|
28
|
+
}
|
|
29
|
+
export declare function submitAndFinalize(SigningRequests: unknown, params: FinalizeParams, afterFinalize?: (db: cds.Transaction) => Promise<void>, send?: boolean, { indexer, client }?: SubmissionDeps): Promise<unknown>;
|
|
22
30
|
export declare function submitRecorded(params: {
|
|
23
31
|
signedTxCbor: string;
|
|
24
32
|
txHash: string;
|
|
25
33
|
buildId: string | null;
|
|
26
|
-
}, indexer?: SubmissionIndexer, client?:
|
|
34
|
+
}, indexer?: SubmissionIndexer, client?: SubmissionClient): Promise<TransactionSubmission>;
|
|
27
35
|
export declare function scheduleDeferredSubmit(req: Request, SigningRequests: unknown, params: FinalizeParams): void;
|
|
28
|
-
export declare function redriveInterruptedSubmissions(): Promise<number>;
|
|
36
|
+
export declare function redriveInterruptedSubmissions(deps?: SubmissionDeps): Promise<number>;
|
|
37
|
+
/** Starts the periodic pass over open signing requests and submissions. Idempotent. */
|
|
38
|
+
export declare function startSubmissionReconciler(): void;
|
|
39
|
+
export declare function stopSubmissionReconciler(): void;
|
|
29
40
|
export {};
|
|
30
41
|
//# sourceMappingURL=submission-finalizer.d.ts.map
|