Home / Function/ generateCspDigest() — astro Function Reference

generateCspDigest() — astro Function Reference

Architecture documentation for the generateCspDigest() function in encryption.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  c0e4ebb5_25cd_cd16_8001_a4d613706261["generateCspDigest()"]
  94fbb11e_4aa9_9dfd_28d5_cc0eb8749e6c["encryption.ts"]
  c0e4ebb5_25cd_cd16_8001_a4d613706261 -->|defined in| 94fbb11e_4aa9_9dfd_28d5_cc0eb8749e6c
  style c0e4ebb5_25cd_cd16_8001_a4d613706261 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/core/encryption.ts lines 123–128

export async function generateCspDigest(data: string, algorithm: CspAlgorithm): Promise<CspHash> {
	const hashBuffer = await crypto.subtle.digest(algorithm, encoder.encode(data));

	const hash = encodeBase64(new Uint8Array(hashBuffer));
	return `${ALGORITHMS[algorithm]}${hash}`;
}

Domain

Subdomains

Frequently Asked Questions

What does generateCspDigest() do?
generateCspDigest() is a function in the astro codebase, defined in packages/astro/src/core/encryption.ts.
Where is generateCspDigest() defined?
generateCspDigest() is defined in packages/astro/src/core/encryption.ts at line 123.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free