diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-02-19 12:33:51 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-02-19 12:33:51 +0900 |
| commit | 2978a6f046f52861a7ac749d1e414758caab8bd5 (patch) | |
| tree | eb5b7d129197320c145ca0a8e54b9cd1bcb98fcd /internal/app/app.go | |
| parent | dfd94675236844ebcec9ea51f2547ad4fd049357 (diff) | |
app: separate appSeal finalise method
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/app/app.go')
| -rw-r--r-- | internal/app/app.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/internal/app/app.go b/internal/app/app.go index eb463924..6696e189 100644 --- a/internal/app/app.go +++ b/internal/app/app.go @@ -6,6 +6,7 @@ import ( "git.gensokyo.uk/security/fortify/fst" "git.gensokyo.uk/security/fortify/internal/app/shim" + "git.gensokyo.uk/security/fortify/internal/fmsg" "git.gensokyo.uk/security/fortify/internal/sys" ) @@ -55,3 +56,23 @@ func (a *app) String() string { return fmt.Sprintf("(unsealed app %s)", a.id) } + +func (a *app) Seal(config *fst.Config) (err error) { + a.mu.Lock() + defer a.mu.Unlock() + + if a.appSeal != nil { + panic("app sealed twice") + } + if config == nil { + return fmsg.WrapError(ErrConfig, + "attempted to seal app with nil config") + } + + seal := new(appSeal) + err = seal.finalise(a.sys, config, a.id.String()) + if err == nil { + a.appSeal = seal + } + return +} |
