@nokinc-flur/sdk 1.0.0 → 1.0.3

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/index.d.cts CHANGED
@@ -986,6 +986,382 @@ declare function decodePaymentRequestQR(s: string): OfflinePaymentRequest;
986
986
  declare function encodeAuthorizationQR(auth: OfflinePaymentAuthorization): string;
987
987
  declare function decodeAuthorizationQR(s: string): OfflinePaymentAuthorization;
988
988
 
989
+ declare const PARTNER_SCOPES: readonly ["passes:write", "passes:read", "passes:redeem", "receipts:write", "receipts:read", "offline:issue", "offline:settle", "offline:read"];
990
+ type PartnerScope = (typeof PARTNER_SCOPES)[number];
991
+ declare const ApiCredentialPublicSchema: z.ZodObject<{
992
+ id: z.ZodString;
993
+ accountId: z.ZodString;
994
+ keyId: z.ZodString;
995
+ scopes: z.ZodArray<z.ZodEnum<["passes:write", "passes:read", "passes:redeem", "receipts:write", "receipts:read", "offline:issue", "offline:settle", "offline:read"]>, "many">;
996
+ label: z.ZodNullable<z.ZodString>;
997
+ createdAtMs: z.ZodNumber;
998
+ lastUsedAtMs: z.ZodNullable<z.ZodNumber>;
999
+ revokedAtMs: z.ZodNullable<z.ZodNumber>;
1000
+ }, "strip", z.ZodTypeAny, {
1001
+ id: string;
1002
+ accountId: string;
1003
+ keyId: string;
1004
+ scopes: ("passes:write" | "passes:read" | "passes:redeem" | "receipts:write" | "receipts:read" | "offline:issue" | "offline:settle" | "offline:read")[];
1005
+ label: string | null;
1006
+ createdAtMs: number;
1007
+ lastUsedAtMs: number | null;
1008
+ revokedAtMs: number | null;
1009
+ }, {
1010
+ id: string;
1011
+ accountId: string;
1012
+ keyId: string;
1013
+ scopes: ("passes:write" | "passes:read" | "passes:redeem" | "receipts:write" | "receipts:read" | "offline:issue" | "offline:settle" | "offline:read")[];
1014
+ label: string | null;
1015
+ createdAtMs: number;
1016
+ lastUsedAtMs: number | null;
1017
+ revokedAtMs: number | null;
1018
+ }>;
1019
+ type ApiCredentialPublic = z.infer<typeof ApiCredentialPublicSchema>;
1020
+ declare const MintedApiCredentialSchema: z.ZodObject<{
1021
+ id: z.ZodString;
1022
+ accountId: z.ZodString;
1023
+ keyId: z.ZodString;
1024
+ scopes: z.ZodArray<z.ZodEnum<["passes:write", "passes:read", "passes:redeem", "receipts:write", "receipts:read", "offline:issue", "offline:settle", "offline:read"]>, "many">;
1025
+ label: z.ZodNullable<z.ZodString>;
1026
+ createdAtMs: z.ZodNumber;
1027
+ lastUsedAtMs: z.ZodNullable<z.ZodNumber>;
1028
+ revokedAtMs: z.ZodNullable<z.ZodNumber>;
1029
+ } & {
1030
+ secret: z.ZodString;
1031
+ }, "strip", z.ZodTypeAny, {
1032
+ id: string;
1033
+ accountId: string;
1034
+ keyId: string;
1035
+ scopes: ("passes:write" | "passes:read" | "passes:redeem" | "receipts:write" | "receipts:read" | "offline:issue" | "offline:settle" | "offline:read")[];
1036
+ label: string | null;
1037
+ createdAtMs: number;
1038
+ lastUsedAtMs: number | null;
1039
+ revokedAtMs: number | null;
1040
+ secret: string;
1041
+ }, {
1042
+ id: string;
1043
+ accountId: string;
1044
+ keyId: string;
1045
+ scopes: ("passes:write" | "passes:read" | "passes:redeem" | "receipts:write" | "receipts:read" | "offline:issue" | "offline:settle" | "offline:read")[];
1046
+ label: string | null;
1047
+ createdAtMs: number;
1048
+ lastUsedAtMs: number | null;
1049
+ revokedAtMs: number | null;
1050
+ secret: string;
1051
+ }>;
1052
+ type MintedApiCredential = z.infer<typeof MintedApiCredentialSchema>;
1053
+ type PartnerClientOptions = {
1054
+ baseUrl: string;
1055
+ /** Stable account id of the partner; included for observability only. */
1056
+ accountId?: string;
1057
+ /** Public key id from the mint response (e.g. flur_pk_...). */
1058
+ keyId: string;
1059
+ /** Plaintext secret from the mint response (e.g. flur_sk_...). */
1060
+ secret: string;
1061
+ fetchImpl?: typeof fetch;
1062
+ /** Override clock for tests. Returns ms. */
1063
+ nowMs?: () => number;
1064
+ /** Override nonce generator for tests. */
1065
+ nonce?: () => string;
1066
+ };
1067
+ type PartnerSignResult = {
1068
+ authorization: string;
1069
+ ts: string;
1070
+ nonce: string;
1071
+ bodyHash: string;
1072
+ };
1073
+ declare function signPartnerRequest(params: {
1074
+ keyId: string;
1075
+ secret: string;
1076
+ method: string;
1077
+ path: string;
1078
+ body?: string | Uint8Array;
1079
+ nowMs?: number;
1080
+ nonce?: string;
1081
+ }): Promise<PartnerSignResult>;
1082
+ type FlurPartnerClient = {
1083
+ /** Make a signed request. Resolves to parsed JSON or throws FlurApiError. */
1084
+ request: <T = unknown>(opts: {
1085
+ method: 'GET' | 'POST' | 'PUT' | 'DELETE';
1086
+ path: string;
1087
+ body?: unknown;
1088
+ }) => Promise<T>;
1089
+ /** Returns a fetch-compatible function with auto-signing. */
1090
+ fetch: typeof fetch;
1091
+ };
1092
+ declare function createFlurPartnerClient(opts: PartnerClientOptions): FlurPartnerClient;
1093
+ /**
1094
+ * SDK helper for partner credential management endpoints. Uses an arbitrary
1095
+ * fetchImpl (typically a session-authenticated fetch) — not the partner HMAC.
1096
+ */
1097
+ type ApiCredentialsAdminClient = {
1098
+ list: (accountId: string) => Promise<{
1099
+ items: ApiCredentialPublic[];
1100
+ }>;
1101
+ mint: (accountId: string, input: {
1102
+ scopes: PartnerScope[];
1103
+ label?: string | null;
1104
+ }) => Promise<MintedApiCredential>;
1105
+ revoke: (accountId: string, credentialId: string) => Promise<ApiCredentialPublic>;
1106
+ };
1107
+ declare function createApiCredentialsAdminClient(opts: {
1108
+ baseUrl: string;
1109
+ fetchImpl?: typeof fetch;
1110
+ }): ApiCredentialsAdminClient;
1111
+
1112
+ /**
1113
+ * Offline settlement SDK helpers.
1114
+ *
1115
+ * The SDK does not "pay" offline — it produces signed `PaymentClaim`s and posts
1116
+ * them to `/v1/offline/settlements`. The backend enforces "paid once" via
1117
+ * UNIQUE(settlement_key) and UNIQUE(token_serial).
1118
+ */
1119
+
1120
+ declare const OfflineTokenSchema: z.ZodObject<{
1121
+ tokenId: z.ZodString;
1122
+ tokenSerial: z.ZodString;
1123
+ issuerAccountId: z.ZodString;
1124
+ payerUserId: z.ZodString;
1125
+ maxAmountKobo: z.ZodNumber;
1126
+ currency: z.ZodString;
1127
+ issuedAtMs: z.ZodNumber;
1128
+ expiresAtMs: z.ZodNumber;
1129
+ issuerSig: z.ZodString;
1130
+ }, "strip", z.ZodTypeAny, {
1131
+ currency: string;
1132
+ issuerSig: string;
1133
+ expiresAtMs: number;
1134
+ tokenId: string;
1135
+ tokenSerial: string;
1136
+ issuerAccountId: string;
1137
+ payerUserId: string;
1138
+ maxAmountKobo: number;
1139
+ issuedAtMs: number;
1140
+ }, {
1141
+ currency: string;
1142
+ issuerSig: string;
1143
+ expiresAtMs: number;
1144
+ tokenId: string;
1145
+ tokenSerial: string;
1146
+ issuerAccountId: string;
1147
+ payerUserId: string;
1148
+ maxAmountKobo: number;
1149
+ issuedAtMs: number;
1150
+ }>;
1151
+ type OfflineToken = z.infer<typeof OfflineTokenSchema>;
1152
+ declare const PaymentClaimSchema: z.ZodObject<{
1153
+ encounterId: z.ZodOptional<z.ZodString>;
1154
+ tokenSerial: z.ZodString;
1155
+ payerUserId: z.ZodString;
1156
+ payeeUserId: z.ZodString;
1157
+ payerNonce: z.ZodString;
1158
+ payeeNonce: z.ZodString;
1159
+ amountKobo: z.ZodNumber;
1160
+ currency: z.ZodDefault<z.ZodString>;
1161
+ occurredAtMs: z.ZodNumber;
1162
+ completedAtMs: z.ZodOptional<z.ZodNumber>;
1163
+ contextId: z.ZodOptional<z.ZodString>;
1164
+ payerPubkey: z.ZodString;
1165
+ payerSignature: z.ZodString;
1166
+ payeePubkey: z.ZodOptional<z.ZodString>;
1167
+ payeeSignature: z.ZodOptional<z.ZodString>;
1168
+ }, "strip", z.ZodTypeAny, {
1169
+ currency: string;
1170
+ amountKobo: number;
1171
+ tokenSerial: string;
1172
+ payerUserId: string;
1173
+ payeeUserId: string;
1174
+ payerNonce: string;
1175
+ payeeNonce: string;
1176
+ occurredAtMs: number;
1177
+ payerPubkey: string;
1178
+ payerSignature: string;
1179
+ encounterId?: string | undefined;
1180
+ completedAtMs?: number | undefined;
1181
+ contextId?: string | undefined;
1182
+ payeePubkey?: string | undefined;
1183
+ payeeSignature?: string | undefined;
1184
+ }, {
1185
+ amountKobo: number;
1186
+ tokenSerial: string;
1187
+ payerUserId: string;
1188
+ payeeUserId: string;
1189
+ payerNonce: string;
1190
+ payeeNonce: string;
1191
+ occurredAtMs: number;
1192
+ payerPubkey: string;
1193
+ payerSignature: string;
1194
+ currency?: string | undefined;
1195
+ encounterId?: string | undefined;
1196
+ completedAtMs?: number | undefined;
1197
+ contextId?: string | undefined;
1198
+ payeePubkey?: string | undefined;
1199
+ payeeSignature?: string | undefined;
1200
+ }>;
1201
+ type PaymentClaim = z.infer<typeof PaymentClaimSchema>;
1202
+ declare const SettlementSchema: z.ZodObject<{
1203
+ settlementId: z.ZodString;
1204
+ settlementKey: z.ZodString;
1205
+ encounterId: z.ZodString;
1206
+ issuerAccountId: z.ZodString;
1207
+ tokenSerial: z.ZodString;
1208
+ payerUserId: z.ZodString;
1209
+ payeeUserId: z.ZodString;
1210
+ amountKobo: z.ZodNumber;
1211
+ currency: z.ZodString;
1212
+ receiptId: z.ZodNullable<z.ZodString>;
1213
+ status: z.ZodEnum<["SETTLED", "REVIEW", "REJECTED"]>;
1214
+ issuerSig: z.ZodString;
1215
+ createdAtMs: z.ZodNumber;
1216
+ }, "strip", z.ZodTypeAny, {
1217
+ status: "SETTLED" | "REVIEW" | "REJECTED";
1218
+ currency: string;
1219
+ issuerSig: string;
1220
+ amountKobo: number;
1221
+ createdAtMs: number;
1222
+ tokenSerial: string;
1223
+ issuerAccountId: string;
1224
+ payerUserId: string;
1225
+ encounterId: string;
1226
+ payeeUserId: string;
1227
+ settlementId: string;
1228
+ settlementKey: string;
1229
+ receiptId: string | null;
1230
+ }, {
1231
+ status: "SETTLED" | "REVIEW" | "REJECTED";
1232
+ currency: string;
1233
+ issuerSig: string;
1234
+ amountKobo: number;
1235
+ createdAtMs: number;
1236
+ tokenSerial: string;
1237
+ issuerAccountId: string;
1238
+ payerUserId: string;
1239
+ encounterId: string;
1240
+ payeeUserId: string;
1241
+ settlementId: string;
1242
+ settlementKey: string;
1243
+ receiptId: string | null;
1244
+ }>;
1245
+ type Settlement = z.infer<typeof SettlementSchema>;
1246
+ declare const SettleResponseSchema: z.ZodObject<{
1247
+ settlement: z.ZodObject<{
1248
+ settlementId: z.ZodString;
1249
+ settlementKey: z.ZodString;
1250
+ encounterId: z.ZodString;
1251
+ issuerAccountId: z.ZodString;
1252
+ tokenSerial: z.ZodString;
1253
+ payerUserId: z.ZodString;
1254
+ payeeUserId: z.ZodString;
1255
+ amountKobo: z.ZodNumber;
1256
+ currency: z.ZodString;
1257
+ receiptId: z.ZodNullable<z.ZodString>;
1258
+ status: z.ZodEnum<["SETTLED", "REVIEW", "REJECTED"]>;
1259
+ issuerSig: z.ZodString;
1260
+ createdAtMs: z.ZodNumber;
1261
+ }, "strip", z.ZodTypeAny, {
1262
+ status: "SETTLED" | "REVIEW" | "REJECTED";
1263
+ currency: string;
1264
+ issuerSig: string;
1265
+ amountKobo: number;
1266
+ createdAtMs: number;
1267
+ tokenSerial: string;
1268
+ issuerAccountId: string;
1269
+ payerUserId: string;
1270
+ encounterId: string;
1271
+ payeeUserId: string;
1272
+ settlementId: string;
1273
+ settlementKey: string;
1274
+ receiptId: string | null;
1275
+ }, {
1276
+ status: "SETTLED" | "REVIEW" | "REJECTED";
1277
+ currency: string;
1278
+ issuerSig: string;
1279
+ amountKobo: number;
1280
+ createdAtMs: number;
1281
+ tokenSerial: string;
1282
+ issuerAccountId: string;
1283
+ payerUserId: string;
1284
+ encounterId: string;
1285
+ payeeUserId: string;
1286
+ settlementId: string;
1287
+ settlementKey: string;
1288
+ receiptId: string | null;
1289
+ }>;
1290
+ encounterId: z.ZodString;
1291
+ replayed: z.ZodBoolean;
1292
+ }, "strip", z.ZodTypeAny, {
1293
+ encounterId: string;
1294
+ settlement: {
1295
+ status: "SETTLED" | "REVIEW" | "REJECTED";
1296
+ currency: string;
1297
+ issuerSig: string;
1298
+ amountKobo: number;
1299
+ createdAtMs: number;
1300
+ tokenSerial: string;
1301
+ issuerAccountId: string;
1302
+ payerUserId: string;
1303
+ encounterId: string;
1304
+ payeeUserId: string;
1305
+ settlementId: string;
1306
+ settlementKey: string;
1307
+ receiptId: string | null;
1308
+ };
1309
+ replayed: boolean;
1310
+ }, {
1311
+ encounterId: string;
1312
+ settlement: {
1313
+ status: "SETTLED" | "REVIEW" | "REJECTED";
1314
+ currency: string;
1315
+ issuerSig: string;
1316
+ amountKobo: number;
1317
+ createdAtMs: number;
1318
+ tokenSerial: string;
1319
+ issuerAccountId: string;
1320
+ payerUserId: string;
1321
+ encounterId: string;
1322
+ payeeUserId: string;
1323
+ settlementId: string;
1324
+ settlementKey: string;
1325
+ receiptId: string | null;
1326
+ };
1327
+ replayed: boolean;
1328
+ }>;
1329
+ type SettleResponse = z.infer<typeof SettleResponseSchema>;
1330
+ /**
1331
+ * Compute the deterministic encounterId. Both parties produce the same value;
1332
+ * the backend enforces it.
1333
+ */
1334
+ declare function computeEncounterId(input: {
1335
+ payerUserId: string;
1336
+ payeeUserId: string;
1337
+ payerNonce: string;
1338
+ payeeNonce: string;
1339
+ tokenSerial: string;
1340
+ }): Promise<string>;
1341
+ type IssueOfflineTokenInput = {
1342
+ /** Optional client-supplied serial (must be unique). */
1343
+ tokenSerial?: string;
1344
+ payerUserId: string;
1345
+ maxAmountKobo: number;
1346
+ currency?: string;
1347
+ ttlMs: number;
1348
+ };
1349
+ type FlurOfflineSettlementsClient = {
1350
+ /** Partner-only: pre-issue a bounded offline settlement token. */
1351
+ issueOfflineToken: (input: IssueOfflineTokenInput) => Promise<OfflineToken>;
1352
+ /** Get a token by serial (partner-scoped). */
1353
+ getOfflineToken: (tokenSerial: string) => Promise<OfflineToken>;
1354
+ /** Atomically settle a signed payment claim (idempotent). */
1355
+ settle: (claim: PaymentClaim) => Promise<SettleResponse>;
1356
+ /** Fetch a stored settlement by id or settlement_key. */
1357
+ getSettlement: (idOrKey: string) => Promise<Settlement>;
1358
+ /** List queued conflict/review items (partner-scoped). */
1359
+ listConflicts: () => Promise<{
1360
+ items: unknown[];
1361
+ }>;
1362
+ };
1363
+ declare function createOfflineSettlementsClient(partner: FlurPartnerClient): FlurOfflineSettlementsClient;
1364
+
989
1365
  declare function bodySha256Hex(body: string): string;
990
1366
  declare function canonicalRequestString(input: {
991
1367
  method: string;
@@ -1067,10 +1443,10 @@ declare const PassSchema: z.ZodEffects<z.ZodObject<{
1067
1443
  validUntilMs: number;
1068
1444
  counterSeed: number;
1069
1445
  issuerSig: string;
1446
+ issuedAtMs: number;
1070
1447
  passId: string;
1071
1448
  kind: "ride-ticket" | "transit-pass" | "event-ticket" | "voucher" | "loyalty" | "receipt-link";
1072
1449
  issuerId: string;
1073
- issuedAtMs: number;
1074
1450
  state: "issued" | "active" | "redeemed" | "expired" | "revoked";
1075
1451
  metadata: Record<string, string | number | boolean | null>;
1076
1452
  holderDeviceId: string;
@@ -1086,10 +1462,10 @@ declare const PassSchema: z.ZodEffects<z.ZodObject<{
1086
1462
  validUntilMs: number;
1087
1463
  counterSeed: number;
1088
1464
  issuerSig: string;
1465
+ issuedAtMs: number;
1089
1466
  passId: string;
1090
1467
  kind: "ride-ticket" | "transit-pass" | "event-ticket" | "voucher" | "loyalty" | "receipt-link";
1091
1468
  issuerId: string;
1092
- issuedAtMs: number;
1093
1469
  state: "issued" | "active" | "redeemed" | "expired" | "revoked";
1094
1470
  metadata: Record<string, string | number | boolean | null>;
1095
1471
  holderDeviceId: string;
@@ -1105,10 +1481,10 @@ declare const PassSchema: z.ZodEffects<z.ZodObject<{
1105
1481
  validUntilMs: number;
1106
1482
  counterSeed: number;
1107
1483
  issuerSig: string;
1484
+ issuedAtMs: number;
1108
1485
  passId: string;
1109
1486
  kind: "ride-ticket" | "transit-pass" | "event-ticket" | "voucher" | "loyalty" | "receipt-link";
1110
1487
  issuerId: string;
1111
- issuedAtMs: number;
1112
1488
  state: "issued" | "active" | "redeemed" | "expired" | "revoked";
1113
1489
  metadata: Record<string, string | number | boolean | null>;
1114
1490
  holderDeviceId: string;
@@ -1124,10 +1500,10 @@ declare const PassSchema: z.ZodEffects<z.ZodObject<{
1124
1500
  validUntilMs: number;
1125
1501
  counterSeed: number;
1126
1502
  issuerSig: string;
1503
+ issuedAtMs: number;
1127
1504
  passId: string;
1128
1505
  kind: "ride-ticket" | "transit-pass" | "event-ticket" | "voucher" | "loyalty" | "receipt-link";
1129
1506
  issuerId: string;
1130
- issuedAtMs: number;
1131
1507
  state: "issued" | "active" | "redeemed" | "expired" | "revoked";
1132
1508
  metadata: Record<string, string | number | boolean | null>;
1133
1509
  holderDeviceId: string;
@@ -1194,10 +1570,10 @@ declare const RedemptionSchema: z.ZodObject<{
1194
1570
  validUntilMs: number;
1195
1571
  counterSeed: number;
1196
1572
  issuerSig: string;
1573
+ issuedAtMs: number;
1197
1574
  passId: string;
1198
1575
  kind: "ride-ticket" | "transit-pass" | "event-ticket" | "voucher" | "loyalty" | "receipt-link";
1199
1576
  issuerId: string;
1200
- issuedAtMs: number;
1201
1577
  state: "issued" | "active" | "redeemed" | "expired" | "revoked";
1202
1578
  metadata: Record<string, string | number | boolean | null>;
1203
1579
  holderDeviceId: string;
@@ -1213,10 +1589,10 @@ declare const RedemptionSchema: z.ZodObject<{
1213
1589
  validUntilMs: number;
1214
1590
  counterSeed: number;
1215
1591
  issuerSig: string;
1592
+ issuedAtMs: number;
1216
1593
  passId: string;
1217
1594
  kind: "ride-ticket" | "transit-pass" | "event-ticket" | "voucher" | "loyalty" | "receipt-link";
1218
1595
  issuerId: string;
1219
- issuedAtMs: number;
1220
1596
  state: "issued" | "active" | "redeemed" | "expired" | "revoked";
1221
1597
  metadata: Record<string, string | number | boolean | null>;
1222
1598
  holderDeviceId: string;
@@ -1232,10 +1608,10 @@ declare const RedemptionSchema: z.ZodObject<{
1232
1608
  validUntilMs: number;
1233
1609
  counterSeed: number;
1234
1610
  issuerSig: string;
1611
+ issuedAtMs: number;
1235
1612
  passId: string;
1236
1613
  kind: "ride-ticket" | "transit-pass" | "event-ticket" | "voucher" | "loyalty" | "receipt-link";
1237
1614
  issuerId: string;
1238
- issuedAtMs: number;
1239
1615
  state: "issued" | "active" | "redeemed" | "expired" | "revoked";
1240
1616
  metadata: Record<string, string | number | boolean | null>;
1241
1617
  holderDeviceId: string;
@@ -1251,10 +1627,10 @@ declare const RedemptionSchema: z.ZodObject<{
1251
1627
  validUntilMs: number;
1252
1628
  counterSeed: number;
1253
1629
  issuerSig: string;
1630
+ issuedAtMs: number;
1254
1631
  passId: string;
1255
1632
  kind: "ride-ticket" | "transit-pass" | "event-ticket" | "voucher" | "loyalty" | "receipt-link";
1256
1633
  issuerId: string;
1257
- issuedAtMs: number;
1258
1634
  state: "issued" | "active" | "redeemed" | "expired" | "revoked";
1259
1635
  metadata: Record<string, string | number | boolean | null>;
1260
1636
  holderDeviceId: string;
@@ -1283,10 +1659,10 @@ declare const RedemptionSchema: z.ZodObject<{
1283
1659
  validUntilMs: number;
1284
1660
  counterSeed: number;
1285
1661
  issuerSig: string;
1662
+ issuedAtMs: number;
1286
1663
  passId: string;
1287
1664
  kind: "ride-ticket" | "transit-pass" | "event-ticket" | "voucher" | "loyalty" | "receipt-link";
1288
1665
  issuerId: string;
1289
- issuedAtMs: number;
1290
1666
  state: "issued" | "active" | "redeemed" | "expired" | "revoked";
1291
1667
  metadata: Record<string, string | number | boolean | null>;
1292
1668
  holderDeviceId: string;
@@ -1310,10 +1686,10 @@ declare const RedemptionSchema: z.ZodObject<{
1310
1686
  validUntilMs: number;
1311
1687
  counterSeed: number;
1312
1688
  issuerSig: string;
1689
+ issuedAtMs: number;
1313
1690
  passId: string;
1314
1691
  kind: "ride-ticket" | "transit-pass" | "event-ticket" | "voucher" | "loyalty" | "receipt-link";
1315
1692
  issuerId: string;
1316
- issuedAtMs: number;
1317
1693
  state: "issued" | "active" | "redeemed" | "expired" | "revoked";
1318
1694
  metadata: Record<string, string | number | boolean | null>;
1319
1695
  holderDeviceId: string;
@@ -1355,59 +1731,6 @@ declare function signRedemption(unsigned: UnsignedRedemption, holderDevicePrivat
1355
1731
  */
1356
1732
  declare function verifyRedemption(r: Redemption, issuerPublicKey: Uint8Array): boolean;
1357
1733
 
1358
- type PassesClientOptions = {
1359
- baseUrl: string;
1360
- /** Pre-configured fetch (typically `createHmacFetch(...)`). Falls back to global fetch. */
1361
- fetchImpl?: typeof fetch;
1362
- };
1363
- type IssuePassInput = {
1364
- /** Device this pass is bound to. Required (BE-19). */
1365
- holderDeviceId: string;
1366
- /** 32-byte hex Ed25519 public key of the bound device. Required (BE-19). */
1367
- holderDevicePubkey: string;
1368
- /** Pass kind (server may default for templated flows). */
1369
- kind: PassKind;
1370
- /** Optional fixed amount for monetary passes (kobo). */
1371
- amountKobo?: number;
1372
- /** Optional cumulative spend cap in kobo across all redemptions. */
1373
- cumulativeCapKobo?: number;
1374
- validFromMs: number;
1375
- validUntilMs: number;
1376
- metadata?: PassMetadata;
1377
- /** Optional template grouping id (server may emit one if omitted). */
1378
- templateId?: string;
1379
- /** Optional human-facing holder identity. */
1380
- holderUserId?: string;
1381
- /** Optional client-supplied id for idempotency / retries. */
1382
- passId?: string;
1383
- };
1384
- type ListPassesInput = {
1385
- holderDeviceId?: string;
1386
- holderUserId?: string;
1387
- state?: PassState;
1388
- kind?: PassKind;
1389
- templateId?: string;
1390
- limit?: number;
1391
- cursor?: string;
1392
- };
1393
- type ListPassesResponse = {
1394
- items: Pass[];
1395
- nextCursor: string | null;
1396
- };
1397
- type RevokePassInput = {
1398
- reason: string;
1399
- };
1400
- type PassesClient = {
1401
- issuePass: (input: IssuePassInput) => Promise<Pass>;
1402
- listPasses: (input: ListPassesInput) => Promise<ListPassesResponse>;
1403
- getPass: (passId: string) => Promise<Pass>;
1404
- redeemPass: (passId: string, redemption: Redemption) => Promise<Pass>;
1405
- revokePass: (passId: string, input: RevokePassInput) => Promise<Pass>;
1406
- /** Local Ed25519 verification of a pass envelope under the supplied issuer public key. */
1407
- verifyPass: (pass: Pass, issuerPublicKey: Uint8Array) => boolean;
1408
- };
1409
- declare function createPassesClient(opts: PassesClientOptions): PassesClient;
1410
-
1411
1734
  declare const RECEIPT_CHANNELS: readonly ["cash", "pass"];
1412
1735
  type ReceiptChannel = (typeof RECEIPT_CHANNELS)[number];
1413
1736
  /** @deprecated use {@link RECEIPT_CHANNELS}. Will be removed before 1.0. */
@@ -1438,12 +1761,12 @@ declare const ReceiptSchema: z.ZodEffects<z.ZodObject<{
1438
1761
  currency: string;
1439
1762
  issuerSig: string;
1440
1763
  amountKobo: number;
1441
- issuerId: string;
1764
+ payerUserId: string;
1442
1765
  issuedAtMs: number;
1766
+ payeeUserId: string;
1443
1767
  receiptId: string;
1768
+ issuerId: string;
1444
1769
  channel: "pass" | "cash";
1445
- payerUserId: string;
1446
- payeeUserId: string;
1447
1770
  payload: Record<string, string | number | boolean | null>;
1448
1771
  intentId?: string | undefined;
1449
1772
  passRedemptionId?: string | undefined;
@@ -1451,12 +1774,12 @@ declare const ReceiptSchema: z.ZodEffects<z.ZodObject<{
1451
1774
  currency: string;
1452
1775
  issuerSig: string;
1453
1776
  amountKobo: number;
1454
- issuerId: string;
1777
+ payerUserId: string;
1455
1778
  issuedAtMs: number;
1779
+ payeeUserId: string;
1456
1780
  receiptId: string;
1781
+ issuerId: string;
1457
1782
  channel: "pass" | "cash";
1458
- payerUserId: string;
1459
- payeeUserId: string;
1460
1783
  payload: Record<string, string | number | boolean | null>;
1461
1784
  intentId?: string | undefined;
1462
1785
  passRedemptionId?: string | undefined;
@@ -1464,12 +1787,12 @@ declare const ReceiptSchema: z.ZodEffects<z.ZodObject<{
1464
1787
  currency: string;
1465
1788
  issuerSig: string;
1466
1789
  amountKobo: number;
1467
- issuerId: string;
1790
+ payerUserId: string;
1468
1791
  issuedAtMs: number;
1792
+ payeeUserId: string;
1469
1793
  receiptId: string;
1794
+ issuerId: string;
1470
1795
  channel: "pass" | "cash";
1471
- payerUserId: string;
1472
- payeeUserId: string;
1473
1796
  payload: Record<string, string | number | boolean | null>;
1474
1797
  intentId?: string | undefined;
1475
1798
  passRedemptionId?: string | undefined;
@@ -1477,12 +1800,12 @@ declare const ReceiptSchema: z.ZodEffects<z.ZodObject<{
1477
1800
  currency: string;
1478
1801
  issuerSig: string;
1479
1802
  amountKobo: number;
1480
- issuerId: string;
1803
+ payerUserId: string;
1481
1804
  issuedAtMs: number;
1805
+ payeeUserId: string;
1482
1806
  receiptId: string;
1807
+ issuerId: string;
1483
1808
  channel: "pass" | "cash";
1484
- payerUserId: string;
1485
- payeeUserId: string;
1486
1809
  payload: Record<string, string | number | boolean | null>;
1487
1810
  intentId?: string | undefined;
1488
1811
  passRedemptionId?: string | undefined;
@@ -1506,6 +1829,75 @@ declare function buildReceipt(input: BuildReceiptInput): UnsignedReceipt;
1506
1829
  declare function signReceipt(unsigned: UnsignedReceipt, issuerPrivateKey: Uint8Array): Receipt;
1507
1830
  declare function verifyReceipt(r: Receipt, issuerPublicKey: Uint8Array): boolean;
1508
1831
 
1832
+ type PassesClientOptions = {
1833
+ baseUrl: string;
1834
+ /** Pre-configured fetch (typically `createHmacFetch(...)`). Falls back to global fetch. */
1835
+ fetchImpl?: typeof fetch;
1836
+ };
1837
+ type IssuePassInput = {
1838
+ /** Device this pass is bound to. Required (BE-19). */
1839
+ holderDeviceId: string;
1840
+ /** 32-byte hex Ed25519 public key of the bound device. Required (BE-19). */
1841
+ holderDevicePubkey: string;
1842
+ /** Pass kind (server may default for templated flows). */
1843
+ kind: PassKind;
1844
+ /** Optional fixed amount for monetary passes (kobo). */
1845
+ amountKobo?: number;
1846
+ /** Optional cumulative spend cap in kobo across all redemptions. */
1847
+ cumulativeCapKobo?: number;
1848
+ validFromMs: number;
1849
+ validUntilMs: number;
1850
+ metadata?: PassMetadata;
1851
+ /** Optional template grouping id (server may emit one if omitted). */
1852
+ templateId?: string;
1853
+ /** Optional human-facing holder identity. */
1854
+ holderUserId?: string;
1855
+ /** Optional client-supplied id for idempotency / retries. */
1856
+ passId?: string;
1857
+ };
1858
+ type ListPassesInput = {
1859
+ holderDeviceId?: string;
1860
+ holderUserId?: string;
1861
+ state?: PassState;
1862
+ kind?: PassKind;
1863
+ templateId?: string;
1864
+ limit?: number;
1865
+ cursor?: string;
1866
+ };
1867
+ type ListPassesResponse = {
1868
+ items: Pass[];
1869
+ nextCursor: string | null;
1870
+ };
1871
+ type RevokePassInput = {
1872
+ reason: string;
1873
+ };
1874
+ type RedeemPassResponse = {
1875
+ pass: Pass;
1876
+ redemptionId: string;
1877
+ };
1878
+ type AtomicRedeemReceiptInput = {
1879
+ payeeUserId: string;
1880
+ payload?: ReceiptPayload;
1881
+ receiptId?: string;
1882
+ };
1883
+ type AtomicRedeemResponse = {
1884
+ pass: Pass;
1885
+ redemptionId: string;
1886
+ receipt: Receipt;
1887
+ };
1888
+ type PassesClient = {
1889
+ issuePass: (input: IssuePassInput) => Promise<Pass>;
1890
+ listPasses: (input: ListPassesInput) => Promise<ListPassesResponse>;
1891
+ getPass: (passId: string) => Promise<Pass>;
1892
+ redeemPassDetailed: (passId: string, redemption: Redemption) => Promise<RedeemPassResponse>;
1893
+ redeemPass: (passId: string, redemption: Redemption) => Promise<Pass>;
1894
+ redeemPassWithReceipt: (passId: string, redemption: Redemption, receipt: AtomicRedeemReceiptInput) => Promise<AtomicRedeemResponse>;
1895
+ revokePass: (passId: string, input: RevokePassInput) => Promise<Pass>;
1896
+ /** Local Ed25519 verification of a pass envelope under the supplied issuer public key. */
1897
+ verifyPass: (pass: Pass, issuerPublicKey: Uint8Array) => boolean;
1898
+ };
1899
+ declare function createPassesClient(opts: PassesClientOptions): PassesClient;
1900
+
1509
1901
  type ReceiptsClientOptions = {
1510
1902
  baseUrl: string;
1511
1903
  fetchImpl?: typeof fetch;
@@ -1590,4 +1982,76 @@ type FlurHandle = CashNamespace & {
1590
1982
  };
1591
1983
  declare function init(opts: FlurInitOptions): FlurHandle;
1592
1984
 
1593
- export { ADDITIONAL_DATA_SUBFIELD, type AccountActivityItem, type AccountSummaryResponse, type AdditionalData, type AuthLogoutInput, type AuthRefreshInput, type AuthRefreshResponse, type AuthorizeSendWithBiometricInput, type AuthorizedOptions, type BiometricSigner, type BuildPassInput, type BuildReceiptInput, type BuildRedemptionInput, type CashNamespace, type CreatePayLinkResponse, type CreateTransferOptions, type DeviceTrustState, type Ed25519KeyPair, FIELD, FlurApiError, FlurCapExceededError, FlurClient, type FlurClientOptions, FlurError, type FlurErrorCode, FlurExpiredError, type FlurHandle, type FlurInitOptions, type FlurPaymentEvent, FlurReplayError, type HmacFetchOptions, type IssuePassInput, type IssueReceiptInput, type ListPassesInput, type ListPassesResponse, type ListReceiptsInput, type ListReceiptsResponse, type ListTransactionsOptions, type MerchantAccountInfo, type Money, NGN_CURRENCY_CODE, NG_COUNTRY_CODE, NQRParseError, type NQRPayloadInput, type OAC, OACSchema, OAC_DEFAULT_CUMULATIVE_KOBO, OAC_DEFAULT_PER_TX_KOBO, OAC_DEFAULT_VALIDITY_MS, type OfflinePaymentAuthorization, OfflinePaymentAuthorizationSchema, type OfflinePaymentRequest, OfflinePaymentRequestSchema, type OnboardingCompleteInput, type OnboardingCompleteResponse, type OnboardingFallback, type OnboardingRiskReason, type OnboardingStartInput, type OnboardingStartResponse, PASS_KINDS, PASS_STATES, PAYLOAD_FORMAT_INDICATOR_VALUE, POINT_OF_INITIATION, type ParsedNQR, type Pass, type PassKind, type PassMetadata, PassMetadataSchema, PassSchema, type PassState, type PassesClient, type PassesClientOptions, type PinSetInput, type PinVerifyInput, type PushPlatform, type PushRegisterInput, RECEIPT_CHANNELS, RECEIPT_KINDS, REPLAY_WINDOW_MS, type Receipt, type ReceiptChannel, type ReceiptKind, type ReceiptPayload, ReceiptPayloadSchema, ReceiptSchema, type ReceiptsClient, type ReceiptsClientOptions, type RecipientResolveInput, type RecipientResolveResponse, type Redemption, RedemptionSchema, type RegisterDeviceInput, type RegisterDeviceResponse, type RegisterSendDeviceKeyInput, type ResolvePayLinkResponse, type RevokePassInput, type RoutingHint, type SendChallengeInput, type SendChallengeResponse, type SendMoneyInput, type SendMoneyOptions, type SendVerifyInput, type SendVerifyResponse, type SubscribeOptions, type TLVField, type TransactionDetailResponse, type TransactionDirection, type TransactionsListResponse, type TransferInput, type TransferResponse, type TransferStatus, type UnsignedOAC, type UnsignedOfflinePaymentAuthorization, type UnsignedOfflinePaymentRequest, type UnsignedPass, type UnsignedReceipt, type UnsignedRedemption, bodySha256Hex, buildAuthorization, buildOAC, buildPass, buildPaymentRequest, buildReceipt, buildRedemption, canonicalJSONBytes, canonicalJSONStringify, canonicalRequestString, constantTimeEqual, crc16ccitt, crc16ccittHex, createHmacFetch, createPassesClient, createReceiptsClient, decodeAuthorizationQR, decodeBase45, decodePaymentRequestQR, encodeAuthorizationQR, encodeBase45, encodeNQR, encodePaymentRequestQR, formatAmount, generateDynamicQR, generateKeyPair, generateStaticQR, init, isPassWithinValidity, moneyMinorToNumber, normalizeE164, parseAmountInput, parseNQR, parseQR, publicKeyFromPrivate, readTLV, routingHint, sign, signAuthorization, signCanonical, signOAC, signPass, signPaymentRequest, signReceipt, signRedemption, signRequestHMAC, verify, verifyAuthorization, verifyCanonical, verifyOAC, verifyPass, verifyPaymentRequest, verifyReceipt, verifyRedemption, verifyRequestHMAC, writeTLV };
1985
+ declare const ACCOUNT_TYPES: readonly ["personal", "business", "partner"];
1986
+ type AccountType = (typeof ACCOUNT_TYPES)[number];
1987
+ declare const ACCOUNT_STATUSES: readonly ["active", "suspended", "closed"];
1988
+ type AccountStatus = (typeof ACCOUNT_STATUSES)[number];
1989
+ declare const MEMBERSHIP_ROLES: readonly ["owner", "admin", "driver", "staff"];
1990
+ type MembershipRole = (typeof MEMBERSHIP_ROLES)[number];
1991
+ declare const AccountSchema: z.ZodObject<{
1992
+ accountId: z.ZodString;
1993
+ type: z.ZodEnum<["personal", "business", "partner"]>;
1994
+ displayName: z.ZodString;
1995
+ status: z.ZodEnum<["active", "suspended", "closed"]>;
1996
+ ownerUserId: z.ZodNullable<z.ZodString>;
1997
+ createdAtMs: z.ZodNumber;
1998
+ }, "strip", z.ZodTypeAny, {
1999
+ type: "personal" | "business" | "partner";
2000
+ status: "active" | "suspended" | "closed";
2001
+ displayName: string;
2002
+ accountId: string;
2003
+ createdAtMs: number;
2004
+ ownerUserId: string | null;
2005
+ }, {
2006
+ type: "personal" | "business" | "partner";
2007
+ status: "active" | "suspended" | "closed";
2008
+ displayName: string;
2009
+ accountId: string;
2010
+ createdAtMs: number;
2011
+ ownerUserId: string | null;
2012
+ }>;
2013
+ type Account = z.infer<typeof AccountSchema>;
2014
+ declare const AccountMembershipSchema: z.ZodObject<{
2015
+ accountId: z.ZodString;
2016
+ userId: z.ZodString;
2017
+ role: z.ZodEnum<["owner", "admin", "driver", "staff"]>;
2018
+ createdAtMs: z.ZodNumber;
2019
+ }, "strip", z.ZodTypeAny, {
2020
+ userId: string;
2021
+ accountId: string;
2022
+ createdAtMs: number;
2023
+ role: "owner" | "admin" | "driver" | "staff";
2024
+ }, {
2025
+ userId: string;
2026
+ accountId: string;
2027
+ createdAtMs: number;
2028
+ role: "owner" | "admin" | "driver" | "staff";
2029
+ }>;
2030
+ type AccountMembership = z.infer<typeof AccountMembershipSchema>;
2031
+ type AccountsClientOptions = {
2032
+ baseUrl: string;
2033
+ /** Pre-configured fetch (e.g. with a session bearer or partner HMAC). */
2034
+ fetchImpl?: typeof fetch;
2035
+ };
2036
+ type CreateBusinessAccountInput = {
2037
+ displayName: string;
2038
+ type?: 'business' | 'partner';
2039
+ };
2040
+ type AddMemberInput = {
2041
+ userId: string;
2042
+ role: MembershipRole;
2043
+ };
2044
+ type AccountsClient = {
2045
+ listMyAccounts: () => Promise<{
2046
+ items: Account[];
2047
+ }>;
2048
+ getAccount: (accountId: string) => Promise<Account>;
2049
+ listMembers: (accountId: string) => Promise<{
2050
+ items: AccountMembership[];
2051
+ }>;
2052
+ createBusinessAccount: (input: CreateBusinessAccountInput) => Promise<Account>;
2053
+ addMember: (accountId: string, input: AddMemberInput) => Promise<AccountMembership>;
2054
+ };
2055
+ declare function createAccountsClient(opts: AccountsClientOptions): AccountsClient;
2056
+
2057
+ export { ACCOUNT_STATUSES, ACCOUNT_TYPES, ADDITIONAL_DATA_SUBFIELD, type Account, type AccountActivityItem, type AccountMembership, AccountMembershipSchema, AccountSchema, type AccountStatus, type AccountSummaryResponse, type AccountType, type AccountsClient, type AccountsClientOptions, type AddMemberInput, type AdditionalData, type ApiCredentialPublic, ApiCredentialPublicSchema, type ApiCredentialsAdminClient, type AtomicRedeemReceiptInput, type AtomicRedeemResponse, type AuthLogoutInput, type AuthRefreshInput, type AuthRefreshResponse, type AuthorizeSendWithBiometricInput, type AuthorizedOptions, type BiometricSigner, type BuildPassInput, type BuildReceiptInput, type BuildRedemptionInput, type CashNamespace, type CreateBusinessAccountInput, type CreatePayLinkResponse, type CreateTransferOptions, type DeviceTrustState, type Ed25519KeyPair, FIELD, FlurApiError, FlurCapExceededError, FlurClient, type FlurClientOptions, FlurError, type FlurErrorCode, FlurExpiredError, type FlurHandle, type FlurInitOptions, type FlurOfflineSettlementsClient, type FlurPartnerClient, type FlurPaymentEvent, FlurReplayError, type HmacFetchOptions, type IssueOfflineTokenInput, type IssuePassInput, type IssueReceiptInput, type ListPassesInput, type ListPassesResponse, type ListReceiptsInput, type ListReceiptsResponse, type ListTransactionsOptions, MEMBERSHIP_ROLES, type MembershipRole, type MerchantAccountInfo, type MintedApiCredential, MintedApiCredentialSchema, type Money, NGN_CURRENCY_CODE, NG_COUNTRY_CODE, NQRParseError, type NQRPayloadInput, type OAC, OACSchema, OAC_DEFAULT_CUMULATIVE_KOBO, OAC_DEFAULT_PER_TX_KOBO, OAC_DEFAULT_VALIDITY_MS, type OfflinePaymentAuthorization, OfflinePaymentAuthorizationSchema, type OfflinePaymentRequest, OfflinePaymentRequestSchema, type OfflineToken, OfflineTokenSchema, type OnboardingCompleteInput, type OnboardingCompleteResponse, type OnboardingFallback, type OnboardingRiskReason, type OnboardingStartInput, type OnboardingStartResponse, PARTNER_SCOPES, PASS_KINDS, PASS_STATES, PAYLOAD_FORMAT_INDICATOR_VALUE, POINT_OF_INITIATION, type ParsedNQR, type PartnerClientOptions, type PartnerScope, type PartnerSignResult, type Pass, type PassKind, type PassMetadata, PassMetadataSchema, PassSchema, type PassState, type PassesClient, type PassesClientOptions, type PaymentClaim, PaymentClaimSchema, type PinSetInput, type PinVerifyInput, type PushPlatform, type PushRegisterInput, RECEIPT_CHANNELS, RECEIPT_KINDS, REPLAY_WINDOW_MS, type Receipt, type ReceiptChannel, type ReceiptKind, type ReceiptPayload, ReceiptPayloadSchema, ReceiptSchema, type ReceiptsClient, type ReceiptsClientOptions, type RecipientResolveInput, type RecipientResolveResponse, type RedeemPassResponse, type Redemption, RedemptionSchema, type RegisterDeviceInput, type RegisterDeviceResponse, type RegisterSendDeviceKeyInput, type ResolvePayLinkResponse, type RevokePassInput, type RoutingHint, type SendChallengeInput, type SendChallengeResponse, type SendMoneyInput, type SendMoneyOptions, type SendVerifyInput, type SendVerifyResponse, type SettleResponse, SettleResponseSchema, type Settlement, SettlementSchema, type SubscribeOptions, type TLVField, type TransactionDetailResponse, type TransactionDirection, type TransactionsListResponse, type TransferInput, type TransferResponse, type TransferStatus, type UnsignedOAC, type UnsignedOfflinePaymentAuthorization, type UnsignedOfflinePaymentRequest, type UnsignedPass, type UnsignedReceipt, type UnsignedRedemption, bodySha256Hex, buildAuthorization, buildOAC, buildPass, buildPaymentRequest, buildReceipt, buildRedemption, canonicalJSONBytes, canonicalJSONStringify, canonicalRequestString, computeEncounterId, constantTimeEqual, crc16ccitt, crc16ccittHex, createAccountsClient, createApiCredentialsAdminClient, createFlurPartnerClient, createHmacFetch, createOfflineSettlementsClient, createPassesClient, createReceiptsClient, decodeAuthorizationQR, decodeBase45, decodePaymentRequestQR, encodeAuthorizationQR, encodeBase45, encodeNQR, encodePaymentRequestQR, formatAmount, generateDynamicQR, generateKeyPair, generateStaticQR, init, isPassWithinValidity, moneyMinorToNumber, normalizeE164, parseAmountInput, parseNQR, parseQR, publicKeyFromPrivate, readTLV, routingHint, sign, signAuthorization, signCanonical, signOAC, signPartnerRequest, signPass, signPaymentRequest, signReceipt, signRedemption, signRequestHMAC, verify, verifyAuthorization, verifyCanonical, verifyOAC, verifyPass, verifyPaymentRequest, verifyReceipt, verifyRedemption, verifyRequestHMAC, writeTLV };