Skip to content

feat: replace base 58 and 64 pkgs with scure/base - #1846

Open
pradel wants to merge 1 commit into
stx-labs:mainfrom
pradel:feat/replace-base-apis-with-scure-pkg
Open

feat: replace base 58 and 64 pkgs with scure/base#1846
pradel wants to merge 1 commit into
stx-labs:mainfrom
pradel:feat/replace-base-apis-with-scure-pkg

Conversation

@pradel

@pradel pradel commented Mar 24, 2026

Copy link
Copy Markdown
Contributor

Description

Replace the bs58, bs58check, and base64-js npm packages with the independently audited @scure/base package (v1.2.6) across @stacks/encryption, @stacks/storage and @stacks/stacking. This reduces the number of dependencies bundled with the apps.

Breaking change?

No. The API surface is identical — base58.encode/decode, base64.encode/decode, and createBase58check(sha256).encode/decode all have the same signatures and behavior.

Checklist

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Replaces bs58, bs58check, and base64-js usage with @scure/base to reduce direct dependencies while keeping the same encoding/decoding behavior across the Stacks encryption/storage packages.

Changes:

  • Swap base64 encoding/decoding from base64-js to @scure/base in encryption + storage code paths.
  • Swap base58 encoding/decoding from bs58 to @scure/base in encryption and update related unit tests.
  • Update workspace dependency manifests/lockfile to add @scure/base and remove direct bs58 / base64-js deps.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/storage/tests/storage.test.ts Updates tests to decode legacy Gaia token using @scure/base base64.
packages/storage/src/hub.ts Uses @scure/base for legacy auth token base64 encoding.
packages/storage/package.json Adds @scure/base, removes direct base64-js dependency.
packages/stacking/package.json Bumps @scure/base and removes bs58 from dependencies.
packages/encryption/tests/keys.test.ts Updates base58check test to use createBase58check(sha256) from @scure/base.
packages/encryption/src/keys.ts Replaces bs58 with @scure/base base58 implementation.
packages/encryption/src/ec.ts Replaces base64 encode/decode in ECIES payloads with @scure/base.
packages/encryption/package.json Adds @scure/base, removes direct base64-js / bs58 and related type/dev deps.
package.json Removes @types/bs58check from repo root devDependencies.
package-lock.json Lockfile updates reflecting dependency removals/additions across workspaces.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/encryption/src/ec.ts
Comment thread packages/stacking/package.json
@pradel

pradel commented Mar 30, 2026

Copy link
Copy Markdown
Contributor Author

@jannik-stacks ready for review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants