INNER CODE UNIT · TypeScript

function

vercel/server-components-notes-demo · libs/session.ts:37

  return async function (data) {
    const pwHash = await crypto.subtle.digest('SHA-256', pwUtf8)
    const encryptKey = await crypto.subtle.importKey(
      'raw',
      pwHash,
      algo,
      false,
      ['encrypt']
    )
    const encrypted = await crypto.subtle.encrypt(
      algo,
      encryptKey,
      encode(data)
    )
    return arrayBufferToBase64(encrypted)
  }
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…