envpkt 0.17.0 → 0.18.0

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/index.d.ts CHANGED
@@ -387,19 +387,26 @@ type BootError = ConfigError | FnoxError | CatalogError | AliasError | {
387
387
  readonly configuredKeyFile?: string;
388
388
  } | IdentityError;
389
389
  type IdentityError = {
390
- readonly _tag: "AgeNotFound";
391
- readonly message: string;
390
+ readonly _tag: "IdentityNotFound";
391
+ readonly path: string;
392
392
  } | {
393
- readonly _tag: "DecryptFailed";
393
+ readonly _tag: "IdentityUnreadable";
394
+ readonly path: string;
394
395
  readonly message: string;
396
+ } | (IdentityFileError & {
397
+ readonly source: string;
398
+ });
399
+ /** Why an age identity (key) file can't be used for in-process decryption. Never carries key material. */
400
+ type IdentityFileError = {
401
+ readonly _tag: "NoIdentityKey";
395
402
  } | {
396
- readonly _tag: "IdentityNotFound";
397
- readonly path: string;
403
+ readonly _tag: "PassphraseProtectedIdentity";
404
+ } | {
405
+ readonly _tag: "UnsupportedIdentity";
406
+ readonly kind: "plugin" | "ssh" | "unknown";
407
+ readonly line: number;
398
408
  };
399
409
  type SealError = {
400
- readonly _tag: "AgeNotFound";
401
- readonly message: string;
402
- } | {
403
410
  readonly _tag: "EncryptFailed";
404
411
  readonly key: string;
405
412
  readonly message: string;
@@ -412,9 +419,6 @@ type SealError = {
412
419
  readonly message: string;
413
420
  };
414
421
  type KeygenError = {
415
- readonly _tag: "AgeNotFound";
416
- readonly message: string;
417
- } | {
418
422
  readonly _tag: "KeygenFailed";
419
423
  readonly message: string;
420
424
  } | {
@@ -579,10 +583,10 @@ declare const envCheck: (config: EnvpktConfig, env: Readonly<Record<string, stri
579
583
  declare const generateTomlFromScan: (matches: ReadonlyArray<MatchResult>) => string;
580
584
  //#endregion
581
585
  //#region src/core/boot.d.ts
582
- /** Programmatic boot — returns Either<BootError, BootResult> */
583
- declare const bootSafe: (options?: BootOptions) => Either<BootError, BootResult>;
584
- /** Programmatic boot — throws EnvpktBootError on failure (intentional throwing wrapper over bootSafe) */
585
- declare const boot: (options?: BootOptions) => BootResult;
586
+ /** Programmatic boot — resolves to Either<BootError, BootResult> */
587
+ declare const bootSafe: (options?: BootOptions) => Promise<Either<BootError, BootResult>>;
588
+ /** Programmatic boot — rejects with EnvpktBootError on failure (intentional throwing wrapper over bootSafe) */
589
+ declare const boot: (options?: BootOptions) => Promise<BootResult>;
586
590
  /** Error class for boot() failures */
587
591
  declare class EnvpktBootError extends Error {
588
592
  readonly error: BootError;
@@ -590,14 +594,17 @@ declare class EnvpktBootError extends Error {
590
594
  }
591
595
  //#endregion
592
596
  //#region src/core/seal.d.ts
593
- /** Encrypt a plaintext string using age with the given recipient public key (armored output) */
594
- declare const ageEncrypt: (plaintext: string, recipient: string) => Either<SealError, string>;
595
- /** Decrypt an age-armored ciphertext using the given identity file. The plaintext is returned as-is, untrimmed. */
596
- declare const ageDecrypt: (ciphertext: string, identityPath: string) => Either<SealError, string>;
597
+ /** Encrypt a plaintext string to an age recipient public key (armored output) */
598
+ declare const ageEncrypt: (plaintext: string, recipient: string) => Promise<Either<SealError, string>>;
599
+ /**
600
+ * Decrypt an age-armored ciphertext with any of the given secret keys (`AGE-SECRET-KEY-…`, as
601
+ * returned by `unwrapAgentKey`). The plaintext is returned as-is, untrimmed.
602
+ */
603
+ declare const ageDecrypt: (ciphertext: string, identities: ReadonlyArray<string>) => Promise<Either<SealError, string>>;
597
604
  /** Seal multiple secrets: encrypt each value with the recipient key and set encrypted_value on meta */
598
- declare const sealSecrets: (meta: Readonly<Record<string, SecretMeta>>, values: Readonly<Record<string, string>>, recipient: string) => Either<SealError, Record<string, SecretMeta>>;
599
- /** Unseal secrets: decrypt encrypted_value for each meta entry that has one */
600
- declare const unsealSecrets: (meta: Readonly<Record<string, SecretMeta>>, identityPath: string) => Either<SealError, Record<string, string>>;
605
+ declare const sealSecrets: (meta: Readonly<Record<string, SecretMeta>>, values: Readonly<Record<string, string>>, recipient: string) => Promise<Either<SealError, Record<string, SecretMeta>>>;
606
+ /** Unseal secrets: decrypt encrypted_value for each meta entry that has one, with any of `identities` */
607
+ declare const unsealSecrets: (meta: Readonly<Record<string, SecretMeta>>, identities: ReadonlyArray<string>) => Promise<Either<SealError, Record<string, string>>>;
601
608
  //#endregion
602
609
  //#region src/core/keygen.d.ts
603
610
  /** Resolve the age identity file path: ENVPKT_AGE_KEY_FILE env var > ~/.envpkt/age-key.txt */
@@ -607,7 +614,7 @@ declare const resolveInlineKey: () => Option<string>;
607
614
  /** Generate an age keypair and write to disk. Refuses to overwrite if the file already exists. */
608
615
  declare const generateKeypair: (options?: {
609
616
  readonly outputPath?: string;
610
- }) => Either<KeygenError, KeygenResult>;
617
+ }) => Promise<Either<KeygenError, KeygenResult>>;
611
618
  type UpdateIdentityOptions = {
612
619
  readonly recipient: string;
613
620
  readonly keyFile?: string;
@@ -742,14 +749,14 @@ declare const detectFnox: (dir: string) => Option<string>;
742
749
  declare const fnoxAvailable: () => boolean;
743
750
  //#endregion
744
751
  //#region src/fnox/identity.d.ts
745
- /** Check if the age CLI is available on PATH */
746
- declare const ageAvailable: () => boolean;
747
752
  /**
748
- * Extract the secret key from an age identity file (plain or encrypted).
749
- * - Plain identity files (from `age-keygen`) contain `AGE-SECRET-KEY-*` lines directly
750
- * - Encrypted identity files need `age --decrypt` to unwrap
753
+ * Read every secret key from a plain age identity file (as written by `envpkt keygen` or
754
+ * `age-keygen`). A missing or unreadable file, and passphrase-protected, plugin and SSH key files,
755
+ * are rejected with a typed error.
751
756
  */
752
- declare const unwrapAgentKey: (identityPath: string) => Either<IdentityError, string>;
757
+ declare const unwrapAgentKey: (identityPath: string) => Either<IdentityError, ReadonlyArray<string>>;
758
+ /** Explain an identity error. Never includes key material. */
759
+ declare const describeIdentityError: (err: IdentityError) => string;
753
760
  //#endregion
754
761
  //#region src/fnox/parse.d.ts
755
762
  /** Read and parse fnox.toml, extracting secret keys and profiles */
@@ -785,4 +792,4 @@ type ToolDef = {
785
792
  declare const toolDefinitions: readonly ToolDef[];
786
793
  declare const callTool: (name: string, args: Record<string, unknown>) => CallToolResult;
787
794
  //#endregion
788
- export { type AgentIdentity, AgentIdentitySchema, type AliasError, type AliasTable, type AuditResult, type BootError, type BootOptions, type BootResult, type CallbackConfig, CallbackConfigSchema, type CatalogError, type ChangedEntry, type CheckResult, type ConfidenceLevel, type ConfigDiff, type ConfigError, type ConfigSource, ConsumerType, type CredentialPattern, type DirectLogger, type DirectTestLoggerHandle, type DotenvEntry, type DriftEntry, type DriftStatus, type EnvAuditResult, type EnvDriftEntry, type EnvDriftStatus, type EnvMeta, EnvMetaSchema, EnvpktBootError, type EnvpktConfig, EnvpktConfigSchema, type FieldChange, type FleetAgent, type FleetHealth, type FnoxConfig, type FnoxError, type FnoxSecret, type FormatDotenvOptions, type FormatPacketOptions, type HealthStatus, type Identity, type IdentityError, IdentitySchema, type KeygenError, type KeygenResult, type LifecycleConfig, LifecycleConfigSchema, type LogEntry, type LogLevel, type LogMetadata, type MatchResult, type McpConfigError, type McpHeader, McpHeaderSchema, type McpHeadersError, type ResolveOptions, type ResolveResult, type ResolvedPath, type ScanOptions, type ScanResult, type SealError, type SecretDisplay, type SecretHealth, type SecretMeta, SecretMetaSchema, type SecretStatus, type SectionDiff, type TomlEditError, type ToolsConfig, ToolsConfigSchema, ageAvailable, ageDecrypt, ageEncrypt, appendSection, boot, bootSafe, buildMcpHeaders, callTool, compareFnoxAndEnvpkt, computeAudit, computeEnvAudit, copyableSecretMeta, createDirectConsoleLogger, createDirectTestLogger, createServer, deriveServiceFromName, detectFnox, diffConfigs, directSilentLogger, discoverConfig, envCheck, envScan, extractFnoxKeys, findConfigPath, fnoxAvailable, fnoxExport, fnoxGet, formatAliasError, formatDotenv, formatMcpHeadersError, formatPacket, generateKeypair, generateTomlFromScan, isEnvAlias, isSecretAlias, loadCatalog, loadConfig, loadConfigFromCwd, maskValue, matchEnvVar, matchValueShape, parseToml, quoteDotenvValue, readConfigFile, readFnoxConfig, readResource, removeSection, renameSection, replaceSection, resolveConfig, resolveConfigPath, resolveInlineKey, resolveKeyPath, resolveSecrets, resolveValues, resourceDefinitions, scanEnv, scanFleet, sealSecrets, serializeEnvBlock, serializeSecretBlock, startServer, toolDefinitions, unsealSecrets, unwrapAgentKey, updateConfigIdentity, updateSectionFields, validateAliases, validateConfig, validateMcpHeaders };
795
+ export { type AgentIdentity, AgentIdentitySchema, type AliasError, type AliasTable, type AuditResult, type BootError, type BootOptions, type BootResult, type CallbackConfig, CallbackConfigSchema, type CatalogError, type ChangedEntry, type CheckResult, type ConfidenceLevel, type ConfigDiff, type ConfigError, type ConfigSource, ConsumerType, type CredentialPattern, type DirectLogger, type DirectTestLoggerHandle, type DotenvEntry, type DriftEntry, type DriftStatus, type EnvAuditResult, type EnvDriftEntry, type EnvDriftStatus, type EnvMeta, EnvMetaSchema, EnvpktBootError, type EnvpktConfig, EnvpktConfigSchema, type FieldChange, type FleetAgent, type FleetHealth, type FnoxConfig, type FnoxError, type FnoxSecret, type FormatDotenvOptions, type FormatPacketOptions, type HealthStatus, type Identity, type IdentityError, type IdentityFileError, IdentitySchema, type KeygenError, type KeygenResult, type LifecycleConfig, LifecycleConfigSchema, type LogEntry, type LogLevel, type LogMetadata, type MatchResult, type McpConfigError, type McpHeader, McpHeaderSchema, type McpHeadersError, type ResolveOptions, type ResolveResult, type ResolvedPath, type ScanOptions, type ScanResult, type SealError, type SecretDisplay, type SecretHealth, type SecretMeta, SecretMetaSchema, type SecretStatus, type SectionDiff, type TomlEditError, type ToolsConfig, ToolsConfigSchema, ageDecrypt, ageEncrypt, appendSection, boot, bootSafe, buildMcpHeaders, callTool, compareFnoxAndEnvpkt, computeAudit, computeEnvAudit, copyableSecretMeta, createDirectConsoleLogger, createDirectTestLogger, createServer, deriveServiceFromName, describeIdentityError, detectFnox, diffConfigs, directSilentLogger, discoverConfig, envCheck, envScan, extractFnoxKeys, findConfigPath, fnoxAvailable, fnoxExport, fnoxGet, formatAliasError, formatDotenv, formatMcpHeadersError, formatPacket, generateKeypair, generateTomlFromScan, isEnvAlias, isSecretAlias, loadCatalog, loadConfig, loadConfigFromCwd, maskValue, matchEnvVar, matchValueShape, parseToml, quoteDotenvValue, readConfigFile, readFnoxConfig, readResource, removeSection, renameSection, replaceSection, resolveConfig, resolveConfigPath, resolveInlineKey, resolveKeyPath, resolveSecrets, resolveValues, resourceDefinitions, scanEnv, scanFleet, sealSecrets, serializeEnvBlock, serializeSecretBlock, startServer, toolDefinitions, unsealSecrets, unwrapAgentKey, updateConfigIdentity, updateSectionFields, validateAliases, validateConfig, validateMcpHeaders };