@fy-/fws-vue 2.3.59 → 2.3.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/composables/rest.ts +5 -4
- package/package.json +1 -1
package/composables/rest.ts
CHANGED
|
@@ -136,18 +136,19 @@ params?: RestParams,
|
|
|
136
136
|
|
|
137
137
|
// Create the actual request function
|
|
138
138
|
const performRequest = async (): Promise<ResultType> => {
|
|
139
|
-
const
|
|
139
|
+
const h: { [key: string]: string } = {}
|
|
140
140
|
const timestamp = Date.now()
|
|
141
141
|
|
|
142
142
|
if (secret && secret !== '') {
|
|
143
143
|
const signature = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(`${method}${url}${timestamp}${secret}`),
|
|
144
144
|
)
|
|
145
|
-
|
|
146
|
-
|
|
145
|
+
h['X-Timestamp'] = timestamp.toString()
|
|
146
|
+
h['X-Signature'] = btoa(String.fromCharCode(...new Uint8Array(signature)))
|
|
147
|
+
console.debug('Using secret for request signature:', `${method}${url}${timestamp}${secret}`)
|
|
147
148
|
}
|
|
148
149
|
|
|
149
150
|
try {
|
|
150
|
-
const restResult: ResultType = await rest(url, method, params)
|
|
151
|
+
const restResult: ResultType = await rest(url, method, params, h)
|
|
151
152
|
|
|
152
153
|
// Store result in server router if in SSR mode
|
|
153
154
|
if (checkSSRMode()) {
|