@nokinc-flur/sdk 1.1.1 → 1.1.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.cjs +256 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +894 -80
- package/dist/index.d.ts +894 -80
- package/dist/index.js +243 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -29,6 +29,8 @@ __export(index_exports, {
|
|
|
29
29
|
AccountSchema: () => AccountSchema,
|
|
30
30
|
ApiCredentialPublicSchema: () => ApiCredentialPublicSchema,
|
|
31
31
|
ArtifactHeaderSchema: () => ArtifactHeaderSchema,
|
|
32
|
+
AttestationSecurityLevelSchema: () => AttestationSecurityLevelSchema,
|
|
33
|
+
CLAIM_DOMAIN_V2: () => CLAIM_DOMAIN_V2,
|
|
32
34
|
COLLECTION_INTENT_STATUSES: () => COLLECTION_INTENT_STATUSES,
|
|
33
35
|
COLLECTION_PAYMENT_STATUSES: () => COLLECTION_PAYMENT_STATUSES,
|
|
34
36
|
CUSTODIAL_MODES: () => CUSTODIAL_MODES,
|
|
@@ -47,6 +49,7 @@ __export(index_exports, {
|
|
|
47
49
|
CreatePayoutInputSchema: () => CreatePayoutInputSchema,
|
|
48
50
|
CreateWithdrawalInputSchema: () => CreateWithdrawalInputSchema,
|
|
49
51
|
CreateWithdrawalResultSchema: () => CreateWithdrawalResultSchema,
|
|
52
|
+
DeviceKeyAlgSchema: () => DeviceKeyAlgSchema,
|
|
50
53
|
DeviceKeyRecordSchema: () => DeviceKeyRecordSchema,
|
|
51
54
|
DisableOfflineInputSchema: () => DisableOfflineInputSchema,
|
|
52
55
|
DisableOfflineResultSchema: () => DisableOfflineResultSchema,
|
|
@@ -91,6 +94,8 @@ __export(index_exports, {
|
|
|
91
94
|
OfflineStateResultSchema: () => OfflineStateResultSchema,
|
|
92
95
|
OfflineStatusResultSchema: () => OfflineStatusResultSchema,
|
|
93
96
|
OfflineTokenSchema: () => OfflineTokenSchema,
|
|
97
|
+
P256EnrollmentChallengeInputSchema: () => P256EnrollmentChallengeInputSchema,
|
|
98
|
+
P256EnrollmentChallengeResultSchema: () => P256EnrollmentChallengeResultSchema,
|
|
94
99
|
PARTNER_FUNDING_DIRECTIONS: () => PARTNER_FUNDING_DIRECTIONS,
|
|
95
100
|
PARTNER_FUNDING_STATUSES: () => PARTNER_FUNDING_STATUSES,
|
|
96
101
|
PARTNER_KINDS: () => PARTNER_KINDS,
|
|
@@ -114,6 +119,8 @@ __export(index_exports, {
|
|
|
114
119
|
PayoutEventInputSchema: () => PayoutEventInputSchema,
|
|
115
120
|
ProviderEventInputSchema: () => ProviderEventInputSchema,
|
|
116
121
|
ProviderEventRecordSchema: () => ProviderEventRecordSchema,
|
|
122
|
+
ProvisionOfflineAllowanceInputSchema: () => ProvisionOfflineAllowanceInputSchema,
|
|
123
|
+
ProvisionOfflineAllowanceResultSchema: () => ProvisionOfflineAllowanceResultSchema,
|
|
117
124
|
PublicCollectionIntentSchema: () => PublicCollectionIntentSchema,
|
|
118
125
|
RECEIPT_CHANNELS: () => RECEIPT_CHANNELS,
|
|
119
126
|
RECEIPT_KINDS: () => RECEIPT_KINDS,
|
|
@@ -125,6 +132,7 @@ __export(index_exports, {
|
|
|
125
132
|
RecordPayoutEventResultSchema: () => RecordPayoutEventResultSchema,
|
|
126
133
|
RedemptionSchema: () => RedemptionSchema,
|
|
127
134
|
RegisterDeviceKeyInputSchema: () => RegisterDeviceKeyInputSchema,
|
|
135
|
+
RegisterDeviceKeyP256InputSchema: () => RegisterDeviceKeyP256InputSchema,
|
|
128
136
|
ReversalRecordArtifactSchema: () => ReversalRecordArtifactSchema,
|
|
129
137
|
RevokeDeviceKeyInputSchema: () => RevokeDeviceKeyInputSchema,
|
|
130
138
|
SETTLEMENT_SCHEDULES: () => SETTLEMENT_SCHEDULES,
|
|
@@ -147,6 +155,8 @@ __export(index_exports, {
|
|
|
147
155
|
buildPaymentRequest: () => buildPaymentRequest,
|
|
148
156
|
buildReceipt: () => buildReceipt,
|
|
149
157
|
buildRedemption: () => buildRedemption,
|
|
158
|
+
canonicalClaimSigningBytes: () => canonicalClaimSigningBytes,
|
|
159
|
+
canonicalClaimSigningPayload: () => canonicalClaimSigningPayload,
|
|
150
160
|
canonicalJSONBytes: () => canonicalJSONBytes,
|
|
151
161
|
canonicalJSONStringify: () => canonicalJSONStringify,
|
|
152
162
|
canonicalRequestString: () => canonicalRequestString,
|
|
@@ -171,6 +181,8 @@ __export(index_exports, {
|
|
|
171
181
|
createPassesClient: () => createPassesClient,
|
|
172
182
|
createReceiptArtifactUri: () => createReceiptArtifactUri,
|
|
173
183
|
createReceiptsClient: () => createReceiptsClient,
|
|
184
|
+
createSoftwareEd25519Signer: () => createSoftwareEd25519Signer,
|
|
185
|
+
createSoftwareP256Signer: () => createSoftwareP256Signer,
|
|
174
186
|
decodeArtifactUri: () => decodeArtifactUri,
|
|
175
187
|
decodeAuthorizationQR: () => decodeAuthorizationQR,
|
|
176
188
|
decodeBase45: () => decodeBase45,
|
|
@@ -212,6 +224,7 @@ __export(index_exports, {
|
|
|
212
224
|
verifyArtifactUri: () => verifyArtifactUri,
|
|
213
225
|
verifyAuthorization: () => verifyAuthorization,
|
|
214
226
|
verifyCanonical: () => verifyCanonical,
|
|
227
|
+
verifyClaimSignature: () => verifyClaimSignature,
|
|
215
228
|
verifyOAC: () => verifyOAC,
|
|
216
229
|
verifyPass: () => verifyPass,
|
|
217
230
|
verifyPaymentRequest: () => verifyPaymentRequest,
|
|
@@ -3144,15 +3157,45 @@ var import_zod13 = require("zod");
|
|
|
3144
3157
|
var Hex64 = import_zod13.z.string().regex(/^[0-9a-f]{64}$/i);
|
|
3145
3158
|
var HexAny = import_zod13.z.string().regex(/^[0-9a-f]+$/i);
|
|
3146
3159
|
var Sha256Hex = import_zod13.z.string().regex(/^[0-9a-f]{64}$/i);
|
|
3160
|
+
var Base64Std = import_zod13.z.string().regex(/^[A-Za-z0-9+/]+={0,2}$/);
|
|
3147
3161
|
var RegisterDeviceKeyInputSchema = import_zod13.z.object({
|
|
3148
3162
|
deviceId: import_zod13.z.string().min(1).max(128),
|
|
3149
3163
|
publicKeyHex: Hex64
|
|
3150
3164
|
});
|
|
3165
|
+
var AttestationSecurityLevelSchema = import_zod13.z.enum([
|
|
3166
|
+
"STRONGBOX",
|
|
3167
|
+
"TEE",
|
|
3168
|
+
"SECURE_ENCLAVE",
|
|
3169
|
+
"SOFTWARE"
|
|
3170
|
+
]);
|
|
3171
|
+
var DeviceKeyAlgSchema = import_zod13.z.enum(["ed25519", "p256"]);
|
|
3172
|
+
var RegisterDeviceKeyP256InputSchema = import_zod13.z.object({
|
|
3173
|
+
deviceId: import_zod13.z.string().min(1).max(128),
|
|
3174
|
+
/** P-256 SubjectPublicKeyInfo DER, base64. */
|
|
3175
|
+
publicKeySpkiB64: Base64Std.min(64).max(4096),
|
|
3176
|
+
/** Base64 of the server-issued enrollment challenge string. */
|
|
3177
|
+
challengeB64: Base64Std.min(8).max(1024),
|
|
3178
|
+
/** iOS App Attest payload or Android X.509 Key Attestation chain. */
|
|
3179
|
+
attestationChainB64: import_zod13.z.array(Base64Std.min(16).max(16384)).min(1).max(16),
|
|
3180
|
+
securityLevel: AttestationSecurityLevelSchema
|
|
3181
|
+
});
|
|
3182
|
+
var P256EnrollmentChallengeInputSchema = import_zod13.z.object({
|
|
3183
|
+
deviceId: import_zod13.z.string().min(1).max(128)
|
|
3184
|
+
});
|
|
3185
|
+
var P256EnrollmentChallengeResultSchema = import_zod13.z.object({
|
|
3186
|
+
challenge: import_zod13.z.string().min(16),
|
|
3187
|
+
expiresAtMs: import_zod13.z.number().int().positive()
|
|
3188
|
+
});
|
|
3151
3189
|
var DeviceKeyRecordSchema = import_zod13.z.object({
|
|
3152
3190
|
id: import_zod13.z.string().uuid(),
|
|
3153
3191
|
userId: import_zod13.z.string().uuid(),
|
|
3154
3192
|
deviceId: import_zod13.z.string(),
|
|
3155
|
-
|
|
3193
|
+
alg: DeviceKeyAlgSchema.default("ed25519"),
|
|
3194
|
+
publicKeyHex: Hex64.nullable().default(null),
|
|
3195
|
+
publicKeySpkiB64: Base64Std.nullable().default(null),
|
|
3196
|
+
securityLevel: AttestationSecurityLevelSchema.nullable().default(null),
|
|
3197
|
+
hardwareBacked: import_zod13.z.boolean().default(false),
|
|
3198
|
+
attestedAtMs: import_zod13.z.number().int().nonnegative().nullable().default(null),
|
|
3156
3199
|
createdAtMs: import_zod13.z.number().int().nonnegative(),
|
|
3157
3200
|
revokedAtMs: import_zod13.z.number().int().nonnegative().nullable()
|
|
3158
3201
|
});
|
|
@@ -3161,7 +3204,9 @@ var ConsumerOACSchema = import_zod13.z.object({
|
|
|
3161
3204
|
issuerId: import_zod13.z.string().min(1).max(64),
|
|
3162
3205
|
userId: import_zod13.z.string().uuid(),
|
|
3163
3206
|
deviceId: import_zod13.z.string().min(1).max(128),
|
|
3164
|
-
|
|
3207
|
+
alg: import_zod13.z.enum(["ed25519", "p256"]).optional(),
|
|
3208
|
+
devicePubkeyHex: Hex64.optional(),
|
|
3209
|
+
devicePubkeySpkiB64: Base64Std.min(64).max(4096).optional(),
|
|
3165
3210
|
perTxCapKobo: import_zod13.z.number().int().positive(),
|
|
3166
3211
|
cumulativeCapKobo: import_zod13.z.number().int().positive(),
|
|
3167
3212
|
currency: import_zod13.z.string().length(3),
|
|
@@ -3169,7 +3214,16 @@ var ConsumerOACSchema = import_zod13.z.object({
|
|
|
3169
3214
|
validUntilMs: import_zod13.z.number().int().nonnegative(),
|
|
3170
3215
|
counterSeed: import_zod13.z.number().int().nonnegative(),
|
|
3171
3216
|
issuedAtMs: import_zod13.z.number().int().nonnegative()
|
|
3172
|
-
})
|
|
3217
|
+
}).refine(
|
|
3218
|
+
(o) => {
|
|
3219
|
+
const alg = o.alg ?? "ed25519";
|
|
3220
|
+
if (alg === "ed25519") {
|
|
3221
|
+
return Boolean(o.devicePubkeyHex) && !o.devicePubkeySpkiB64;
|
|
3222
|
+
}
|
|
3223
|
+
return Boolean(o.devicePubkeySpkiB64) && !o.devicePubkeyHex;
|
|
3224
|
+
},
|
|
3225
|
+
{ message: "OAC device pubkey shape must match alg" }
|
|
3226
|
+
);
|
|
3173
3227
|
var SignedConsumerOACSchema = import_zod13.z.object({
|
|
3174
3228
|
oac: ConsumerOACSchema,
|
|
3175
3229
|
issuerSig: HexAny,
|
|
@@ -3205,6 +3259,7 @@ var EnableOfflineInputSchema = import_zod13.z.object({
|
|
|
3205
3259
|
installId: import_zod13.z.string().min(1).max(128),
|
|
3206
3260
|
partnerId: import_zod13.z.string().min(1).max(64).optional()
|
|
3207
3261
|
});
|
|
3262
|
+
var ProvisionOfflineAllowanceInputSchema = EnableOfflineInputSchema;
|
|
3208
3263
|
var DisableOfflineInputSchema = import_zod13.z.object({
|
|
3209
3264
|
deviceId: import_zod13.z.string().min(1).max(128),
|
|
3210
3265
|
installId: import_zod13.z.string().min(1).max(128).optional(),
|
|
@@ -3242,6 +3297,7 @@ var EnableOfflineResultSchema = import_zod13.z.object({
|
|
|
3242
3297
|
hold: OfflineHoldRecordSchema,
|
|
3243
3298
|
oac: OACRecordSchema
|
|
3244
3299
|
});
|
|
3300
|
+
var ProvisionOfflineAllowanceResultSchema = EnableOfflineResultSchema;
|
|
3245
3301
|
var DisableOfflineResultSchema = import_zod13.z.object({
|
|
3246
3302
|
hold: OfflineHoldRecordSchema,
|
|
3247
3303
|
trusted: import_zod13.z.boolean(),
|
|
@@ -3254,7 +3310,10 @@ var OfflineStatusResultSchema = import_zod13.z.object({
|
|
|
3254
3310
|
var OfflineStateResultSchema = import_zod13.z.object({
|
|
3255
3311
|
active: OACRecordSchema.nullable()
|
|
3256
3312
|
});
|
|
3313
|
+
var ClaimAlgSchema = import_zod13.z.enum(["ed25519", "p256"]);
|
|
3257
3314
|
var ConsumerPaymentClaimSchema = import_zod13.z.object({
|
|
3315
|
+
/** Algorithm discriminator. Omit / 'ed25519' for V1 clients. */
|
|
3316
|
+
alg: ClaimAlgSchema.optional(),
|
|
3258
3317
|
oacId: import_zod13.z.string().uuid(),
|
|
3259
3318
|
encounterId: Sha256Hex.optional(),
|
|
3260
3319
|
payerUserId: import_zod13.z.string().uuid(),
|
|
@@ -3267,11 +3326,28 @@ var ConsumerPaymentClaimSchema = import_zod13.z.object({
|
|
|
3267
3326
|
occurredAtMs: import_zod13.z.number().int().nonnegative(),
|
|
3268
3327
|
completedAtMs: import_zod13.z.number().int().nonnegative().optional(),
|
|
3269
3328
|
contextId: import_zod13.z.string().max(128).optional(),
|
|
3270
|
-
|
|
3271
|
-
|
|
3329
|
+
// ed25519 path
|
|
3330
|
+
payerPubkeyHex: Hex64.optional(),
|
|
3331
|
+
payerSignature: HexAny.optional(),
|
|
3272
3332
|
payeePubkeyHex: Hex64.optional(),
|
|
3273
|
-
payeeSignature: HexAny.optional()
|
|
3274
|
-
|
|
3333
|
+
payeeSignature: HexAny.optional(),
|
|
3334
|
+
// p256 path
|
|
3335
|
+
payerPubkeySpkiB64: import_zod13.z.string().min(64).max(4096).optional(),
|
|
3336
|
+
payerSignatureDerB64: import_zod13.z.string().min(16).max(2048).optional(),
|
|
3337
|
+
payeePubkeySpkiB64: import_zod13.z.string().min(64).max(4096).optional(),
|
|
3338
|
+
payeeSignatureDerB64: import_zod13.z.string().min(16).max(2048).optional()
|
|
3339
|
+
}).refine(
|
|
3340
|
+
(c) => {
|
|
3341
|
+
const alg = c.alg ?? "ed25519";
|
|
3342
|
+
if (alg === "ed25519") {
|
|
3343
|
+
return Boolean(c.payerPubkeyHex) && Boolean(c.payerSignature);
|
|
3344
|
+
}
|
|
3345
|
+
return Boolean(c.payerPubkeySpkiB64) && Boolean(c.payerSignatureDerB64);
|
|
3346
|
+
},
|
|
3347
|
+
{
|
|
3348
|
+
message: "payer key/signature fields must match alg (ed25519: hex; p256: SPKI+DER b64)"
|
|
3349
|
+
}
|
|
3350
|
+
);
|
|
3275
3351
|
var ConsumerSettlementSchema = import_zod13.z.object({
|
|
3276
3352
|
settlementId: import_zod13.z.string().uuid(),
|
|
3277
3353
|
settlementKey: Sha256Hex,
|
|
@@ -3336,6 +3412,18 @@ function createMeOfflineClient(opts) {
|
|
|
3336
3412
|
RegisterDeviceKeyInputSchema.parse(input),
|
|
3337
3413
|
(raw) => DeviceKeyRecordSchema.parse(raw)
|
|
3338
3414
|
),
|
|
3415
|
+
issueP256EnrollmentChallenge: (input) => call(
|
|
3416
|
+
"POST",
|
|
3417
|
+
"/v1/me/offline/keys/p256/challenge",
|
|
3418
|
+
P256EnrollmentChallengeInputSchema.parse(input),
|
|
3419
|
+
(raw) => P256EnrollmentChallengeResultSchema.parse(raw)
|
|
3420
|
+
),
|
|
3421
|
+
registerDeviceKeyP256: (input) => call(
|
|
3422
|
+
"POST",
|
|
3423
|
+
"/v1/me/offline/keys/p256",
|
|
3424
|
+
RegisterDeviceKeyP256InputSchema.parse(input),
|
|
3425
|
+
(raw) => DeviceKeyRecordSchema.parse(raw)
|
|
3426
|
+
),
|
|
3339
3427
|
listDeviceKeys: () => call(
|
|
3340
3428
|
"GET",
|
|
3341
3429
|
"/v1/me/offline/keys",
|
|
@@ -3348,6 +3436,12 @@ function createMeOfflineClient(opts) {
|
|
|
3348
3436
|
RevokeDeviceKeyInputSchema.parse(input),
|
|
3349
3437
|
() => void 0
|
|
3350
3438
|
),
|
|
3439
|
+
provisionAllowance: (input) => call(
|
|
3440
|
+
"POST",
|
|
3441
|
+
"/v1/me/offline/allowance",
|
|
3442
|
+
ProvisionOfflineAllowanceInputSchema.parse(input),
|
|
3443
|
+
(raw) => ProvisionOfflineAllowanceResultSchema.parse(raw)
|
|
3444
|
+
),
|
|
3351
3445
|
enable: (input) => call(
|
|
3352
3446
|
"POST",
|
|
3353
3447
|
"/v1/me/offline/enable",
|
|
@@ -3393,6 +3487,148 @@ function createMeOfflineClient(opts) {
|
|
|
3393
3487
|
};
|
|
3394
3488
|
}
|
|
3395
3489
|
|
|
3490
|
+
// src/me-offline/signer.ts
|
|
3491
|
+
var import_ed255198 = require("@noble/curves/ed25519");
|
|
3492
|
+
var import_nist = require("@noble/curves/nist");
|
|
3493
|
+
var import_utils3 = require("@noble/hashes/utils");
|
|
3494
|
+
var CLAIM_DOMAIN_V2 = "flur:consumer-offline:v2:claim";
|
|
3495
|
+
function canonicalClaimSigningPayload(claim) {
|
|
3496
|
+
return {
|
|
3497
|
+
domain: CLAIM_DOMAIN_V2,
|
|
3498
|
+
alg: claim.alg,
|
|
3499
|
+
oacId: claim.oacId,
|
|
3500
|
+
payerUserId: claim.payerUserId,
|
|
3501
|
+
payeeUserId: claim.payeeUserId,
|
|
3502
|
+
payerDeviceId: claim.payerDeviceId,
|
|
3503
|
+
payerNonce: claim.payerNonce,
|
|
3504
|
+
payeeNonce: claim.payeeNonce,
|
|
3505
|
+
amountKobo: claim.amountKobo,
|
|
3506
|
+
currency: claim.currency,
|
|
3507
|
+
occurredAtMs: claim.occurredAtMs,
|
|
3508
|
+
completedAtMs: claim.completedAtMs ?? null,
|
|
3509
|
+
contextId: claim.contextId ?? null
|
|
3510
|
+
};
|
|
3511
|
+
}
|
|
3512
|
+
function canonicalClaimSigningBytes(claim) {
|
|
3513
|
+
return canonicalJSONBytes(canonicalClaimSigningPayload(claim));
|
|
3514
|
+
}
|
|
3515
|
+
function bytesToBase64(bytes) {
|
|
3516
|
+
if (typeof Buffer !== "undefined") {
|
|
3517
|
+
return Buffer.from(bytes).toString("base64");
|
|
3518
|
+
}
|
|
3519
|
+
let bin = "";
|
|
3520
|
+
for (let i = 0; i < bytes.length; i++) bin += String.fromCharCode(bytes[i]);
|
|
3521
|
+
return btoa(bin);
|
|
3522
|
+
}
|
|
3523
|
+
function base64ToBytes(b64) {
|
|
3524
|
+
if (typeof Buffer !== "undefined") {
|
|
3525
|
+
return new Uint8Array(Buffer.from(b64, "base64"));
|
|
3526
|
+
}
|
|
3527
|
+
const bin = atob(b64);
|
|
3528
|
+
const out = new Uint8Array(bin.length);
|
|
3529
|
+
for (let i = 0; i < bin.length; i++) out[i] = bin.charCodeAt(i);
|
|
3530
|
+
return out;
|
|
3531
|
+
}
|
|
3532
|
+
var P256_SPKI_HEADER = new Uint8Array([
|
|
3533
|
+
48,
|
|
3534
|
+
89,
|
|
3535
|
+
48,
|
|
3536
|
+
19,
|
|
3537
|
+
6,
|
|
3538
|
+
7,
|
|
3539
|
+
42,
|
|
3540
|
+
134,
|
|
3541
|
+
72,
|
|
3542
|
+
206,
|
|
3543
|
+
61,
|
|
3544
|
+
2,
|
|
3545
|
+
1,
|
|
3546
|
+
6,
|
|
3547
|
+
8,
|
|
3548
|
+
42,
|
|
3549
|
+
134,
|
|
3550
|
+
72,
|
|
3551
|
+
206,
|
|
3552
|
+
61,
|
|
3553
|
+
3,
|
|
3554
|
+
1,
|
|
3555
|
+
7,
|
|
3556
|
+
3,
|
|
3557
|
+
66,
|
|
3558
|
+
0
|
|
3559
|
+
]);
|
|
3560
|
+
function p256PublicKeyToSpkiB64(rawUncompressed) {
|
|
3561
|
+
if (rawUncompressed.length !== 65 || rawUncompressed[0] !== 4) {
|
|
3562
|
+
throw new Error("p256: expected 65-byte uncompressed point");
|
|
3563
|
+
}
|
|
3564
|
+
const out = new Uint8Array(P256_SPKI_HEADER.length + rawUncompressed.length);
|
|
3565
|
+
out.set(P256_SPKI_HEADER, 0);
|
|
3566
|
+
out.set(rawUncompressed, P256_SPKI_HEADER.length);
|
|
3567
|
+
return bytesToBase64(out);
|
|
3568
|
+
}
|
|
3569
|
+
function p256SpkiB64ToPublicKey(spkiB64) {
|
|
3570
|
+
const spki = base64ToBytes(spkiB64);
|
|
3571
|
+
if (spki.length !== P256_SPKI_HEADER.length + 65) {
|
|
3572
|
+
throw new Error("p256: invalid SPKI length");
|
|
3573
|
+
}
|
|
3574
|
+
for (let i = 0; i < P256_SPKI_HEADER.length; i++) {
|
|
3575
|
+
if (spki[i] !== P256_SPKI_HEADER[i]) {
|
|
3576
|
+
throw new Error("p256: invalid SPKI header");
|
|
3577
|
+
}
|
|
3578
|
+
}
|
|
3579
|
+
return spki.slice(P256_SPKI_HEADER.length);
|
|
3580
|
+
}
|
|
3581
|
+
function createSoftwareEd25519Signer(privateKey) {
|
|
3582
|
+
const pub = import_ed255198.ed25519.getPublicKey(privateKey);
|
|
3583
|
+
return {
|
|
3584
|
+
alg: "ed25519",
|
|
3585
|
+
async getPublicKey() {
|
|
3586
|
+
return { alg: "ed25519", publicKey: (0, import_utils3.bytesToHex)(pub) };
|
|
3587
|
+
},
|
|
3588
|
+
async sign(bytes) {
|
|
3589
|
+
const sig = import_ed255198.ed25519.sign(bytes, privateKey);
|
|
3590
|
+
return { alg: "ed25519", signature: (0, import_utils3.bytesToHex)(sig) };
|
|
3591
|
+
}
|
|
3592
|
+
};
|
|
3593
|
+
}
|
|
3594
|
+
function createSoftwareP256Signer(privateKey) {
|
|
3595
|
+
const raw = import_nist.p256.getPublicKey(privateKey, false);
|
|
3596
|
+
const spkiB64 = p256PublicKeyToSpkiB64(raw);
|
|
3597
|
+
return {
|
|
3598
|
+
alg: "p256",
|
|
3599
|
+
async getPublicKey() {
|
|
3600
|
+
return { alg: "p256", publicKey: spkiB64 };
|
|
3601
|
+
},
|
|
3602
|
+
async sign(bytes) {
|
|
3603
|
+
const sig = import_nist.p256.sign(bytes, privateKey, { prehash: true });
|
|
3604
|
+
const der = sig.toBytes("der");
|
|
3605
|
+
return { alg: "p256", signature: bytesToBase64(der) };
|
|
3606
|
+
}
|
|
3607
|
+
};
|
|
3608
|
+
}
|
|
3609
|
+
function verifyClaimSignature(input) {
|
|
3610
|
+
try {
|
|
3611
|
+
if (input.alg === "ed25519") {
|
|
3612
|
+
return import_ed255198.ed25519.verify(
|
|
3613
|
+
(0, import_utils3.hexToBytes)(input.signature),
|
|
3614
|
+
input.bytes,
|
|
3615
|
+
(0, import_utils3.hexToBytes)(input.publicKey)
|
|
3616
|
+
);
|
|
3617
|
+
}
|
|
3618
|
+
if (input.alg === "p256") {
|
|
3619
|
+
const sigDer = base64ToBytes(input.signature);
|
|
3620
|
+
const pub = p256SpkiB64ToPublicKey(input.publicKey);
|
|
3621
|
+
return import_nist.p256.verify(sigDer, input.bytes, pub, {
|
|
3622
|
+
prehash: true,
|
|
3623
|
+
format: "der"
|
|
3624
|
+
});
|
|
3625
|
+
}
|
|
3626
|
+
return false;
|
|
3627
|
+
} catch {
|
|
3628
|
+
return false;
|
|
3629
|
+
}
|
|
3630
|
+
}
|
|
3631
|
+
|
|
3396
3632
|
// src/partner-funding/client.ts
|
|
3397
3633
|
var import_zod14 = require("zod");
|
|
3398
3634
|
var MinorString = import_zod14.z.string().regex(/^-?\d+$/);
|
|
@@ -4120,6 +4356,8 @@ function createOfflinePaymentAuthorizationArtifactUri(input) {
|
|
|
4120
4356
|
AccountSchema,
|
|
4121
4357
|
ApiCredentialPublicSchema,
|
|
4122
4358
|
ArtifactHeaderSchema,
|
|
4359
|
+
AttestationSecurityLevelSchema,
|
|
4360
|
+
CLAIM_DOMAIN_V2,
|
|
4123
4361
|
COLLECTION_INTENT_STATUSES,
|
|
4124
4362
|
COLLECTION_PAYMENT_STATUSES,
|
|
4125
4363
|
CUSTODIAL_MODES,
|
|
@@ -4138,6 +4376,7 @@ function createOfflinePaymentAuthorizationArtifactUri(input) {
|
|
|
4138
4376
|
CreatePayoutInputSchema,
|
|
4139
4377
|
CreateWithdrawalInputSchema,
|
|
4140
4378
|
CreateWithdrawalResultSchema,
|
|
4379
|
+
DeviceKeyAlgSchema,
|
|
4141
4380
|
DeviceKeyRecordSchema,
|
|
4142
4381
|
DisableOfflineInputSchema,
|
|
4143
4382
|
DisableOfflineResultSchema,
|
|
@@ -4182,6 +4421,8 @@ function createOfflinePaymentAuthorizationArtifactUri(input) {
|
|
|
4182
4421
|
OfflineStateResultSchema,
|
|
4183
4422
|
OfflineStatusResultSchema,
|
|
4184
4423
|
OfflineTokenSchema,
|
|
4424
|
+
P256EnrollmentChallengeInputSchema,
|
|
4425
|
+
P256EnrollmentChallengeResultSchema,
|
|
4185
4426
|
PARTNER_FUNDING_DIRECTIONS,
|
|
4186
4427
|
PARTNER_FUNDING_STATUSES,
|
|
4187
4428
|
PARTNER_KINDS,
|
|
@@ -4205,6 +4446,8 @@ function createOfflinePaymentAuthorizationArtifactUri(input) {
|
|
|
4205
4446
|
PayoutEventInputSchema,
|
|
4206
4447
|
ProviderEventInputSchema,
|
|
4207
4448
|
ProviderEventRecordSchema,
|
|
4449
|
+
ProvisionOfflineAllowanceInputSchema,
|
|
4450
|
+
ProvisionOfflineAllowanceResultSchema,
|
|
4208
4451
|
PublicCollectionIntentSchema,
|
|
4209
4452
|
RECEIPT_CHANNELS,
|
|
4210
4453
|
RECEIPT_KINDS,
|
|
@@ -4216,6 +4459,7 @@ function createOfflinePaymentAuthorizationArtifactUri(input) {
|
|
|
4216
4459
|
RecordPayoutEventResultSchema,
|
|
4217
4460
|
RedemptionSchema,
|
|
4218
4461
|
RegisterDeviceKeyInputSchema,
|
|
4462
|
+
RegisterDeviceKeyP256InputSchema,
|
|
4219
4463
|
ReversalRecordArtifactSchema,
|
|
4220
4464
|
RevokeDeviceKeyInputSchema,
|
|
4221
4465
|
SETTLEMENT_SCHEDULES,
|
|
@@ -4238,6 +4482,8 @@ function createOfflinePaymentAuthorizationArtifactUri(input) {
|
|
|
4238
4482
|
buildPaymentRequest,
|
|
4239
4483
|
buildReceipt,
|
|
4240
4484
|
buildRedemption,
|
|
4485
|
+
canonicalClaimSigningBytes,
|
|
4486
|
+
canonicalClaimSigningPayload,
|
|
4241
4487
|
canonicalJSONBytes,
|
|
4242
4488
|
canonicalJSONStringify,
|
|
4243
4489
|
canonicalRequestString,
|
|
@@ -4262,6 +4508,8 @@ function createOfflinePaymentAuthorizationArtifactUri(input) {
|
|
|
4262
4508
|
createPassesClient,
|
|
4263
4509
|
createReceiptArtifactUri,
|
|
4264
4510
|
createReceiptsClient,
|
|
4511
|
+
createSoftwareEd25519Signer,
|
|
4512
|
+
createSoftwareP256Signer,
|
|
4265
4513
|
decodeArtifactUri,
|
|
4266
4514
|
decodeAuthorizationQR,
|
|
4267
4515
|
decodeBase45,
|
|
@@ -4303,6 +4551,7 @@ function createOfflinePaymentAuthorizationArtifactUri(input) {
|
|
|
4303
4551
|
verifyArtifactUri,
|
|
4304
4552
|
verifyAuthorization,
|
|
4305
4553
|
verifyCanonical,
|
|
4554
|
+
verifyClaimSignature,
|
|
4306
4555
|
verifyOAC,
|
|
4307
4556
|
verifyPass,
|
|
4308
4557
|
verifyPaymentRequest,
|