@settlemint/sdk-js 2.1.1-prc71cad32 → 2.1.1-prcb1d9c8d
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 +4 -4
- package/dist/settlemint.cjs +13 -17
- package/dist/settlemint.cjs.map +1 -1
- package/dist/settlemint.d.cts +15 -4
- package/dist/settlemint.d.ts +15 -4
- package/dist/settlemint.mjs +13 -17
- package/dist/settlemint.mjs.map +1 -1
- package/package.json +2 -2
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`](#settlemintclient)
|
|
63
63
|
|
|
64
|
-
Defined in: [settlemint.ts:
|
|
64
|
+
Defined in: [settlemint.ts:223](https://github.com/settlemint/sdk/blob/v2.1.1/sdk/js/src/settlemint.ts#L223)
|
|
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
|
+
Defined in: [settlemint.ts:117](https://github.com/settlemint/sdk/blob/v2.1.1/sdk/js/src/settlemint.ts#L117)
|
|
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:
|
|
119
|
+
Defined in: [settlemint.ts:109](https://github.com/settlemint/sdk/blob/v2.1.1/sdk/js/src/settlemint.ts#L109)
|
|
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/v2.1.1/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:
|
|
132
|
+
| <a id="anonymous"></a> `anonymous?` | `boolean` | `undefined` | Whether to allow anonymous access (no access token required) | - | [settlemint.ts:111](https://github.com/settlemint/sdk/blob/v2.1.1/sdk/js/src/settlemint.ts#L111) |
|
|
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/v2.1.1/sdk/js/src/helpers/client-options.schema.ts#L11) |
|
|
134
134
|
|
|
135
135
|
### Type Aliases
|
package/dist/settlemint.cjs
CHANGED
|
@@ -1546,26 +1546,20 @@ function generateResponse(pincode, salt, challenge) {
|
|
|
1546
1546
|
const hashedPincode = hashPincode(pincode, salt);
|
|
1547
1547
|
return (0, import_node_crypto.createHash)("sha256").update(`${hashedPincode}_${challenge}`).digest("hex");
|
|
1548
1548
|
}
|
|
1549
|
-
async function
|
|
1549
|
+
async function getPincodeVerificationChallenges({
|
|
1550
1550
|
userWalletAddress,
|
|
1551
|
-
pincode,
|
|
1552
1551
|
accessToken,
|
|
1553
1552
|
instance,
|
|
1554
1553
|
nodeId
|
|
1555
1554
|
}) {
|
|
1556
1555
|
const response = await fetch(
|
|
1557
|
-
`${instance}/cm/nodes/${encodeURIComponent(nodeId)}/user-wallets/${encodeURIComponent(userWalletAddress)}/verifications/challenges`,
|
|
1556
|
+
`${instance}/cm/nodes/${encodeURIComponent(nodeId)}/user-wallets/${encodeURIComponent(userWalletAddress)}/verifications/challenges?type=PINCODE`,
|
|
1558
1557
|
{
|
|
1559
1558
|
method: "POST",
|
|
1560
1559
|
headers: {
|
|
1561
1560
|
"Content-Type": "application/json",
|
|
1562
1561
|
"x-auth-token": accessToken
|
|
1563
|
-
}
|
|
1564
|
-
body: JSON.stringify({
|
|
1565
|
-
pincode,
|
|
1566
|
-
verificationType: "PINCODE",
|
|
1567
|
-
name: "pincode"
|
|
1568
|
-
})
|
|
1562
|
+
}
|
|
1569
1563
|
}
|
|
1570
1564
|
);
|
|
1571
1565
|
if (!response.ok) {
|
|
@@ -1575,15 +1569,16 @@ async function getPincodeVerificationResponse({
|
|
|
1575
1569
|
throw new Error("Failed to get verification challenge");
|
|
1576
1570
|
}
|
|
1577
1571
|
const verificationChallenges = await response.json();
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1572
|
+
return verificationChallenges;
|
|
1573
|
+
}
|
|
1574
|
+
function getPincodeVerificationChallengeResponse({
|
|
1575
|
+
verificationChallenge,
|
|
1576
|
+
pincode
|
|
1577
|
+
}) {
|
|
1578
|
+
if (!verificationChallenge?.challenge?.secret || !verificationChallenge?.challenge?.salt) {
|
|
1584
1579
|
throw new Error("Could not authenticate pin code, invalid challenge format");
|
|
1585
1580
|
}
|
|
1586
|
-
const { secret, salt } = challenge;
|
|
1581
|
+
const { secret, salt } = verificationChallenge.challenge;
|
|
1587
1582
|
return generateResponse(pincode, salt, secret);
|
|
1588
1583
|
}
|
|
1589
1584
|
|
|
@@ -1690,7 +1685,8 @@ function createSettleMintClient(options) {
|
|
|
1690
1685
|
config: getPlatformConfig(gqlClient)
|
|
1691
1686
|
},
|
|
1692
1687
|
wallet: {
|
|
1693
|
-
|
|
1688
|
+
pincodeVerificationChallengeResponse: getPincodeVerificationChallengeResponse,
|
|
1689
|
+
pincodeVerificationChallenges: (args) => getPincodeVerificationChallenges({
|
|
1694
1690
|
...args,
|
|
1695
1691
|
instance: validatedOptions.instance,
|
|
1696
1692
|
accessToken: validatedOptions.accessToken
|