
Research
/Security News
Contagious Interview Campaign Escalates With 67 Malicious npm Packages and New Malware Loader
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.
@kiltprotocol/vc-export
Advanced tools
Data sovereignty and interoperability
This package helps you to translate KILT credentials to the popular Verifiable Credential format and structure. It provides you with tools to export your existing KILT credentials to the widely understood Verifiable Credential, produce Verifiable Presentations from a Verifiable Credential, and to verify the associated proofs.
NPM:
npm install @kiltprotocol/vc-export
YARN:
yarn add @kiltprotocol/vc-export
fromCredentialAndAttestation()
: translates Credential
to VerifiableCredential
makePresentation()
: creates VerifiablePresentation
()removeProperties()
: derives a new VerifiableCredential
from an existing one with a reduced set of disclosed attributesissuer
and not revokedvc-js
and jsonld-signatures^5.0.0
suites
: contains suites to verify the three KILT proof types that secure a KILT VC.
KiltIntegritySuite
: provides integrity protection for essential components of the credential while allowing for blinding of claims relating to the credentialSubject
.KiltSignatureSuite
: verifies the signature over the root hash of a KILT credential.KiltAttestedSuite
: provides lookup functionality to the KILT blockchain to check whether a credential is attested and still valid.context
: contains a json-ld @context
definitions for KILT VCs.documentLoader
: an implementation of the DocumentLoader required to use vc-js
/ jsonld-signatures
which allows to serve essential @context
definitions to the json-ld processor, including the context
included here.Credential
as a VerifiableCredential
Given we are in possession of an attested KILT claim and the associated KILT identity:
import { Attestation, ICredential } from '@kiltprotocol/sdk-js'
import * as vcExport from '@kiltprotocol/vc-export'
let credential: ICredential
// fetch the attestion
const api = await kilt.connect('wss://spiritnet.kilt.io/')
const attestation = Attestation.fromChain(
await api.query.attestation.attestations(credential.rootHash),
credential.rootHash
)
// turn the KILT credential into a VerifiableCredential
const VC = vcExport.fromCredentialAndAttestation(credential, attestation)
// produce a reduced copy of the VC where only selected attributes are disclosed
const nameOnly = await vcExport.presentation.removeProperties(VC, ['name'])
// or directly produce a VerifiablePresentation, which implicitly performs the step above
const presentation = await vcExport.presentation.makePresentation(VC, ['name'])
A verifier can now check the proofs attached to the VerifiableCredential but can only see the disclosed attributes:
// Here's an example for verifying the attestation proof
const api = await kilt.connect('wss://spiritnet.kilt.io/')
try {
presentation.verifiableCredential.proof.foreach((proof) => {
if (proof.type === vcExport.constants.KILT_ATTESTED_PROOF_TYPE)
vcExport.verification.verifyAttestedProof(
presentation.verifiableCredential,
proof,
api
)
})
console.log(
`Name of the crook: ${presentation.verifiableCredential.credentialSubject.name}`
) // prints 'Billy The Kid'
console.log(
`Reward: ${presentation.verifiableCredential.credentialSubject.reward}`
) // undefined
} catch (e) {
console.error('Failed verification', e)
}
vc-js
Assuming we have a KILT credential expressed as a VC (credential
), for example as produced by the example above.
import * as kilt from '@kiltprotocol/sdk-js'
import { vcjsSuites, verification } from '@kiltprotocol/vc-export'
import vcjs from 'vc-js'
import jsigs from 'jsonld-signatures'
// 1. set up suites
const { KiltIntegritySuite, KiltSignatureSuite, KiltAttestedSuite } =
vcjsSuites.suites
const signatureSuite = new KiltSignatureSuite.KiltSignatureSuite()
const integritySuite = new KiltIntegritySuite.KiltDisclosureSuite()
// the KiltAttestedSuite requires a connection object that allows access to the KILT blockchain, which we can obtain via the KILT sdk
const KiltConnection = await kilt.connect('wss://spiritnet.kilt.io/')
const attestedSuite = new KiltAttestedSuite.KiltAttestedSuite({
KiltConnection,
})
// 2. verify credential schema
const schemaVerified = verification.validateSchema(credential).verified
// unfortunately the VC credentialSchema definition is underspecified in their context - we therefore have to remove it before credential verification
delete credential['credentialSchema']
// 3. obtain default kilt context loader
const { documentLoader } = vcjsSuites
// 4. obtain the `assertionMethod` proof purpose from `jsonld-signatures`
const purpose = new jsigs.purposes.AssertionProofPurpose()
// 5. call vc-js.verifyCredential with suites and context loader
const result = await vcjs.verifyCredential({
credential,
suite: [signatureSuite, integritySuite, attestedSuite],
purpose,
documentLoader,
})
// 6. make sure all `results` indicate successful verification
const verified = result.results.every((i) => i.verified === true)
FAQs
Unknown package
The npm package @kiltprotocol/vc-export receives a total of 238 weekly downloads. As such, @kiltprotocol/vc-export popularity was classified as not popular.
We found that @kiltprotocol/vc-export demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.