Is anybody aware of a quick hack to create a PEM formatted key from the issuer-did in a ucan?
I want to verify a ucan with the jsonwebtoken library (jsonwebtoken - npm) but it wants to have the key in PEM format.
I tried to borrow the “rsa/verify()” function from “keystore-idb” but realized that it relies heavily on atob, btoa etc. Things that are not existent out of the box in node.
On the other hand Node just recently added support for “subtle”.
I tried to adapt the necessary parts to work with node’s subtle but my key format seems not to be right:
[ERR_INVALID_ARG_TYPE]: The "key" argument must be an instance of CryptoKey. Received an instance of Buffer
Here is how I try to verify the signature:
const b64PubKey = didToPublicKey(iss);
const signedData = ucan.split(".").slice(0,2).join(".");
const signature = ucan.split(".")[2];
const verifyResult = await verify(
signedData,
signature,
b64PubKey.publicKey,
8
)
Thx!