github.com/levb/mattermost-server@v5.3.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_INSTALLATION_DATE_KEY  = "InstallationDate"
    20  )
    21  
    22  type System struct {
    23  	Name  string `json:"name"`
    24  	Value string `json:"value"`
    25  }
    26  
    27  func (o *System) ToJson() string {
    28  	b, _ := json.Marshal(o)
    29  	return string(b)
    30  }
    31  
    32  func SystemFromJson(data io.Reader) *System {
    33  	var o *System
    34  	json.NewDecoder(data).Decode(&o)
    35  	return o
    36  }
    37  
    38  type SystemAsymmetricSigningKey struct {
    39  	ECDSAKey *SystemECDSAKey `json:"ecdsa_key,omitempty"`
    40  }
    41  
    42  type SystemECDSAKey struct {
    43  	Curve string   `json:"curve"`
    44  	X     *big.Int `json:"x"`
    45  	Y     *big.Int `json:"y"`
    46  	D     *big.Int `json:"d,omitempty"`
    47  }