final class WebhookSignature (View source)

internal  
 

WebhookVerifier와 WebhookSigner가 함께 쓰는 webhookSecret 해석 규칙과 서명 계산 규칙입니다.

Constants

private SECRET_PREFIX

Methods

static string
decodeSecret(string $webhookSecret)

webhookSecret에서 whsec_ 접두사를 떼고 Base64로 디코딩한 서명 키를 반환합니다.

static string
compute(string $secret, string $msgId, int $timestamp, string $body)

{msgId}.{timestamp}.{body}에 대한 HMAC-SHA256 원시 서명 바이트를 계산합니다.

Details

static string decodeSecret(string $webhookSecret)

webhookSecret에서 whsec_ 접두사를 떼고 Base64로 디코딩한 서명 키를 반환합니다.

Parameters

string $webhookSecret

Return Value

string

Exceptions

InvalidArgumentException

static string compute(string $secret, string $msgId, int $timestamp, string $body)

{msgId}.{timestamp}.{body}에 대한 HMAC-SHA256 원시 서명 바이트를 계산합니다.

Parameters

string $secret
string $msgId
int $timestamp
string $body

Return Value

string