tests/testthat/test_hmac.R

context("HMAC signature")

test_that("ECDSA works", {
  key <- read_jwk("../keys/hmac.json")
  sig <- readBin("../keys/hmac.sig", raw(), 100)
  expect_identical(sig, unclass(openssl::sha256(charToRaw("testje"), key = key)))
})

Try the jose package in your browser

Any scripts or data that you put into this service are public.

jose documentation built on Oct. 4, 2024, 5:11 p.m.