# All files / src/model keystore.coffee

100% Statements 8/8
100% Branches 0/0
100% Functions 0/0
100% Lines 8/8

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    321x
    1x
    1x
    1x

    1x

    1x

    1x
    1x
     mongoose = require "mongoose"
    server = require "../server"
    connectionDefault = server.connectionDefault
    Schema = mongoose.Schema

    certificate =
      country:          String
      state:            String
      locality:         String
      organization:     String
      organizationUnit: String
      commonName:       String
      emailAddress:     String
      validity:
        start:          Date
        end:            Date
      data:             String
      fingerprint:      String

    CertificateSchema = new Schema certificate

    KeystoreSchema = new Schema
      key:    String
      passphrase: String
      cert:   certificate
      ca:     [certificate]

    # Model for storing the server key and cert as well as trusted certificates
    exports.Keystore = connectionDefault.model 'Keystore', KeystoreSchema
    exports.Certificate = connectionDefault.model 'Certificate', CertificateSchema