jsonld-signatures
Version:
An implementation of the Linked Data Signatures specifications for JSON-LD in JavaScript.
21 lines (19 loc) • 430 B
JavaScript
/*
* Copyright (c) 2021 Digital Bazaar, Inc. All rights reserved.
*/
;
const crypto = require('crypto');
module.exports = {
/**
* Hashes a string of data using SHA-256.
*
* @param {string} string - the string to hash.
*
* @return {Uint8Array} the hash digest.
*/
async sha256digest({string}) {
return new Uint8Array(
crypto.createHash('sha256').update(string).digest()
);
}
};