@compilot/js-sdk 2.0.41-dev → 2.0.43-dev

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.
@@ -357,11 +357,11 @@ zod.z.object({
357
357
  * @example
358
358
  *
359
359
  * ```typescript
360
- * import { createApiClient } from "@compilot/js-sdk";
360
+ * import { createSdk } from "@compilot/js-sdk";
361
361
  *
362
- * const apiClient = createApiClient({ apiKey });
362
+ * const compilotSdk = createSdk({ apiKey });
363
363
  *
364
- * await apiClient.attachCustomerInformation({
364
+ * await compilotSdk.attachCustomerInformation({
365
365
  * externalCustomerId: "123",
366
366
  * information: {
367
367
  * email: "test@test.com",
@@ -549,11 +549,11 @@ var attachCustomerInformationFactory = function attachCustomerInformationFactory
549
549
  * Basic usage:
550
550
  *
551
551
  * ```typescript
552
- * import { createApiClient } from "@compilot/js-sdk";
552
+ * import { createSdk } from "@compilot/js-sdk";
553
553
  *
554
- * const apiClient = createApiClient({ apiKey });
554
+ * const compilotSdk = createSdk({ apiKey });
555
555
  *
556
- * const sessionContent = await apiClient.createSession({
556
+ * const sessionContent = await compilotSdk.createSession({
557
557
  * workflowId: "4f7b537f-0ae0-429c-98c8-3f6555ef23d6",
558
558
  * externalCustomerId: "123",
559
559
  * additionalInformation: {
@@ -571,9 +571,9 @@ var attachCustomerInformationFactory = function attachCustomerInformationFactory
571
571
  * Please find below an example of how to use the createSession function in Next.js:
572
572
  *
573
573
  * ```typescript
574
- * import { createApiClient } from "@compilot/js-sdk";
574
+ * import { createSdk } from "@compilot/js-sdk";
575
575
  *
576
- * const apiClient = createApiClient({ apiKey });
576
+ * const compilotSdk = createSdk({ apiKey });
577
577
  *
578
578
  *
579
579
  * export default async function handler(req: NextApiRequest, res: NextApiResponse ) {
@@ -583,7 +583,7 @@ var attachCustomerInformationFactory = function attachCustomerInformationFactory
583
583
  * return;
584
584
  * }
585
585
  *
586
- * const sessionRes = await apiClient.createSession({
586
+ * const sessionRes = await compilotSdk.createSession({
587
587
  * workflowId: "4f7b537f-0ae0-429c-98c8-3f6555ef23d6",
588
588
  * externalCustomerId: req.session.externalCustomerId,
589
589
  * });
@@ -633,11 +633,11 @@ var createWeb2SessionFactory = function createWeb2SessionFactory(deps) {
633
633
  * Basic usage:
634
634
  *
635
635
  * ```typescript
636
- * import { createApiClient } from "@compilot/js-sdk";
636
+ * import { createSdk } from "@compilot/js-sdk";
637
637
  *
638
- * const apiClient = createApiClient({ apiKey });
638
+ * const compilotSdk = createSdk({ apiKey });
639
639
  *
640
- * const challengeContent = await apiClient.createWeb3Challenge({
640
+ * const challengeContent = await compilotSdk.createWeb3Challenge({
641
641
  * address: "0xabc",
642
642
  * namespace: "eip155",
643
643
  * blockchainId: "1",
@@ -651,9 +651,9 @@ var createWeb2SessionFactory = function createWeb2SessionFactory(deps) {
651
651
  * Please find below an example of how to use the createWeb3Challenge function in Next.js:
652
652
  *
653
653
  * ```typescript
654
- * import { createApiClient } from "@compilot/js-sdk";
654
+ * import { createSdk } from "@compilot/js-sdk";
655
655
  *
656
- * const apiClient = createApiClient({ apiKey });
656
+ * const compilotSdk = createSdk({ apiKey });
657
657
  *
658
658
  * export default async function handler(req: NextApiRequest, res: NextApiResponse ) {
659
659
  * if (req.method !== "POST") {
@@ -662,7 +662,7 @@ var createWeb2SessionFactory = function createWeb2SessionFactory(deps) {
662
662
  * return;
663
663
  * }
664
664
  *
665
- * const challengeContent = await apiClient.createWeb3Challenge({
665
+ * const challengeContent = await compilotSdk.createWeb3Challenge({
666
666
  * address: "0xabc",
667
667
  * namespace: "eip155",
668
668
  * blockchainId: "1",
@@ -714,11 +714,11 @@ var createWeb3ChallengeFactory = function createWeb3ChallengeFactory(deps) {
714
714
  * @example
715
715
  * ```typescript
716
716
  *
717
- * import { createApiClient } from "@compilot/js-sdk";
717
+ * import { createSdk } from "@compilot/js-sdk";
718
718
  *
719
- * const apiClient = createApiClient({ apiKey });
719
+ * const compilotSdk = createSdk({ apiKey });
720
720
  *
721
- * const customerStatus = await apiClient.getCustomerStatusByCustomerId({
721
+ * const customerStatus = await compilotSdk.getCustomerStatusByCustomerId({
722
722
  * customerId: "123",
723
723
  * });
724
724
  * ```
@@ -761,11 +761,11 @@ var getCustomerStatusByCustomerIdFactory = function getCustomerStatusByCustomerI
761
761
  * @example
762
762
  * ```typescript
763
763
  *
764
- * import { createApiClient } from "@compilot/js-sdk";
764
+ * import { createSdk } from "@compilot/js-sdk";
765
765
  *
766
- * const apiClient = createApiClient({ apiKey });
766
+ * const compilotSdk = createSdk({ apiKey });
767
767
  *
768
- * const customerStatus = await apiClient.getCustomerStatusByExternalCustomerId({
768
+ * const customerStatus = await compilotSdk.getCustomerStatusByExternalCustomerId({
769
769
  * externalCustomerId: "123",
770
770
  * });
771
771
  * ```
@@ -805,11 +805,11 @@ var getCustomerStatusByExternalCustomerIdFactory = function getCustomerStatusByE
805
805
  *
806
806
  * @example
807
807
  * ```typescript
808
- * import { createApiClient } from "@compilot/js-sdk";
808
+ * import { createSdk } from "@compilot/js-sdk";
809
809
  *
810
- * const apiClient = createApiClient({ apiKey });
810
+ * const compilotSdk = createSdk({ apiKey });
811
811
  *
812
- * const customerStatus = await apiClient.getCustomerStatusByWallet({
812
+ * const customerStatus = await compilotSdk.getCustomerStatusByWallet({
813
813
  * walletAddress: "tz1abc",
814
814
  * workspaceId: "123",
815
815
  * });
@@ -852,11 +852,11 @@ var getCustomerStatusByWalletFactory = function getCustomerStatusByWalletFactory
852
852
  *
853
853
  * @example
854
854
  * ```typescript
855
- * import { createApiClient } from "@compilot/js-sdk";
855
+ * import { createSdk } from "@compilot/js-sdk";
856
856
  *
857
- * const apiClient = createApiClient({ apiKey });
857
+ * const compilotSdk = createSdk({ apiKey });
858
858
  *
859
- * const wallets = await apiClient.getCustomerWallets({
859
+ * const wallets = await compilotSdk.getCustomerWallets({
860
860
  * customerId: "123",
861
861
  * });
862
862
  * ```
@@ -953,11 +953,11 @@ function _objectSpread2(e) {
953
953
  *
954
954
  * Eip155:
955
955
  * ```typescript
956
- * import { createApiClient } from "@compilot/js-sdk";
956
+ * import { createSdk } from "@compilot/js-sdk";
957
957
  *
958
- * const apiClient = createApiClient({ apiKey });
958
+ * const compilotSdk = createSdk({ apiKey });
959
959
  *
960
- * const txAuthDataSignature = await apiClient.getTxAuthDataSignature({
960
+ * const txAuthDataSignature = await compilotSdk.getTxAuthDataSignature({
961
961
  * namespace: "eip155",
962
962
  * contractAbi: ExampleGatedNFTMinterABI,
963
963
  * contractAddress: "0x123",
@@ -1262,6 +1262,90 @@ var validateWebhookEventFactory = function validateWebhookEventFactory(_ref) {
1262
1262
  };
1263
1263
  };
1264
1264
 
1265
+ /**
1266
+ * Verify a challenge for a wallet. The web-sdk can use this to verify a signed message and prove ownership of a wallet.
1267
+ *
1268
+ * @param params The parameters to verify
1269
+ * @returns A promise that resolves to the auth session
1270
+ *
1271
+ * @category Actions
1272
+ *
1273
+ * @example
1274
+ *
1275
+ * Basic usage:
1276
+ *
1277
+ * ```typescript
1278
+ * import { createSdk } from "@compilot/js-sdk";
1279
+ *
1280
+ * const compilotSdk = createSdk({ apiKey });
1281
+ *
1282
+ * const challengeContent = await compilotSdk.verifyWeb3Challenge({
1283
+ * address: "0xabc",
1284
+ * namespace: "eip155",
1285
+ * blockchainId: "1",
1286
+ * message: ".....", // the challenge message
1287
+ * signedMessage: ".....", // the signed message, some wallets need to process the message before signing
1288
+ * signature: ".....", // the wallet signature of the signed message
1289
+ * signerPublicKey: "0x...",
1290
+ * });
1291
+ * ```
1292
+ *
1293
+ * More often used as part of an api to protect the api key.
1294
+ * Please find below an example of how to use the verifyWeb3Challenge function in Next.js:
1295
+ *
1296
+ * ```typescript
1297
+ * import { createSdk } from "@compilot/js-sdk";
1298
+ *
1299
+ * const compilotSdk = createSdk({ apiKey });
1300
+ *
1301
+ * export default async function handler(req: NextApiRequest, res: NextApiResponse ) {
1302
+ * if (req.method !== "POST") {
1303
+ * res.setHeader("Allow", ["POST"]);
1304
+ * res.status(405).end(`Method ${req.method} Not Allowed`);
1305
+ * return;
1306
+ * }
1307
+ *
1308
+ * const authSession = await compilotSdk.verifyWeb3Challenge({
1309
+ * ...req.body
1310
+ * });
1311
+ *
1312
+ * // now we know this user is authenticated, save the user address to the local database for future reference
1313
+ * db.update(authSession.externalCustomerId, {
1314
+ * address: req.body.address,
1315
+ * });
1316
+ *
1317
+ * // Return the challenge to the client
1318
+ * res.status(200).json(authSession);
1319
+ * }
1320
+ * ```
1321
+ */
1322
+
1323
+ var verifyWeb3ChallengeFactory = function verifyWeb3ChallengeFactory(deps) {
1324
+ return /*#__PURE__*/function () {
1325
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
1326
+ var res;
1327
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
1328
+ while (1) switch (_context.prev = _context.next) {
1329
+ case 0:
1330
+ _context.next = 2;
1331
+ return deps.identityApiClient.auth.verifyWalletChallenge({
1332
+ requestBody: params
1333
+ });
1334
+ case 2:
1335
+ res = _context.sent;
1336
+ return _context.abrupt("return", res);
1337
+ case 4:
1338
+ case "end":
1339
+ return _context.stop();
1340
+ }
1341
+ }, _callee);
1342
+ }));
1343
+ return function (_x) {
1344
+ return _ref.apply(this, arguments);
1345
+ };
1346
+ }();
1347
+ };
1348
+
1265
1349
  /**
1266
1350
  * Error thrown when API key is not provided.
1267
1351
  */
@@ -1332,6 +1416,9 @@ var createSdk = function createSdk(_ref) {
1332
1416
  createWeb3Challenge: createWeb3ChallengeFactory({
1333
1417
  identityApiClient: identityApiClient$1
1334
1418
  }),
1419
+ verifyWeb3Challenge: verifyWeb3ChallengeFactory({
1420
+ identityApiClient: identityApiClient$1
1421
+ }),
1335
1422
  createSession: createWeb2SessionFactory({
1336
1423
  identityApiClient: identityApiClient$1
1337
1424
  }),
@@ -357,11 +357,11 @@ zod.z.object({
357
357
  * @example
358
358
  *
359
359
  * ```typescript
360
- * import { createApiClient } from "@compilot/js-sdk";
360
+ * import { createSdk } from "@compilot/js-sdk";
361
361
  *
362
- * const apiClient = createApiClient({ apiKey });
362
+ * const compilotSdk = createSdk({ apiKey });
363
363
  *
364
- * await apiClient.attachCustomerInformation({
364
+ * await compilotSdk.attachCustomerInformation({
365
365
  * externalCustomerId: "123",
366
366
  * information: {
367
367
  * email: "test@test.com",
@@ -549,11 +549,11 @@ var attachCustomerInformationFactory = function attachCustomerInformationFactory
549
549
  * Basic usage:
550
550
  *
551
551
  * ```typescript
552
- * import { createApiClient } from "@compilot/js-sdk";
552
+ * import { createSdk } from "@compilot/js-sdk";
553
553
  *
554
- * const apiClient = createApiClient({ apiKey });
554
+ * const compilotSdk = createSdk({ apiKey });
555
555
  *
556
- * const sessionContent = await apiClient.createSession({
556
+ * const sessionContent = await compilotSdk.createSession({
557
557
  * workflowId: "4f7b537f-0ae0-429c-98c8-3f6555ef23d6",
558
558
  * externalCustomerId: "123",
559
559
  * additionalInformation: {
@@ -571,9 +571,9 @@ var attachCustomerInformationFactory = function attachCustomerInformationFactory
571
571
  * Please find below an example of how to use the createSession function in Next.js:
572
572
  *
573
573
  * ```typescript
574
- * import { createApiClient } from "@compilot/js-sdk";
574
+ * import { createSdk } from "@compilot/js-sdk";
575
575
  *
576
- * const apiClient = createApiClient({ apiKey });
576
+ * const compilotSdk = createSdk({ apiKey });
577
577
  *
578
578
  *
579
579
  * export default async function handler(req: NextApiRequest, res: NextApiResponse ) {
@@ -583,7 +583,7 @@ var attachCustomerInformationFactory = function attachCustomerInformationFactory
583
583
  * return;
584
584
  * }
585
585
  *
586
- * const sessionRes = await apiClient.createSession({
586
+ * const sessionRes = await compilotSdk.createSession({
587
587
  * workflowId: "4f7b537f-0ae0-429c-98c8-3f6555ef23d6",
588
588
  * externalCustomerId: req.session.externalCustomerId,
589
589
  * });
@@ -633,11 +633,11 @@ var createWeb2SessionFactory = function createWeb2SessionFactory(deps) {
633
633
  * Basic usage:
634
634
  *
635
635
  * ```typescript
636
- * import { createApiClient } from "@compilot/js-sdk";
636
+ * import { createSdk } from "@compilot/js-sdk";
637
637
  *
638
- * const apiClient = createApiClient({ apiKey });
638
+ * const compilotSdk = createSdk({ apiKey });
639
639
  *
640
- * const challengeContent = await apiClient.createWeb3Challenge({
640
+ * const challengeContent = await compilotSdk.createWeb3Challenge({
641
641
  * address: "0xabc",
642
642
  * namespace: "eip155",
643
643
  * blockchainId: "1",
@@ -651,9 +651,9 @@ var createWeb2SessionFactory = function createWeb2SessionFactory(deps) {
651
651
  * Please find below an example of how to use the createWeb3Challenge function in Next.js:
652
652
  *
653
653
  * ```typescript
654
- * import { createApiClient } from "@compilot/js-sdk";
654
+ * import { createSdk } from "@compilot/js-sdk";
655
655
  *
656
- * const apiClient = createApiClient({ apiKey });
656
+ * const compilotSdk = createSdk({ apiKey });
657
657
  *
658
658
  * export default async function handler(req: NextApiRequest, res: NextApiResponse ) {
659
659
  * if (req.method !== "POST") {
@@ -662,7 +662,7 @@ var createWeb2SessionFactory = function createWeb2SessionFactory(deps) {
662
662
  * return;
663
663
  * }
664
664
  *
665
- * const challengeContent = await apiClient.createWeb3Challenge({
665
+ * const challengeContent = await compilotSdk.createWeb3Challenge({
666
666
  * address: "0xabc",
667
667
  * namespace: "eip155",
668
668
  * blockchainId: "1",
@@ -714,11 +714,11 @@ var createWeb3ChallengeFactory = function createWeb3ChallengeFactory(deps) {
714
714
  * @example
715
715
  * ```typescript
716
716
  *
717
- * import { createApiClient } from "@compilot/js-sdk";
717
+ * import { createSdk } from "@compilot/js-sdk";
718
718
  *
719
- * const apiClient = createApiClient({ apiKey });
719
+ * const compilotSdk = createSdk({ apiKey });
720
720
  *
721
- * const customerStatus = await apiClient.getCustomerStatusByCustomerId({
721
+ * const customerStatus = await compilotSdk.getCustomerStatusByCustomerId({
722
722
  * customerId: "123",
723
723
  * });
724
724
  * ```
@@ -761,11 +761,11 @@ var getCustomerStatusByCustomerIdFactory = function getCustomerStatusByCustomerI
761
761
  * @example
762
762
  * ```typescript
763
763
  *
764
- * import { createApiClient } from "@compilot/js-sdk";
764
+ * import { createSdk } from "@compilot/js-sdk";
765
765
  *
766
- * const apiClient = createApiClient({ apiKey });
766
+ * const compilotSdk = createSdk({ apiKey });
767
767
  *
768
- * const customerStatus = await apiClient.getCustomerStatusByExternalCustomerId({
768
+ * const customerStatus = await compilotSdk.getCustomerStatusByExternalCustomerId({
769
769
  * externalCustomerId: "123",
770
770
  * });
771
771
  * ```
@@ -805,11 +805,11 @@ var getCustomerStatusByExternalCustomerIdFactory = function getCustomerStatusByE
805
805
  *
806
806
  * @example
807
807
  * ```typescript
808
- * import { createApiClient } from "@compilot/js-sdk";
808
+ * import { createSdk } from "@compilot/js-sdk";
809
809
  *
810
- * const apiClient = createApiClient({ apiKey });
810
+ * const compilotSdk = createSdk({ apiKey });
811
811
  *
812
- * const customerStatus = await apiClient.getCustomerStatusByWallet({
812
+ * const customerStatus = await compilotSdk.getCustomerStatusByWallet({
813
813
  * walletAddress: "tz1abc",
814
814
  * workspaceId: "123",
815
815
  * });
@@ -852,11 +852,11 @@ var getCustomerStatusByWalletFactory = function getCustomerStatusByWalletFactory
852
852
  *
853
853
  * @example
854
854
  * ```typescript
855
- * import { createApiClient } from "@compilot/js-sdk";
855
+ * import { createSdk } from "@compilot/js-sdk";
856
856
  *
857
- * const apiClient = createApiClient({ apiKey });
857
+ * const compilotSdk = createSdk({ apiKey });
858
858
  *
859
- * const wallets = await apiClient.getCustomerWallets({
859
+ * const wallets = await compilotSdk.getCustomerWallets({
860
860
  * customerId: "123",
861
861
  * });
862
862
  * ```
@@ -953,11 +953,11 @@ function _objectSpread2(e) {
953
953
  *
954
954
  * Eip155:
955
955
  * ```typescript
956
- * import { createApiClient } from "@compilot/js-sdk";
956
+ * import { createSdk } from "@compilot/js-sdk";
957
957
  *
958
- * const apiClient = createApiClient({ apiKey });
958
+ * const compilotSdk = createSdk({ apiKey });
959
959
  *
960
- * const txAuthDataSignature = await apiClient.getTxAuthDataSignature({
960
+ * const txAuthDataSignature = await compilotSdk.getTxAuthDataSignature({
961
961
  * namespace: "eip155",
962
962
  * contractAbi: ExampleGatedNFTMinterABI,
963
963
  * contractAddress: "0x123",
@@ -1262,6 +1262,90 @@ var validateWebhookEventFactory = function validateWebhookEventFactory(_ref) {
1262
1262
  };
1263
1263
  };
1264
1264
 
1265
+ /**
1266
+ * Verify a challenge for a wallet. The web-sdk can use this to verify a signed message and prove ownership of a wallet.
1267
+ *
1268
+ * @param params The parameters to verify
1269
+ * @returns A promise that resolves to the auth session
1270
+ *
1271
+ * @category Actions
1272
+ *
1273
+ * @example
1274
+ *
1275
+ * Basic usage:
1276
+ *
1277
+ * ```typescript
1278
+ * import { createSdk } from "@compilot/js-sdk";
1279
+ *
1280
+ * const compilotSdk = createSdk({ apiKey });
1281
+ *
1282
+ * const challengeContent = await compilotSdk.verifyWeb3Challenge({
1283
+ * address: "0xabc",
1284
+ * namespace: "eip155",
1285
+ * blockchainId: "1",
1286
+ * message: ".....", // the challenge message
1287
+ * signedMessage: ".....", // the signed message, some wallets need to process the message before signing
1288
+ * signature: ".....", // the wallet signature of the signed message
1289
+ * signerPublicKey: "0x...",
1290
+ * });
1291
+ * ```
1292
+ *
1293
+ * More often used as part of an api to protect the api key.
1294
+ * Please find below an example of how to use the verifyWeb3Challenge function in Next.js:
1295
+ *
1296
+ * ```typescript
1297
+ * import { createSdk } from "@compilot/js-sdk";
1298
+ *
1299
+ * const compilotSdk = createSdk({ apiKey });
1300
+ *
1301
+ * export default async function handler(req: NextApiRequest, res: NextApiResponse ) {
1302
+ * if (req.method !== "POST") {
1303
+ * res.setHeader("Allow", ["POST"]);
1304
+ * res.status(405).end(`Method ${req.method} Not Allowed`);
1305
+ * return;
1306
+ * }
1307
+ *
1308
+ * const authSession = await compilotSdk.verifyWeb3Challenge({
1309
+ * ...req.body
1310
+ * });
1311
+ *
1312
+ * // now we know this user is authenticated, save the user address to the local database for future reference
1313
+ * db.update(authSession.externalCustomerId, {
1314
+ * address: req.body.address,
1315
+ * });
1316
+ *
1317
+ * // Return the challenge to the client
1318
+ * res.status(200).json(authSession);
1319
+ * }
1320
+ * ```
1321
+ */
1322
+
1323
+ var verifyWeb3ChallengeFactory = function verifyWeb3ChallengeFactory(deps) {
1324
+ return /*#__PURE__*/function () {
1325
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
1326
+ var res;
1327
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
1328
+ while (1) switch (_context.prev = _context.next) {
1329
+ case 0:
1330
+ _context.next = 2;
1331
+ return deps.identityApiClient.auth.verifyWalletChallenge({
1332
+ requestBody: params
1333
+ });
1334
+ case 2:
1335
+ res = _context.sent;
1336
+ return _context.abrupt("return", res);
1337
+ case 4:
1338
+ case "end":
1339
+ return _context.stop();
1340
+ }
1341
+ }, _callee);
1342
+ }));
1343
+ return function (_x) {
1344
+ return _ref.apply(this, arguments);
1345
+ };
1346
+ }();
1347
+ };
1348
+
1265
1349
  /**
1266
1350
  * Error thrown when API key is not provided.
1267
1351
  */
@@ -1332,6 +1416,9 @@ var createSdk = function createSdk(_ref) {
1332
1416
  createWeb3Challenge: createWeb3ChallengeFactory({
1333
1417
  identityApiClient: identityApiClient$1
1334
1418
  }),
1419
+ verifyWeb3Challenge: verifyWeb3ChallengeFactory({
1420
+ identityApiClient: identityApiClient$1
1421
+ }),
1335
1422
  createSession: createWeb2SessionFactory({
1336
1423
  identityApiClient: identityApiClient$1
1337
1424
  }),
@@ -355,11 +355,11 @@ z.object({
355
355
  * @example
356
356
  *
357
357
  * ```typescript
358
- * import { createApiClient } from "@compilot/js-sdk";
358
+ * import { createSdk } from "@compilot/js-sdk";
359
359
  *
360
- * const apiClient = createApiClient({ apiKey });
360
+ * const compilotSdk = createSdk({ apiKey });
361
361
  *
362
- * await apiClient.attachCustomerInformation({
362
+ * await compilotSdk.attachCustomerInformation({
363
363
  * externalCustomerId: "123",
364
364
  * information: {
365
365
  * email: "test@test.com",
@@ -547,11 +547,11 @@ var attachCustomerInformationFactory = function attachCustomerInformationFactory
547
547
  * Basic usage:
548
548
  *
549
549
  * ```typescript
550
- * import { createApiClient } from "@compilot/js-sdk";
550
+ * import { createSdk } from "@compilot/js-sdk";
551
551
  *
552
- * const apiClient = createApiClient({ apiKey });
552
+ * const compilotSdk = createSdk({ apiKey });
553
553
  *
554
- * const sessionContent = await apiClient.createSession({
554
+ * const sessionContent = await compilotSdk.createSession({
555
555
  * workflowId: "4f7b537f-0ae0-429c-98c8-3f6555ef23d6",
556
556
  * externalCustomerId: "123",
557
557
  * additionalInformation: {
@@ -569,9 +569,9 @@ var attachCustomerInformationFactory = function attachCustomerInformationFactory
569
569
  * Please find below an example of how to use the createSession function in Next.js:
570
570
  *
571
571
  * ```typescript
572
- * import { createApiClient } from "@compilot/js-sdk";
572
+ * import { createSdk } from "@compilot/js-sdk";
573
573
  *
574
- * const apiClient = createApiClient({ apiKey });
574
+ * const compilotSdk = createSdk({ apiKey });
575
575
  *
576
576
  *
577
577
  * export default async function handler(req: NextApiRequest, res: NextApiResponse ) {
@@ -581,7 +581,7 @@ var attachCustomerInformationFactory = function attachCustomerInformationFactory
581
581
  * return;
582
582
  * }
583
583
  *
584
- * const sessionRes = await apiClient.createSession({
584
+ * const sessionRes = await compilotSdk.createSession({
585
585
  * workflowId: "4f7b537f-0ae0-429c-98c8-3f6555ef23d6",
586
586
  * externalCustomerId: req.session.externalCustomerId,
587
587
  * });
@@ -631,11 +631,11 @@ var createWeb2SessionFactory = function createWeb2SessionFactory(deps) {
631
631
  * Basic usage:
632
632
  *
633
633
  * ```typescript
634
- * import { createApiClient } from "@compilot/js-sdk";
634
+ * import { createSdk } from "@compilot/js-sdk";
635
635
  *
636
- * const apiClient = createApiClient({ apiKey });
636
+ * const compilotSdk = createSdk({ apiKey });
637
637
  *
638
- * const challengeContent = await apiClient.createWeb3Challenge({
638
+ * const challengeContent = await compilotSdk.createWeb3Challenge({
639
639
  * address: "0xabc",
640
640
  * namespace: "eip155",
641
641
  * blockchainId: "1",
@@ -649,9 +649,9 @@ var createWeb2SessionFactory = function createWeb2SessionFactory(deps) {
649
649
  * Please find below an example of how to use the createWeb3Challenge function in Next.js:
650
650
  *
651
651
  * ```typescript
652
- * import { createApiClient } from "@compilot/js-sdk";
652
+ * import { createSdk } from "@compilot/js-sdk";
653
653
  *
654
- * const apiClient = createApiClient({ apiKey });
654
+ * const compilotSdk = createSdk({ apiKey });
655
655
  *
656
656
  * export default async function handler(req: NextApiRequest, res: NextApiResponse ) {
657
657
  * if (req.method !== "POST") {
@@ -660,7 +660,7 @@ var createWeb2SessionFactory = function createWeb2SessionFactory(deps) {
660
660
  * return;
661
661
  * }
662
662
  *
663
- * const challengeContent = await apiClient.createWeb3Challenge({
663
+ * const challengeContent = await compilotSdk.createWeb3Challenge({
664
664
  * address: "0xabc",
665
665
  * namespace: "eip155",
666
666
  * blockchainId: "1",
@@ -712,11 +712,11 @@ var createWeb3ChallengeFactory = function createWeb3ChallengeFactory(deps) {
712
712
  * @example
713
713
  * ```typescript
714
714
  *
715
- * import { createApiClient } from "@compilot/js-sdk";
715
+ * import { createSdk } from "@compilot/js-sdk";
716
716
  *
717
- * const apiClient = createApiClient({ apiKey });
717
+ * const compilotSdk = createSdk({ apiKey });
718
718
  *
719
- * const customerStatus = await apiClient.getCustomerStatusByCustomerId({
719
+ * const customerStatus = await compilotSdk.getCustomerStatusByCustomerId({
720
720
  * customerId: "123",
721
721
  * });
722
722
  * ```
@@ -759,11 +759,11 @@ var getCustomerStatusByCustomerIdFactory = function getCustomerStatusByCustomerI
759
759
  * @example
760
760
  * ```typescript
761
761
  *
762
- * import { createApiClient } from "@compilot/js-sdk";
762
+ * import { createSdk } from "@compilot/js-sdk";
763
763
  *
764
- * const apiClient = createApiClient({ apiKey });
764
+ * const compilotSdk = createSdk({ apiKey });
765
765
  *
766
- * const customerStatus = await apiClient.getCustomerStatusByExternalCustomerId({
766
+ * const customerStatus = await compilotSdk.getCustomerStatusByExternalCustomerId({
767
767
  * externalCustomerId: "123",
768
768
  * });
769
769
  * ```
@@ -803,11 +803,11 @@ var getCustomerStatusByExternalCustomerIdFactory = function getCustomerStatusByE
803
803
  *
804
804
  * @example
805
805
  * ```typescript
806
- * import { createApiClient } from "@compilot/js-sdk";
806
+ * import { createSdk } from "@compilot/js-sdk";
807
807
  *
808
- * const apiClient = createApiClient({ apiKey });
808
+ * const compilotSdk = createSdk({ apiKey });
809
809
  *
810
- * const customerStatus = await apiClient.getCustomerStatusByWallet({
810
+ * const customerStatus = await compilotSdk.getCustomerStatusByWallet({
811
811
  * walletAddress: "tz1abc",
812
812
  * workspaceId: "123",
813
813
  * });
@@ -850,11 +850,11 @@ var getCustomerStatusByWalletFactory = function getCustomerStatusByWalletFactory
850
850
  *
851
851
  * @example
852
852
  * ```typescript
853
- * import { createApiClient } from "@compilot/js-sdk";
853
+ * import { createSdk } from "@compilot/js-sdk";
854
854
  *
855
- * const apiClient = createApiClient({ apiKey });
855
+ * const compilotSdk = createSdk({ apiKey });
856
856
  *
857
- * const wallets = await apiClient.getCustomerWallets({
857
+ * const wallets = await compilotSdk.getCustomerWallets({
858
858
  * customerId: "123",
859
859
  * });
860
860
  * ```
@@ -951,11 +951,11 @@ function _objectSpread2(e) {
951
951
  *
952
952
  * Eip155:
953
953
  * ```typescript
954
- * import { createApiClient } from "@compilot/js-sdk";
954
+ * import { createSdk } from "@compilot/js-sdk";
955
955
  *
956
- * const apiClient = createApiClient({ apiKey });
956
+ * const compilotSdk = createSdk({ apiKey });
957
957
  *
958
- * const txAuthDataSignature = await apiClient.getTxAuthDataSignature({
958
+ * const txAuthDataSignature = await compilotSdk.getTxAuthDataSignature({
959
959
  * namespace: "eip155",
960
960
  * contractAbi: ExampleGatedNFTMinterABI,
961
961
  * contractAddress: "0x123",
@@ -1260,6 +1260,90 @@ var validateWebhookEventFactory = function validateWebhookEventFactory(_ref) {
1260
1260
  };
1261
1261
  };
1262
1262
 
1263
+ /**
1264
+ * Verify a challenge for a wallet. The web-sdk can use this to verify a signed message and prove ownership of a wallet.
1265
+ *
1266
+ * @param params The parameters to verify
1267
+ * @returns A promise that resolves to the auth session
1268
+ *
1269
+ * @category Actions
1270
+ *
1271
+ * @example
1272
+ *
1273
+ * Basic usage:
1274
+ *
1275
+ * ```typescript
1276
+ * import { createSdk } from "@compilot/js-sdk";
1277
+ *
1278
+ * const compilotSdk = createSdk({ apiKey });
1279
+ *
1280
+ * const challengeContent = await compilotSdk.verifyWeb3Challenge({
1281
+ * address: "0xabc",
1282
+ * namespace: "eip155",
1283
+ * blockchainId: "1",
1284
+ * message: ".....", // the challenge message
1285
+ * signedMessage: ".....", // the signed message, some wallets need to process the message before signing
1286
+ * signature: ".....", // the wallet signature of the signed message
1287
+ * signerPublicKey: "0x...",
1288
+ * });
1289
+ * ```
1290
+ *
1291
+ * More often used as part of an api to protect the api key.
1292
+ * Please find below an example of how to use the verifyWeb3Challenge function in Next.js:
1293
+ *
1294
+ * ```typescript
1295
+ * import { createSdk } from "@compilot/js-sdk";
1296
+ *
1297
+ * const compilotSdk = createSdk({ apiKey });
1298
+ *
1299
+ * export default async function handler(req: NextApiRequest, res: NextApiResponse ) {
1300
+ * if (req.method !== "POST") {
1301
+ * res.setHeader("Allow", ["POST"]);
1302
+ * res.status(405).end(`Method ${req.method} Not Allowed`);
1303
+ * return;
1304
+ * }
1305
+ *
1306
+ * const authSession = await compilotSdk.verifyWeb3Challenge({
1307
+ * ...req.body
1308
+ * });
1309
+ *
1310
+ * // now we know this user is authenticated, save the user address to the local database for future reference
1311
+ * db.update(authSession.externalCustomerId, {
1312
+ * address: req.body.address,
1313
+ * });
1314
+ *
1315
+ * // Return the challenge to the client
1316
+ * res.status(200).json(authSession);
1317
+ * }
1318
+ * ```
1319
+ */
1320
+
1321
+ var verifyWeb3ChallengeFactory = function verifyWeb3ChallengeFactory(deps) {
1322
+ return /*#__PURE__*/function () {
1323
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
1324
+ var res;
1325
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
1326
+ while (1) switch (_context.prev = _context.next) {
1327
+ case 0:
1328
+ _context.next = 2;
1329
+ return deps.identityApiClient.auth.verifyWalletChallenge({
1330
+ requestBody: params
1331
+ });
1332
+ case 2:
1333
+ res = _context.sent;
1334
+ return _context.abrupt("return", res);
1335
+ case 4:
1336
+ case "end":
1337
+ return _context.stop();
1338
+ }
1339
+ }, _callee);
1340
+ }));
1341
+ return function (_x) {
1342
+ return _ref.apply(this, arguments);
1343
+ };
1344
+ }();
1345
+ };
1346
+
1263
1347
  /**
1264
1348
  * Error thrown when API key is not provided.
1265
1349
  */
@@ -1330,6 +1414,9 @@ var createSdk = function createSdk(_ref) {
1330
1414
  createWeb3Challenge: createWeb3ChallengeFactory({
1331
1415
  identityApiClient: identityApiClient
1332
1416
  }),
1417
+ verifyWeb3Challenge: verifyWeb3ChallengeFactory({
1418
+ identityApiClient: identityApiClient
1419
+ }),
1333
1420
  createSession: createWeb2SessionFactory({
1334
1421
  identityApiClient: identityApiClient
1335
1422
  }),
@@ -22,11 +22,11 @@ export declare const AttachCustomerInformationParams: z.ZodType<AttachCustomerIn
22
22
  * @example
23
23
  *
24
24
  * ```typescript
25
- * import { createApiClient } from "@compilot/js-sdk";
25
+ * import { createSdk } from "@compilot/js-sdk";
26
26
  *
27
- * const apiClient = createApiClient({ apiKey });
27
+ * const compilotSdk = createSdk({ apiKey });
28
28
  *
29
- * await apiClient.attachCustomerInformation({
29
+ * await compilotSdk.attachCustomerInformation({
30
30
  * externalCustomerId: "123",
31
31
  * information: {
32
32
  * email: "test@test.com",
@@ -12,11 +12,11 @@ import type { AuthSession, Web2CreateSessionParams } from "@nexeraid/identity-sc
12
12
  * Basic usage:
13
13
  *
14
14
  * ```typescript
15
- * import { createApiClient } from "@compilot/js-sdk";
15
+ * import { createSdk } from "@compilot/js-sdk";
16
16
  *
17
- * const apiClient = createApiClient({ apiKey });
17
+ * const compilotSdk = createSdk({ apiKey });
18
18
  *
19
- * const sessionContent = await apiClient.createSession({
19
+ * const sessionContent = await compilotSdk.createSession({
20
20
  * workflowId: "4f7b537f-0ae0-429c-98c8-3f6555ef23d6",
21
21
  * externalCustomerId: "123",
22
22
  * additionalInformation: {
@@ -34,9 +34,9 @@ import type { AuthSession, Web2CreateSessionParams } from "@nexeraid/identity-sc
34
34
  * Please find below an example of how to use the createSession function in Next.js:
35
35
  *
36
36
  * ```typescript
37
- * import { createApiClient } from "@compilot/js-sdk";
37
+ * import { createSdk } from "@compilot/js-sdk";
38
38
  *
39
- * const apiClient = createApiClient({ apiKey });
39
+ * const compilotSdk = createSdk({ apiKey });
40
40
  *
41
41
  *
42
42
  * export default async function handler(req: NextApiRequest, res: NextApiResponse ) {
@@ -46,7 +46,7 @@ import type { AuthSession, Web2CreateSessionParams } from "@nexeraid/identity-sc
46
46
  * return;
47
47
  * }
48
48
  *
49
- * const sessionRes = await apiClient.createSession({
49
+ * const sessionRes = await compilotSdk.createSession({
50
50
  * workflowId: "4f7b537f-0ae0-429c-98c8-3f6555ef23d6",
51
51
  * externalCustomerId: req.session.externalCustomerId,
52
52
  * });
@@ -13,11 +13,11 @@ import type { ChallengeResponse, WalletChallengeRequest } from "@nexeraid/identi
13
13
  * Basic usage:
14
14
  *
15
15
  * ```typescript
16
- * import { createApiClient } from "@compilot/js-sdk";
16
+ * import { createSdk } from "@compilot/js-sdk";
17
17
  *
18
- * const apiClient = createApiClient({ apiKey });
18
+ * const compilotSdk = createSdk({ apiKey });
19
19
  *
20
- * const challengeContent = await apiClient.createWeb3Challenge({
20
+ * const challengeContent = await compilotSdk.createWeb3Challenge({
21
21
  * address: "0xabc",
22
22
  * namespace: "eip155",
23
23
  * blockchainId: "1",
@@ -31,9 +31,9 @@ import type { ChallengeResponse, WalletChallengeRequest } from "@nexeraid/identi
31
31
  * Please find below an example of how to use the createWeb3Challenge function in Next.js:
32
32
  *
33
33
  * ```typescript
34
- * import { createApiClient } from "@compilot/js-sdk";
34
+ * import { createSdk } from "@compilot/js-sdk";
35
35
  *
36
- * const apiClient = createApiClient({ apiKey });
36
+ * const compilotSdk = createSdk({ apiKey });
37
37
  *
38
38
  * export default async function handler(req: NextApiRequest, res: NextApiResponse ) {
39
39
  * if (req.method !== "POST") {
@@ -42,7 +42,7 @@ import type { ChallengeResponse, WalletChallengeRequest } from "@nexeraid/identi
42
42
  * return;
43
43
  * }
44
44
  *
45
- * const challengeContent = await apiClient.createWeb3Challenge({
45
+ * const challengeContent = await compilotSdk.createWeb3Challenge({
46
46
  * address: "0xabc",
47
47
  * namespace: "eip155",
48
48
  * blockchainId: "1",
@@ -11,11 +11,11 @@ import type { CustomerStatus } from "@nexeraid/identity-schemas";
11
11
  * @example
12
12
  * ```typescript
13
13
  *
14
- * import { createApiClient } from "@compilot/js-sdk";
14
+ * import { createSdk } from "@compilot/js-sdk";
15
15
  *
16
- * const apiClient = createApiClient({ apiKey });
16
+ * const compilotSdk = createSdk({ apiKey });
17
17
  *
18
- * const customerStatus = await apiClient.getCustomerStatusByCustomerId({
18
+ * const customerStatus = await compilotSdk.getCustomerStatusByCustomerId({
19
19
  * customerId: "123",
20
20
  * });
21
21
  * ```
@@ -11,11 +11,11 @@ import type { CustomerStatus, ExternalCustomerId } from "@nexeraid/identity-sche
11
11
  * @example
12
12
  * ```typescript
13
13
  *
14
- * import { createApiClient } from "@compilot/js-sdk";
14
+ * import { createSdk } from "@compilot/js-sdk";
15
15
  *
16
- * const apiClient = createApiClient({ apiKey });
16
+ * const compilotSdk = createSdk({ apiKey });
17
17
  *
18
- * const customerStatus = await apiClient.getCustomerStatusByExternalCustomerId({
18
+ * const customerStatus = await compilotSdk.getCustomerStatusByExternalCustomerId({
19
19
  * externalCustomerId: "123",
20
20
  * });
21
21
  * ```
@@ -10,11 +10,11 @@ import type { CustomerStatus } from "@nexeraid/identity-schemas";
10
10
  *
11
11
  * @example
12
12
  * ```typescript
13
- * import { createApiClient } from "@compilot/js-sdk";
13
+ * import { createSdk } from "@compilot/js-sdk";
14
14
  *
15
- * const apiClient = createApiClient({ apiKey });
15
+ * const compilotSdk = createSdk({ apiKey });
16
16
  *
17
- * const customerStatus = await apiClient.getCustomerStatusByWallet({
17
+ * const customerStatus = await compilotSdk.getCustomerStatusByWallet({
18
18
  * walletAddress: "tz1abc",
19
19
  * workspaceId: "123",
20
20
  * });
@@ -9,11 +9,11 @@ import type { NexeraAPIClient } from "@nexeraid/api-client";
9
9
  *
10
10
  * @example
11
11
  * ```typescript
12
- * import { createApiClient } from "@compilot/js-sdk";
12
+ * import { createSdk } from "@compilot/js-sdk";
13
13
  *
14
- * const apiClient = createApiClient({ apiKey });
14
+ * const compilotSdk = createSdk({ apiKey });
15
15
  *
16
- * const wallets = await apiClient.getCustomerWallets({
16
+ * const wallets = await compilotSdk.getCustomerWallets({
17
17
  * customerId: "123",
18
18
  * });
19
19
  * ```
@@ -13,11 +13,11 @@ import { ExtendedTezosTxAuthDataSignatureResponse } from "@nexeraid/identity-sch
13
13
  *
14
14
  * Eip155:
15
15
  * ```typescript
16
- * import { createApiClient } from "@compilot/js-sdk";
16
+ * import { createSdk } from "@compilot/js-sdk";
17
17
  *
18
- * const apiClient = createApiClient({ apiKey });
18
+ * const compilotSdk = createSdk({ apiKey });
19
19
  *
20
- * const txAuthDataSignature = await apiClient.getTxAuthDataSignature({
20
+ * const txAuthDataSignature = await compilotSdk.getTxAuthDataSignature({
21
21
  * namespace: "eip155",
22
22
  * contractAbi: ExampleGatedNFTMinterABI,
23
23
  * contractAddress: "0x123",
@@ -0,0 +1,64 @@
1
+ import type { IdentityApiClient } from "@nexeraid/identity-api-client";
2
+ import type { AuthSession, VerifyChallengeParams } from "@nexeraid/identity-schemas";
3
+ /**
4
+ * Verify a challenge for a wallet. The web-sdk can use this to verify a signed message and prove ownership of a wallet.
5
+ *
6
+ * @param params The parameters to verify
7
+ * @returns A promise that resolves to the auth session
8
+ *
9
+ * @category Actions
10
+ *
11
+ * @example
12
+ *
13
+ * Basic usage:
14
+ *
15
+ * ```typescript
16
+ * import { createSdk } from "@compilot/js-sdk";
17
+ *
18
+ * const compilotSdk = createSdk({ apiKey });
19
+ *
20
+ * const challengeContent = await compilotSdk.verifyWeb3Challenge({
21
+ * address: "0xabc",
22
+ * namespace: "eip155",
23
+ * blockchainId: "1",
24
+ * message: ".....", // the challenge message
25
+ * signedMessage: ".....", // the signed message, some wallets need to process the message before signing
26
+ * signature: ".....", // the wallet signature of the signed message
27
+ * signerPublicKey: "0x...",
28
+ * });
29
+ * ```
30
+ *
31
+ * More often used as part of an api to protect the api key.
32
+ * Please find below an example of how to use the verifyWeb3Challenge function in Next.js:
33
+ *
34
+ * ```typescript
35
+ * import { createSdk } from "@compilot/js-sdk";
36
+ *
37
+ * const compilotSdk = createSdk({ apiKey });
38
+ *
39
+ * export default async function handler(req: NextApiRequest, res: NextApiResponse ) {
40
+ * if (req.method !== "POST") {
41
+ * res.setHeader("Allow", ["POST"]);
42
+ * res.status(405).end(`Method ${req.method} Not Allowed`);
43
+ * return;
44
+ * }
45
+ *
46
+ * const authSession = await compilotSdk.verifyWeb3Challenge({
47
+ * ...req.body
48
+ * });
49
+ *
50
+ * // now we know this user is authenticated, save the user address to the local database for future reference
51
+ * db.update(authSession.externalCustomerId, {
52
+ * address: req.body.address,
53
+ * });
54
+ *
55
+ * // Return the challenge to the client
56
+ * res.status(200).json(authSession);
57
+ * }
58
+ * ```
59
+ */
60
+ export type VerifyWeb3ChallengeFn = (params: VerifyChallengeParams) => Promise<AuthSession>;
61
+ export declare const verifyWeb3ChallengeFactory: (deps: {
62
+ identityApiClient: IdentityApiClient;
63
+ }) => VerifyWeb3ChallengeFn;
64
+ //# sourceMappingURL=verifyWeb3Challenge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verifyWeb3Challenge.d.ts","sourceRoot":"../../../../src/actions","sources":["verifyWeb3Challenge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,KAAK,EACV,WAAW,EACX,qBAAqB,EACtB,MAAM,4BAA4B,CAAC;AAEpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AACH,MAAM,MAAM,qBAAqB,GAAG,CAClC,MAAM,EAAE,qBAAqB,KAC1B,OAAO,CAAC,WAAW,CAAC,CAAC;AAE1B,eAAO,MAAM,0BAA0B,SAC9B;IAAE,iBAAiB,EAAE,iBAAiB,CAAA;CAAE,KAAG,qBAMjD,CAAC"}
@@ -11,6 +11,7 @@ export declare const createSdk: ({ apiKey, webhookSecret, }: {
11
11
  webhookSecret?: string;
12
12
  }) => {
13
13
  createWeb3Challenge: import("../actions/createWeb3Challenge.js").CreateWeb3ChallengeFn;
14
+ verifyWeb3Challenge: import("../actions/verifyWeb3Challenge.js").VerifyWeb3ChallengeFn;
14
15
  createSession: import("../actions/createWeb2Session.js").CreateWeb2SessionFn;
15
16
  getTxAuthDataSignature: import("../actions/getTxAuthDataSignature.js").GetTxAuthDataSignatureFn;
16
17
  attachCustomerInformation: import("../actions/attachCustomerInformation.js").AttachCustomerInformationFn;
@@ -1 +1 @@
1
- {"version":3,"file":"createSdk.d.ts","sourceRoot":"../../../../src/configuration","sources":["createSdk.ts"],"names":[],"mappings":"AAgBA;;;;;;;GAOG;AACH,eAAO,MAAM,SAAS,+BAGnB;IACD,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;;;;;;;;;;CA0CA,CAAC;AAEF,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC"}
1
+ {"version":3,"file":"createSdk.d.ts","sourceRoot":"../../../../src/configuration","sources":["createSdk.ts"],"names":[],"mappings":"AAiBA;;;;;;;GAOG;AACH,eAAO,MAAM,SAAS,+BAGnB;IACD,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;;;;;;;;;;;CA2CA,CAAC;AAEF,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC"}
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compilot/js-sdk",
3
- "version": "2.0.41",
3
+ "version": "2.0.43",
4
4
  "description": "ComPilot JS SDK",
5
5
  "keywords": [],
6
6
  "license": "ISC",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compilot/js-sdk",
3
- "version": "2.0.41-dev",
3
+ "version": "2.0.43-dev",
4
4
  "description": "ComPilot JS SDK",
5
5
  "keywords": [],
6
6
  "license": "ISC",
@@ -28,9 +28,9 @@
28
28
  "svix": "1.21.0",
29
29
  "zod": "^3.23.8",
30
30
  "@nexeraid/api-client": "1.10.2-dev",
31
- "@nexeraid/identity-api-client": "1.3.215-dev",
32
- "@nexeraid/identity-schemas": "1.12.38-dev",
33
- "@nexeraid/logger": "0.1.2-dev"
31
+ "@nexeraid/identity-schemas": "1.12.40-dev",
32
+ "@nexeraid/logger": "0.1.2-dev",
33
+ "@nexeraid/identity-api-client": "1.3.215-dev"
34
34
  },
35
35
  "devDependencies": {
36
36
  "prettier": "^3.3.3",
package/readme.md CHANGED
@@ -18,7 +18,7 @@ npm install @compilot/js-sdk
18
18
  /**
19
19
  * Create an API client and authenticate with your API key
20
20
  */
21
- const apiClient = createApiClient({
21
+ const compilotSdk = createSdk({
22
22
  apiKey: API_KEY,
23
23
  });
24
24
  ```
@@ -32,7 +32,7 @@ If you already have your own authentication system, you can create a user sessio
32
32
  * Get access token
33
33
  * This has to be done from secured server, to avoid leaking API_KEY
34
34
  */
35
- const sessionRes = await apiClient.createSession({
35
+ const sessionRes = await compilotSdk.createSession({
36
36
  /**
37
37
  * The workflow id that this session will be bound to.
38
38
  * You can find this id in compilot's dashboard.
@@ -50,13 +50,13 @@ const sessionRes = await apiClient.createSession({
50
50
  Please find below an example endpoint using express:
51
51
 
52
52
  ```javascript
53
- const apiClient = createApiClient({
53
+ const compilotSdk = createSdk({
54
54
  apiKey: API_KEY,
55
55
  });
56
56
 
57
57
  app.get('/my-compilot-auth', (req, res) => {
58
58
  const userId = req.userId;
59
- const authSession = await apiClient.createSession({
59
+ const authSession = await compilotSdk.createSession({
60
60
  workflowId: WORKFLOW_ID,
61
61
  externalUserId: userId,
62
62
  });