MCPcopy Create free account
hub / github.com/cloudflare/templates / stringToArrayBuffer

Function stringToArrayBuffer

x402-proxy-template/src/jwt.ts:44–47  ·  view source on GitHub ↗

* Convert string to Uint8Array

(str: string)

Source from the content-addressed store, hash-verified

42 * Convert string to Uint8Array
43 */
44function stringToArrayBuffer(str: string): Uint8Array {
45 const encoder = new TextEncoder();
46 return encoder.encode(str);
47}
48
49/**
50 * Convert BufferSource to string

Callers 3

importSecretKeyFunction · 0.85
generateJWTFunction · 0.85
verifyJWTFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected