# Install
In order to sign documents in the browser, you must include the MIRACL Trust DVS client library served from the MIRACL Trust CDN.
<script
type="text/javascript"
src="https://cdn.mpin.io/dvs/1.0.0/dvs.client.min.js"></script>
# Configure
Before using the DVS client library, you must configure and initialize it.
const dvs = new DVS({
userId: "test@example.com",
clientId: "<YOUR_CLIENT_ID>",
redirectURI: "http://127.0.0.1/login",
});
You can see a full list of configuration options in MIRACL Trust DVS Web Plugin.
# Generate Signature
After configuration, you can call the sign
method. This produces a
cryptographic signature of the provided document, which you can store and
verify:
dvs.sign(
{
doc: "This is a test document for signing",
hash: "a85675951451ebbcccb4c4d1a41dfe6cbf0f037ef505ffccd3d314930b3d7316",
timestamp: 1608300866,
},
function callback(error, signature) {
if (error) {
// The signing was not successful.
// This can happen if the user entered a wrong PIN or
// there was a malicious attempt to temper with the signing.
}
// The signature was created successfully.
// You can now send it to your back end for verification.
console.log(signature);
},
);
# Verify Signature
The signature must be verified on the back end. For more information, see Digital Signatures.