Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
94655a4
feat: add SafeCard validation with JIT signing checks
gomesalexandre Nov 26, 2025
cc6ec1e
chore: version packages to 1.62.13-gridplus-validation.7
gomesalexandre Nov 26, 2025
1a2de02
refactor: simplify validation API - throw instead of return isValid
gomesalexandre Nov 26, 2025
9963fd5
refactor: change isExternal to isInternal with reversed logic
gomesalexandre Nov 26, 2025
fed33f6
refactor: use type field and remove all console.logs
gomesalexandre Nov 26, 2025
df67c40
chore: version to 1.62.13-gridplus-validation.10
gomesalexandre Nov 26, 2025
a30995b
fix: use cached getActiveWallet instead of fetching again
gomesalexandre Nov 26, 2025
92bcc7f
refactor: rename walletUid to activeWalletId for consistency
gomesalexandre Nov 26, 2025
02f554f
fix: remove resetActiveWallets() call that cleared cache during pairing
gomesalexandre Nov 26, 2025
abf79f4
chore: restore resetActiveWallets() call in connectDevice()
gomesalexandre Nov 26, 2025
6b5a48f
feat: add specific error message for internal wallet access
gomesalexandre Nov 26, 2025
080c811
refactor: add isEmptyWallet helper for cleaner buffer comparisons
gomesalexandre Nov 26, 2025
4d193f4
refactor: optimize buffer comparison to avoid allocation
gomesalexandre Nov 26, 2025
980bb88
feat: add type-aware SafeCard validation error messages
gomesalexandre Nov 26, 2025
b9a90c7
feat: pass expectedType through all validation call paths
gomesalexandre Nov 26, 2025
f84db93
chore: revert package.json version bumps to master baseline
gomesalexandre Nov 26, 2025
f79fac9
chore: revert sandbox and integration package.json to master
gomesalexandre Nov 26, 2025
8b6bbd0
chore: restore comment explaining resetActiveWallets purpose
gomesalexandre Nov 26, 2025
e638101
chore: remove unnecessary braces and comment
gomesalexandre Nov 26, 2025
9779859
chore: remove redundant type annotation
gomesalexandre Nov 26, 2025
8cfee51
refactor: extract SafeCardType for reusability
gomesalexandre Nov 26, 2025
503a451
chore: remove unused walletName from validation return
gomesalexandre Nov 26, 2025
7f36a79
refactor: use viem zeroHash for cleaner empty wallet check
gomesalexandre Nov 26, 2025
63ec5fe
chore: lint fix - quote style
gomesalexandre Nov 26, 2025
45b2fee
refactor: rename isEmptyWallet to isZeroSafecardUid and fix stale com…
gomesalexandre Nov 26, 2025
d4763b4
refactor: rename to isSafecardDisconnected for clarity
gomesalexandre Nov 26, 2025
68f2227
refactor: reverse logic to isSafecardConnected for clarity
gomesalexandre Nov 26, 2025
adc51f4
refactor: throw error if expected ID not set before signing
gomesalexandre Nov 26, 2025
b00dfb2
[skip ci] trigger CI skip
gomesalexandre Nov 26, 2025
e1f9119
[skip ci] chore: remove unnecessary braces from single-line if
gomesalexandre Nov 26, 2025
7d31e00
[skip ci] chore: simplify error message
gomesalexandre Nov 26, 2025
acfa893
[skip ci] chore: add blank lines after guard clauses
gomesalexandre Nov 26, 2025
fc4723c
[skip ci] refactor: remove unused password parameter from connectDevice
gomesalexandre Nov 26, 2025
9cf7045
chore: trigger CI
gomesalexandre Nov 26, 2025
2938229
chore: version to 1.62.13-gridplus-validation.17
gomesalexandre Nov 26, 2025
be61514
[skip ci] refactor: export SafeCardType from gridplus and import in a…
gomesalexandre Nov 27, 2025
d5ed205
[skip ci] fix: update sandbox to destructure pairDevice result
gomesalexandre Nov 27, 2025
b99f6b8
Merge branch 'master' into feat_gridplus_validation_v2
gomesalexandre Nov 28, 2025
50218b2
chore: version packages to 1.62.16-bro-seriously-fml.0
gomesalexandre Nov 28, 2025
951a647
chore: update internal dependencies after prepublish build
gomesalexandre Nov 28, 2025
f26738b
chore: version packages to 1.62.16-bro-seriously-fml.1
gomesalexandre Nov 28, 2025
1e845ea
chore: update internal dependencies after prepublish build
gomesalexandre Nov 28, 2025
af2fe3b
feat: prepare for yeet
gomesalexandre Nov 28, 2025
3d5e95b
feat: yarn.lock too
gomesalexandre Nov 28, 2025
b32d09c
chore(release): publish 1.62.16
gomesalexandre Nov 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: add specific error message for internal wallet access
When expectedType is 'internal' and validation fails, throw more
specific error: "Remove inserted SafeCard to access internal GridPlus wallet"

This allows web to show different error messages for:
- External SafeCard mismatch: "Wrong SafeCard inserted..."
- Internal wallet blocked by external card: "Remove inserted SafeCard..."

Changes:
- Added expectedType property to track expected wallet type
- Updated setExpectedActiveWalletId() to accept optional type parameter
- Throw different error messages based on expected type

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
  • Loading branch information
gomesalexandre and claude committed Nov 26, 2025
commit 6b5a48fa87799c4ae54e026dddcee8e47deb466b
7 changes: 6 additions & 1 deletion packages/hdwallet-gridplus/src/gridplus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,14 +301,16 @@ export class GridPlusHDWallet

client: Client | undefined;
private expectedActiveWalletId?: string;
private expectedType?: 'external' | 'internal';

constructor(client: Client) {
super();
this.client = client;
}

public setExpectedActiveWalletId(activeWalletId: string): void {
public setExpectedActiveWalletId(activeWalletId: string, type?: 'external' | 'internal'): void {
this.expectedActiveWalletId = activeWalletId;
this.expectedType = type;
}

async cancel(): Promise<void> {}
Expand Down Expand Up @@ -410,6 +412,9 @@ export class GridPlusHDWallet

// Validate against expected activeWalletId if provided
if (expectedActiveWalletId && activeWalletId !== expectedActiveWalletId) {
if (this.expectedType === 'internal') {
throw new Error("Remove inserted SafeCard to access internal GridPlus wallet");
}
throw new Error("Active SafeCard doesn't match expected SafeCard");
}

Expand Down