carlos / platform Public

Clone
git clone https://amadan.net/carlos/platform

Plain git — no account needed to clone.

Download

Download this file

1package hostops
2
3import (
4 "context"
5 "crypto/ed25519"
6 "errors"
7 "os"
8
9 "github.com/carlosframework/platform/internal/release"
10)
11
12func CheckCreateFreeze(ctx context.Context, s release.Store, pub ed25519.PublicKey) error {
13 raw, _, err := s.Get(ctx, BackfillKey)
14 if errors.Is(err, os.ErrNotExist) {
15 return nil
16 }
17 if err != nil {
18 return err
19 }
20 var plan BackfillPlan
21 if release.VerifyRootEnvelope(pub, raw, &plan) != nil || plan.V != 1 || plan.ID == "" {
22 return ErrIdentity
23 }
24 if plan.Phase != "done" {
25 return ErrPending
26 }
27 return nil
28}
29