
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
@mattrglobal/vc-cwt-verifier
Advanced tools
Add the module as a dependency to your application or library.
yarn add @mattrglobal/vc-cwt-verifier
or
npm install @mattrglobal/vc-cwt-verifier
import { verify } from "@mattrglobal/vc-cwt-verifier";
import * as hex from "@stablelib/hex";
const payload: Uint8Array = hex.decode(
"d2844aa204456b65792d310126a0590137a50178376469643a7765623a6d61747472676c6f62616c2e6769746875622e696f3a6e7a63703a71766e6e6b38396b696a726f65696e6478613375051a6178cc15041a74477215627663a46840636f6e7465787482782668747470733a2f2f7777772e77332e6f72672f323031382f63726564656e7469616c732f7631782768747470733a2f2f6865616c74682e676f76742e6e7a2f63726564656e7469616c732f63706e7a6776657273696f6e65312e302e306474797065827456657269666961626c6543726564656e7469616c6f5075626c6963436f766964506173737163726564656e7469616c5375626a656374a369676976656e4e616d65644a61636b6a66616d696c794e616d656753706172726f7763646f626a313936302d30342d313607d84050e6060795d65f4f85a3924bc4380a30c75840ef52b04644273e9757b2418fea39fae5eac99dd354eaf862f8f8f7c842a85550a0ff485c6999fc29527075686eeceaff36775e4ef031ef94dbc13e6e9f6a83ab"
);
const verifyResult = await verify({ payload });
if (verifyResult.isErr()) {
const { error } = verifyResult;
// handle error unable to verify
return;
}
const verifyResponse = verifyResult.value;
if (!verifyResponse.verified) {
const { reason } = verifyResponse;
// show or handle verification fail reason
}
const { payload, header } = verifyResponse;
// show or handle verified payload & header
import { verify } from "@mattrglobal/vc-cwt-verifier";
const verifyResult = await verify({
trustedIssuers: ["did:web:example.com", "did:web:mattrglobal.github.io:test:example"],
payload: {},
});
const verifyResponse = verifyResult.value;
if (!verifyResponse.verified) {
const { reason } = verifyResponse;
// show or handle verification fail reason
}
const { payload, header } = verifyResponse;
// show or handle verified payload & header
If assertExpiry
or assertNotBefore
are omitted they will be checked against the current date and time by default
import { verify } from "@mattrglobal/vc-cwt-verifier";
const verifyResult = await verify({
assertExpiry: false,
assertNotBefore: false,
payload: ...
});
const verifyResponse = verifyResult.value;
if (!verifyResponse.verified) {
const { reason } = verifyResponse;
// show or handle verification fail reason
}
const { payload, header } = verifyResponse;
// show or handle verified payload & header
By default an in memory cache will be provided. This can be overwritten by passing a different cache instance.
import { verify, getDefaultIssuerResolver } from "@mattrglobal/vc-cwt-verifier";
const issuerResolver = getDefaultIssuerResolver({ cache: myCache });
const verifyResult = await verify({
payload: ...,
issuerResolver
});
Functions that have an error path return a Neverthrow Result that represents either success or failure. All functions can throw exceptions for unexpected and unrecoverable errors.
See here for licence information
FAQs
vc-cwt-verifier
We found that @mattrglobal/vc-cwt-verifier demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers 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.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.