github.com/braveheart12/just@v0.8.7/core/certificate.go (about)

     1  /*
     2   *    Copyright 2019 Insolar Technologies
     3   *
     4   *    Licensed under the Apache License, Version 2.0 (the "License");
     5   *    you may not use this file except in compliance with the License.
     6   *    You may obtain a copy of the License at
     7   *
     8   *        http://www.apache.org/licenses/LICENSE-2.0
     9   *
    10   *    Unless required by applicable law or agreed to in writing, software
    11   *    distributed under the License is distributed on an "AS IS" BASIS,
    12   *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13   *    See the License for the specific language governing permissions and
    14   *    limitations under the License.
    15   */
    16  
    17  package core
    18  
    19  import (
    20  	"crypto"
    21  )
    22  
    23  type NodeMeta interface {
    24  	GetNodeRef() *RecordRef
    25  	GetPublicKey() crypto.PublicKey
    26  }
    27  
    28  // Certificate interface provides methods to manage keys
    29  //go:generate minimock -i github.com/insolar/insolar/core.Certificate -o ../testutils -s _mock.go
    30  type Certificate interface {
    31  	AuthorizationCertificate
    32  
    33  	GetRootDomainReference() *RecordRef
    34  	GetDiscoveryNodes() []DiscoveryNode
    35  }
    36  
    37  //go:generate minimock -i github.com/insolar/insolar/core.DiscoveryNode -o ../testutils -s _mock.go
    38  type DiscoveryNode interface {
    39  	NodeMeta
    40  
    41  	GetHost() string
    42  }
    43  
    44  // AuthorizationCertificate interface provides methods to manage info about node from it certificate
    45  type AuthorizationCertificate interface {
    46  	NodeMeta
    47  
    48  	GetRole() StaticRole
    49  	SerializeNodePart() []byte
    50  	GetDiscoverySigns() map[RecordRef][]byte
    51  }
    52  
    53  // CertificateManager interface provides methods to manage nodes certificate
    54  //go:generate minimock -i github.com/insolar/insolar/core.CertificateManager -o ../testutils -s _mock.go
    55  type CertificateManager interface {
    56  	GetCertificate() Certificate
    57  	VerifyAuthorizationCertificate(authCert AuthorizationCertificate) (bool, error)
    58  	NewUnsignedCertificate(pKey string, role string, nodeRef string) (Certificate, error)
    59  }