mirror of
https://github.com/whyour/qinglong.git
synced 2026-09-21 01:00:24 +08:00
25 lines
1.0 KiB
TypeScript
25 lines
1.0 KiB
TypeScript
import type { CompletionReceipt } from '../../domain/completionReceipt';
|
|
import { matchesWorkerExecutionCompletionReceiptAuthentication } from '../../domain/workerExecutionCompletionReceiptAuthentication';
|
|
import type { WorkerExecutionOfferJournalRecord } from '../../domain/workerExecutionOffer';
|
|
import type { WorkerExecutionCompletionReceiptAuthenticator } from '../../ports/workerExecutionCompletionReceiptAuthenticator';
|
|
|
|
export class Sha256WorkerExecutionCompletionReceiptAuthenticator
|
|
implements WorkerExecutionCompletionReceiptAuthenticator
|
|
{
|
|
authenticate(
|
|
receipt: CompletionReceipt,
|
|
record: WorkerExecutionOfferJournalRecord,
|
|
): boolean {
|
|
if (
|
|
record.completionReceiptCallbackSequence === undefined ||
|
|
record.completionReceiptTokenDigest === undefined
|
|
) {
|
|
return false;
|
|
}
|
|
return matchesWorkerExecutionCompletionReceiptAuthentication(receipt, {
|
|
callbackSequence: record.completionReceiptCallbackSequence,
|
|
tokenDigest: record.completionReceiptTokenDigest,
|
|
});
|
|
}
|
|
}
|