Skip to content

feat: add public GetSecurityInfo and FlashMD5 API methods#21

Merged
deadprogram merged 2 commits intotinygo-org:mainfrom
jgangemi:jae/upstream-public-api
Apr 11, 2026
Merged

feat: add public GetSecurityInfo and FlashMD5 API methods#21
deadprogram merged 2 commits intotinygo-org:mainfrom
jgangemi:jae/upstream-public-api

Conversation

@jgangemi
Copy link
Copy Markdown
Contributor

@jgangemi jgangemi commented Apr 9, 2026

Summary

  • Expose GetSecurityInfo() for querying device security/fuse status
  • Expose FlashMD5(offset, size) for verifying flash region contents by hash
  • Add stub loader guard to EraseRegion (previously would fail with a confusing error when called without stub)

Use case

These public methods enable tools built on espflasher to verify flash contents and query device security state without reimplementing the protocol layer.

Note: CLI subcommands for these methods will be submitted as a follow-up PR after the library changes are accepted.

Test plan

  • go test -v ./pkg/espflasher/... — all tests pass
  • TestFlashMD5RequiresStub verifies stub guard
  • TestGetSecurityInfo verifies response parsing
  • golangci-lint run ./pkg/espflasher/... — no new issues

@jgangemi jgangemi force-pushed the jae/upstream-public-api branch 3 times, most recently from 65806df to 1d8ef29 Compare April 11, 2026 15:08
Comment thread pkg/espflasher/flasher.go Outdated
jgangemi and others added 2 commits April 11, 2026 09:32
GET_SECURITY_INFO (0x14) is ROM-only; stub returns 0xC0. Cache the
response during detectChip() and return it from readSecurityInfo().

When stub is loaded and no cached info is available, return
UnsupportedCommandError with guidance to use ChipAuto.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jgangemi jgangemi force-pushed the jae/upstream-public-api branch from 1d8ef29 to fbf9ec1 Compare April 11, 2026 15:32
@deadprogram
Copy link
Copy Markdown
Member

Thanks for adding this and making my requested changes! 😸 now squash/merging.

@deadprogram deadprogram merged commit b62650b into tinygo-org:main Apr 11, 2026
3 checks passed
@deadprogram
Copy link
Copy Markdown
Member

Also note I removed this since tools do not get credit, only the humans who use them:

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@jgangemi
Copy link
Copy Markdown
Contributor Author

no worries - i just like to clarify it's not actually me making these changes. i'm smart but not that smart. 🙃

@jgangemi jgangemi deleted the jae/upstream-public-api branch April 11, 2026 16:00
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