@zkp2p/sdk 0.4.2 → 0.4.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 CHANGED
@@ -42384,7 +42384,7 @@ function normalizeOptionalString(value) {
42384
42384
  function normalizeBaseUrl(value, label) {
42385
42385
  const normalized = normalizeOptionalString(value)?.replace(/\/+$/u, "");
42386
42386
  if (!normalized) {
42387
- throw new Error(`${label} is required for buyer TEE session encryption.`);
42387
+ throw new Error(`${label} is required.`);
42388
42388
  }
42389
42389
  return normalized;
42390
42390
  }
@@ -42477,6 +42477,35 @@ async function apiVerifyBuyerTeePayment(payload, attestationServiceUrl, platform
42477
42477
  return res.json();
42478
42478
  });
42479
42479
  }
42480
+ async function apiRequestIdentityAttestation(payload, attestationServiceUrl, platform, actionType) {
42481
+ return withRetry(async () => {
42482
+ let res;
42483
+ try {
42484
+ const endpoint = "/identity";
42485
+ const baseUrl = normalizeBaseUrl(attestationServiceUrl, "Attestation Service URL");
42486
+ res = await fetch(`${baseUrl}${endpoint}`, {
42487
+ method: "POST",
42488
+ headers: headers(),
42489
+ body: JSON.stringify({
42490
+ platform,
42491
+ actionType,
42492
+ encryptedSessionMaterial: payload.encryptedSessionMaterial,
42493
+ params: payload.params
42494
+ })
42495
+ });
42496
+ } catch (error) {
42497
+ throw new exports.NetworkError("Failed to connect to Attestation Service", {
42498
+ endpoint: "/identity",
42499
+ error
42500
+ });
42501
+ }
42502
+ if (!res.ok) {
42503
+ const errorText = await res.text();
42504
+ throw parseAPIError(res, errorText);
42505
+ }
42506
+ return res.json();
42507
+ });
42508
+ }
42480
42509
  async function createEncryptedBuyerTeeSessionMaterial({
42481
42510
  actionType,
42482
42511
  attestationRuntime,
@@ -47476,11 +47505,11 @@ var ERC20_ABI = [
47476
47505
  ];
47477
47506
 
47478
47507
  // src/client/Zkp2pClient.ts
47479
- function isStringRecord(value) {
47508
+ function isObjectRecord(value) {
47480
47509
  if (!value || typeof value !== "object" || Array.isArray(value)) {
47481
47510
  return false;
47482
47511
  }
47483
- return Object.values(value).every((entry) => typeof entry === "string");
47512
+ return true;
47484
47513
  }
47485
47514
  function normalizeTelegramUsername(value) {
47486
47515
  if (typeof value !== "string") {
@@ -47517,7 +47546,7 @@ function normalizeQuotePayeeData(maker) {
47517
47546
  return {
47518
47547
  offchainId,
47519
47548
  telegramUsername: normalizeTelegramUsername(maker?.telegramUsername) ?? legacy?.telegramUsername ?? null,
47520
- metadata: isStringRecord(maker?.metadata) ? maker.metadata : legacy?.metadata ?? null
47549
+ metadata: isObjectRecord(maker?.metadata) ? maker.metadata : legacy?.metadata ?? null
47521
47550
  };
47522
47551
  }
47523
47552
  function normalizePayeeDataInputItem(raw) {
@@ -50561,6 +50590,7 @@ exports.apiGetPayeeDetails = apiGetPayeeDetails;
50561
50590
  exports.apiGetQuotesBestByPlatform = apiGetQuotesBestByPlatform;
50562
50591
  exports.apiGetTakerTier = apiGetTakerTier;
50563
50592
  exports.apiPostDepositDetails = apiPostDepositDetails;
50593
+ exports.apiRequestIdentityAttestation = apiRequestIdentityAttestation;
50564
50594
  exports.apiUploadGoogleOAuthSellerCredential = apiUploadGoogleOAuthSellerCredential;
50565
50595
  exports.apiValidatePayeeDetails = apiValidatePayeeDetails;
50566
50596
  exports.appendAttributionToCalldata = appendAttributionToCalldata;