MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / makeKeychainExtension

Function makeKeychainExtension

packages/plugins/keychain/src/index.ts:52–72  ·  view source on GitHub ↗
(
  _ctx: PluginCtx<unknown>,
  options: KeychainPluginConfig | undefined,
)

Source from the content-addressed store, hash-verified

50// ---------------------------------------------------------------------------
51
52const makeKeychainExtension = (
53 _ctx: PluginCtx<unknown>,
54 options: KeychainPluginConfig | undefined,
55) => {
56 const serviceName = resolveServiceName(options?.serviceName);
57 return {
58 /** Human-readable name for the keychain on this platform */
59 displayName: displayName(),
60
61 /** Whether the current platform supports system keychain */
62 isSupported: isSupportedPlatform(),
63
64 /** Check if a secret exists in the system keychain. `id` is the opaque
65 * provider item id (the keychain account); v2 has no scope partitioning. */
66 has: (id: string) =>
67 getPassword(serviceName, id).pipe(
68 Effect.map((value: string | null) => value !== null),
69 Effect.orElseSucceed(() => false),
70 ),
71 };
72};
73
74export const keychainPlugin = definePlugin((options?: KeychainPluginConfig) => ({
75 id: "keychain" as const,

Callers 1

index.tsFile · 0.85

Calls 4

resolveServiceNameFunction · 0.90
displayNameFunction · 0.90
isSupportedPlatformFunction · 0.90
getPasswordFunction · 0.90

Tested by

no test coverage detected