Skip to content

Commit

Permalink
JSR Fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Marcos Candeia <[email protected]>
  • Loading branch information
mcandeia committed Aug 7, 2024
1 parent d2776d8 commit 31cffb9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions async/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export class Event {
constructor() {
this.#waiter = deferred();
}
async wait() {
async wait(): Promise<boolean> {
if (this.#waiter) {
await this.#waiter;
}
Expand All @@ -22,7 +22,7 @@ export class Event {
this.#waiter = deferred();
}
}
is_set() {
is_set(): boolean {
return !this.#waiter;
}
}
4 changes: 2 additions & 2 deletions client/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand Down Expand Up @@ -160,7 +160,7 @@ export const signal = async (
event: string,
payload: unknown,
opts?: ClientOptions,
) => {
): Promise<void> => {
await fetchSuccessResponse(
`/executions/${id}/signals/${event}`,
opts,
Expand Down
2 changes: 1 addition & 1 deletion security/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const signedFetch = async (
input: FetchParams[0],
init?: FetchParams[1],
key?: PromiseOrValue<CryptoKey>,
) => {
): Promise<Response> => {
const req = new Request(input, init);
if (!req.headers.has("host")) {
req.headers.set("host", new URL(req.url).host);
Expand Down
6 changes: 3 additions & 3 deletions security/identity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const getPkCrypto = async () => {
return await pkCrypto;
};

const getPublicKey = async () => {
const getPublicKey = async (): Promise<JsonWebKey> => {
const [publicKey] = await getKeyPair();
return publicKey;
};
Expand Down Expand Up @@ -61,7 +61,7 @@ const parseSignatureHeader = (sig: string): Record<string, string> => {
const keyId = "durable-workers-key";

// should be /.well_known/jwks.json
export const wellKnownJWKSHandler = async () =>
export const wellKnownJWKSHandler: () => Promise<Response> = async (): Promise<Response> =>
Response.json({ keys: [{ ...await getPublicKey(), kid: keyId }] });

export const fetchPublicKey = async (
Expand Down Expand Up @@ -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<string> => {
return await stringToSHA256(txt).then((encoded) =>
encode(new Uint8Array(encoded))
);
Expand Down

0 comments on commit 31cffb9

Please sign in to comment.