We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I am using a custom provider which signs URLs using HMAC-SHA256. If async getImage is not supported, the image URL may not be generated correctly.
If we aim to support #276 in the future, async getImage support will also be necessary.
import { subtle } from 'uncrypto'; async function sign(salt: string, target: string, secret: string, size = 32): Promise<string> { if (!salt || !secret) return ''; const encoder = new TextEncoder(); const secretEncoded = encoder.encode(secret); const key = await subtle.importKey( 'raw', secretEncoded, { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'], ); const saltEncoded = encoder.encode(salt); const targetEncoded = encoder.encode(target); const data = new Uint8Array([...saltEncoded, ...targetEncoded]); const signature = await subtle.sign('HMAC', key, data); return arrayBufferToBase64Url(signature.slice(0, size)); }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I am using a custom provider which signs URLs using HMAC-SHA256. If async getImage is not supported, the image URL may not be generated correctly.
If we aim to support #276 in the future, async getImage support will also be necessary.
The text was updated successfully, but these errors were encountered: