MCPcopy Create free account
hub / github.com/anomalyco/opencode / generateRandomString

Function generateRandomString

packages/opencode/src/plugin/xai.ts:62–67  ·  view source on GitHub ↗
(length: number)

Source from the content-addressed store, hash-verified

60}
61
62function generateRandomString(length: number): string {
63 const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~"
64 return Array.from(crypto.getRandomValues(new Uint8Array(length)))
65 .map((b) => chars[b % chars.length])
66 .join("")
67}
68
69function base64UrlEncode(buffer: ArrayBuffer): string {
70 const binary = String.fromCharCode(...new Uint8Array(buffer))

Callers 1

generatePKCEFunction · 0.70

Calls 1

fromMethod · 0.45

Tested by

no test coverage detected