@foxy.io/sdk 1.7.0 → 1.7.1
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.
|
@@ -51,7 +51,7 @@ const optionsV8N = v8n_1.default().schema({
|
|
|
51
51
|
function createSSOURL(options) {
|
|
52
52
|
var _a;
|
|
53
53
|
optionsV8N.check(options);
|
|
54
|
-
const timestamp = (_a = options.timestamp) !== null && _a !== void 0 ? _a : Date.now();
|
|
54
|
+
const timestamp = (_a = options.timestamp) !== null && _a !== void 0 ? _a : Math.floor(Date.now() / 1000) + 3600;
|
|
55
55
|
const decodedToken = `${options.customer}|${timestamp}|${options.secret}`;
|
|
56
56
|
const encodedToken = crypto.createHash('sha1').update(decodedToken);
|
|
57
57
|
const url = new url_1.URL('/checkout', options.domain);
|
|
@@ -26,7 +26,7 @@ const optionsV8N = v8n().schema({
|
|
|
26
26
|
export function createSSOURL(options) {
|
|
27
27
|
var _a;
|
|
28
28
|
optionsV8N.check(options);
|
|
29
|
-
const timestamp = (_a = options.timestamp) !== null && _a !== void 0 ? _a : Date.now();
|
|
29
|
+
const timestamp = (_a = options.timestamp) !== null && _a !== void 0 ? _a : Math.floor(Date.now() / 1000) + 3600;
|
|
30
30
|
const decodedToken = `${options.customer}|${timestamp}|${options.secret}`;
|
|
31
31
|
const encodedToken = crypto.createHash('sha1').update(decodedToken);
|
|
32
32
|
const url = new URL('/checkout', options.domain);
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
interface Options {
|
|
2
2
|
/**
|
|
3
|
-
* Integer, epoch time. The future time that this authentication token will expire.
|
|
3
|
+
* Integer, epoch time (seconds). The future time that this authentication token will expire.
|
|
4
4
|
* If a customer makes a checkout request with an expired authentication token, then FoxyCart
|
|
5
5
|
* will redirect them to the endpoint in order to generate a new token. You can make use of the
|
|
6
6
|
* timestamp value you received to your endpoint in the GET parameters, and add additional time
|
|
7
7
|
* to it for how long you want it to be valid for. For example, adding 3600 to the timestamp will
|
|
8
|
-
* extend it by 3600 seconds, or
|
|
8
|
+
* extend it by 3600 seconds, or 60 minutes.
|
|
9
|
+
*
|
|
10
|
+
* Defaults to an hour from now.
|
|
9
11
|
*
|
|
10
12
|
* @see https://docs.foxycart.com/v/2.0/sso#the_details
|
|
11
13
|
*/
|
package/package.json
CHANGED