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 Nov. 6, 2021, 5:07 p.m.