From 31cffb97d29b3f9f67ab477571c9dbe4f3e3232c Mon Sep 17 00:00:00 2001 From: Marcos Candeia Date: Tue, 6 Aug 2024 22:37:10 -0300 Subject: [PATCH] JSR Fixes Signed-off-by: Marcos Candeia --- async/event.ts | 4 ++-- client/init.ts | 4 ++-- security/fetch.ts | 2 +- security/identity.ts | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/async/event.ts b/async/event.ts index 743d506..3c275d8 100644 --- a/async/event.ts +++ b/async/event.ts @@ -5,7 +5,7 @@ export class Event { constructor() { this.#waiter = deferred(); } - async wait() { + async wait(): Promise { if (this.#waiter) { await this.#waiter; } @@ -22,7 +22,7 @@ export class Event { this.#waiter = deferred(); } } - is_set() { + is_set(): boolean { return !this.#waiter; } } diff --git a/client/init.ts b/client/init.ts index f6da76b..c22267b 100644 --- a/client/init.ts +++ b/client/init.ts @@ -17,7 +17,7 @@ export interface ClientOptions { audience?: string; } export let defaultOpts: ClientOptions | null = null; -export const init = (opts: ClientOptions) => { +export const init = (opts: ClientOptions): void => { defaultOpts = opts; }; @@ -160,7 +160,7 @@ export const signal = async ( event: string, payload: unknown, opts?: ClientOptions, -) => { +): Promise => { await fetchSuccessResponse( `/executions/${id}/signals/${event}`, opts, diff --git a/security/fetch.ts b/security/fetch.ts index e9c9285..7995909 100644 --- a/security/fetch.ts +++ b/security/fetch.ts @@ -11,7 +11,7 @@ export const signedFetch = async ( input: FetchParams[0], init?: FetchParams[1], key?: PromiseOrValue, -) => { +): Promise => { const req = new Request(input, init); if (!req.headers.has("host")) { req.headers.set("host", new URL(req.url).host); diff --git a/security/identity.ts b/security/identity.ts index 7820709..293eb33 100644 --- a/security/identity.ts +++ b/security/identity.ts @@ -13,7 +13,7 @@ const getPkCrypto = async () => { return await pkCrypto; }; -const getPublicKey = async () => { +const getPublicKey = async (): Promise => { const [publicKey] = await getKeyPair(); return publicKey; }; @@ -61,7 +61,7 @@ const parseSignatureHeader = (sig: string): Record => { const keyId = "durable-workers-key"; // should be /.well_known/jwks.json -export const wellKnownJWKSHandler = async () => +export const wellKnownJWKSHandler: () => Promise = async (): Promise => Response.json({ keys: [{ ...await getPublicKey(), kid: keyId }] }); export const fetchPublicKey = async ( @@ -156,7 +156,7 @@ const stringToSHA256 = (txt: string) => { /** * Encode a given message to string. */ -export const stringToBase64SHA256 = async (txt: string) => { +export const stringToBase64SHA256 = async (txt: string): Promise => { return await stringToSHA256(txt).then((encoded) => encode(new Uint8Array(encoded)) );