@settlemint/sdk-js 1.1.3-prf89024e6 → 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/README.md CHANGED
@@ -61,7 +61,7 @@ The SettleMint JavaScript SDK provides a type-safe wrapper around the SettleMint
61
61
 
62
62
  > **createSettleMintClient**(`options`): [`SettlemintClient`](README.md#settlemintclient)
63
63
 
64
- Defined in: [settlemint.ts:216](https://github.com/settlemint/sdk/blob/v1.1.3/sdk/js/src/settlemint.ts#L216)
64
+ Defined in: [settlemint.ts:210](https://github.com/settlemint/sdk/blob/v1.1.3/sdk/js/src/settlemint.ts#L210)
65
65
 
66
66
  Creates a SettleMint client with the provided options. The client provides methods to interact with
67
67
  various SettleMint resources like workspaces, applications, blockchain networks, blockchain nodes, middleware,
@@ -108,7 +108,7 @@ const workspace = await client.workspace.read('workspace-unique-name');
108
108
 
109
109
  #### SettlemintClient
110
110
 
111
- Defined in: [settlemint.ts:111](https://github.com/settlemint/sdk/blob/v1.1.3/sdk/js/src/settlemint.ts#L111)
111
+ Defined in: [settlemint.ts:110](https://github.com/settlemint/sdk/blob/v1.1.3/sdk/js/src/settlemint.ts#L110)
112
112
 
113
113
  Client interface for interacting with the SettleMint platform.
114
114
 
@@ -116,7 +116,7 @@ Client interface for interacting with the SettleMint platform.
116
116
 
117
117
  #### SettlemintClientOptions
118
118
 
119
- Defined in: [settlemint.ts:103](https://github.com/settlemint/sdk/blob/v1.1.3/sdk/js/src/settlemint.ts#L103)
119
+ Defined in: [settlemint.ts:102](https://github.com/settlemint/sdk/blob/v1.1.3/sdk/js/src/settlemint.ts#L102)
120
120
 
121
121
  Options for the Settlemint client.
122
122
 
@@ -129,7 +129,7 @@ Options for the Settlemint client.
129
129
  | Property | Type | Default value | Description | Inherited from | Defined in |
130
130
  | ------ | ------ | ------ | ------ | ------ | ------ |
131
131
  | <a id="accesstoken"></a> `accessToken` | `string` | `AccessTokenSchema` | The access token used to authenticate with the SettleMint platform | `ClientOptions.accessToken` | [helpers/client-options.schema.ts:9](https://github.com/settlemint/sdk/blob/v1.1.3/sdk/js/src/helpers/client-options.schema.ts#L9) |
132
- | <a id="anonymous"></a> `anonymous?` | `boolean` | `undefined` | Whether to allow anonymous access (no access token required) | - | [settlemint.ts:105](https://github.com/settlemint/sdk/blob/v1.1.3/sdk/js/src/settlemint.ts#L105) |
132
+ | <a id="anonymous"></a> `anonymous?` | `boolean` | `undefined` | Whether to allow anonymous access (no access token required) | - | [settlemint.ts:104](https://github.com/settlemint/sdk/blob/v1.1.3/sdk/js/src/settlemint.ts#L104) |
133
133
  | <a id="instance"></a> `instance` | `string` | `UrlSchema` | The URL of the SettleMint instance to connect to | `ClientOptions.instance` | [helpers/client-options.schema.ts:11](https://github.com/settlemint/sdk/blob/v1.1.3/sdk/js/src/helpers/client-options.schema.ts#L11) |
134
134
 
135
135
  ### Type Aliases
@@ -1527,56 +1527,6 @@ var ClientOptionsSchema = import_zod.z.object({
1527
1527
  instance: import_validation2.UrlSchema
1528
1528
  });
1529
1529
 
1530
- // src/pincode-verification.ts
1531
- var import_node_crypto = require("crypto");
1532
- function hashPincode(pincode, salt) {
1533
- return (0, import_node_crypto.createHash)("sha256").update(`${salt}${pincode}`).digest("hex");
1534
- }
1535
- function generateResponse(pincode, salt, challenge) {
1536
- const hashedPincode = hashPincode(pincode, salt);
1537
- return (0, import_node_crypto.createHash)("sha256").update(`${hashedPincode}_${challenge}`).digest("hex");
1538
- }
1539
- async function getPincodeVerificationResponse({
1540
- userWalletAddress,
1541
- pincode,
1542
- accessToken,
1543
- instance,
1544
- nodeId
1545
- }) {
1546
- const response = await fetch(
1547
- `${instance}/cm/nodes/${encodeURIComponent(nodeId)}/user-wallets/${encodeURIComponent(userWalletAddress)}/verifications/challenges`,
1548
- {
1549
- method: "POST",
1550
- headers: {
1551
- "Content-Type": "application/json",
1552
- "x-auth-token": accessToken
1553
- },
1554
- body: JSON.stringify({
1555
- pincode,
1556
- verificationType: "PINCODE",
1557
- name: "pincode"
1558
- })
1559
- }
1560
- );
1561
- if (!response.ok) {
1562
- if (response.status === 404) {
1563
- throw new Error(`No user wallet found with address '${userWalletAddress}' for node '${nodeId}'`);
1564
- }
1565
- throw new Error("Failed to get verification challenge");
1566
- }
1567
- const verificationChallenges = await response.json();
1568
- if (!verificationChallenges.length) {
1569
- throw new Error("No verification challenges received");
1570
- }
1571
- const firstChallenge = verificationChallenges[0];
1572
- const challenge = firstChallenge?.challenge;
1573
- if (!challenge?.secret || !challenge?.salt) {
1574
- throw new Error("Could not authenticate pin code, invalid challenge format");
1575
- }
1576
- const { secret, salt } = challenge;
1577
- return generateResponse(pincode, salt, secret);
1578
- }
1579
-
1580
1530
  // src/settlemint.ts
1581
1531
  function createSettleMintClient(options) {
1582
1532
  (0, import_runtime.ensureServer)();
@@ -1678,13 +1628,6 @@ function createSettleMintClient(options) {
1678
1628
  },
1679
1629
  platform: {
1680
1630
  config: getPlatformConfig(gqlClient)
1681
- },
1682
- wallet: {
1683
- pincodeVerificationResponse: (args) => getPincodeVerificationResponse({
1684
- ...args,
1685
- instance: validatedOptions.instance,
1686
- accessToken: validatedOptions.accessToken
1687
- })
1688
1631
  }
1689
1632
  };
1690
1633
  }