@settlemint/sdk-cli 2.1.1-main4ec969e5 → 2.1.1-main579e87d8
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/cli.js +47 -27
- package/dist/cli.js.map +8 -7
- package/package.json +3 -3
package/dist/cli.js
CHANGED
@@ -245278,7 +245278,7 @@ function pruneCurrentEnv(currentEnv, env2) {
|
|
245278
245278
|
var package_default = {
|
245279
245279
|
name: "@settlemint/sdk-cli",
|
245280
245280
|
description: "Command-line interface for SettleMint SDK, providing development tools and project management capabilities",
|
245281
|
-
version: "2.1.1-
|
245281
|
+
version: "2.1.1-main579e87d8",
|
245282
245282
|
type: "module",
|
245283
245283
|
private: false,
|
245284
245284
|
license: "FSL-1.1-MIT",
|
@@ -245327,8 +245327,8 @@ var package_default = {
|
|
245327
245327
|
"@inquirer/input": "4.1.9",
|
245328
245328
|
"@inquirer/password": "4.0.12",
|
245329
245329
|
"@inquirer/select": "4.1.1",
|
245330
|
-
"@settlemint/sdk-js": "2.1.1-
|
245331
|
-
"@settlemint/sdk-utils": "2.1.1-
|
245330
|
+
"@settlemint/sdk-js": "2.1.1-main579e87d8",
|
245331
|
+
"@settlemint/sdk-utils": "2.1.1-main579e87d8",
|
245332
245332
|
"@types/node": "22.14.1",
|
245333
245333
|
"@types/semver": "7.7.0",
|
245334
245334
|
"@types/which": "3.0.4",
|
@@ -248684,24 +248684,18 @@ function generateResponse(pincode, salt, challenge) {
|
|
248684
248684
|
const hashedPincode = hashPincode(pincode, salt);
|
248685
248685
|
return createHash("sha256").update(`${hashedPincode}_${challenge}`).digest("hex");
|
248686
248686
|
}
|
248687
|
-
async function
|
248687
|
+
async function getPincodeVerificationChallenges({
|
248688
248688
|
userWalletAddress,
|
248689
|
-
pincode,
|
248690
248689
|
accessToken,
|
248691
248690
|
instance,
|
248692
248691
|
nodeId
|
248693
248692
|
}) {
|
248694
|
-
const response = await fetch(`${instance}/cm/nodes/${encodeURIComponent(nodeId)}/user-wallets/${encodeURIComponent(userWalletAddress)}/verifications/challenges`, {
|
248693
|
+
const response = await fetch(`${instance}/cm/nodes/${encodeURIComponent(nodeId)}/user-wallets/${encodeURIComponent(userWalletAddress)}/verifications/challenges?type=PINCODE`, {
|
248695
248694
|
method: "POST",
|
248696
248695
|
headers: {
|
248697
248696
|
"Content-Type": "application/json",
|
248698
248697
|
"x-auth-token": accessToken
|
248699
|
-
}
|
248700
|
-
body: JSON.stringify({
|
248701
|
-
pincode,
|
248702
|
-
verificationType: "PINCODE",
|
248703
|
-
name: "pincode"
|
248704
|
-
})
|
248698
|
+
}
|
248705
248699
|
});
|
248706
248700
|
if (!response.ok) {
|
248707
248701
|
if (response.status === 404) {
|
@@ -248710,15 +248704,16 @@ async function getPincodeVerificationResponse({
|
|
248710
248704
|
throw new Error("Failed to get verification challenge");
|
248711
248705
|
}
|
248712
248706
|
const verificationChallenges = await response.json();
|
248713
|
-
|
248714
|
-
|
248715
|
-
|
248716
|
-
|
248717
|
-
|
248718
|
-
|
248707
|
+
return verificationChallenges;
|
248708
|
+
}
|
248709
|
+
function getPincodeVerificationChallengeResponse({
|
248710
|
+
verificationChallenge,
|
248711
|
+
pincode
|
248712
|
+
}) {
|
248713
|
+
if (!verificationChallenge?.challenge?.secret || !verificationChallenge?.challenge?.salt) {
|
248719
248714
|
throw new Error("Could not authenticate pin code, invalid challenge format");
|
248720
248715
|
}
|
248721
|
-
const { secret, salt } = challenge;
|
248716
|
+
const { secret, salt } = verificationChallenge.challenge;
|
248722
248717
|
return generateResponse(pincode, salt, secret);
|
248723
248718
|
}
|
248724
248719
|
function createSettleMintClient(options) {
|
@@ -248820,7 +248815,8 @@ function createSettleMintClient(options) {
|
|
248820
248815
|
config: getPlatformConfig(gqlClient)
|
248821
248816
|
},
|
248822
248817
|
wallet: {
|
248823
|
-
|
248818
|
+
pincodeVerificationChallengeResponse: getPincodeVerificationChallengeResponse,
|
248819
|
+
pincodeVerificationChallenges: (args) => getPincodeVerificationChallenges({
|
248824
248820
|
...args,
|
248825
248821
|
instance: validatedOptions.instance,
|
248826
248822
|
accessToken: validatedOptions.accessToken
|
@@ -251894,7 +251890,6 @@ async function codegenMinio(env2) {
|
|
251894
251890
|
|
251895
251891
|
export const { client } = createServerMinioClient({
|
251896
251892
|
instance: process.env.SETTLEMINT_MINIO_ENDPOINT!,
|
251897
|
-
accessToken: process.env.SETTLEMINT_ACCESS_TOKEN!,
|
251898
251893
|
accessKey: process.env.SETTLEMINT_MINIO_ACCESS_KEY!,
|
251899
251894
|
secretKey: process.env.SETTLEMINT_MINIO_SECRET_KEY!
|
251900
251895
|
});`;
|
@@ -256500,6 +256495,27 @@ function logoutCommand() {
|
|
256500
256495
|
});
|
256501
256496
|
}
|
256502
256497
|
|
256498
|
+
// src/prompts/pincode-verification.prompt.ts
|
256499
|
+
async function pincodeVerificationPrompt(verificationChallenges) {
|
256500
|
+
if (verificationChallenges.length === 0) {
|
256501
|
+
cancel2("No pincode is configured");
|
256502
|
+
}
|
256503
|
+
if (verificationChallenges.length === 1) {
|
256504
|
+
return verificationChallenges[0];
|
256505
|
+
}
|
256506
|
+
const verificationChallenge = await esm_default3({
|
256507
|
+
message: "Which pincode verification do you want to use?",
|
256508
|
+
choices: verificationChallenges.map((verificationChallenge2) => ({
|
256509
|
+
name: verificationChallenge2.name,
|
256510
|
+
value: verificationChallenge2
|
256511
|
+
}))
|
256512
|
+
});
|
256513
|
+
if (!verificationChallenge) {
|
256514
|
+
cancel2("No pincode verification challenge selected");
|
256515
|
+
}
|
256516
|
+
return verificationChallenge;
|
256517
|
+
}
|
256518
|
+
|
256503
256519
|
// src/commands/pincode-verification-response.ts
|
256504
256520
|
function pincodeVerificationResponseCommand() {
|
256505
256521
|
return new Command("pincode-verification-response").alias("pvr").description("Get pincode verification response for a blockchain node").requiredOption("--wallet-address <walletAddress>", "The wallet address to get pincode verification response for").option("-i, --instance <instance>", "The instance to connect to (defaults to the instance in the .env file)").option("--blockchain-node <blockchainNode>", "Blockchain Node unique name to get pincode verification response for").action(async ({ instance, blockchainNode, walletAddress }) => {
|
@@ -256531,6 +256547,11 @@ function pincodeVerificationResponseCommand() {
|
|
256531
256547
|
return nothingSelectedError("blockchain node");
|
256532
256548
|
}
|
256533
256549
|
}
|
256550
|
+
const pincodeVerificationChallenges = await settlemint.wallet.pincodeVerificationChallenges({
|
256551
|
+
userWalletAddress: walletAddress,
|
256552
|
+
nodeId: selectedBlockchainNode.id
|
256553
|
+
});
|
256554
|
+
const verificationChallenge = await pincodeVerificationPrompt(pincodeVerificationChallenges);
|
256534
256555
|
const pincode = await esm_default5({
|
256535
256556
|
message: "Enter your pincode",
|
256536
256557
|
validate(value4) {
|
@@ -256540,10 +256561,9 @@ function pincodeVerificationResponseCommand() {
|
|
256540
256561
|
return true;
|
256541
256562
|
}
|
256542
256563
|
});
|
256543
|
-
const pincodeVerificationResponse =
|
256544
|
-
|
256545
|
-
pincode
|
256546
|
-
nodeId: selectedBlockchainNode.id
|
256564
|
+
const pincodeVerificationResponse = settlemint.wallet.pincodeVerificationChallengeResponse({
|
256565
|
+
verificationChallenge,
|
256566
|
+
pincode
|
256547
256567
|
});
|
256548
256568
|
note(`Pincode verification response: ${pincodeVerificationResponse}`);
|
256549
256569
|
outro("Pincode verification response generated");
|
@@ -256597,7 +256617,7 @@ async function waitForCompletion({
|
|
256597
256617
|
} else {
|
256598
256618
|
note(`${capitalizeFirstLetter2(type4)} failed to ${getActionLabel(action)}`);
|
256599
256619
|
}
|
256600
|
-
return
|
256620
|
+
return false;
|
256601
256621
|
}
|
256602
256622
|
if (spinner2) {
|
256603
256623
|
spinner2.text = `${capitalizeFirstLetter2(type4)} is not ready yet (status: ${resource.status})`;
|
@@ -259873,4 +259893,4 @@ async function sdkCliCommand(argv = process.argv) {
|
|
259873
259893
|
// src/cli.ts
|
259874
259894
|
sdkCliCommand();
|
259875
259895
|
|
259876
|
-
//# debugId=
|
259896
|
+
//# debugId=F027455EA1DE3D5E64756E2164756E21
|