Get started with jose CDN
MIT licensed
Jose: Easy JS encryption/decryption for Web Crypto APIs JWS, JWE standards.
Tags:- compact
- decode
- decrypt
- detached
- ec
- ecdsa
- eddsa
- electron
- embedded
- encrypt
- flattened
- general
- jose
- json web token
- jsonwebtoken
- jwa
- jwe
- jwk
- jwks
- jws
- jwt
- oct
- payload
- pem
- pkcs8
- rsa
- sign
- signature
- spki
- validate
- verify
- webcrypto
- x509
Stable version
Copied!
How to start using jose CDN
const jose = await import('https://cdn.cdnhub.io/jose/5.2.3/index.js');
const secret = 'my-secret-key'; // Replace this with your actual secret key
async function createJwtForUser(user) {
const payload = { sub: user.id, name: user.name }; // Replace with your actual user data
const key = await jose.JWK.asKey(secret, 'symmetric'); // Create a key from the secret
const jwt = await jose.JWT.create(payload, key).sign(); // Create and sign the JWT
return jwt;
}
(async () => {
const jose = await import('https://cdn.cdnhub.io/jose/5.2.3/index.js');
const user = { id: '123', name: 'jose' };
try {
const jwt = await createJwtForUser(user);
console.log('JWT:', jwt);
} catch (error) {
console.error('Error creating JWT:', error);
}
})();
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
All versions
3.20.0
3.20.1
3.20.2
3.20.3
4.0.0
4.0.1
4.0.2
4.0.3
4.0.4
4.1.0
4.1.1
4.1.2
4.1.3
4.1.4
4.1.5
4.10.0
4.10.1
4.10.2
4.10.3
4.10.4
4.11.0
4.11.1
4.11.2
4.11.3
4.11.4
4.12.0
4.12.1
4.12.2
4.13.0
4.13.1
4.13.2
4.14.0
4.14.1
4.14.2
4.14.3
4.14.4
4.14.5
4.14.6
4.15.0
4.15.1
4.15.2
4.15.3
4.15.4
4.2.0
4.2.1
4.3.0
4.3.1
4.3.2
4.3.3
4.3.4
4.3.5
4.3.6
4.3.7
4.3.8
4.3.9
4.4.0
4.5.0
4.5.1
4.5.2
4.5.3
4.6.0
4.6.1
4.6.2
4.7.0
4.8.0
4.8.1
4.8.2
4.8.3
4.9.0
4.9.1
4.9.2
4.9.3
5.0.0
5.0.1
5.0.2
5.1.0
5.1.1
5.1.2
5.1.3
5.2.0
5.2.1
5.2.2
5.2.3
5.2.4
5.3.0
5.4.0
5.4.1
5.5.0
5.6.0
5.6.1
5.6.2
5.6.3
5.7.0
*** 5.8.0