Skip to content

Commit

Permalink
adjust signJson typings
Browse files Browse the repository at this point in the history
  • Loading branch information
ggazzo committed Dec 6, 2024
1 parent ff7b807 commit 6e8bc1f
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions packages/main/src/signJson.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,24 @@ export type SignedEvent<T extends EventBase> = T & {
};
};

export async function signJson<T extends EventBase>(
type SignedJson<T extends object> = T & {
signatures: {
[key: string]: {
[key: string]: string;
};
};
};

export async function signJson<
T extends object & {
signatures?: Record<string, Record<string, string>>;
unsigned?: Record<string, any>;
},
>(
jsonObject: T,
signingKey: SigningKey,
signingName?: string,
): Promise<SignedEvent<T>> {
): Promise<SignedJson<T>> {
const keyId: ProtocolVersionKey = `${signingKey.algorithm}:${signingKey.version}`;
const { signatures = {}, unsigned, ...rest } = jsonObject;

Expand Down

0 comments on commit 6e8bc1f

Please sign in to comment.