@originvault/ov-id-sdk
Version:
A TypeScript SDK for managing decentralized identities (DIDs) and verifiable credentials (VCs)
40 lines • 1.21 kB
JavaScript
import { userAgent } from './userAgent.js';
import { verifyPrimaryDID } from './identityManager.js';
export async function signVC(subject, password) {
try {
const did = await verifyPrimaryDID(password);
if (typeof did !== 'string')
return false;
const signedVC = await userAgent?.createVerifiableCredential({
credential: {
issuer: { id: did },
credentialSubject: {
id: did,
...subject
},
'@context': ['https://www.w3.org/2018/credentials/v1'],
type: ['VerifiableCredential'],
},
proofFormat: 'jwt'
});
return signedVC;
}
catch (error) {
console.error("❌ Error signing VC:", error);
throw error;
}
}
export async function verifyVC(credential) {
try {
const verified = await userAgent?.verifyCredential({
credential,
policies: { proofFormat: 'jwt' }
});
return verified;
}
catch (error) {
console.error("❌ Error verifying VC:", error);
throw error;
}
}
//# sourceMappingURL=signer.js.map