Function verifyJWS

  • verifiy JWS signature

    Parameters

    • sJWS: string

      JWS signature string

    • keyobjOrString: string | CryptoKey

      key for verification. CryptoKey object, PKCS#8 PEM public key or HMAC hexadecimal key string

    • Optional acceptAlgs: string[]

      acceptable JWS signature algorithm to avoid downgrade attacks (OPTION)

    Returns Promise<boolean>

    true if JWS signature is valid

    See

    Example

    await verifyJWS("eJYOe...", pubkey) -> true/false
    await verifyJWS("eJYOe...", pubkey, ["RS512", "PS512"]) -> true/false
    await verifyJWS("eJYOe...", "-----BEGIN PUBLIC...", ["ES512"]) -> true/false
    await verifyJWS("eJYOe...", "12ab34...", ["HS512"]) -> true/false