@atomist/sdm-core
Version:
Atomist Software Delivery Machine - Implementation
37 lines • 1.71 kB
TypeScript
import { GraphClientListener, HandlerContext } from "@atomist/automation-client";
import { GoalSigningAlgorithm, GoalSigningConfiguration, SdmGoalEvent } from "@atomist/sdm";
import { SdmGoalMessage } from "@atomist/sdm/lib/api/goal/SdmGoalMessage";
import { DeepPartial } from "ts-essentials";
export interface SignatureMixin {
signature: string;
}
export declare const DefaultGoalSigningAlgorithm: GoalSigningAlgorithm<string>;
/**
* AutomationEventListener that verifies incoming SDM goals against a set of configurable
* verification public keys.
*
* Optionally a private key can be specified to sign outgoing goals. Setting this is strongly
* recommended to prevent executing untrusted and/or tampered SDM goals.
*/
export declare class GoalSigningAutomationEventListener implements GraphClientListener {
private readonly gsc;
constructor(gsc: GoalSigningConfiguration);
operationStarting(operation: any): any;
private initVerificationKeys;
}
/**
* Verify a goal signature against the public keys configured in provided Configuration.
* If signature can't be verified, the goal will be marked as failed and an Error will be thrown.
* @param goal goal to verify
* @param gsc signing configuration
* @param ctx
*/
export declare function verifyGoal(goal: SdmGoalEvent & DeepPartial<SignatureMixin>, gsc: GoalSigningConfiguration, ctx: HandlerContext): Promise<void>;
/**
* Add a signature to a goal
* @param goal
* @param gsc
*/
export declare function signGoal(goal: SdmGoalMessage, gsc: GoalSigningConfiguration): SdmGoalMessage & SignatureMixin;
export declare function normalizeGoal(goal: SdmGoalMessage | SdmGoalEvent): string;
//# sourceMappingURL=goalSigning.d.ts.map