@tinycloud/cli 0.7.7-beta.7 → 0.7.7
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/dist/index.js +24 -6
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -12105,11 +12105,7 @@ async function bootstrapDelegatedSession(ctx, delegation) {
|
|
|
12105
12105
|
delegationCid: delegation.cid,
|
|
12106
12106
|
spaceId: delegation.spaceId,
|
|
12107
12107
|
jwk,
|
|
12108
|
-
verificationMethod: sessionDid
|
|
12109
|
-
address: delegation.ownerAddress,
|
|
12110
|
-
chainId: delegation.chainId,
|
|
12111
|
-
siwe: "",
|
|
12112
|
-
signature: ""
|
|
12108
|
+
verificationMethod: sessionDid
|
|
12113
12109
|
});
|
|
12114
12110
|
await ProfileManager.setProfile(ctx.profile, {
|
|
12115
12111
|
...profile,
|
|
@@ -13023,7 +13019,7 @@ function registerAuthCommand(program2) {
|
|
|
13023
13019
|
return;
|
|
13024
13020
|
}
|
|
13025
13021
|
if (isRequestBoundDelegationEnvelope(parsed)) {
|
|
13026
|
-
await
|
|
13022
|
+
await importRequestBoundDelegationWithBootstrap(ctx, parsed);
|
|
13027
13023
|
return;
|
|
13028
13024
|
}
|
|
13029
13025
|
const imported = normalizeDelegationImport(parsed);
|
|
@@ -13346,6 +13342,28 @@ function isRequestBoundDelegationEnvelope(value) {
|
|
|
13346
13342
|
const candidate = value;
|
|
13347
13343
|
return candidate.kind === "tinycloud.auth.delegation" && candidate.version === 1 && Object.hasOwn(candidate, "requestId");
|
|
13348
13344
|
}
|
|
13345
|
+
async function importRequestBoundDelegationWithBootstrap(ctx, artifact) {
|
|
13346
|
+
const session = await ProfileManager.getSession(ctx.profile);
|
|
13347
|
+
if (session !== null) {
|
|
13348
|
+
await importRequestBoundDelegation(ctx, artifact);
|
|
13349
|
+
return;
|
|
13350
|
+
}
|
|
13351
|
+
const profile = await ProfileManager.getProfile(ctx.profile);
|
|
13352
|
+
if (resolveProfilePosture(profile) !== "delegate-session") {
|
|
13353
|
+
await importRequestBoundDelegation(ctx, artifact);
|
|
13354
|
+
return;
|
|
13355
|
+
}
|
|
13356
|
+
const candidate = artifact;
|
|
13357
|
+
const delegation = normalizePortableDelegation(candidate.delegation);
|
|
13358
|
+
try {
|
|
13359
|
+
await bootstrapDelegatedSession(ctx, delegation);
|
|
13360
|
+
await importRequestBoundDelegation(ctx, artifact);
|
|
13361
|
+
} catch (error) {
|
|
13362
|
+
await ProfileManager.clearSession(ctx.profile);
|
|
13363
|
+
await ProfileManager.setProfile(ctx.profile, profile);
|
|
13364
|
+
throw error;
|
|
13365
|
+
}
|
|
13366
|
+
}
|
|
13349
13367
|
async function importRequestBoundDelegation(ctx, artifact) {
|
|
13350
13368
|
const result = await invokeOperation(
|
|
13351
13369
|
"tinycloud.auth.import",
|