github.com/transparency-dev/armored-witness-os@v0.1.3-0.20240514084412-27eef7325168/api/rpc/rpc.go (about)

     1  // Copyright 2022 The Armored Witness OS authors. All Rights Reserved.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package rpc
    16  
    17  import (
    18  	"github.com/coreos/go-semver/semver"
    19  	"github.com/transparency-dev/armored-witness-boot/config"
    20  )
    21  
    22  // Handler represents an RPC request for event handler registration.
    23  type Handler struct {
    24  	G uint32
    25  	P uint32
    26  }
    27  
    28  // LEDStatus represents an RPC LED state request.
    29  type LEDStatus struct {
    30  	Name string
    31  	On   bool
    32  }
    33  
    34  // WriteBlocks represents an RPC request for internal eMMC write.
    35  type WriteBlocks struct {
    36  	LBA  int
    37  	Data []byte
    38  }
    39  
    40  // Read represents an RPC request for internal eMMC read.
    41  type Read struct {
    42  	Offset int64
    43  	Size   int64
    44  }
    45  
    46  // WitnessStatus represents the witness applet's status.
    47  type WitnessStatus struct {
    48  	// Identity is the note-compatible public key used to verify witness signatures.
    49  	Identity string
    50  	// IP is the currently-assigned IP address of the witness applet.
    51  	IP string
    52  	// IDAttestPublicKey is the stable-derived use by this device to attest to witness IDs.
    53  	IDAttestPublicKey string
    54  	// AttestedID is a note formatted attestation for the current witness ID.
    55  	AttestedID string
    56  }
    57  
    58  // FirmwareUpdate represents a firmware update.
    59  type FirmwareUpdate struct {
    60  	// Sequence is a counter used to ensure correct ordering of chunks of firmware.
    61  	Sequence uint
    62  
    63  	// Image is the firmware image to be applied.
    64  	Image []byte
    65  
    66  	//  Proof contains firmware transparency artefacts for the new firmware image.
    67  	Proof config.ProofBundle
    68  }
    69  
    70  // InstalledVersions represents the installed/running versions
    71  // of the TrustedOS and applet.
    72  type InstalledVersions struct {
    73  	OS     semver.Version
    74  	Applet semver.Version
    75  }