Replies: 1 comment 1 reply
-
In order to verify the JWT token, you need the compressed
// Incase of ed25519 curve
import { getED25519Key } from "@toruslabs/openlogin-ed25519";
const app_scoped_privkey = "app scoped private key";
const ed25519Key = getED25519Key(Buffer.from(app_scoped_privkey.padStart(64, "0"), "hex"));
const app_pub_key = ed25519Key.pk.toString("hex");
// Incase of secp256k1 curve
import { getPublicCompressed } from "@toruslabs/eccrypto";
const app_scoped_privkey = "app scoped private key";
const app_pub_key = getPublicCompressed(Buffer.from(app_scoped_privkey.padStart(64, "0"), "hex")).toString("hex"); Verify JWT Token // JWT verification using JWK
import * as jose from "jose"
const app_pub_key = "obtained from the frontend"
const idToken = "obtained from the frontend"
const jwks = jose.createRemoteJWKSet(new URL("https://api.openlogin.com/jwks"));
const jwtDecoded = await jose.jwtVerify(idToken, jwks, { algorithms: ["ES256"] });
if ((jwtDecoded.payload as any).wallets[0].public_key === app_pub_key) {
// Verified
} Checkout https://web3auth.io/docs/server-side-verification/social-login-users#verifying-jwt-token-idtoken to learn more. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Beta Was this translation helpful? Give feedback.
All reactions