Fix NSFW settings by signing client mutations and handling locked identities
Hop-State: A_06FP8RGGWKVFCFAHNJBQWT0 Hop-Proposal: R_06FP8RG166W8E071QG1PYWG Hop-Task: T_06FP8QVS84N3BR04V6F3GJG Hop-Attempt: AT_06FP8QVS87X77VCAYKNHKF0
This commit is contained in:
@@ -29,6 +29,13 @@ export interface SignedAction {
|
||||
sig: string;
|
||||
}
|
||||
|
||||
export class SignedActionError extends Error {
|
||||
constructor(message: string) {
|
||||
super(message);
|
||||
this.name = 'SignedActionError';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify a signed action against a specific public key
|
||||
*/
|
||||
@@ -146,7 +153,7 @@ export async function requireSignedAction(signedAction: SignedAction): Promise<t
|
||||
const result = await verifyUserAction(signedAction);
|
||||
|
||||
if (!result.valid) {
|
||||
throw new Error(result.error || 'Invalid signature');
|
||||
throw new SignedActionError(result.error || 'Invalid signature');
|
||||
}
|
||||
|
||||
return result.user!;
|
||||
|
||||
Reference in New Issue
Block a user