Repository navigation
v0.3.0 - Support for encrypted responses
- [server] Supports encrypted responses by default (#14)
Encrypted Responses
Use of @simpledigicreds/server will now request and handle encrypted responses by default:
import { generatePresentationOptions, verifyPresentationResponse } from '@simpledigicreds/server';
/* server */
const presentationRequest = await generatePresentationRequest({
credentialOptions: {
format: 'mdl',
desiredClaims: ['family_name', 'given_name'],
},
requestOrigin: 'http://localhost:8000',
});
const { dcapiOptions } = presentationRequest;
/* browser */
if (typeof window.DigitalCredential === 'function') {
const presentation = await navigator.credentials.get(dcapiOptions);
}
/* server */
const verified = await verifyPresentationResponse({
data: presentation.data,
request: presentationRequest,
});It remains possible to make unencrypted responses by specifying encryptResponse: false when calling generatePresentationRequest():
const mdlRequest = await generatePresentationRequest({
credentialOptions: {
format: "mdl",
desiredClaims: ["family_name", "given_name"],
},
requestOrigin: "http://localhost:8000",
encryptResponse: false, // <----
});