Completed
Push — master ( 63a2ed...6e6341 )
by Paul
03:41
created

Registration::setPublicKey()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
rs 9.4286
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
/**
3
 *
4
 * @copyright (c) 2015, Paul Sohier
5
 * @copyright (c) 2014 Yubico AB
6
 * @license BSD-2-Clause
7
 *
8
 *
9
 * Orignal Copyright:
10
 * Copyright (c) 2014 Yubico AB
11
 * All rights reserved.
12
 *
13
 * Redistribution and use in source and binary forms, with or without
14
 * modification, are permitted provided that the following conditions are
15
 * met:
16
 *
17
 *   * Redistributions of source code must retain the above copyright
18
 *     notice, this list of conditions and the following disclaimer.
19
 *
20
 *   * Redistributions in binary form must reproduce the above
21
 *     copyright notice, this list of conditions and the following
22
 *     disclaimer in the documentation and/or other materials provided
23
 *     with the distribution.
24
 *
25
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36
 */
37
38
namespace paul999\u2f;
39
40
/**
41
 * Class returned for successful registrations
42
 *
43
 * @package u2flib_server
44
 */
45
class Registration implements RegistrationInterface
46
{
47
    /**
48
     * The key handle of the registered authenticator
49
     * @var string
50
     */
51
    private $keyHandle;
52
53
    /**
54
     * The public key of the registered authenticator
55
     * @var string
56
     */
57
    private $publicKey;
58
59
    /**
60
     * The attestation certificate of the registered authenticator
61
     * @var string
62
     */
63
    private $certificate;
64
65
    /**
66
     * The counter associated with this registration
67
     * @var int
68
     */
69
    private $counter = -1;
70
71
    /**
72
     * Registration constructor.
73
     * @param string $keyHandle
74
     * @param string $publicKey
75
     * @param string $certificate
76
     * @param int $counter
77
     */
78
    public function __construct($keyHandle = null, $publicKey = null, $certificate = null, $counter = -1)
79
    {
80
        $this->keyHandle = $keyHandle;
81
        $this->publicKey = $publicKey;
82
        $this->certificate = $certificate;
83
        $this->counter = $counter;
84
    }
85
86
    /**
87
     * @return string
88
     */
89
    public function getKeyHandle()
90
    {
91
        return $this->keyHandle;
92
    }
93
94
    /**
95
     * @param string $keyHandle
96
     * @return RegistrationInterface
97
     */
98
    public function setKeyHandle($keyHandle)
99
    {
100
        $this->keyHandle = $keyHandle;
101
        return $this;
102
    }
103
104
    /**
105
     * @return string
106
     */
107
    public function getPublicKey()
108
    {
109
        return $this->publicKey;
110
    }
111
112
    /**
113
     * @param string $publicKey
114
     * @return RegistrationInterface
115
     */
116
    public function setPublicKey($publicKey)
117
    {
118
        $this->publicKey = $publicKey;
119
        return $this;
120
    }
121
122
    /**
123
     * @return string
124
     */
125
    public function getCertificate()
126
    {
127
        return $this->certificate;
128
    }
129
130
    /**
131
     * @param string $certificate
132
     * @return RegistrationInterface
133
     */
134
    public function setCertificate($certificate)
135
    {
136
        $this->certificate = $certificate;
137
        return $this;
138
    }
139
140
    /**
141
     * @return int
142
     */
143
    public function getCounter()
144
    {
145
        return $this->counter;
146
    }
147
148
    /**
149
     * @param int $counter
150
     * @return RegistrationInterface
151
     */
152
    public function setCounter($counter)
153
    {
154
        $this->counter = $counter;
155
        return $this;
156
    }
157
}