Send hotlink access token hash on upload; keep secret client-side only.
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
export const hashHotlinkAccessToken = async (accessToken: string): Promise<string> => {
|
||||
const encoder = new TextEncoder();
|
||||
|
||||
const data = encoder.encode(accessToken);
|
||||
|
||||
const digest = await crypto.subtle.digest('SHA-256', data);
|
||||
|
||||
return [...new Uint8Array(digest)].map(byte => byte.toString(16).padStart(2, '0')).join('');
|
||||
};
|
||||
Reference in New Issue
Block a user