@topolo/sdk 0.21.0 → 0.21.1
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/node/credential-store.cjs +26 -10
- package/dist/node/credential-store.js +26 -10
- package/package.json +2 -2
|
@@ -481,6 +481,22 @@ var import_node_fs = require("fs");
|
|
|
481
481
|
var import_node_os = require("os");
|
|
482
482
|
var import_node_path = require("path");
|
|
483
483
|
var KEYCHAIN_SERVICE = "topolo-external-agent-installation";
|
|
484
|
+
var MACOS_KEYCHAIN_WRITE_SCRIPT = [
|
|
485
|
+
"log_user 0",
|
|
486
|
+
"set timeout 10",
|
|
487
|
+
"set secret [gets stdin]",
|
|
488
|
+
"spawn -noecho /usr/bin/security add-generic-password -U -a $env(TOPOLO_KEYCHAIN_ACCOUNT) -s $env(TOPOLO_KEYCHAIN_SERVICE) -w",
|
|
489
|
+
"for {set prompt 0} {$prompt < 2} {incr prompt} {",
|
|
490
|
+
" expect {",
|
|
491
|
+
' -re {(?i)password} { send -- "$secret\\r" }',
|
|
492
|
+
" timeout { exit 70 }",
|
|
493
|
+
" eof { exit 71 }",
|
|
494
|
+
" }",
|
|
495
|
+
"}",
|
|
496
|
+
"expect eof",
|
|
497
|
+
"set result [wait]",
|
|
498
|
+
"exit [lindex $result 3]"
|
|
499
|
+
].join("\n");
|
|
484
500
|
function installationStorePath() {
|
|
485
501
|
const override = process.env.TOPOLO_INSTALLATIONS_PATH?.trim();
|
|
486
502
|
if (override) return override;
|
|
@@ -507,16 +523,16 @@ function createPlatformInstallationSecretBackend(options = {}) {
|
|
|
507
523
|
if (platform2 === "darwin") {
|
|
508
524
|
return {
|
|
509
525
|
async set(account, value) {
|
|
510
|
-
runOrThrow(spawn("
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
"
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
526
|
+
runOrThrow(spawn("/usr/bin/expect", ["-c", MACOS_KEYCHAIN_WRITE_SCRIPT], {
|
|
527
|
+
input: `${value}
|
|
528
|
+
`,
|
|
529
|
+
encoding: "utf8",
|
|
530
|
+
env: {
|
|
531
|
+
...process.env,
|
|
532
|
+
TOPOLO_KEYCHAIN_ACCOUNT: account,
|
|
533
|
+
TOPOLO_KEYCHAIN_SERVICE: KEYCHAIN_SERVICE
|
|
534
|
+
}
|
|
535
|
+
}), "macOS Keychain write");
|
|
520
536
|
},
|
|
521
537
|
async get(account) {
|
|
522
538
|
const result = spawn("security", [
|
|
@@ -428,6 +428,22 @@ import { existsSync } from "fs";
|
|
|
428
428
|
import { homedir, platform as hostPlatform } from "os";
|
|
429
429
|
import { dirname, join } from "path";
|
|
430
430
|
var KEYCHAIN_SERVICE = "topolo-external-agent-installation";
|
|
431
|
+
var MACOS_KEYCHAIN_WRITE_SCRIPT = [
|
|
432
|
+
"log_user 0",
|
|
433
|
+
"set timeout 10",
|
|
434
|
+
"set secret [gets stdin]",
|
|
435
|
+
"spawn -noecho /usr/bin/security add-generic-password -U -a $env(TOPOLO_KEYCHAIN_ACCOUNT) -s $env(TOPOLO_KEYCHAIN_SERVICE) -w",
|
|
436
|
+
"for {set prompt 0} {$prompt < 2} {incr prompt} {",
|
|
437
|
+
" expect {",
|
|
438
|
+
' -re {(?i)password} { send -- "$secret\\r" }',
|
|
439
|
+
" timeout { exit 70 }",
|
|
440
|
+
" eof { exit 71 }",
|
|
441
|
+
" }",
|
|
442
|
+
"}",
|
|
443
|
+
"expect eof",
|
|
444
|
+
"set result [wait]",
|
|
445
|
+
"exit [lindex $result 3]"
|
|
446
|
+
].join("\n");
|
|
431
447
|
function installationStorePath() {
|
|
432
448
|
const override = process.env.TOPOLO_INSTALLATIONS_PATH?.trim();
|
|
433
449
|
if (override) return override;
|
|
@@ -454,16 +470,16 @@ function createPlatformInstallationSecretBackend(options = {}) {
|
|
|
454
470
|
if (platform2 === "darwin") {
|
|
455
471
|
return {
|
|
456
472
|
async set(account, value) {
|
|
457
|
-
runOrThrow(spawn("
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
"
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
473
|
+
runOrThrow(spawn("/usr/bin/expect", ["-c", MACOS_KEYCHAIN_WRITE_SCRIPT], {
|
|
474
|
+
input: `${value}
|
|
475
|
+
`,
|
|
476
|
+
encoding: "utf8",
|
|
477
|
+
env: {
|
|
478
|
+
...process.env,
|
|
479
|
+
TOPOLO_KEYCHAIN_ACCOUNT: account,
|
|
480
|
+
TOPOLO_KEYCHAIN_SERVICE: KEYCHAIN_SERVICE
|
|
481
|
+
}
|
|
482
|
+
}), "macOS Keychain write");
|
|
467
483
|
},
|
|
468
484
|
async get(account) {
|
|
469
485
|
const result = spawn("security", [
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@topolo/sdk",
|
|
3
3
|
"packageManager": "pnpm@10.17.1",
|
|
4
|
-
"version": "0.21.
|
|
5
|
-
"topoloPublishedVersion": "0.21.
|
|
4
|
+
"version": "0.21.1",
|
|
5
|
+
"topoloPublishedVersion": "0.21.1",
|
|
6
6
|
"description": "Typed client SDK for the Topolo platform. Used by TopoloCli, TopoloMCP, and third-party agents.",
|
|
7
7
|
"license": "UNLICENSED",
|
|
8
8
|
"author": "Topolo",
|