Appearance
Used by the signer
The signer library is a HUAWEI CLOUD signature algorithm library, which can be used to generate HUAWEI CLOUD authentication signatures. The usage of the signer library is as follows:
ts
import * as sys from 'sys';
import * as http from 'http';
import * as signer from 'signer';
const signHeaders = signer.signHeaders(
sys.getParameter('hwc_key'),
sys.getParameter('hwc_secret'),
);
const client = http.newClient();
const data = client.get(url, {
headers: {
... signHeaders('GET', url)
},
);
console.log(data);
Note that the input secret parameters used for signing should be encrypted for storage, for example, in encrypted system parameters.