github.com/cjdelisle/matterfoss@v5.11.1+incompatible/model/system.go (about)

     1  // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
     2  // See License.txt for license information.
     3  
     4  package model
     5  
     6  import (
     7  	"encoding/json"
     8  	"io"
     9  	"math/big"
    10  )
    11  
    12  const (
    13  	SYSTEM_DIAGNOSTIC_ID             = "DiagnosticId"
    14  	SYSTEM_RAN_UNIT_TESTS            = "RanUnitTests"
    15  	SYSTEM_LAST_SECURITY_TIME        = "LastSecurityTime"
    16  	SYSTEM_ACTIVE_LICENSE_ID         = "ActiveLicenseId"
    17  	SYSTEM_LAST_COMPLIANCE_TIME      = "LastComplianceTime"
    18  	SYSTEM_ASYMMETRIC_SIGNING_KEY    = "AsymmetricSigningKey"
    19  	SYSTEM_POST_ACTION_COOKIE_SECRET = "PostActionCookieSecret"
    20  	SYSTEM_INSTALLATION_DATE_KEY     = "InstallationDate"
    21  )
    22  
    23  type System struct {
    24  	Name  string `json:"name"`
    25  	Value string `json:"value"`
    26  }
    27  
    28  func (o *System) ToJson() string {
    29  	b, _ := json.Marshal(o)
    30  	return string(b)
    31  }
    32  
    33  func SystemFromJson(data io.Reader) *System {
    34  	var o *System
    35  	json.NewDecoder(data).Decode(&o)
    36  	return o
    37  }
    38  
    39  type SystemPostActionCookieSecret struct {
    40  	Secret []byte `json:"key,omitempty"`
    41  }
    42  
    43  type SystemAsymmetricSigningKey struct {
    44  	ECDSAKey *SystemECDSAKey `json:"ecdsa_key,omitempty"`
    45  }
    46  
    47  type SystemECDSAKey struct {
    48  	Curve string   `json:"curve"`
    49  	X     *big.Int `json:"x"`
    50  	Y     *big.Int `json:"y"`
    51  	D     *big.Int `json:"d,omitempty"`
    52  }