Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const decoded = b58cdecode(signature, prefix[pref]);
return {
bytes,
sig: b58cencode(decoded, prefix.sig),
prefixSig: signature,
sbytes: bytes + buf2hex(toBuffer(decoded)),
};
} catch (ex) {
if (ex instanceof HttpResponseError) {
if (ex.status === STATUS_CODE.NOT_FOUND) {
throw new KeyNotFoundError(`Key not found: ${this.pkh}`, ex);
} else if (ex.status === STATUS_CODE.FORBIDDEN) {
throw new OperationNotAuthorizedError('Signing Operation not authorized', ex);
} else if (ex.status === STATUS_CODE.BAD_REQUEST) {
throw new BadSigningDataError('Invalid data', ex, {
bytes,
watermark,
});
}
}
throw ex;
}
}
}