Home / Function/ createKeyFromString() — astro Function Reference

createKeyFromString() — astro Function Reference

Architecture documentation for the createKeyFromString() function in csp-server-islands.test.js from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  4fbd866f_9864_7e00_154e_4ecd81616f93["createKeyFromString()"]
  f70a7047_7ccc_b7ad_81e5_76bae835b053["csp-server-islands.test.js"]
  4fbd866f_9864_7e00_154e_4ecd81616f93 -->|defined in| f70a7047_7ccc_b7ad_81e5_76bae835b053
  01bb668a_4d4a_5361_54e0_3a9bf0d7505f["getEncryptedComponentExport()"]
  01bb668a_4d4a_5361_54e0_3a9bf0d7505f -->|calls| 4fbd866f_9864_7e00_154e_4ecd81616f93
  style 4fbd866f_9864_7e00_154e_4ecd81616f93 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/test/csp-server-islands.test.js lines 9–19

async function createKeyFromString(keyString) {
	const binaryString = atob(keyString);
	const bytes = new Uint8Array(binaryString.length);
	for (let i = 0; i < binaryString.length; i++) {
		bytes[i] = binaryString.charCodeAt(i);
	}
	return await crypto.subtle.importKey('raw', bytes, { name: 'AES-GCM' }, false, [
		'encrypt',
		'decrypt',
	]);
}

Subdomains

Frequently Asked Questions

What does createKeyFromString() do?
createKeyFromString() is a function in the astro codebase, defined in packages/astro/test/csp-server-islands.test.js.
Where is createKeyFromString() defined?
createKeyFromString() is defined in packages/astro/test/csp-server-islands.test.js at line 9.
What calls createKeyFromString()?
createKeyFromString() is called by 1 function(s): getEncryptedComponentExport.

Analyze Your Own Codebase

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

Try Supermodel Free