diff options
Diffstat (limited to 'worker/secret.ts')
-rw-r--r-- | worker/secret.ts | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/worker/secret.ts b/worker/secret.ts index 11daf06..071b539 100644 --- a/worker/secret.ts +++ b/worker/secret.ts @@ -39,12 +39,12 @@ export interface IVault<TClient, TKey, TItemId> { // -- <Vault> -- type TClient = ITraceable<unknown, LogMetricTraceSupplier>; -type TKey = { +export type BitwardenKey = { BW_SESSION: string; BITWARDENCLI_APPDATA_DIR: string; }; type TItemId = string; -export class Bitwarden implements IVault<TClient, TKey, TItemId> { +export class Bitwarden implements IVault<TClient, BitwardenKey, TItemId> { constructor(private readonly config: BitwardenConfig) {} public unlock(client: TClient) { @@ -52,7 +52,7 @@ export class Bitwarden implements IVault<TClient, TKey, TItemId> { .move(this.config) .flatMap(TraceUtil.withMetricTrace(Bitwarden.loginMetric)) .map((tConfig) => - Either.fromFailable<Error, { config: BitwardenConfig; key: Pick<TKey, 'BITWARDENCLI_APPDATA_DIR'> }>( + Either.fromFailable<Error, { config: BitwardenConfig; key: Pick<BitwardenKey, 'BITWARDENCLI_APPDATA_DIR'> }>( () => { const sessionPath = path.join(this.config.sessionBaseDirectory, randomUUID()); mkdirSync(sessionPath, { recursive: true }); @@ -78,7 +78,7 @@ export class Bitwarden implements IVault<TClient, TKey, TItemId> { .get(); } - public fetchSecret<T extends SecretItem>(client: TClient, key: TKey, item: string): Promise<IEither<Error, T>> { + public fetchSecret<T extends SecretItem>(client: TClient, key: BitwardenKey, item: string): Promise<IEither<Error, T>> { return client .move(key) .flatMap(TraceUtil.withMetricTrace(Bitwarden.fetchSecretMetric)) @@ -104,7 +104,7 @@ export class Bitwarden implements IVault<TClient, TKey, TItemId> { .get(); } - public lock(client: TClient, key: TKey) { + public lock(client: TClient, key: BitwardenKey) { return client .move(key) .flatMap(TraceUtil.withMetricTrace(Bitwarden.lockVaultMetric)) |