Member Junction
    Preparing search index...

    Interface ResolvedCredential<T>

    The resolved credential with its values and source information.

    interface ResolvedCredential<
        T extends Record<string, string> = Record<string, string>,
    > {
        credential: MJCredentialEntity;
        expiresAt?: Date;
        source: "database" | "request";
        values: T;
    }

    Type Parameters

    • T extends Record<string, string> = Record<string, string>

      The shape of the credential values (defaults to Record<string, string>)

    Index

    Properties

    credential: MJCredentialEntity

    The credential entity if loaded from database. Will be null if directValues was provided.

    expiresAt?: Date

    Optional expiration date from the credential. Null if no expiration is set.

    source: "database" | "request"

    Where the credential came from.

    • 'database': Loaded from the Credentials table
    • 'request': Provided via directValues option
    values: T

    The decrypted credential values, typed according to the credential type's FieldSchema.

    For example, for an "API Key" type credential:

    interface APIKeyValues {
    apiKey: string;
    }
    const cred = await engine.getCredential<APIKeyValues>('OpenAI', options);
    console.log(cred.values.apiKey); // Strongly typed!