passwd-sso-cli 0.4.28 → 0.4.30

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.
@@ -5,6 +5,28 @@
5
5
  * Socket: $XDG_RUNTIME_DIR/passwd-sso/decrypt.sock
6
6
  * Protocol: newline-delimited JSON over Unix domain socket
7
7
  */
8
+ import type { Socket } from "node:net";
9
+ import { z } from "zod";
10
+ export declare const DecryptRequestSchema: z.ZodObject<{
11
+ entryId: z.ZodString;
12
+ clientId: z.ZodString;
13
+ field: z.ZodDefault<z.ZodEnum<{
14
+ title: "title";
15
+ username: "username";
16
+ password: "password";
17
+ url: "url";
18
+ notes: "notes";
19
+ totp: "totp";
20
+ _json: "_json";
21
+ }>>;
22
+ }, z.core.$strip>;
23
+ export interface DecryptResponse {
24
+ ok: boolean;
25
+ value?: string;
26
+ error?: string;
27
+ }
28
+ export declare const MAX_BUFFER_SIZE: number;
29
+ export declare function handleConnection(socket: Socket): void;
8
30
  export interface DecryptAgentOptions {
9
31
  eval?: boolean;
10
32
  }
@@ -17,7 +17,7 @@ import { getEncryptionKey, getUserId, getSecretKeyBytes, setEncryptionKey } from
17
17
  import { readPassphrase, unlockWithPassphrase } from "./unlock.js";
18
18
  import * as output from "../lib/output.js";
19
19
  // ─── Input Validation Schema ───────────────────────────────────
20
- const DecryptRequestSchema = z.object({
20
+ export const DecryptRequestSchema = z.object({
21
21
  entryId: z.string().regex(/^[a-zA-Z0-9_-]{1,100}$/),
22
22
  clientId: z.string().startsWith("mcpc_").max(100),
23
23
  field: z.enum(["password", "username", "url", "notes", "totp", "title", "_json"]).default("password"),
@@ -114,8 +114,8 @@ async function handleDecryptRequest(req) {
114
114
  }
115
115
  }
116
116
  // ─── Connection Handler ────────────────────────────────────────
117
- const MAX_BUFFER_SIZE = 64 * 1024; // 64KB — far more than any valid request
118
- function handleConnection(socket) {
117
+ export const MAX_BUFFER_SIZE = 64 * 1024; // 64KB — far more than any valid request
118
+ export function handleConnection(socket) {
119
119
  let buffer = "";
120
120
  socket.on("data", (chunk) => {
121
121
  buffer += chunk.toString("utf-8");
package/dist/index.js CHANGED
@@ -189,12 +189,12 @@ async function interactiveMode() {
189
189
  const idx = lengthIdx !== -1 ? lengthIdx : lengthIdx2;
190
190
  const rawLength = idx !== -1 ? args[idx + 1] : undefined;
191
191
  const parsedLength = rawLength && !rawLength.startsWith("-") ? parseInt(rawLength, 10) : NaN;
192
- if (idx !== -1 && (isNaN(parsedLength) || parsedLength <= 0)) {
192
+ if (idx !== -1 && (Number.isNaN(parsedLength) || parsedLength <= 0)) {
193
193
  output.error("Usage: generate [-l <number>] [--copy]");
194
194
  break;
195
195
  }
196
196
  await generateCommand({
197
- length: isNaN(parsedLength) ? 20 : parsedLength,
197
+ length: Number.isNaN(parsedLength) ? 20 : parsedLength,
198
198
  copy: args.includes("--copy") || args.includes("-c"),
199
199
  json: args.includes("--json"),
200
200
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "passwd-sso-cli",
3
- "version": "0.4.28",
3
+ "version": "0.4.30",
4
4
  "description": "CLI for passwd-sso password manager",
5
5
  "type": "module",
6
6
  "license": "MIT",