@eluvio/elv-client-js 4.0.130 → 4.0.131
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/package.json
CHANGED
package/src/RemoteSigner.js
CHANGED
|
@@ -73,7 +73,7 @@ class RemoteSigner extends Ethers.Signer {
|
|
|
73
73
|
this.signer = this.provider.getSigner(this.address);
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
async RetrieveCSAT({email, nonce, tenantId, force=false}) {
|
|
76
|
+
async RetrieveCSAT({email, nonce, tenantId, force=false, duration=24}) {
|
|
77
77
|
nonce = nonce || Utils.B58(UUID.parse(UUID.v4()));
|
|
78
78
|
|
|
79
79
|
let response = await Utils.ResponseToJson(
|
|
@@ -83,7 +83,8 @@ class RemoteSigner extends Ethers.Signer {
|
|
|
83
83
|
email,
|
|
84
84
|
nonce,
|
|
85
85
|
force,
|
|
86
|
-
tid: tenantId
|
|
86
|
+
tid: tenantId,
|
|
87
|
+
exp: duration * 60 * 60
|
|
87
88
|
},
|
|
88
89
|
path: UrlJoin("as", "wlt", "sign", "csat"),
|
|
89
90
|
headers: {
|
|
@@ -632,7 +632,7 @@ exports.CreateContentObject = async function({libraryId, objectId, options={}})
|
|
|
632
632
|
libraryId,
|
|
633
633
|
objectId,
|
|
634
634
|
writeToken: createResponse.write_token,
|
|
635
|
-
createKMSConk: options.createKMSConk
|
|
635
|
+
createKMSConk: !!options.createKMSConk // make sure `undefined` gets converted to `false`
|
|
636
636
|
}
|
|
637
637
|
);
|
|
638
638
|
|
|
@@ -478,6 +478,7 @@ class ElvWalletClient {
|
|
|
478
478
|
* @param {string=} email - Email address of the user. If not specified, this method will attempt to extract the email from the ID token.
|
|
479
479
|
* @param {Array<string>=} signerURIs - (Only if using custom OAuth) - URIs corresponding to the key server(s) to use
|
|
480
480
|
* @param {boolean=} shareEmail=false - Whether or not the user consents to sharing their email
|
|
481
|
+
* @param {number=} tokenDuration=24 - Token expiration duration, in hours
|
|
481
482
|
*
|
|
482
483
|
* @returns {Promise<Object>} - Returns an authorization tokens that can be used to initialize the client using <a href="#Authenticate">Authenticate</a>.
|
|
483
484
|
* Save this token to avoid having to reauthenticate with OAuth. This token expires after 24 hours.
|
|
@@ -487,9 +488,18 @@ class ElvWalletClient {
|
|
|
487
488
|
* - signingToken - Identical to `authToken`, but also includes the ability to perform arbitrary signatures with the custodial wallet. This token should be protected and should not be
|
|
488
489
|
* shared with third parties.
|
|
489
490
|
*/
|
|
490
|
-
async AuthenticateOAuth({
|
|
491
|
-
|
|
492
|
-
|
|
491
|
+
async AuthenticateOAuth({
|
|
492
|
+
idToken,
|
|
493
|
+
tenantId,
|
|
494
|
+
email,
|
|
495
|
+
signerURIs,
|
|
496
|
+
shareEmail=false,
|
|
497
|
+
extraData={},
|
|
498
|
+
nonce,
|
|
499
|
+
createRemoteToken=true,
|
|
500
|
+
force=false,
|
|
501
|
+
tokenDuration=24
|
|
502
|
+
}) {
|
|
493
503
|
if(!tenantId && this.selectedMarketplaceInfo) {
|
|
494
504
|
// Load tenant ID automatically from selected marketplace
|
|
495
505
|
await this.AvailableMarketplaces();
|
|
@@ -501,7 +511,7 @@ class ElvWalletClient {
|
|
|
501
511
|
let fabricToken, expiresAt;
|
|
502
512
|
if(createRemoteToken && this.client.signer.remoteSigner) {
|
|
503
513
|
expiresAt = Date.now() + 24 * 60 * 60 * 1000;
|
|
504
|
-
const tokenResponse = await this.client.signer.RetrieveCSAT({email, nonce, tenantId, force});
|
|
514
|
+
const tokenResponse = await this.client.signer.RetrieveCSAT({email, nonce, tenantId, force, duration: tokenDuration});
|
|
505
515
|
fabricToken = tokenResponse.token;
|
|
506
516
|
nonce = tokenResponse.nonce;
|
|
507
517
|
} else {
|