@nokinc-flur/sdk 1.1.4 → 2.0.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.js CHANGED
@@ -2956,13 +2956,10 @@ function createAccountsClient(opts) {
2956
2956
 
2957
2957
  // src/me-offline/client.ts
2958
2958
  import { z as z13 } from "zod";
2959
- var Hex64 = z13.string().regex(/^[0-9a-f]{64}$/i);
2960
- var Sha256Hex = z13.string().regex(/^[0-9a-f]{64}$/i);
2959
+ var Sha256Hex = z13.string().regex(/^[0-9a-f]{64}$/);
2961
2960
  var Base64Std3 = z13.string().regex(/^[A-Za-z0-9+/]+={0,2}$/);
2962
- var RegisterDeviceKeyInputSchema = z13.object({
2963
- deviceId: z13.string().min(1).max(128),
2964
- publicKeyHex: Hex64
2965
- });
2961
+ var ACCOUNT_FUNDED_OAC_MAX_TTL_MS = 1e3 * 60 * 60 * 24 * 7;
2962
+ var CONSUMER_OFFLINE_CLAIM_SUBMIT_GRACE_MS = 1e3 * 60 * 60 * 24;
2966
2963
  var AttestationSecurityLevelSchema = z13.enum([
2967
2964
  "STRONGBOX",
2968
2965
  "TEE",
@@ -2993,9 +2990,7 @@ var DeviceKeyRecordSchema = z13.object({
2993
2990
  deviceId: z13.string(),
2994
2991
  /** Always 'p256' on the consumer offline rail. Field retained for forward-compat. */
2995
2992
  alg: DeviceKeyAlgSchema.default("p256"),
2996
- /** Legacy ed25519 hex key. Always null on new records (kept for back-compat reads). */
2997
- publicKeyHex: Hex64.nullable().default(null),
2998
- /** P-256 SubjectPublicKeyInfo DER, base64. Required for new records. */
2993
+ /** P-256 SubjectPublicKeyInfo DER, base64. */
2999
2994
  publicKeySpkiB64: Base64Std3.nullable().default(null),
3000
2995
  securityLevel: AttestationSecurityLevelSchema.nullable().default(null),
3001
2996
  hardwareBacked: z13.boolean().default(false),
@@ -3008,8 +3003,13 @@ var ConsumerOACSchema = z13.object({
3008
3003
  issuerId: z13.string().min(1).max(64),
3009
3004
  userId: z13.string().uuid(),
3010
3005
  deviceId: z13.string().min(1).max(128),
3011
- /** Always 'p256'. Field retained for forward-compat. */
3012
- alg: z13.literal("p256").default("p256"),
3006
+ /**
3007
+ * Always 'p256'. Required on the wire (backend always emits it).
3008
+ * Kept as a literal so input/output infer identically and the schema
3009
+ * can be nested inside other response shapes without Zod input/output
3010
+ * divergence under tsup DTS bundling.
3011
+ */
3012
+ alg: z13.literal("p256"),
3013
3013
  /** P-256 SubjectPublicKeyInfo DER, base64. */
3014
3014
  devicePubkeySpkiB64: Base64Std3.min(64).max(4096),
3015
3015
  perTxCapKobo: z13.number().int().positive(),
@@ -3029,83 +3029,17 @@ var SignedConsumerOACSchema = z13.object({
3029
3029
  });
3030
3030
  var OACRecordSchema = SignedConsumerOACSchema.extend({
3031
3031
  currentOfflineSpentKobo: z13.number().int().nonnegative(),
3032
- status: z13.enum([
3033
- "active",
3034
- "superseded",
3035
- "expired",
3036
- "revoked",
3037
- "disabling",
3038
- "draining",
3039
- "closed"
3040
- ]),
3032
+ status: z13.enum(["active", "superseded", "expired", "revoked"]),
3041
3033
  supersededAtMs: z13.number().int().nonnegative().nullable(),
3042
- revokedAtMs: z13.number().int().nonnegative().nullable(),
3043
- holdId: z13.string().uuid().nullable().optional()
3034
+ revokedAtMs: z13.number().int().nonnegative().nullable()
3044
3035
  });
3045
- var IssueOACInputSchema = z13.object({
3036
+ var IssueAccountOacInputSchema = z13.object({
3046
3037
  deviceId: z13.string().min(1).max(128),
3047
3038
  perTxCapKobo: z13.number().int().positive().optional(),
3048
3039
  cumulativeCapKobo: z13.number().int().positive().optional(),
3049
- ttlMs: z13.number().int().min(6e4).max(1e3 * 60 * 60 * 24 * 7).optional(),
3050
- spendableOnlineKobo: z13.number().int().nonnegative().optional()
3051
- });
3052
- var EnableOfflineInputSchema = z13.object({
3053
- deviceId: z13.string().min(1).max(128),
3054
- amountKobo: z13.number().int().positive(),
3055
- perTxCapKobo: z13.number().int().positive().optional(),
3056
- ttlMs: z13.number().int().min(6e4).max(1e3 * 60 * 60 * 24 * 7).optional(),
3057
- installId: z13.string().min(1).max(128),
3058
- partnerId: z13.string().min(1).max(64).optional()
3059
- });
3060
- var ProvisionOfflineAllowanceInputSchema = EnableOfflineInputSchema;
3061
- var DisableOfflineInputSchema = z13.object({
3062
- deviceId: z13.string().min(1).max(128),
3063
- installId: z13.string().min(1).max(128).optional(),
3064
- claims: z13.array(z13.unknown()).max(256).optional()
3065
- });
3066
- var OfflineHoldRecordSchema = z13.object({
3067
- holdId: z13.string().uuid(),
3068
- userId: z13.string().uuid(),
3069
- deviceId: z13.string(),
3070
- partnerId: z13.string(),
3071
- adapterKind: z13.string(),
3072
- externalHoldRef: z13.string().nullable(),
3073
- amountKobo: z13.number().int().nonnegative(),
3074
- capturedKobo: z13.number().int().nonnegative(),
3075
- releasedKobo: z13.number().int().nonnegative(),
3076
- remainingKobo: z13.number().int().nonnegative(),
3077
- currency: z13.string().length(3),
3078
- status: z13.enum([
3079
- "placing",
3080
- "active",
3081
- "disabling",
3082
- "draining",
3083
- "closed",
3084
- "revoked",
3085
- "failed"
3086
- ]),
3087
- installId: z13.string().nullable(),
3088
- drainDeadlineMs: z13.number().int().nonnegative(),
3089
- disableRequestedAtMs: z13.number().int().nonnegative().nullable(),
3090
- createdAtMs: z13.number().int().nonnegative(),
3091
- closedAtMs: z13.number().int().nonnegative().nullable(),
3092
- isTrusted: z13.boolean().optional()
3093
- });
3094
- var EnableOfflineResultSchema = z13.object({
3095
- hold: OfflineHoldRecordSchema,
3096
- oac: OACRecordSchema
3097
- });
3098
- var ProvisionOfflineAllowanceResultSchema = EnableOfflineResultSchema;
3099
- var DisableOfflineResultSchema = z13.object({
3100
- hold: OfflineHoldRecordSchema,
3101
- trusted: z13.boolean(),
3102
- settledClaims: z13.number().int().nonnegative()
3040
+ ttlMs: z13.number().int().min(6e4).max(ACCOUNT_FUNDED_OAC_MAX_TTL_MS).optional()
3103
3041
  });
3104
3042
  var OfflineStatusResultSchema = z13.object({
3105
- hold: OfflineHoldRecordSchema.nullable(),
3106
- active: OACRecordSchema.nullable()
3107
- });
3108
- var OfflineStateResultSchema = z13.object({
3109
3043
  active: OACRecordSchema.nullable()
3110
3044
  });
3111
3045
  var ConsumerPaymentClaimSchema = z13.object({
@@ -3187,12 +3121,6 @@ function createMeOfflineClient(opts) {
3187
3121
  }
3188
3122
  const deviceKeyItems = z13.object({ items: z13.array(DeviceKeyRecordSchema) });
3189
3123
  return {
3190
- registerDeviceKey: (input) => call(
3191
- "POST",
3192
- "/v1/me/offline/keys",
3193
- RegisterDeviceKeyInputSchema.parse(input),
3194
- (raw) => DeviceKeyRecordSchema.parse(raw)
3195
- ),
3196
3124
  issueP256EnrollmentChallenge: (input) => call(
3197
3125
  "POST",
3198
3126
  "/v1/me/offline/keys/p256/challenge",
@@ -3217,30 +3145,12 @@ function createMeOfflineClient(opts) {
3217
3145
  RevokeDeviceKeyInputSchema.parse(input),
3218
3146
  () => void 0
3219
3147
  ),
3220
- provisionAllowance: (input) => call(
3221
- "POST",
3222
- "/v1/me/offline/allowance",
3223
- ProvisionOfflineAllowanceInputSchema.parse(input),
3224
- (raw) => ProvisionOfflineAllowanceResultSchema.parse(raw)
3225
- ),
3226
- enable: (input) => call(
3148
+ issueAccountOac: (input) => call(
3227
3149
  "POST",
3228
- "/v1/me/offline/enable",
3229
- EnableOfflineInputSchema.parse(input),
3230
- (raw) => EnableOfflineResultSchema.parse(raw)
3231
- ),
3232
- refresh: (input) => call(
3233
- "POST",
3234
- "/v1/me/offline/refresh",
3235
- IssueOACInputSchema.parse(input),
3150
+ "/v1/me/offline/oac",
3151
+ IssueAccountOacInputSchema.parse(input),
3236
3152
  (raw) => OACRecordSchema.parse(raw)
3237
3153
  ),
3238
- disable: (input) => call(
3239
- "POST",
3240
- "/v1/me/offline/disable",
3241
- DisableOfflineInputSchema.parse(input),
3242
- (raw) => DisableOfflineResultSchema.parse(raw)
3243
- ),
3244
3154
  getStatus: (deviceId) => {
3245
3155
  const qs = deviceId ? `?deviceId=${encodeURIComponent(deviceId)}` : "";
3246
3156
  return call(
@@ -3250,15 +3160,6 @@ function createMeOfflineClient(opts) {
3250
3160
  (raw) => OfflineStatusResultSchema.parse(raw)
3251
3161
  );
3252
3162
  },
3253
- getState: (deviceId) => {
3254
- const qs = deviceId ? `?deviceId=${encodeURIComponent(deviceId)}` : "";
3255
- return call(
3256
- "GET",
3257
- `/v1/me/offline/state${qs}`,
3258
- void 0,
3259
- (raw) => OfflineStateResultSchema.parse(raw)
3260
- );
3261
- },
3262
3163
  submitClaim: (claim) => call(
3263
3164
  "POST",
3264
3165
  "/v1/me/offline/claims",
@@ -4174,6 +4075,7 @@ function createOfflinePaymentAuthorizationArtifactUri(input) {
4174
4075
  });
4175
4076
  }
4176
4077
  export {
4078
+ ACCOUNT_FUNDED_OAC_MAX_TTL_MS,
4177
4079
  ACCOUNT_STATUSES,
4178
4080
  ACCOUNT_TYPES,
4179
4081
  ADDITIONAL_DATA_SUBFIELD,
@@ -4187,6 +4089,7 @@ export {
4187
4089
  CLAIM_DOMAIN_V2,
4188
4090
  COLLECTION_INTENT_STATUSES,
4189
4091
  COLLECTION_PAYMENT_STATUSES,
4092
+ CONSUMER_OFFLINE_CLAIM_SUBMIT_GRACE_MS,
4190
4093
  CUSTODIAL_MODES,
4191
4094
  CollectionIntentSchema,
4192
4095
  CollectionPaymentResultSchema,
@@ -4205,10 +4108,6 @@ export {
4205
4108
  CreateWithdrawalResultSchema,
4206
4109
  DeviceKeyAlgSchema,
4207
4110
  DeviceKeyRecordSchema,
4208
- DisableOfflineInputSchema,
4209
- DisableOfflineResultSchema,
4210
- EnableOfflineInputSchema,
4211
- EnableOfflineResultSchema,
4212
4111
  FIELD,
4213
4112
  FLUR_ARTIFACT_URI_PREFIX,
4214
4113
  FLUR_ARTIFACT_URI_SCHEME,
@@ -4223,7 +4122,7 @@ export {
4223
4122
  HARDENED_ARTIFACT_TYPES,
4224
4123
  IdentityArtifactSchema,
4225
4124
  IngestFundingResultSchema,
4226
- IssueOACInputSchema,
4125
+ IssueAccountOacInputSchema,
4227
4126
  LedgerJournalEntryArtifactSchema,
4228
4127
  ListPayoutDestinationsResultSchema,
4229
4128
  MEMBERSHIP_ROLES,
@@ -4242,11 +4141,9 @@ export {
4242
4141
  OAC_DEFAULT_VALIDITY_MS,
4243
4142
  OFFLINE_CLAIM_SMS_PREFIX,
4244
4143
  OfflineClaimArtifactSchema,
4245
- OfflineHoldRecordSchema,
4246
4144
  OfflinePaymentAuthorizationArtifactSchema,
4247
4145
  OfflinePaymentAuthorizationSchema,
4248
4146
  OfflinePaymentRequestSchema,
4249
- OfflineStateResultSchema,
4250
4147
  OfflineStatusResultSchema,
4251
4148
  OfflineTokenSchema,
4252
4149
  P256EnrollmentChallengeInputSchema,
@@ -4274,8 +4171,6 @@ export {
4274
4171
  PayoutEventInputSchema,
4275
4172
  ProviderEventInputSchema,
4276
4173
  ProviderEventRecordSchema,
4277
- ProvisionOfflineAllowanceInputSchema,
4278
- ProvisionOfflineAllowanceResultSchema,
4279
4174
  PublicCollectionIntentSchema,
4280
4175
  RECEIPT_CHANNELS,
4281
4176
  RECEIPT_KINDS,
@@ -4286,7 +4181,6 @@ export {
4286
4181
  ReconciliationReportSchema,
4287
4182
  RecordPayoutEventResultSchema,
4288
4183
  RedemptionSchema,
4289
- RegisterDeviceKeyInputSchema,
4290
4184
  RegisterDeviceKeyP256InputSchema,
4291
4185
  ReversalRecordArtifactSchema,
4292
4186
  RevokeDeviceKeyInputSchema,