import * as trustedTimestamp from '../src' import crypto from 'crypto' console.log(trustedTimestamp) const resultSendSMS = ` 000 Enviado para processamento Teste 73991032685 16/08/2019 15:06:03 90367966 ` const resultQuerySMS = ` 014 ENVIADO COM SUCESSO Teste 5573991032685 16/08/2019 15:06:03 0 1 90367966 ` const doValidation = async (): void => { try { const urlTimeStampAuthority = 'https://freetsa.org/tsr' const urlTSABry = `https://14703539039:14703539039@act.bry.com.br` const hashSend = crypto.createHash('sha256').update(resultSendSMS).digest('hex') const hashQuery = crypto.createHash('sha256').update(resultQuerySMS).digest('hex') const requestFilePath = await trustedTimestamp.createRequestFile(hashQuery) const responseFilePath = await trustedTimestamp.signRequestFile(requestFilePath, urlTSABry) const timestamp = await trustedTimestamp.getTimestampFromResponse(responseFilePath) console.log(hashQuery, timestamp, requestFilePath, responseFilePath) } catch (error) { console.log(error) } } doValidation()