@ledgerhq/revault-api 1.20.0 → 1.21.0
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/lib/{app-types-Cvdd2De7.d.mts → app-types-DxLEPfjw.d.mts} +2048 -0
- package/lib/fakes.d.mts +1 -1
- package/lib/fakes.mjs +53 -34
- package/lib/fakes.mjs.map +1 -1
- package/lib/index.d.mts +1062 -1
- package/package.json +5 -92
package/lib/fakes.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RequestType, VaultRequest, VaultRequestReview, Account } from '@prisma/client';
|
|
2
|
-
import { y as UserChallenge, A as AccountResponse, s as VaultRequestResponse } from './app-types-
|
|
2
|
+
import { y as UserChallenge, A as AccountResponse, s as VaultRequestResponse } from './app-types-DxLEPfjw.mjs';
|
|
3
3
|
import z__default from 'zod';
|
|
4
4
|
|
|
5
5
|
declare const zCreateGroupRequestData: z__default.ZodObject<{
|
package/lib/fakes.mjs
CHANGED
|
@@ -4,6 +4,9 @@ import { ChallengeType, PsdModel, AccountType, AccountGovernanceType, Activation
|
|
|
4
4
|
import 'axios';
|
|
5
5
|
import invariant from 'invariant';
|
|
6
6
|
import { omit, times } from 'lodash';
|
|
7
|
+
import 'crypto';
|
|
8
|
+
import 'fs/promises';
|
|
9
|
+
import 'path';
|
|
7
10
|
|
|
8
11
|
// src/__fakes__/responses.ts
|
|
9
12
|
|
|
@@ -85,28 +88,28 @@ var zUserRegistrationDeviceData = z.object({
|
|
|
85
88
|
name: z.string().describe("Name of the user to register"),
|
|
86
89
|
psdModel: z.nativeEnum(PsdModel).describe("Device model"),
|
|
87
90
|
pubKey: zPubKey.describe("Device public key"),
|
|
88
|
-
confidentialityKey: zPubKey
|
|
89
|
-
psdEphemeralKey: zPubKey
|
|
90
|
-
psdEphemeralKeyAttestation: zHsmCertificate
|
|
91
|
-
}).describe("
|
|
91
|
+
confidentialityKey: zPubKey,
|
|
92
|
+
psdEphemeralKey: zPubKey,
|
|
93
|
+
psdEphemeralKeyAttestation: zHsmCertificate
|
|
94
|
+
}).describe("Data generated by the PSD to register on HSM");
|
|
92
95
|
var zUserRegistrationChallenge = z.object({
|
|
93
|
-
challenge: z.string()
|
|
94
|
-
ephemeralPublicKey: zPubKey
|
|
95
|
-
ephemeralPublicKeyAttestation: zHsmCertificate
|
|
96
|
-
handshake: zHexString
|
|
97
|
-
handshakeAttestation: zHsmCertificate
|
|
98
|
-
u2fRegisterData: z.string()
|
|
99
|
-
ciphertext: z.string()
|
|
100
|
-
requestId: z.string()
|
|
101
|
-
}).describe("
|
|
96
|
+
challenge: z.string(),
|
|
97
|
+
ephemeralPublicKey: zPubKey,
|
|
98
|
+
ephemeralPublicKeyAttestation: zHsmCertificate,
|
|
99
|
+
handshake: zHexString,
|
|
100
|
+
handshakeAttestation: zHsmCertificate,
|
|
101
|
+
u2fRegisterData: z.string(),
|
|
102
|
+
ciphertext: z.string(),
|
|
103
|
+
requestId: z.string()
|
|
104
|
+
}).describe("Challenge generated by HSM\xA0using the PSD registration data");
|
|
102
105
|
z.object({
|
|
103
|
-
certificate: zHsmCertificate
|
|
104
|
-
u2fRegister: zHexString
|
|
105
|
-
u2fKeyHandle: zHexString
|
|
106
|
-
registerData: z.string()
|
|
107
|
-
validationKey: zPubKey
|
|
108
|
-
pairingPayload: z.string()
|
|
109
|
-
}).describe("
|
|
106
|
+
certificate: zHsmCertificate,
|
|
107
|
+
u2fRegister: zHexString,
|
|
108
|
+
u2fKeyHandle: zHexString,
|
|
109
|
+
registerData: z.string(),
|
|
110
|
+
validationKey: zPubKey,
|
|
111
|
+
pairingPayload: z.string()
|
|
112
|
+
}).describe("Final registration response from PSD to HSM");
|
|
110
113
|
z.object({
|
|
111
114
|
confidentialityKeyCurve25519: z.string(),
|
|
112
115
|
confidentialityKeySignature: z.string()
|
|
@@ -1208,6 +1211,11 @@ var serializeAccount = (account) => {
|
|
|
1208
1211
|
};
|
|
1209
1212
|
return zAccountResponse.parse(response);
|
|
1210
1213
|
};
|
|
1214
|
+
var zRequestReviewStep = z.object({
|
|
1215
|
+
stageName: z.string().regex(/^\w+$/).describe("The review stage name"),
|
|
1216
|
+
quorum: z.number().int().min(1).describe("Quorum for the review step")
|
|
1217
|
+
});
|
|
1218
|
+
var zRequestReviewSteps = z.array(zRequestReviewStep);
|
|
1211
1219
|
var zSciConfigData = z5.object({
|
|
1212
1220
|
dapps: z5.array(z5.string()).nullable().describe("Allowed DApps, null allows all"),
|
|
1213
1221
|
customContractCallEnabled: z5.boolean().describe("Allow non-DApp SCI")
|
|
@@ -1219,11 +1227,6 @@ var zCreateSciConfigRequestData = z5.object({
|
|
|
1219
1227
|
var zEditSciConfigRequestData = z5.object({
|
|
1220
1228
|
config: zSciConfigData
|
|
1221
1229
|
});
|
|
1222
|
-
var zRequestReviewStep = z.object({
|
|
1223
|
-
stageName: z.string().regex(/^\w+$/).describe("The review stage name"),
|
|
1224
|
-
quorum: z.number().int().min(1).describe("Quorum for the review step")
|
|
1225
|
-
});
|
|
1226
|
-
var zRequestReviewSteps = z.array(zRequestReviewStep);
|
|
1227
1230
|
var zGroupName = z5.string().min(1).max(19).describe("Group name");
|
|
1228
1231
|
var zCreateGroupRequestData = z5.object({
|
|
1229
1232
|
name: zGroupName,
|
|
@@ -1460,7 +1463,10 @@ var zVaultRequestMixinsByType = {
|
|
|
1460
1463
|
}),
|
|
1461
1464
|
[RequestType.CREATE_SETTLEMENT]: z5.object({
|
|
1462
1465
|
type: z5.literal(RequestType.CREATE_SETTLEMENT),
|
|
1463
|
-
data: zCreateSettlementRequestData
|
|
1466
|
+
data: zCreateSettlementRequestData,
|
|
1467
|
+
meta: z5.object({
|
|
1468
|
+
hash: z5.string().nullable()
|
|
1469
|
+
}).optional().nullable()
|
|
1464
1470
|
}),
|
|
1465
1471
|
[RequestType.FORCE_UNPLEDGE]: z5.object({
|
|
1466
1472
|
type: z5.literal(RequestType.FORCE_UNPLEDGE),
|
|
@@ -1468,7 +1474,10 @@ var zVaultRequestMixinsByType = {
|
|
|
1468
1474
|
}),
|
|
1469
1475
|
[RequestType.TRADELINK_WITHDRAW]: z5.object({
|
|
1470
1476
|
type: z5.literal(RequestType.TRADELINK_WITHDRAW),
|
|
1471
|
-
data: zTradelinkWithdrawRequestData
|
|
1477
|
+
data: zTradelinkWithdrawRequestData,
|
|
1478
|
+
meta: z5.object({
|
|
1479
|
+
hash: z5.string().nullable()
|
|
1480
|
+
}).optional().nullable()
|
|
1472
1481
|
}),
|
|
1473
1482
|
// Deprecate ADMIN_GOV_RULE
|
|
1474
1483
|
[RequestType.CREATE_ADMIN_GOV_RULE]: z5.object({
|
|
@@ -1502,7 +1511,13 @@ var zVaultRequestCommonMixin = z5.object({
|
|
|
1502
1511
|
reviews: z5.array(zRequestReviewResponse).describe("Requests reviews"),
|
|
1503
1512
|
// `type` and `data` are correlated -- See `zVaultRequestMixinsByType`
|
|
1504
1513
|
createdAt: z5.coerce.date().describe("Creation timestamp"),
|
|
1505
|
-
updatedAt: z5.coerce.date().describe("Last modification timestamp")
|
|
1514
|
+
updatedAt: z5.coerce.date().describe("Last modification timestamp"),
|
|
1515
|
+
// `inflight` is fetched from ONGOING RequestSaga
|
|
1516
|
+
inflight: z5.object({
|
|
1517
|
+
lastError: z5.string().describe("Error message from the last failure"),
|
|
1518
|
+
numFailed: z5.number().int().describe("Number of failures so far"),
|
|
1519
|
+
retryAfter: z5.coerce.date().describe("Date after which next retry is scheduled")
|
|
1520
|
+
}).optional().describe("Extra information if the request is currently being processed")
|
|
1506
1521
|
});
|
|
1507
1522
|
var allowedRequestCreationInput = {
|
|
1508
1523
|
[RequestType.CREATE_ADMIN]: zVaultRequestMixinsByType[RequestType.CREATE_ADMIN],
|
|
@@ -1679,12 +1694,16 @@ function serializeVaultRequest(request) {
|
|
|
1679
1694
|
...request,
|
|
1680
1695
|
legacyId: request.gateId
|
|
1681
1696
|
};
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1697
|
+
switch (request.type) {
|
|
1698
|
+
case "CREATE_TRANSACTION":
|
|
1699
|
+
case "TRADELINK_WITHDRAW":
|
|
1700
|
+
case "CREATE_SETTLEMENT":
|
|
1701
|
+
Object.assign(serialized, {
|
|
1702
|
+
meta: {
|
|
1703
|
+
hash: request.transactionMeta?.hash ?? null
|
|
1704
|
+
}
|
|
1705
|
+
});
|
|
1706
|
+
break;
|
|
1688
1707
|
}
|
|
1689
1708
|
return zVaultRequestResponse.parse(serialized);
|
|
1690
1709
|
}
|