I don’t see any mention of JWS in Apple’s documentation, I think they are looking for a raw ECDSA signature. What you want is probably:
:public_key.sign(completePath, :sha256, priv)
|> Base.url_encode64(padding: false)
Where priv
is the raw private key in Erlang record format. If you want to keep using JOSE for reading the key you could use priv = JOSE.JWK.to_key(privateKey) |> elem(1)
. Or you could use x509 instead: priv = File.read!("authkey.p8") |> X509.PrivateKey.from_pem!()
.