Minishlink\WebPush\VAPID::createVapidKeys PHP 메소드

createVapidKeys() 공개 정적인 메소드

DO NOT create keys at each initialization! Save those keys and reuse them.
public static createVapidKeys ( ) : array
리턴 array
    public static function createVapidKeys()
    {
        $privateKeyObject = EccFactory::getNistCurves()->generator256()->createPrivateKey();
        return self::getUncompressedKeys($privateKeyObject);
    }

Usage Example

예제 #1
0
 public function testCreateVapidKeys()
 {
     $keys = VAPID::createVapidKeys();
     $this->assertArrayHasKey('publicKey', $keys);
     $this->assertArrayHasKey('privateKey', $keys);
     $this->assertEquals(strlen($keys['publicKey']), 88);
     $this->assertEquals(strlen($keys['privateKey']), 44);
 }