@nokinc-flur/sdk 2.4.0 → 2.5.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/dist/index.cjs +363 -274
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +355 -181
- package/dist/index.d.ts +355 -181
- package/dist/index.js +356 -274
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2955,76 +2955,142 @@ function createAccountsClient(opts) {
|
|
|
2955
2955
|
}
|
|
2956
2956
|
|
|
2957
2957
|
// src/me-offline/client.ts
|
|
2958
|
+
import { z as z14 } from "zod";
|
|
2959
|
+
|
|
2960
|
+
// src/me-offline/revocation.ts
|
|
2958
2961
|
import { z as z13 } from "zod";
|
|
2959
|
-
var Sha256Hex = z13.string().regex(/^[0-9a-f]{64}$/);
|
|
2960
2962
|
var Base64Std3 = z13.string().regex(/^[A-Za-z0-9+/]+={0,2}$/);
|
|
2961
|
-
var
|
|
2963
|
+
var CONSUMER_REVOCATION_DOMAIN = "flur:consumer-offline:v1:revocation";
|
|
2964
|
+
var REVOCATION_LIST_MAX_ENTRIES = 1e5;
|
|
2965
|
+
var RevocationListSchema = z13.object({
|
|
2966
|
+
issuerId: z13.string().min(1).max(64),
|
|
2967
|
+
/**
|
|
2968
|
+
* Monotonic snapshot counter. A device MUST NOT replace a pinned list with
|
|
2969
|
+
* one carrying a lower sequence — this defeats a downgrade/rollback attack
|
|
2970
|
+
* that replays an older list to resurrect a revoked credential.
|
|
2971
|
+
*/
|
|
2972
|
+
sequence: z13.number().int().nonnegative(),
|
|
2973
|
+
issuedAtMs: z13.number().int().nonnegative(),
|
|
2974
|
+
/**
|
|
2975
|
+
* Freshness bound. After this instant the list is considered stale and the
|
|
2976
|
+
* verifier treats it as untrustworthy (fail-closed), forcing a re-pin.
|
|
2977
|
+
* Optional so the issuer may publish a list without a hard expiry.
|
|
2978
|
+
*/
|
|
2979
|
+
notAfterMs: z13.number().int().positive().optional(),
|
|
2980
|
+
/** OAC ids that are revoked AND not yet past their own validity window. */
|
|
2981
|
+
revokedOacIds: z13.array(z13.string().uuid()).max(REVOCATION_LIST_MAX_ENTRIES)
|
|
2982
|
+
});
|
|
2983
|
+
var SignedRevocationListSchema = z13.object({
|
|
2984
|
+
list: RevocationListSchema,
|
|
2985
|
+
/** ASN.1 DER ECDSA P-256 issuer signature over the signing payload, base64. */
|
|
2986
|
+
issuerSig: Base64Std3.min(16).max(2048),
|
|
2987
|
+
/** Issuer's P-256 public key as SubjectPublicKeyInfo DER, base64. */
|
|
2988
|
+
issuerPublicKeySpkiB64: Base64Std3.min(64).max(4096)
|
|
2989
|
+
});
|
|
2990
|
+
function revocationListSigningPayload(list) {
|
|
2991
|
+
const payload = {
|
|
2992
|
+
domain: CONSUMER_REVOCATION_DOMAIN,
|
|
2993
|
+
issuerId: list.issuerId,
|
|
2994
|
+
sequence: list.sequence,
|
|
2995
|
+
issuedAtMs: list.issuedAtMs,
|
|
2996
|
+
revokedOacIds: list.revokedOacIds
|
|
2997
|
+
};
|
|
2998
|
+
if (list.notAfterMs !== void 0) payload.notAfterMs = list.notAfterMs;
|
|
2999
|
+
return payload;
|
|
3000
|
+
}
|
|
3001
|
+
function verifyRevocationList(signed, trustedKeys, options = {}) {
|
|
3002
|
+
const parsed = SignedRevocationListSchema.safeParse(signed);
|
|
3003
|
+
if (!parsed.success) return { ok: false, reason: "malformed" };
|
|
3004
|
+
const list = parsed.data.list;
|
|
3005
|
+
const nowMs = options.nowMs ?? Date.now();
|
|
3006
|
+
const pinned = trustedKeys.filter(
|
|
3007
|
+
(k) => k.issuerId === list.issuerId && (k.notBeforeMs === void 0 || nowMs >= k.notBeforeMs) && (k.notAfterMs === void 0 || nowMs <= k.notAfterMs)
|
|
3008
|
+
);
|
|
3009
|
+
if (pinned.length === 0) return { ok: false, reason: "untrusted_issuer" };
|
|
3010
|
+
const signingBytes = canonicalJSONBytes(revocationListSigningPayload(list));
|
|
3011
|
+
const signatureOk = pinned.some(
|
|
3012
|
+
(k) => verifyIssuerP256(signingBytes, parsed.data.issuerSig, k.publicKeySpkiB64)
|
|
3013
|
+
);
|
|
3014
|
+
if (!signatureOk) return { ok: false, reason: "signature_invalid" };
|
|
3015
|
+
if (list.notAfterMs !== void 0 && nowMs > list.notAfterMs) {
|
|
3016
|
+
return { ok: false, reason: "stale" };
|
|
3017
|
+
}
|
|
3018
|
+
return { ok: true, list, revokedOacIds: new Set(list.revokedOacIds) };
|
|
3019
|
+
}
|
|
3020
|
+
function isOacRevoked(oacId, revokedOacIds) {
|
|
3021
|
+
return revokedOacIds.has(oacId);
|
|
3022
|
+
}
|
|
3023
|
+
|
|
3024
|
+
// src/me-offline/client.ts
|
|
3025
|
+
var Sha256Hex = z14.string().regex(/^[0-9a-f]{64}$/);
|
|
3026
|
+
var Base64Std4 = z14.string().regex(/^[A-Za-z0-9+/]+={0,2}$/);
|
|
3027
|
+
var ClaimNonce = z14.string().min(8).max(128).refine((value) => !value.includes("|"), {
|
|
2962
3028
|
message: "nonce must not contain |"
|
|
2963
3029
|
});
|
|
2964
3030
|
var ACCOUNT_FUNDED_OAC_MAX_TTL_MS = 1e3 * 60 * 60 * 24;
|
|
2965
|
-
var IssuerTrustKeySchema =
|
|
2966
|
-
issuerId:
|
|
2967
|
-
alg:
|
|
2968
|
-
publicKeySpkiB64:
|
|
2969
|
-
notBeforeMs:
|
|
2970
|
-
notAfterMs:
|
|
3031
|
+
var IssuerTrustKeySchema = z14.object({
|
|
3032
|
+
issuerId: z14.string().min(1).max(128),
|
|
3033
|
+
alg: z14.literal("p256"),
|
|
3034
|
+
publicKeySpkiB64: Base64Std4.min(64).max(4096),
|
|
3035
|
+
notBeforeMs: z14.number().int().nonnegative().optional(),
|
|
3036
|
+
notAfterMs: z14.number().int().positive().optional()
|
|
2971
3037
|
});
|
|
2972
|
-
var IssuerTrustBundleSchema =
|
|
2973
|
-
keys:
|
|
3038
|
+
var IssuerTrustBundleSchema = z14.object({
|
|
3039
|
+
keys: z14.array(IssuerTrustKeySchema).min(1)
|
|
2974
3040
|
});
|
|
2975
3041
|
var CONSUMER_OFFLINE_CLAIM_SUBMIT_GRACE_MS = 1e3 * 60 * 60 * 24;
|
|
2976
|
-
var AttestationSecurityLevelSchema =
|
|
3042
|
+
var AttestationSecurityLevelSchema = z14.enum([
|
|
2977
3043
|
"STRONGBOX",
|
|
2978
3044
|
"TEE",
|
|
2979
3045
|
"SECURE_ENCLAVE",
|
|
2980
3046
|
"SOFTWARE"
|
|
2981
3047
|
]);
|
|
2982
|
-
var DeviceKeyAlgSchema =
|
|
2983
|
-
var RegisterDeviceKeyP256InputSchema =
|
|
2984
|
-
deviceId:
|
|
3048
|
+
var DeviceKeyAlgSchema = z14.literal("p256");
|
|
3049
|
+
var RegisterDeviceKeyP256InputSchema = z14.object({
|
|
3050
|
+
deviceId: z14.string().min(1).max(128),
|
|
2985
3051
|
/** P-256 SubjectPublicKeyInfo DER, base64. */
|
|
2986
|
-
publicKeySpkiB64:
|
|
3052
|
+
publicKeySpkiB64: Base64Std4.min(64).max(4096),
|
|
2987
3053
|
/** Base64 of the server-issued enrollment challenge string. */
|
|
2988
|
-
challengeB64:
|
|
3054
|
+
challengeB64: Base64Std4.min(8).max(1024),
|
|
2989
3055
|
/** iOS App Attest payload or Android X.509 Key Attestation chain. */
|
|
2990
|
-
attestationChainB64:
|
|
3056
|
+
attestationChainB64: z14.array(Base64Std4.min(16).max(16384)).min(1).max(16),
|
|
2991
3057
|
securityLevel: AttestationSecurityLevelSchema
|
|
2992
3058
|
});
|
|
2993
|
-
var P256EnrollmentChallengeInputSchema =
|
|
2994
|
-
deviceId:
|
|
3059
|
+
var P256EnrollmentChallengeInputSchema = z14.object({
|
|
3060
|
+
deviceId: z14.string().min(1).max(128)
|
|
2995
3061
|
});
|
|
2996
|
-
var P256EnrollmentChallengeResultSchema =
|
|
2997
|
-
challenge:
|
|
2998
|
-
expiresAtMs:
|
|
3062
|
+
var P256EnrollmentChallengeResultSchema = z14.object({
|
|
3063
|
+
challenge: z14.string().min(16),
|
|
3064
|
+
expiresAtMs: z14.number().int().positive()
|
|
2999
3065
|
});
|
|
3000
|
-
var DeviceKeyRecordSchema =
|
|
3001
|
-
id:
|
|
3002
|
-
userId:
|
|
3003
|
-
deviceId:
|
|
3066
|
+
var DeviceKeyRecordSchema = z14.object({
|
|
3067
|
+
id: z14.string().uuid(),
|
|
3068
|
+
userId: z14.string().uuid(),
|
|
3069
|
+
deviceId: z14.string(),
|
|
3004
3070
|
/** Always 'p256' on the consumer offline rail. Field retained for forward-compat. */
|
|
3005
3071
|
alg: DeviceKeyAlgSchema.default("p256"),
|
|
3006
3072
|
/** P-256 SubjectPublicKeyInfo DER, base64. */
|
|
3007
|
-
publicKeySpkiB64:
|
|
3073
|
+
publicKeySpkiB64: Base64Std4.nullable().default(null),
|
|
3008
3074
|
securityLevel: AttestationSecurityLevelSchema.nullable().default(null),
|
|
3009
|
-
hardwareBacked:
|
|
3010
|
-
attestedAtMs:
|
|
3011
|
-
createdAtMs:
|
|
3012
|
-
revokedAtMs:
|
|
3075
|
+
hardwareBacked: z14.boolean().default(false),
|
|
3076
|
+
attestedAtMs: z14.number().int().nonnegative().nullable().default(null),
|
|
3077
|
+
createdAtMs: z14.number().int().nonnegative(),
|
|
3078
|
+
revokedAtMs: z14.number().int().nonnegative().nullable()
|
|
3013
3079
|
});
|
|
3014
|
-
var ConsumerOACSchema =
|
|
3015
|
-
oacId:
|
|
3016
|
-
issuerId:
|
|
3017
|
-
userId:
|
|
3018
|
-
deviceId:
|
|
3080
|
+
var ConsumerOACSchema = z14.object({
|
|
3081
|
+
oacId: z14.string().uuid(),
|
|
3082
|
+
issuerId: z14.string().min(1).max(64),
|
|
3083
|
+
userId: z14.string().uuid(),
|
|
3084
|
+
deviceId: z14.string().min(1).max(128),
|
|
3019
3085
|
/**
|
|
3020
3086
|
* Always 'p256'. Required on the wire (backend always emits it).
|
|
3021
3087
|
* Kept as a literal so input/output infer identically and the schema
|
|
3022
3088
|
* can be nested inside other response shapes without Zod input/output
|
|
3023
3089
|
* divergence under tsup DTS bundling.
|
|
3024
3090
|
*/
|
|
3025
|
-
alg:
|
|
3091
|
+
alg: z14.literal("p256"),
|
|
3026
3092
|
/** P-256 SubjectPublicKeyInfo DER, base64. */
|
|
3027
|
-
devicePubkeySpkiB64:
|
|
3093
|
+
devicePubkeySpkiB64: Base64Std4.min(64).max(4096),
|
|
3028
3094
|
/**
|
|
3029
3095
|
* Per-transaction / cumulative offline spend ceilings. Zero is valid and
|
|
3030
3096
|
* denotes an identity-only OAC: the credential proves who the holder is and
|
|
@@ -3032,104 +3098,104 @@ var ConsumerOACSchema = z13.object({
|
|
|
3032
3098
|
* no offline spend authority (every claim against it routes to REVIEW).
|
|
3033
3099
|
* Issued to zero-balance wallets so they can still be paid offline.
|
|
3034
3100
|
*/
|
|
3035
|
-
perTxCapKobo:
|
|
3036
|
-
cumulativeCapKobo:
|
|
3037
|
-
currency:
|
|
3038
|
-
validFromMs:
|
|
3039
|
-
validUntilMs:
|
|
3040
|
-
counterSeed:
|
|
3041
|
-
issuedAtMs:
|
|
3101
|
+
perTxCapKobo: z14.number().int().nonnegative(),
|
|
3102
|
+
cumulativeCapKobo: z14.number().int().nonnegative(),
|
|
3103
|
+
currency: z14.string().length(3),
|
|
3104
|
+
validFromMs: z14.number().int().nonnegative(),
|
|
3105
|
+
validUntilMs: z14.number().int().nonnegative(),
|
|
3106
|
+
counterSeed: z14.number().int().nonnegative(),
|
|
3107
|
+
issuedAtMs: z14.number().int().nonnegative(),
|
|
3042
3108
|
/**
|
|
3043
3109
|
* Issuer-attested identity folded into the OAC so a single signed
|
|
3044
3110
|
* credential serves both Tier B offline-verifiable identity and offline
|
|
3045
3111
|
* spend authority. Verified offline against a pinned issuer key; the
|
|
3046
3112
|
* backend remains authoritative at settlement.
|
|
3047
3113
|
*/
|
|
3048
|
-
phoneE164:
|
|
3049
|
-
displayName:
|
|
3114
|
+
phoneE164: z14.string().regex(/^\+[1-9]\d{7,14}$/),
|
|
3115
|
+
displayName: z14.string().min(1).max(64)
|
|
3050
3116
|
});
|
|
3051
|
-
var SignedConsumerOACSchema =
|
|
3117
|
+
var SignedConsumerOACSchema = z14.object({
|
|
3052
3118
|
oac: ConsumerOACSchema,
|
|
3053
3119
|
/** ASN.1 DER ECDSA P-256 issuer signature, base64. */
|
|
3054
|
-
issuerSig:
|
|
3120
|
+
issuerSig: Base64Std4.min(16).max(2048),
|
|
3055
3121
|
/** Issuer's P-256 public key as SubjectPublicKeyInfo DER, base64. */
|
|
3056
|
-
issuerPublicKeySpkiB64:
|
|
3122
|
+
issuerPublicKeySpkiB64: Base64Std4.min(64).max(4096)
|
|
3057
3123
|
});
|
|
3058
3124
|
var OACRecordSchema = SignedConsumerOACSchema.extend({
|
|
3059
|
-
currentOfflineSpentKobo:
|
|
3060
|
-
status:
|
|
3061
|
-
supersededAtMs:
|
|
3062
|
-
revokedAtMs:
|
|
3125
|
+
currentOfflineSpentKobo: z14.number().int().nonnegative(),
|
|
3126
|
+
status: z14.enum(["active", "superseded", "expired", "revoked"]),
|
|
3127
|
+
supersededAtMs: z14.number().int().nonnegative().nullable(),
|
|
3128
|
+
revokedAtMs: z14.number().int().nonnegative().nullable()
|
|
3063
3129
|
});
|
|
3064
|
-
var IssueAccountOacInputSchema =
|
|
3065
|
-
deviceId:
|
|
3066
|
-
perTxCapKobo:
|
|
3067
|
-
cumulativeCapKobo:
|
|
3068
|
-
ttlMs:
|
|
3130
|
+
var IssueAccountOacInputSchema = z14.object({
|
|
3131
|
+
deviceId: z14.string().min(1).max(128),
|
|
3132
|
+
perTxCapKobo: z14.number().int().positive().optional(),
|
|
3133
|
+
cumulativeCapKobo: z14.number().int().positive().optional(),
|
|
3134
|
+
ttlMs: z14.number().int().min(6e4).max(ACCOUNT_FUNDED_OAC_MAX_TTL_MS).optional()
|
|
3069
3135
|
});
|
|
3070
|
-
var OfflineStatusResultSchema =
|
|
3136
|
+
var OfflineStatusResultSchema = z14.object({
|
|
3071
3137
|
active: OACRecordSchema.nullable()
|
|
3072
3138
|
});
|
|
3073
|
-
var ConsumerPaymentClaimSchema =
|
|
3139
|
+
var ConsumerPaymentClaimSchema = z14.object({
|
|
3074
3140
|
/** Always 'p256'. Retained for forward-compat and as an explicit domain marker. */
|
|
3075
|
-
alg:
|
|
3076
|
-
oacId:
|
|
3141
|
+
alg: z14.literal("p256").default("p256"),
|
|
3142
|
+
oacId: z14.string().uuid(),
|
|
3077
3143
|
encounterId: Sha256Hex.optional(),
|
|
3078
|
-
payerUserId:
|
|
3079
|
-
payeeUserId:
|
|
3080
|
-
payerDeviceId:
|
|
3144
|
+
payerUserId: z14.string().uuid(),
|
|
3145
|
+
payeeUserId: z14.string().uuid(),
|
|
3146
|
+
payerDeviceId: z14.string().min(1).max(128),
|
|
3081
3147
|
payerNonce: ClaimNonce,
|
|
3082
3148
|
payeeNonce: ClaimNonce,
|
|
3083
|
-
amountKobo:
|
|
3084
|
-
currency:
|
|
3085
|
-
occurredAtMs:
|
|
3086
|
-
completedAtMs:
|
|
3087
|
-
contextId:
|
|
3088
|
-
requestId:
|
|
3089
|
-
requestMode:
|
|
3090
|
-
requestTakerUserId:
|
|
3091
|
-
requestAmountKobo:
|
|
3092
|
-
requestCurrency:
|
|
3093
|
-
requestReference:
|
|
3094
|
-
requestCreatedAtMs:
|
|
3095
|
-
requestExpiresAtMs:
|
|
3096
|
-
requestNonce:
|
|
3097
|
-
requestTakerDeviceId:
|
|
3098
|
-
requestTakerPubkeySpkiB64:
|
|
3099
|
-
requestTakerSignatureDerB64:
|
|
3100
|
-
payerPubkeySpkiB64:
|
|
3101
|
-
payerSignatureDerB64:
|
|
3102
|
-
payeePubkeySpkiB64:
|
|
3103
|
-
payeeSignatureDerB64:
|
|
3149
|
+
amountKobo: z14.number().int().positive(),
|
|
3150
|
+
currency: z14.string().length(3).default("NGN"),
|
|
3151
|
+
occurredAtMs: z14.number().int().nonnegative(),
|
|
3152
|
+
completedAtMs: z14.number().int().nonnegative().optional(),
|
|
3153
|
+
contextId: z14.string().max(128).optional(),
|
|
3154
|
+
requestId: z14.string().uuid().optional(),
|
|
3155
|
+
requestMode: z14.enum(["fixed", "editable"]).optional(),
|
|
3156
|
+
requestTakerUserId: z14.string().uuid().optional(),
|
|
3157
|
+
requestAmountKobo: z14.number().int().positive().optional(),
|
|
3158
|
+
requestCurrency: z14.string().length(3).optional(),
|
|
3159
|
+
requestReference: z14.string().max(128).nullable().optional(),
|
|
3160
|
+
requestCreatedAtMs: z14.number().int().nonnegative().optional(),
|
|
3161
|
+
requestExpiresAtMs: z14.number().int().positive().optional(),
|
|
3162
|
+
requestNonce: z14.string().min(8).max(128).optional(),
|
|
3163
|
+
requestTakerDeviceId: z14.string().min(1).max(128).nullable().optional(),
|
|
3164
|
+
requestTakerPubkeySpkiB64: Base64Std4.min(64).max(4096).optional(),
|
|
3165
|
+
requestTakerSignatureDerB64: Base64Std4.min(16).max(2048).optional(),
|
|
3166
|
+
payerPubkeySpkiB64: Base64Std4.min(64).max(4096),
|
|
3167
|
+
payerSignatureDerB64: Base64Std4.min(16).max(2048),
|
|
3168
|
+
payeePubkeySpkiB64: Base64Std4.min(64).max(4096).optional(),
|
|
3169
|
+
payeeSignatureDerB64: Base64Std4.min(16).max(2048).optional()
|
|
3104
3170
|
});
|
|
3105
|
-
var ConsumerSettlementSchema =
|
|
3106
|
-
settlementId:
|
|
3171
|
+
var ConsumerSettlementSchema = z14.object({
|
|
3172
|
+
settlementId: z14.string().uuid(),
|
|
3107
3173
|
settlementKey: Sha256Hex,
|
|
3108
3174
|
encounterId: Sha256Hex,
|
|
3109
|
-
oacId:
|
|
3110
|
-
payerUserId:
|
|
3111
|
-
payeeUserId:
|
|
3112
|
-
amountKobo:
|
|
3113
|
-
currency:
|
|
3114
|
-
status:
|
|
3115
|
-
reviewReason:
|
|
3116
|
-
ledgerRef:
|
|
3175
|
+
oacId: z14.string().uuid(),
|
|
3176
|
+
payerUserId: z14.string().uuid(),
|
|
3177
|
+
payeeUserId: z14.string().uuid(),
|
|
3178
|
+
amountKobo: z14.number().int().positive(),
|
|
3179
|
+
currency: z14.string().length(3),
|
|
3180
|
+
status: z14.enum(["SETTLED", "REVIEW"]),
|
|
3181
|
+
reviewReason: z14.string().nullable(),
|
|
3182
|
+
ledgerRef: z14.string().nullable(),
|
|
3117
3183
|
/** ASN.1 DER ECDSA P-256 issuer signature, base64. */
|
|
3118
|
-
issuerSig:
|
|
3184
|
+
issuerSig: Base64Std4.min(16).max(2048),
|
|
3119
3185
|
/** Canonical millisecond timestamp signed into the settlement receipt. */
|
|
3120
|
-
issuedAtMs:
|
|
3186
|
+
issuedAtMs: z14.number().int().nonnegative(),
|
|
3121
3187
|
/** Compatibility alias for API consumers that predate issuedAtMs. */
|
|
3122
|
-
createdAtMs:
|
|
3188
|
+
createdAtMs: z14.number().int().nonnegative().optional()
|
|
3123
3189
|
});
|
|
3124
|
-
var ConsumerSettleResultSchema =
|
|
3190
|
+
var ConsumerSettleResultSchema = z14.object({
|
|
3125
3191
|
settlement: ConsumerSettlementSchema,
|
|
3126
3192
|
encounterId: Sha256Hex,
|
|
3127
|
-
replayed:
|
|
3193
|
+
replayed: z14.boolean()
|
|
3128
3194
|
});
|
|
3129
|
-
var RevokeDeviceKeyInputSchema =
|
|
3130
|
-
deviceId:
|
|
3195
|
+
var RevokeDeviceKeyInputSchema = z14.object({
|
|
3196
|
+
deviceId: z14.string().min(1).max(128),
|
|
3131
3197
|
/** Step-up token from /api/v1/auth/send/verify with purpose='offline_revoke'. */
|
|
3132
|
-
sendAuthToken:
|
|
3198
|
+
sendAuthToken: z14.string().min(16)
|
|
3133
3199
|
});
|
|
3134
3200
|
function createMeOfflineClient(opts) {
|
|
3135
3201
|
const fetchImpl = opts.fetchImpl ?? globalThis.fetch;
|
|
@@ -3162,7 +3228,7 @@ function createMeOfflineClient(opts) {
|
|
|
3162
3228
|
}
|
|
3163
3229
|
return parser(raw);
|
|
3164
3230
|
}
|
|
3165
|
-
const deviceKeyItems =
|
|
3231
|
+
const deviceKeyItems = z14.object({ items: z14.array(DeviceKeyRecordSchema) });
|
|
3166
3232
|
return {
|
|
3167
3233
|
issueP256EnrollmentChallenge: (input) => call(
|
|
3168
3234
|
"POST",
|
|
@@ -3220,6 +3286,12 @@ function createMeOfflineClient(opts) {
|
|
|
3220
3286
|
"/v1/issuer/keys",
|
|
3221
3287
|
void 0,
|
|
3222
3288
|
(raw) => IssuerTrustBundleSchema.parse(raw)
|
|
3289
|
+
),
|
|
3290
|
+
getRevocations: () => call(
|
|
3291
|
+
"GET",
|
|
3292
|
+
"/v1/issuer/revocations",
|
|
3293
|
+
void 0,
|
|
3294
|
+
(raw) => SignedRevocationListSchema.parse(raw)
|
|
3223
3295
|
)
|
|
3224
3296
|
};
|
|
3225
3297
|
}
|
|
@@ -3366,26 +3438,26 @@ function verifyClaimSignature(input) {
|
|
|
3366
3438
|
}
|
|
3367
3439
|
|
|
3368
3440
|
// src/me-offline/request.ts
|
|
3369
|
-
import { z as
|
|
3370
|
-
var
|
|
3441
|
+
import { z as z15 } from "zod";
|
|
3442
|
+
var Base64Std5 = z15.string().regex(/^[A-Za-z0-9+/]+={0,2}$/);
|
|
3371
3443
|
var CONSUMER_PAYMENT_REQUEST_DOMAIN = "flur:consumer-offline:v1:request";
|
|
3372
|
-
var ConsumerPaymentRequestEnvelopeSchema =
|
|
3373
|
-
requestId:
|
|
3374
|
-
mode:
|
|
3375
|
-
takerUserId:
|
|
3376
|
-
amountKobo:
|
|
3377
|
-
currency:
|
|
3378
|
-
reference:
|
|
3379
|
-
createdAtMs:
|
|
3380
|
-
expiresAtMs:
|
|
3381
|
-
nonce:
|
|
3382
|
-
takerDeviceId:
|
|
3383
|
-
takerPubkeySpkiB64:
|
|
3384
|
-
takerSignatureDerB64:
|
|
3444
|
+
var ConsumerPaymentRequestEnvelopeSchema = z15.object({
|
|
3445
|
+
requestId: z15.string().uuid(),
|
|
3446
|
+
mode: z15.enum(["fixed", "editable"]),
|
|
3447
|
+
takerUserId: z15.string().uuid(),
|
|
3448
|
+
amountKobo: z15.number().int().positive(),
|
|
3449
|
+
currency: z15.string().length(3).default("NGN"),
|
|
3450
|
+
reference: z15.string().max(128).nullable().default(null),
|
|
3451
|
+
createdAtMs: z15.number().int().nonnegative(),
|
|
3452
|
+
expiresAtMs: z15.number().int().positive(),
|
|
3453
|
+
nonce: z15.string().min(8).max(128),
|
|
3454
|
+
takerDeviceId: z15.string().min(1).max(128).nullable().default(null),
|
|
3455
|
+
takerPubkeySpkiB64: Base64Std5.min(64).max(4096).optional(),
|
|
3456
|
+
takerSignatureDerB64: Base64Std5.min(16).max(2048).optional()
|
|
3385
3457
|
}).superRefine((value, ctx) => {
|
|
3386
3458
|
if (value.expiresAtMs <= value.createdAtMs) {
|
|
3387
3459
|
ctx.addIssue({
|
|
3388
|
-
code:
|
|
3460
|
+
code: z15.ZodIssueCode.custom,
|
|
3389
3461
|
path: ["expiresAtMs"],
|
|
3390
3462
|
message: "expiresAtMs must be greater than createdAtMs"
|
|
3391
3463
|
});
|
|
@@ -3396,21 +3468,21 @@ var ConsumerPaymentRequestEnvelopeSchema = z14.object({
|
|
|
3396
3468
|
if (value.mode === "fixed" || hasSignature) {
|
|
3397
3469
|
if (!value.takerDeviceId) {
|
|
3398
3470
|
ctx.addIssue({
|
|
3399
|
-
code:
|
|
3471
|
+
code: z15.ZodIssueCode.custom,
|
|
3400
3472
|
path: ["takerDeviceId"],
|
|
3401
3473
|
message: "signed requests require takerDeviceId"
|
|
3402
3474
|
});
|
|
3403
3475
|
}
|
|
3404
3476
|
if (!value.takerPubkeySpkiB64) {
|
|
3405
3477
|
ctx.addIssue({
|
|
3406
|
-
code:
|
|
3478
|
+
code: z15.ZodIssueCode.custom,
|
|
3407
3479
|
path: ["takerPubkeySpkiB64"],
|
|
3408
3480
|
message: "signed requests require takerPubkeySpkiB64"
|
|
3409
3481
|
});
|
|
3410
3482
|
}
|
|
3411
3483
|
if (!value.takerSignatureDerB64) {
|
|
3412
3484
|
ctx.addIssue({
|
|
3413
|
-
code:
|
|
3485
|
+
code: z15.ZodIssueCode.custom,
|
|
3414
3486
|
path: ["takerSignatureDerB64"],
|
|
3415
3487
|
message: "signed requests require takerSignatureDerB64"
|
|
3416
3488
|
});
|
|
@@ -3581,7 +3653,7 @@ function base64UrlDecodeUtf8(input) {
|
|
|
3581
3653
|
}
|
|
3582
3654
|
|
|
3583
3655
|
// src/me-offline/oac.ts
|
|
3584
|
-
import { z as
|
|
3656
|
+
import { z as z16 } from "zod";
|
|
3585
3657
|
var CONSUMER_OAC_DOMAIN = "flur:consumer-offline:v1:oac";
|
|
3586
3658
|
function consumerOacSigningPayload(oac) {
|
|
3587
3659
|
return { domain: CONSUMER_OAC_DOMAIN, ...oac };
|
|
@@ -3607,6 +3679,9 @@ function verifyOacOffline(signed, trustedKeys, options = {}) {
|
|
|
3607
3679
|
}
|
|
3608
3680
|
if (nowMs < oac.validFromMs) return { ok: false, reason: "not_yet_valid" };
|
|
3609
3681
|
if (nowMs >= oac.validUntilMs) return { ok: false, reason: "expired" };
|
|
3682
|
+
if (options.revokedOacIds?.has(oac.oacId)) {
|
|
3683
|
+
return { ok: false, reason: "revoked" };
|
|
3684
|
+
}
|
|
3610
3685
|
return {
|
|
3611
3686
|
ok: true,
|
|
3612
3687
|
oac,
|
|
@@ -3624,13 +3699,13 @@ var CONSUMER_OAC_QR_PREFIX = "FLUROAC1.";
|
|
|
3624
3699
|
function isConsumerOacQR(value) {
|
|
3625
3700
|
return value.startsWith(CONSUMER_OAC_QR_PREFIX);
|
|
3626
3701
|
}
|
|
3627
|
-
var OacPresentmentRequestSchema =
|
|
3702
|
+
var OacPresentmentRequestSchema = z16.object({
|
|
3628
3703
|
/** Requested amount in minor units (kobo). */
|
|
3629
|
-
amountMinor:
|
|
3704
|
+
amountMinor: z16.number().int().positive().max(1e12).optional(),
|
|
3630
3705
|
/** Purpose/intent code (mirrors the NIBSS intent vocabulary). */
|
|
3631
|
-
intent:
|
|
3706
|
+
intent: z16.string().min(1).max(32).optional(),
|
|
3632
3707
|
/** Free-text reference / note. */
|
|
3633
|
-
reference:
|
|
3708
|
+
reference: z16.string().min(1).max(64).optional()
|
|
3634
3709
|
}).strict();
|
|
3635
3710
|
function encodeConsumerOacQR(signed, request) {
|
|
3636
3711
|
const parsed = SignedConsumerOACSchema.parse(signed);
|
|
@@ -3964,14 +4039,14 @@ function base64UrlToBytes(input) {
|
|
|
3964
4039
|
}
|
|
3965
4040
|
|
|
3966
4041
|
// src/partner-funding/client.ts
|
|
3967
|
-
import { z as
|
|
3968
|
-
var MinorString =
|
|
3969
|
-
var PositiveMinor =
|
|
3970
|
-
|
|
3971
|
-
|
|
4042
|
+
import { z as z17 } from "zod";
|
|
4043
|
+
var MinorString = z17.string().regex(/^-?\d+$/);
|
|
4044
|
+
var PositiveMinor = z17.union([
|
|
4045
|
+
z17.number().int().positive(),
|
|
4046
|
+
z17.string().regex(/^[1-9]\d{0,18}$/)
|
|
3972
4047
|
]);
|
|
3973
|
-
var Currency =
|
|
3974
|
-
var Metadata =
|
|
4048
|
+
var Currency = z17.string().trim().length(3).transform((v) => v.toUpperCase());
|
|
4049
|
+
var Metadata = z17.record(z17.unknown());
|
|
3975
4050
|
var PARTNER_KINDS = ["bank", "merchant"];
|
|
3976
4051
|
var CUSTODIAL_MODES = ["agent_of_bank", "flur_virtual_pool"];
|
|
3977
4052
|
var PARTNER_PROFILE_STATUSES = [
|
|
@@ -3998,126 +4073,126 @@ var WITHDRAWAL_STATES = [
|
|
|
3998
4073
|
"failed",
|
|
3999
4074
|
"reversed"
|
|
4000
4075
|
];
|
|
4001
|
-
var PartnerProfileSchema =
|
|
4002
|
-
partnerAccountId:
|
|
4003
|
-
kind:
|
|
4004
|
-
custodialMode:
|
|
4005
|
-
displayName:
|
|
4006
|
-
bankCode:
|
|
4007
|
-
poolAccountNumber:
|
|
4008
|
-
status:
|
|
4076
|
+
var PartnerProfileSchema = z17.object({
|
|
4077
|
+
partnerAccountId: z17.string().uuid(),
|
|
4078
|
+
kind: z17.enum(PARTNER_KINDS),
|
|
4079
|
+
custodialMode: z17.enum(CUSTODIAL_MODES),
|
|
4080
|
+
displayName: z17.string(),
|
|
4081
|
+
bankCode: z17.string().nullable(),
|
|
4082
|
+
poolAccountNumber: z17.string().nullable(),
|
|
4083
|
+
status: z17.enum(PARTNER_PROFILE_STATUSES),
|
|
4009
4084
|
metadata: Metadata,
|
|
4010
|
-
createdAtMs:
|
|
4011
|
-
updatedAtMs:
|
|
4085
|
+
createdAtMs: z17.number().int().nonnegative(),
|
|
4086
|
+
updatedAtMs: z17.number().int().nonnegative()
|
|
4012
4087
|
});
|
|
4013
|
-
var UpsertPartnerProfileInputSchema =
|
|
4014
|
-
kind:
|
|
4015
|
-
custodialMode:
|
|
4016
|
-
displayName:
|
|
4017
|
-
bankCode:
|
|
4018
|
-
poolAccountNumber:
|
|
4088
|
+
var UpsertPartnerProfileInputSchema = z17.object({
|
|
4089
|
+
kind: z17.enum(PARTNER_KINDS),
|
|
4090
|
+
custodialMode: z17.enum(CUSTODIAL_MODES),
|
|
4091
|
+
displayName: z17.string().trim().min(1).max(200),
|
|
4092
|
+
bankCode: z17.string().trim().min(1).max(64).optional(),
|
|
4093
|
+
poolAccountNumber: z17.string().trim().min(1).max(64).optional(),
|
|
4019
4094
|
metadata: Metadata.optional()
|
|
4020
4095
|
});
|
|
4021
|
-
var PartnerFundingEventInputSchema =
|
|
4022
|
-
externalRef:
|
|
4023
|
-
direction:
|
|
4024
|
-
userId:
|
|
4025
|
-
accountId:
|
|
4096
|
+
var PartnerFundingEventInputSchema = z17.object({
|
|
4097
|
+
externalRef: z17.string().trim().min(8).max(128),
|
|
4098
|
+
direction: z17.enum(PARTNER_FUNDING_DIRECTIONS).optional(),
|
|
4099
|
+
userId: z17.string().uuid().optional(),
|
|
4100
|
+
accountId: z17.string().uuid().optional(),
|
|
4026
4101
|
amountMinor: PositiveMinor,
|
|
4027
4102
|
currency: Currency,
|
|
4028
|
-
fundingSource:
|
|
4103
|
+
fundingSource: z17.string().trim().min(1).max(64).optional(),
|
|
4029
4104
|
providerMetadata: Metadata.optional()
|
|
4030
4105
|
});
|
|
4031
|
-
var PartnerFundingSchema =
|
|
4032
|
-
fundingId:
|
|
4033
|
-
partnerId:
|
|
4034
|
-
accountId:
|
|
4035
|
-
userId:
|
|
4036
|
-
direction:
|
|
4037
|
-
currency:
|
|
4106
|
+
var PartnerFundingSchema = z17.object({
|
|
4107
|
+
fundingId: z17.string().uuid(),
|
|
4108
|
+
partnerId: z17.string().uuid(),
|
|
4109
|
+
accountId: z17.string().uuid(),
|
|
4110
|
+
userId: z17.string().uuid().nullable(),
|
|
4111
|
+
direction: z17.enum(PARTNER_FUNDING_DIRECTIONS),
|
|
4112
|
+
currency: z17.string(),
|
|
4038
4113
|
amountMinor: MinorString,
|
|
4039
|
-
externalRef:
|
|
4040
|
-
status:
|
|
4041
|
-
fundingSource:
|
|
4042
|
-
ledgerRef:
|
|
4114
|
+
externalRef: z17.string(),
|
|
4115
|
+
status: z17.enum(PARTNER_FUNDING_STATUSES),
|
|
4116
|
+
fundingSource: z17.string(),
|
|
4117
|
+
ledgerRef: z17.string(),
|
|
4043
4118
|
providerMetadata: Metadata,
|
|
4044
|
-
createdAtMs:
|
|
4045
|
-
updatedAtMs:
|
|
4119
|
+
createdAtMs: z17.number().int().nonnegative(),
|
|
4120
|
+
updatedAtMs: z17.number().int().nonnegative()
|
|
4046
4121
|
});
|
|
4047
|
-
var IngestFundingResultSchema =
|
|
4122
|
+
var IngestFundingResultSchema = z17.object({
|
|
4048
4123
|
funding: PartnerFundingSchema,
|
|
4049
|
-
replayed:
|
|
4124
|
+
replayed: z17.boolean()
|
|
4050
4125
|
});
|
|
4051
|
-
var PayoutDestinationSchema =
|
|
4052
|
-
destinationId:
|
|
4053
|
-
accountId:
|
|
4054
|
-
partnerId:
|
|
4055
|
-
bankCode:
|
|
4056
|
-
accountNumber:
|
|
4057
|
-
accountName:
|
|
4058
|
-
status:
|
|
4059
|
-
verifiedAtMs:
|
|
4126
|
+
var PayoutDestinationSchema = z17.object({
|
|
4127
|
+
destinationId: z17.string().uuid(),
|
|
4128
|
+
accountId: z17.string().uuid(),
|
|
4129
|
+
partnerId: z17.string().uuid(),
|
|
4130
|
+
bankCode: z17.string(),
|
|
4131
|
+
accountNumber: z17.string(),
|
|
4132
|
+
accountName: z17.string(),
|
|
4133
|
+
status: z17.enum(PAYOUT_DESTINATION_STATUSES),
|
|
4134
|
+
verifiedAtMs: z17.number().int().nonnegative().nullable(),
|
|
4060
4135
|
metadata: Metadata,
|
|
4061
|
-
createdAtMs:
|
|
4062
|
-
updatedAtMs:
|
|
4136
|
+
createdAtMs: z17.number().int().nonnegative(),
|
|
4137
|
+
updatedAtMs: z17.number().int().nonnegative()
|
|
4063
4138
|
});
|
|
4064
|
-
var CreatePayoutDestinationInputSchema =
|
|
4065
|
-
partnerId:
|
|
4066
|
-
bankCode:
|
|
4067
|
-
accountNumber:
|
|
4068
|
-
accountName:
|
|
4139
|
+
var CreatePayoutDestinationInputSchema = z17.object({
|
|
4140
|
+
partnerId: z17.string().uuid(),
|
|
4141
|
+
bankCode: z17.string().trim().min(1).max(32),
|
|
4142
|
+
accountNumber: z17.string().trim().min(4).max(64),
|
|
4143
|
+
accountName: z17.string().trim().min(1).max(200),
|
|
4069
4144
|
metadata: Metadata.optional()
|
|
4070
4145
|
});
|
|
4071
|
-
var ListPayoutDestinationsResultSchema =
|
|
4072
|
-
items:
|
|
4146
|
+
var ListPayoutDestinationsResultSchema = z17.object({
|
|
4147
|
+
items: z17.array(PayoutDestinationSchema)
|
|
4073
4148
|
});
|
|
4074
|
-
var WithdrawalSchema =
|
|
4075
|
-
withdrawalId:
|
|
4076
|
-
accountId:
|
|
4077
|
-
userId:
|
|
4078
|
-
partnerId:
|
|
4079
|
-
destinationId:
|
|
4080
|
-
currency:
|
|
4149
|
+
var WithdrawalSchema = z17.object({
|
|
4150
|
+
withdrawalId: z17.string().uuid(),
|
|
4151
|
+
accountId: z17.string().uuid(),
|
|
4152
|
+
userId: z17.string().uuid(),
|
|
4153
|
+
partnerId: z17.string().uuid(),
|
|
4154
|
+
destinationId: z17.string().uuid(),
|
|
4155
|
+
currency: z17.string(),
|
|
4081
4156
|
amountMinor: MinorString,
|
|
4082
|
-
state:
|
|
4083
|
-
idempotencyKey:
|
|
4084
|
-
providerRef:
|
|
4085
|
-
lastError:
|
|
4086
|
-
ledgerRef:
|
|
4087
|
-
reverseLedgerRef:
|
|
4157
|
+
state: z17.enum(WITHDRAWAL_STATES),
|
|
4158
|
+
idempotencyKey: z17.string(),
|
|
4159
|
+
providerRef: z17.string().nullable(),
|
|
4160
|
+
lastError: z17.string().nullable(),
|
|
4161
|
+
ledgerRef: z17.string(),
|
|
4162
|
+
reverseLedgerRef: z17.string().nullable(),
|
|
4088
4163
|
metadata: Metadata,
|
|
4089
|
-
createdAtMs:
|
|
4090
|
-
updatedAtMs:
|
|
4164
|
+
createdAtMs: z17.number().int().nonnegative(),
|
|
4165
|
+
updatedAtMs: z17.number().int().nonnegative()
|
|
4091
4166
|
});
|
|
4092
|
-
var CreateWithdrawalInputSchema =
|
|
4093
|
-
destinationId:
|
|
4167
|
+
var CreateWithdrawalInputSchema = z17.object({
|
|
4168
|
+
destinationId: z17.string().uuid(),
|
|
4094
4169
|
amountMinor: PositiveMinor,
|
|
4095
4170
|
currency: Currency,
|
|
4096
|
-
idempotencyKey:
|
|
4171
|
+
idempotencyKey: z17.string().trim().min(8).max(128),
|
|
4097
4172
|
metadata: Metadata.optional()
|
|
4098
4173
|
});
|
|
4099
|
-
var CreateWithdrawalResultSchema =
|
|
4174
|
+
var CreateWithdrawalResultSchema = z17.object({
|
|
4100
4175
|
withdrawal: WithdrawalSchema,
|
|
4101
|
-
replayed:
|
|
4176
|
+
replayed: z17.boolean()
|
|
4102
4177
|
});
|
|
4103
|
-
var PayoutEventInputSchema =
|
|
4104
|
-
externalRef:
|
|
4105
|
-
withdrawalId:
|
|
4106
|
-
state:
|
|
4107
|
-
providerRef:
|
|
4108
|
-
failureCode:
|
|
4109
|
-
failureMessage:
|
|
4178
|
+
var PayoutEventInputSchema = z17.object({
|
|
4179
|
+
externalRef: z17.string().trim().min(8).max(128),
|
|
4180
|
+
withdrawalId: z17.string().uuid().optional(),
|
|
4181
|
+
state: z17.enum(["submitted", "processing", "paid", "failed"]),
|
|
4182
|
+
providerRef: z17.string().trim().min(1).max(128).optional(),
|
|
4183
|
+
failureCode: z17.string().trim().max(64).optional(),
|
|
4184
|
+
failureMessage: z17.string().trim().max(512).optional(),
|
|
4110
4185
|
providerMetadata: Metadata.optional()
|
|
4111
4186
|
});
|
|
4112
|
-
var RecordPayoutEventResultSchema =
|
|
4187
|
+
var RecordPayoutEventResultSchema = z17.object({
|
|
4113
4188
|
withdrawal: WithdrawalSchema,
|
|
4114
|
-
replayed:
|
|
4189
|
+
replayed: z17.boolean()
|
|
4115
4190
|
});
|
|
4116
|
-
var ReconciliationReportSchema =
|
|
4117
|
-
partnerId:
|
|
4118
|
-
currency:
|
|
4119
|
-
fromMs:
|
|
4120
|
-
toMs:
|
|
4191
|
+
var ReconciliationReportSchema = z17.object({
|
|
4192
|
+
partnerId: z17.string().uuid(),
|
|
4193
|
+
currency: z17.string(),
|
|
4194
|
+
fromMs: z17.number().int().nonnegative(),
|
|
4195
|
+
toMs: z17.number().int().nonnegative(),
|
|
4121
4196
|
fundingsCreditMinor: MinorString,
|
|
4122
4197
|
fundingsDebitMinor: MinorString,
|
|
4123
4198
|
withdrawalsPaidMinor: MinorString,
|
|
@@ -4126,7 +4201,7 @@ var ReconciliationReportSchema = z16.object({
|
|
|
4126
4201
|
expectedReserveBalanceMinor: MinorString,
|
|
4127
4202
|
actualReserveBalanceMinor: MinorString,
|
|
4128
4203
|
imbalanceMinor: MinorString,
|
|
4129
|
-
generatedAtMs:
|
|
4204
|
+
generatedAtMs: z17.number().int().nonnegative()
|
|
4130
4205
|
});
|
|
4131
4206
|
function createPartnerFundingClient(partner) {
|
|
4132
4207
|
return {
|
|
@@ -4278,19 +4353,19 @@ function createPartnerProfileAdminClient(opts) {
|
|
|
4278
4353
|
}
|
|
4279
4354
|
|
|
4280
4355
|
// src/artifacts/envelope.ts
|
|
4281
|
-
import { z as
|
|
4356
|
+
import { z as z18 } from "zod";
|
|
4282
4357
|
var FLUR_ARTIFACT_URI_SCHEME = "flur";
|
|
4283
4358
|
var FLUR_ARTIFACT_VERSION = 1;
|
|
4284
4359
|
var FLUR_ARTIFACT_URI_PREFIX = `${FLUR_ARTIFACT_URI_SCHEME}://v${FLUR_ARTIFACT_VERSION}/`;
|
|
4285
4360
|
var ArtifactTypeRe = /^[a-z][a-z0-9_]{1,63}$/;
|
|
4286
|
-
var ArtifactHeaderSchema =
|
|
4287
|
-
v:
|
|
4288
|
-
t:
|
|
4289
|
-
iss:
|
|
4290
|
-
kid:
|
|
4291
|
-
iat:
|
|
4292
|
-
exp:
|
|
4293
|
-
nonce:
|
|
4361
|
+
var ArtifactHeaderSchema = z18.object({
|
|
4362
|
+
v: z18.literal(FLUR_ARTIFACT_VERSION),
|
|
4363
|
+
t: z18.string().regex(ArtifactTypeRe, "invalid artifact type"),
|
|
4364
|
+
iss: z18.string().min(1).max(128),
|
|
4365
|
+
kid: z18.string().min(1).max(128),
|
|
4366
|
+
iat: z18.number().int().nonnegative(),
|
|
4367
|
+
exp: z18.number().int().positive().optional(),
|
|
4368
|
+
nonce: z18.string().min(8).max(64).regex(/^[A-Za-z0-9_-]+$/, "nonce must be url-safe")
|
|
4294
4369
|
});
|
|
4295
4370
|
var FlurArtifactError = class extends Error {
|
|
4296
4371
|
constructor(message, code) {
|
|
@@ -4429,7 +4504,7 @@ function verifyArtifactSignature(decoded, publicKeySpkiB64, options = {}) {
|
|
|
4429
4504
|
}
|
|
4430
4505
|
|
|
4431
4506
|
// src/artifacts/types.ts
|
|
4432
|
-
import { z as
|
|
4507
|
+
import { z as z19 } from "zod";
|
|
4433
4508
|
var ARTIFACT_TYPES = {
|
|
4434
4509
|
OFFLINE_PAYMENT_AUTHORIZATION: "offline_payment_authorization",
|
|
4435
4510
|
RECEIPT: "receipt",
|
|
@@ -4444,32 +4519,32 @@ var ARTIFACT_TYPES = {
|
|
|
4444
4519
|
PASS: "pass",
|
|
4445
4520
|
IDENTITY: "identity"
|
|
4446
4521
|
};
|
|
4447
|
-
var HexString = (length) =>
|
|
4522
|
+
var HexString = (length) => z19.string().regex(
|
|
4448
4523
|
new RegExp(`^[0-9a-fA-F]{${length * 2}}$`),
|
|
4449
4524
|
`expected ${length}-byte hex string`
|
|
4450
4525
|
);
|
|
4451
|
-
var OfflinePaymentAuthorizationArtifactSchema =
|
|
4526
|
+
var OfflinePaymentAuthorizationArtifactSchema = z19.object({
|
|
4452
4527
|
authorization: OfflinePaymentAuthorizationSchema
|
|
4453
4528
|
});
|
|
4454
|
-
var ReceiptArtifactSchema =
|
|
4455
|
-
receiptId:
|
|
4456
|
-
paymentReference:
|
|
4457
|
-
payerUserId:
|
|
4458
|
-
payeeUserId:
|
|
4459
|
-
amountKobo:
|
|
4460
|
-
currency:
|
|
4461
|
-
channel:
|
|
4462
|
-
settledAtMs:
|
|
4463
|
-
ledgerTxnId:
|
|
4464
|
-
memo:
|
|
4529
|
+
var ReceiptArtifactSchema = z19.object({
|
|
4530
|
+
receiptId: z19.string().min(1).max(64),
|
|
4531
|
+
paymentReference: z19.string().min(1).max(64),
|
|
4532
|
+
payerUserId: z19.string().min(1).max(64).optional(),
|
|
4533
|
+
payeeUserId: z19.string().min(1).max(64),
|
|
4534
|
+
amountKobo: z19.number().int().positive(),
|
|
4535
|
+
currency: z19.literal("NGN"),
|
|
4536
|
+
channel: z19.enum(["online", "offline_reconciled", "pay_link", "nqr"]),
|
|
4537
|
+
settledAtMs: z19.number().int().positive(),
|
|
4538
|
+
ledgerTxnId: z19.string().min(1).max(64).optional(),
|
|
4539
|
+
memo: z19.string().max(140).optional(),
|
|
4465
4540
|
hashChainPrev: HexString(32).optional()
|
|
4466
4541
|
});
|
|
4467
|
-
var ShortId =
|
|
4468
|
-
var PositiveInt =
|
|
4469
|
-
var NonNegativeInt =
|
|
4470
|
-
var Currency2 =
|
|
4471
|
-
var Memo =
|
|
4472
|
-
var NqrPaymentRequestArtifactSchema =
|
|
4542
|
+
var ShortId = z19.string().min(1).max(64);
|
|
4543
|
+
var PositiveInt = z19.number().int().positive();
|
|
4544
|
+
var NonNegativeInt = z19.number().int().nonnegative();
|
|
4545
|
+
var Currency2 = z19.literal("NGN");
|
|
4546
|
+
var Memo = z19.string().max(140);
|
|
4547
|
+
var NqrPaymentRequestArtifactSchema = z19.object({
|
|
4473
4548
|
requestId: ShortId,
|
|
4474
4549
|
payeeUserId: ShortId,
|
|
4475
4550
|
amountKobo: PositiveInt.optional(),
|
|
@@ -4477,7 +4552,7 @@ var NqrPaymentRequestArtifactSchema = z18.object({
|
|
|
4477
4552
|
memo: Memo.optional(),
|
|
4478
4553
|
expiresAtMs: PositiveInt.optional()
|
|
4479
4554
|
});
|
|
4480
|
-
var PaymentIntentArtifactSchema =
|
|
4555
|
+
var PaymentIntentArtifactSchema = z19.object({
|
|
4481
4556
|
intentId: ShortId,
|
|
4482
4557
|
payerUserId: ShortId,
|
|
4483
4558
|
payeeUserId: ShortId,
|
|
@@ -4486,7 +4561,7 @@ var PaymentIntentArtifactSchema = z18.object({
|
|
|
4486
4561
|
idempotencyKey: ShortId,
|
|
4487
4562
|
createdAtMs: PositiveInt
|
|
4488
4563
|
});
|
|
4489
|
-
var OfflineClaimArtifactSchema =
|
|
4564
|
+
var OfflineClaimArtifactSchema = z19.object({
|
|
4490
4565
|
claimId: ShortId,
|
|
4491
4566
|
authorizationId: ShortId,
|
|
4492
4567
|
payeeUserId: ShortId,
|
|
@@ -4495,10 +4570,10 @@ var OfflineClaimArtifactSchema = z18.object({
|
|
|
4495
4570
|
claimedAtMs: PositiveInt,
|
|
4496
4571
|
paymentReference: ShortId.optional()
|
|
4497
4572
|
});
|
|
4498
|
-
var SettlementRecordArtifactSchema =
|
|
4573
|
+
var SettlementRecordArtifactSchema = z19.object({
|
|
4499
4574
|
settlementId: ShortId,
|
|
4500
4575
|
ledgerTxnId: ShortId,
|
|
4501
|
-
sourceRefType:
|
|
4576
|
+
sourceRefType: z19.enum([
|
|
4502
4577
|
"offline_authorization",
|
|
4503
4578
|
"offline_claim",
|
|
4504
4579
|
"transfer",
|
|
@@ -4509,12 +4584,12 @@ var SettlementRecordArtifactSchema = z18.object({
|
|
|
4509
4584
|
currency: Currency2,
|
|
4510
4585
|
settledAtMs: PositiveInt
|
|
4511
4586
|
});
|
|
4512
|
-
var ReversalRecordArtifactSchema =
|
|
4587
|
+
var ReversalRecordArtifactSchema = z19.object({
|
|
4513
4588
|
reversalId: ShortId,
|
|
4514
4589
|
originalTxnId: ShortId,
|
|
4515
4590
|
amountKobo: PositiveInt,
|
|
4516
4591
|
currency: Currency2,
|
|
4517
|
-
reason:
|
|
4592
|
+
reason: z19.enum([
|
|
4518
4593
|
"user_dispute",
|
|
4519
4594
|
"fraud",
|
|
4520
4595
|
"duplicate",
|
|
@@ -4524,7 +4599,7 @@ var ReversalRecordArtifactSchema = z18.object({
|
|
|
4524
4599
|
reversedAtMs: PositiveInt,
|
|
4525
4600
|
memo: Memo.optional()
|
|
4526
4601
|
});
|
|
4527
|
-
var LedgerJournalEntryArtifactSchema =
|
|
4602
|
+
var LedgerJournalEntryArtifactSchema = z19.object({
|
|
4528
4603
|
entryId: ShortId,
|
|
4529
4604
|
journalId: ShortId,
|
|
4530
4605
|
debitAccountId: ShortId,
|
|
@@ -4535,13 +4610,13 @@ var LedgerJournalEntryArtifactSchema = z18.object({
|
|
|
4535
4610
|
refType: ShortId.optional(),
|
|
4536
4611
|
refId: ShortId.optional()
|
|
4537
4612
|
});
|
|
4538
|
-
var StatementArtifactSchema =
|
|
4613
|
+
var StatementArtifactSchema = z19.object({
|
|
4539
4614
|
statementId: ShortId,
|
|
4540
4615
|
userId: ShortId,
|
|
4541
4616
|
periodStartMs: PositiveInt,
|
|
4542
4617
|
periodEndMs: PositiveInt,
|
|
4543
|
-
openingBalanceKobo:
|
|
4544
|
-
closingBalanceKobo:
|
|
4618
|
+
openingBalanceKobo: z19.number().int(),
|
|
4619
|
+
closingBalanceKobo: z19.number().int(),
|
|
4545
4620
|
transactionCount: NonNegativeInt,
|
|
4546
4621
|
currency: Currency2,
|
|
4547
4622
|
hashChainPrev: HexString(32).optional()
|
|
@@ -4549,16 +4624,16 @@ var StatementArtifactSchema = z18.object({
|
|
|
4549
4624
|
message: "periodEndMs must be greater than periodStartMs",
|
|
4550
4625
|
path: ["periodEndMs"]
|
|
4551
4626
|
});
|
|
4552
|
-
var PassArtifactSchema =
|
|
4627
|
+
var PassArtifactSchema = z19.object({
|
|
4553
4628
|
passId: ShortId,
|
|
4554
4629
|
holderId: ShortId,
|
|
4555
|
-
category:
|
|
4556
|
-
title:
|
|
4630
|
+
category: z19.enum(["membership", "ticket", "loyalty", "access", "voucher"]),
|
|
4631
|
+
title: z19.string().min(1).max(120),
|
|
4557
4632
|
validFromMs: PositiveInt,
|
|
4558
4633
|
validUntilMs: PositiveInt.optional(),
|
|
4559
|
-
metadata:
|
|
4560
|
-
|
|
4561
|
-
|
|
4634
|
+
metadata: z19.record(
|
|
4635
|
+
z19.string().min(1).max(64),
|
|
4636
|
+
z19.union([z19.string().max(280), z19.number(), z19.boolean()])
|
|
4562
4637
|
).optional()
|
|
4563
4638
|
}).refine(
|
|
4564
4639
|
(v) => v.validUntilMs === void 0 || v.validUntilMs > v.validFromMs,
|
|
@@ -4567,10 +4642,10 @@ var PassArtifactSchema = z18.object({
|
|
|
4567
4642
|
path: ["validUntilMs"]
|
|
4568
4643
|
}
|
|
4569
4644
|
);
|
|
4570
|
-
var IdentityArtifactSchema =
|
|
4645
|
+
var IdentityArtifactSchema = z19.object({
|
|
4571
4646
|
attestationId: ShortId,
|
|
4572
4647
|
subjectId: ShortId,
|
|
4573
|
-
claimType:
|
|
4648
|
+
claimType: z19.enum([
|
|
4574
4649
|
"phone_verified",
|
|
4575
4650
|
"email_verified",
|
|
4576
4651
|
"bvn_verified",
|
|
@@ -4708,6 +4783,7 @@ export {
|
|
|
4708
4783
|
CONSUMER_OAC_QR_PREFIX,
|
|
4709
4784
|
CONSUMER_OFFLINE_CLAIM_SUBMIT_GRACE_MS,
|
|
4710
4785
|
CONSUMER_PAYMENT_REQUEST_DOMAIN,
|
|
4786
|
+
CONSUMER_REVOCATION_DOMAIN,
|
|
4711
4787
|
CONSUMER_SETTLEMENT_DOMAIN,
|
|
4712
4788
|
CONSUMER_SETTLEMENT_RECEIPT_QR_PREFIX,
|
|
4713
4789
|
CUSTODIAL_MODES,
|
|
@@ -4805,6 +4881,7 @@ export {
|
|
|
4805
4881
|
RECEIPT_CHANNELS,
|
|
4806
4882
|
RECEIPT_KINDS,
|
|
4807
4883
|
REPLAY_WINDOW_MS,
|
|
4884
|
+
REVOCATION_LIST_MAX_ENTRIES,
|
|
4808
4885
|
ReceiptArtifactSchema,
|
|
4809
4886
|
ReceiptPayloadSchema,
|
|
4810
4887
|
ReceiptSchema,
|
|
@@ -4813,12 +4890,14 @@ export {
|
|
|
4813
4890
|
RedemptionSchema,
|
|
4814
4891
|
RegisterDeviceKeyP256InputSchema,
|
|
4815
4892
|
ReversalRecordArtifactSchema,
|
|
4893
|
+
RevocationListSchema,
|
|
4816
4894
|
RevokeDeviceKeyInputSchema,
|
|
4817
4895
|
SETTLEMENT_SCHEDULES,
|
|
4818
4896
|
SettleResponseSchema,
|
|
4819
4897
|
SettlementRecordArtifactSchema,
|
|
4820
4898
|
SettlementSchema,
|
|
4821
4899
|
SignedConsumerOACSchema,
|
|
4900
|
+
SignedRevocationListSchema,
|
|
4822
4901
|
StatementArtifactSchema,
|
|
4823
4902
|
UpsertMerchantProfileInputSchema,
|
|
4824
4903
|
UpsertPartnerProfileInputSchema,
|
|
@@ -4899,6 +4978,7 @@ export {
|
|
|
4899
4978
|
isConsumerPaymentRequestExpired,
|
|
4900
4979
|
isHardenedArtifactType,
|
|
4901
4980
|
isKnownArtifactType,
|
|
4981
|
+
isOacRevoked,
|
|
4902
4982
|
isPassWithinValidity,
|
|
4903
4983
|
moneyMinorToNumber,
|
|
4904
4984
|
normalizeE164,
|
|
@@ -4906,6 +4986,7 @@ export {
|
|
|
4906
4986
|
parseNQR,
|
|
4907
4987
|
parseQR,
|
|
4908
4988
|
readTLV,
|
|
4989
|
+
revocationListSigningPayload,
|
|
4909
4990
|
routingHint,
|
|
4910
4991
|
signArtifact,
|
|
4911
4992
|
signAuthorization,
|
|
@@ -4932,6 +5013,7 @@ export {
|
|
|
4932
5013
|
verifyReceipt,
|
|
4933
5014
|
verifyRedemption,
|
|
4934
5015
|
verifyRequestHMAC,
|
|
5016
|
+
verifyRevocationList,
|
|
4935
5017
|
writeTLV
|
|
4936
5018
|
};
|
|
4937
5019
|
//# sourceMappingURL=index.js.map
|