MCPcopy Create free account
hub / github.com/different-ai/opencode-browser / computeExtensionIdFromKey

Function computeExtensionIdFromKey

bin/cli.js:123–141  ·  view source on GitHub ↗
(key)

Source from the content-addressed store, hash-verified

121}
122
123function computeExtensionIdFromKey(key) {
124 try {
125 const raw = String(key || "").trim();
126 if (!raw) return null;
127 const buffer = Buffer.from(raw, "base64");
128 if (!buffer.length) return null;
129 const hash = createHash("sha256").update(buffer).digest();
130 const bytes = hash.subarray(0, 16);
131 return Array.from(bytes)
132 .map((b) => {
133 const hi = b >> 4;
134 const lo = b & 15;
135 return String.fromCharCode(97 + hi) + String.fromCharCode(97 + lo);
136 })
137 .join("");
138 } catch {
139 return null;
140 }
141}
142
143function getExtensionIdFromManifest() {
144 const manifest = readExtensionManifest();

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected