You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constjose=require("node-jose");asyncfunctioncreateKeystore(){constkeystore=jose.JWK.createKeyStore();// Add the public key to the keystoreconstkey=awaitkeystore.add({kty: 'RSA',kid: "erityuiuerot",use: 'sig',alg: 'RS256',n: "kjfghdsjkbfdasbf",e: 'AQAB'},'json');returnkeystore;}asyncfunctionverifyDetachedJWS(jws,payload){try{constkeystore=awaitcreateKeystore();console.log("keystore",keystore);// Use JWS.createVerify to verify the tokenconstverifier=jose.JWS.createVerify(keystore);constresult=awaitverifier.verify(jws);console.log('Verification successful:',result);}catch(error){console.error('Verification failed:',error);}}// Example JWS token (without payload) and payload (replace with your actual values)constjws='eyJhbGciOiJSUzI1NiIsImtpZCI6InNhbXBsZS1rZXktaWQifQ..SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c';verifyDetachedJWS(jws,payload);
But I am getting the following error:
Verification failed: Error: no key found
at processSig (/node_modules/node-jose/lib/jws/verify.js:132:22)
I am unable to figure out where the issue is. Can you please help me resolve this as soon as possible?
Do I need to use private for verification, if yes then please suggest code how to do it.
Hi Team,
I have a response from the external API in the below format:
The signature is without the payload check ("..") in
inputData
signature, and I am trying to verify the signature.My public key format is:
The
inputData
is:I am using the below code to verify it in nodejs:
But I am getting the following error:
I am unable to figure out where the issue is. Can you please help me resolve this as soon as possible?
Do I need to use private for verification, if yes then please suggest code how to do it.
my private key is in below format :
PrivateKey : {
keys : [{
"p": "",
"kty": "RSA",
"q": "",
"d": "",
"e": "",
"use": "sig",
"kid": "",
"qi": "",
"dp": "",
"dq": "",
"n": ""
}]
};
Kindest Regards,
Shreya
The text was updated successfully, but these errors were encountered: