assertNotNull($key1a); $this->assertEquals($key1a->getBinaryKey(), $key1b->getBinaryKey()); $key2a = new JwtDerivedKey("bar", "foosalt"); $key2b = new JwtDerivedKey("bar", "barsalt"); $key2c = new JwtDerivedKey("bar", "barsalt"); $this->assertNotNull($key2a); $this->assertNotEquals($key2a->getBinaryKey(), $key2b->getBinaryKey()); $this->assertEquals($key2b->getBinaryKey(), $key2c->getBinaryKey()); } public function testTheDerivedKeysShouldBeUnique() { $keys = []; $keys[] = (new JwtDerivedKey("foo", "foosalt"))->getBinaryKey(); $keys[] = (new JwtDerivedKey("foo", "barsalt"))->getBinaryKey(); $keys[] = (new JwtDerivedKey("foo", "bazsalt"))->getBinaryKey(); $keys[] = (new JwtDerivedKey("bar", "foosalt"))->getBinaryKey(); $keys[] = (new JwtDerivedKey("bar", "barsalt"))->getBinaryKey(); $keys[] = (new JwtDerivedKey("bar", "bazsalt"))->getBinaryKey(); $unique = array_unique($keys); $this->assertEquals(count($keys), count($unique)); } }