@@ -28,8 +28,12 @@ class SteamGuardTest extends AuthenticatorInterfaceTestAbstract{
2828
2929 protected const secret = 'MTIzNDU2Nzg5MDEyMzQ1Njc4OTA= ' ;
3030
31+ /**
32+ * Timestamps and -slices from the RFC6238 page, codes from a verified implementation
33+ *
34+ * @see https://tools.ietf.org/html/rfc6238#page-14
35+ */
3136 protected const SteamGuardVectors = [
32- // timestamps and time slices from RFC 6238, see https://tools.ietf.org/html/rfc6238#page-14
3337 [ 59 , '1 ' , 'PV9M4 ' ],
3438 [ 1111111109 , '23523ec ' , 'PY4YB ' ],
3539 [ 1111111111 , '23523ed ' , '5PP3V ' ],
@@ -52,6 +56,15 @@ public function testSetGetSecret():void{
5256 $ this ::assertSame ($ this ::rawsecret, Base64::decode ($ secret ));
5357 }
5458
59+ public function testSetGetRawSecret ():void {
60+ $ this ->authenticatorInterface ->setRawSecret ($ this ::rawsecret);
61+
62+ $ secret = $ this ->authenticatorInterface ->getRawSecret ();
63+
64+ $ this ::assertSame ($ this ::secret, Base64::encode ($ secret ));
65+ $ this ::assertSame ($ this ::rawsecret, $ secret );
66+ }
67+
5568 public function testCreateSecretDefaultLength ():void {
5669 $ this ::assertSame (
5770 $ this ->options ->secret_length ,
@@ -75,11 +88,6 @@ public function testCreateSecretCheckCharacterSet():void{
7588 $ this ::assertMatchesRegularExpression ('#^[ ' .Base64::CHARSET .']+$# ' , $ secret );
7689 }
7790
78- /**
79- * Timestamps and -slices from the RFC6238 page, codes from a verified implementation
80- *
81- * @see https://tools.ietf.org/html/rfc6238#page-14
82- */
8391 public static function steamGuardVectors ():Generator {
8492 foreach (self ::SteamGuardVectors as [$ timestamp , $ timeslice , $ totp ]){
8593 // skip 64bit numbers on 32bit PHP
0 commit comments