Skip to content

Commit

Permalink
fix(encryption)!: change message signing prefix, closes #1328
Browse files Browse the repository at this point in the history
BREAKING CHANGE:
The message signing prefix was changed from `Stacks Message Signing` to `Stacks Signed Message`.
  • Loading branch information
janniks committed Sep 30, 2022
1 parent b2a5f96 commit 65ce121
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 212 deletions.
12 changes: 11 additions & 1 deletion .github/MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
- [Stacks.js (<=4.x.x) → (5.x.x)](#stacksjs-4xx--5xx)
- [Breaking Changes](#breaking-changes)
- [Buffer to Uint8Array](#buffer-to-uint8array)
- [Message Signing Prefix](#message-signing-prefix)
- [blockstack.js → Stacks.js (1.x.x)](#blockstackjs--stacksjs-1xx)
- [Auth](#auth)
- [Using blockstack.js](#using-blockstackjs)
Expand All @@ -18,7 +19,8 @@

### Breaking Changes

- To reduce the bundle sizes of applications using Stacks.js we are switching from Buffer (a polyfill to match Node.js APIs) to Uint8Arrays (which Buffers use in the background anyway). [Read more...](#buffer-to-uint8array)
- To reduce the bundle sizes of applications using Stacks.js, we are switching from Buffer (a polyfill to match Node.js APIs) to Uint8Arrays (which Buffers use in the background anyway). [Read more...](#buffer-to-uint8array)
- To allow message signing on Ledger hardware wallets, we are changing the message signing prefix. [Read more...]

#### Buffer to Uint8Array

Expand Down Expand Up @@ -55,6 +57,14 @@ Buffer.from([222, 173, 190, 239]).toString('hex'); // 'deadbeef'
bytesToHex(Uint8Array.from([222, 173, 190, 239])); // 'deadbeef'
```

#### Message Signing Prefix

The message signing prefix was changed from `Stacks Message Signing` to `Stacks Signed Message`.
The change relates to the functions `verifyMessageSignature`, `encodeMessage`, `decodeMessage`, and `hashMessage`.
The `verifyMessageSignature` functions was updated to verify against both the old and the new prefix (for unhashed message-input).
This will generate a different hash/signature from the same input compared to previous versions of Stacks.js.
If you have previously stored messages/signatures and compare to freshly generated ones, the messages/signatures will not match to previously stored.

---

## blockstack.js → Stacks.js (1.x.x)
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
branches:
- master
tags-ignore:
- "**"
- '**'

workflow_call:
workflow_dispatch:
Expand All @@ -18,10 +18,12 @@ jobs:
with:
node-version: 16
cache: npm

- run: npm ci

- name: Bootstrap lerna
run: npm run bootstrap

- name: Check bootstrap
run: |
if [[ -n $(git status -s) ]]; then
Expand All @@ -33,8 +35,10 @@ jobs:
- name: Run lint
run: npm run lint

- name: Run typecheck
run: npm run typecheck

- name: Check for circular dependencies
run: npm run madge

Expand Down

0 comments on commit 65ce121

Please sign in to comment.