@dfinity/auth-client
Advanced tools
Comparing version 0.10.0 to 0.10.1
@@ -22,3 +22,3 @@ import { Identity, SignIdentity } from '@dfinity/agent'; | ||
/** | ||
* Experiation of the authentication | ||
* Expiration of the authentication in nanoseconds | ||
*/ | ||
@@ -25,0 +25,0 @@ maxTimeToLive?: bigint; |
@@ -86,3 +86,6 @@ "use strict"; | ||
const chainStorage = await storage.get(KEY_LOCALSTORAGE_DELEGATION); | ||
if (chainStorage) { | ||
if (options.identity) { | ||
identity = options.identity; | ||
} | ||
else if (chainStorage) { | ||
chain = identity_1.DelegationChain.fromJSON(chainStorage); | ||
@@ -142,2 +145,5 @@ // Verify that the delegation isn't expired. | ||
} | ||
// Set default maxTimeToLive to 1 day | ||
const defaultTimeToLive = | ||
/* days */ BigInt(1) * /* hours */ BigInt(24) * /* nanoseconds */ BigInt(3600000000000); | ||
// Create the URL of the IDP. (e.g. https://XXXX/#authorize) | ||
@@ -152,3 +158,3 @@ const identityProviderUrl = new URL(((_a = options === null || options === void 0 ? void 0 : options.identityProvider) === null || _a === void 0 ? void 0 : _a.toString()) || IDENTITY_PROVIDER_DEFAULT); | ||
// Add an event listener to handle responses. | ||
this._eventHandler = this._getEventHandler(identityProviderUrl, options); | ||
this._eventHandler = this._getEventHandler(identityProviderUrl, Object.assign({ maxTimeToLive: defaultTimeToLive }, options)); | ||
window.addEventListener('message', this._eventHandler); | ||
@@ -155,0 +161,0 @@ // Open a new window with the IDP provider. |
@@ -22,3 +22,3 @@ import { Identity, SignIdentity } from '@dfinity/agent'; | ||
/** | ||
* Experiation of the authentication | ||
* Expiration of the authentication in nanoseconds | ||
*/ | ||
@@ -25,0 +25,0 @@ maxTimeToLive?: bigint; |
@@ -82,3 +82,6 @@ import { AnonymousIdentity, } from '@dfinity/agent'; | ||
const chainStorage = await storage.get(KEY_LOCALSTORAGE_DELEGATION); | ||
if (chainStorage) { | ||
if (options.identity) { | ||
identity = options.identity; | ||
} | ||
else if (chainStorage) { | ||
chain = DelegationChain.fromJSON(chainStorage); | ||
@@ -138,2 +141,5 @@ // Verify that the delegation isn't expired. | ||
} | ||
// Set default maxTimeToLive to 1 day | ||
const defaultTimeToLive = | ||
/* days */ BigInt(1) * /* hours */ BigInt(24) * /* nanoseconds */ BigInt(3600000000000); | ||
// Create the URL of the IDP. (e.g. https://XXXX/#authorize) | ||
@@ -148,3 +154,3 @@ const identityProviderUrl = new URL(((_a = options === null || options === void 0 ? void 0 : options.identityProvider) === null || _a === void 0 ? void 0 : _a.toString()) || IDENTITY_PROVIDER_DEFAULT); | ||
// Add an event listener to handle responses. | ||
this._eventHandler = this._getEventHandler(identityProviderUrl, options); | ||
this._eventHandler = this._getEventHandler(identityProviderUrl, Object.assign({ maxTimeToLive: defaultTimeToLive }, options)); | ||
window.addEventListener('message', this._eventHandler); | ||
@@ -151,0 +157,0 @@ // Open a new window with the IDP provider. |
{ | ||
"name": "@dfinity/auth-client", | ||
"version": "0.10.0", | ||
"version": "0.10.1", | ||
"author": "DFINITY Stiftung <sdk@dfinity.org>", | ||
@@ -40,6 +40,6 @@ "license": "Apache-2.0", | ||
"peerDependencies": { | ||
"@dfinity/agent": "^0.10.0", | ||
"@dfinity/authentication": "^0.10.0", | ||
"@dfinity/identity": "^0.10.0", | ||
"@dfinity/principal": "^0.10.0" | ||
"@dfinity/agent": "^0.10.1", | ||
"@dfinity/authentication": "^0.10.1", | ||
"@dfinity/identity": "^0.10.1", | ||
"@dfinity/principal": "^0.10.1" | ||
}, | ||
@@ -46,0 +46,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
234057
646