![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
JSON Web tokens helpers for Chai
A set of helpers for chai that allow you to make assertions on json web tokens.
npm i chai-jwt
const chai = require('chai');
const chaiJWT = require('chai-jwt');
chai.use(chaiJWT);
Asserts that the provided string has a valid format that can be parsed as JWT. Does not check signature or the provided fields. If succeed, it changes the context to the decoded token.
Example
const validJWT = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzY29wZSI6InVwZGF0ZTpzb21ldGhpbmciLCJleHAiOjE0NzA3NjE3ODEsImlhdCI6MTQ3MDc2MDc5M30.1b4RC22Kpx4X4GWXU-Wgsk4IbeRGVD7tNW-tM-LzkVE';
const invalidJWT = 'eyJ0eXAiOiJK22V1QiLCJhbGciOiJIUzI1NiJ9..1b4RC22Kpx4X4GWXU-Wgsk4IbeRGVD7tNW-tM-LzkVE';
expect(validJWT).to.be.a.jwt; // Doesn't fail
expect(invalidJWT).to.be.a.jwt; // fails
expect(validJWT).to.be.a.jwt.and.eql({
"scope": "update:something",
"exp": 1470761781,
"iat": 1470760793
});
Asserts that the provided token is signed with the provided secret.
Example
const validJWT = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzY29wZSI6InVwZGF0ZTpzb21ldGhpbmciLCJleHAiOjE0NzA3NjE3ODEsImlhdCI6MTQ3MDc2MDc5M30.1b4RC22Kpx4X4GWXU-Wgsk4IbeRGVD7tNW-tM-LzkVE';
expect(validJWT).to.be.signedWith('1234'); // Doesn't fail
expect(validJWT).to.be.signedWith('not the right secret'); // fails
Alias of .property
for JWTs. Asserts that the provided token has a given claim. If value is provided
it will also assert the claim value using strict equality.
Example
const validJWT = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzY29wZSI6InVwZGF0ZTpzb21ldGhpbmciLCJleHAiOjE0NzA3NjE3ODEsImlhdCI6MTQ3MDc2MDc5M30.1b4RC22Kpx4X4GWXU-Wgsk4IbeRGVD7tNW-tM-LzkVE';
expect(validJWT).to.be.have.property('scope'); // Doesn't fail
expect(validJWT).to.be.have.property('other'); // fails
FAQs
JWT helpers for chai
The npm package chai-jwt receives a total of 0 weekly downloads. As such, chai-jwt popularity was classified as not popular.
We found that chai-jwt demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.