MCPcopy Index your code
hub / github.com/chronark/envshare / encodeCompositeKey

Function encodeCompositeKey

pkg/encoding.ts:6–13  ·  view source on GitHub ↗
(version: number, id: string, encryptionKey: Uint8Array)

Source from the content-addressed store, hash-verified

4 * To share links easily, we encode the id, where the data is stored in redis, together with the secret encryption key.
5 */
6export function encodeCompositeKey(version: number, id: string, encryptionKey: Uint8Array): string {
7 if (version < 0 || version > 255) {
8 throw new Error("Version must fit in a byte");
9 }
10 const compositeKey = new Uint8Array([version, ...fromBase58(id), ...encryptionKey]);
11
12 return toBase58(compositeKey);
13}
14
15/**
16 * To share links easily, we encode the id, where the data is stored in redis, together with the secret encryption key.

Callers 2

encoding.test.tsFile · 0.90
onSubmitFunction · 0.90

Calls 2

fromBase58Function · 0.90
toBase58Function · 0.90

Tested by

no test coverage detected