Skip to content

refactor(keychain): add call scope restrictions, builder, and call encoders#34

Merged
grandizzy merged 2 commits intomainfrom
georgen/keychain-call-scope-restrictions
Apr 8, 2026
Merged

refactor(keychain): add call scope restrictions, builder, and call encoders#34
grandizzy merged 2 commits intomainfrom
georgen/keychain-call-scope-restrictions

Conversation

@decofe
Copy link
Copy Markdown
Member

@decofe decofe commented Apr 8, 2026

Port review feedback from tempoxyz/tempo#3469 to tempo-go, matching the Rust SDK and pytempo#43.

Changes

  • Add SelectorRule and CallScope types with per-selector recipient filtering
  • Add CallScopeBuilder with WithSelector(), Transfer(), Approve(), TransferWithMemo(), Unrestricted()
  • Add KeyRestrictions with private fields and getters (IsUnrestricted, IsCallAllowed, Expiry, Limits, AllowedCalls)
  • Add call builders: AuthorizeKey, SetAllowedCalls, RemoveAllowedCalls, RevokeKey, UpdateSpendingLimit
  • Add validation: conflicting allowAnyCalls + allowedCalls, duplicate CallScope targets, nil restrictions guard

Testing

go test ./pkg/keychain/ -v -count=1  # 42 passed
go vet ./pkg/keychain/               # clean
go fmt ./pkg/keychain/               # clean

Prompted by: georgen

…coders

Port review feedback from tempoxyz/tempo#3469:
- Add SelectorRule and CallScope types with per-selector recipient filtering
- Add CallScopeBuilder with WithSelector, Transfer, Approve, TransferWithMemo
- Add KeyRestrictions with private fields, getters (IsUnrestricted, IsCallAllowed, Expiry, Limits, AllowedCalls)
- Add AuthorizeKey, SetAllowedCalls, RemoveAllowedCalls, RevokeKey, UpdateSpendingLimit call builders
- Add validation: conflicting allowAnyCalls+allowedCalls, duplicate targets, nil restrictions

Amp-Thread-ID: https://ampcode.com/threads/T-019d6cdc-3b11-77fb-ba20-20f949093528
…ecompile functions

Co-authored-by: georgen <129292+georgen@users.noreply.github.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019d6cdc-3b11-77fb-ba20-20f949093528
@grandizzy grandizzy marked this pull request as ready for review April 8, 2026 12:16
@grandizzy grandizzy requested review from 0xrusowsky and onbjerg April 8, 2026 12:17
@grandizzy grandizzy merged commit 497f195 into main Apr 8, 2026
8 checks passed
@grandizzy grandizzy deleted the georgen/keychain-call-scope-restrictions branch April 8, 2026 13:40
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.

3 participants