diff --git a/README.md b/README.md index e6bab99..4163b43 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@ - `onion3` - `skynet` - `arweave` +- `walrus` ## 📥 Install diff --git a/src/map.ts b/src/map.ts index 7103314..0c404a0 100644 --- a/src/map.ts +++ b/src/map.ts @@ -6,6 +6,7 @@ export const codeToName = { 0x01bd: "onion3", 0xb19910: "skynet", 0xb29910: "arweave", + 0xb59910: "walrus", } as const; export const nameToCode = { @@ -16,6 +17,7 @@ export const nameToCode = { onion3: 0x01bd, skynet: 0xb19910, arweave: 0xb29910, + walrus: 0xb59910, } as const; export type CodecId = keyof typeof codeToName; diff --git a/src/profiles.ts b/src/profiles.ts index 8060f41..c90f012 100644 --- a/src/profiles.ts +++ b/src/profiles.ts @@ -114,6 +114,9 @@ const encodes = { arweave: (value: string): Bytes => { return base64Decode(value); }, + walrus: (value: string): Bytes => { + return hexStringToBytes(value); + } }; /** @@ -150,6 +153,9 @@ const decodes = { base64: (value: Bytes): string => { return base64url.encode(value).substring(1); }, + hex: (value: Bytes): string => { + return bytesToHexString(value); + }, }; export type Profile = { @@ -183,6 +189,10 @@ export const profiles = { encode: encodes.arweave, decode: decodes.base64, }, + walrus: { + encode: encodes.walrus, + decode: decodes.hex, + }, default: { encode: encodes.utf8, decode: decodes.utf8, diff --git a/tsconfig.base.json b/tsconfig.base.json index 3be3fbb..1457290 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -31,7 +31,7 @@ "importHelpers": true, // This is only used for build validation. Since we do not have `tslib` installed, this will fail if we accidentally make use of anything that'd require injection of helpers. // Language and environment - "moduleResolution": "NodeNext", + "moduleResolution": "Node", "module": "ESNext", "target": "ES2021", // Setting this to `ES2021` enables native support for `Node v16+`: https://github.com/microsoft/TypeScript/wiki/Node-Target-Mapping.