buckyos 0.7.140 → 0.7.144
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/cli/core/auth.ts +2 -3
- package/cli/dist/cli.mjs +3 -4
- package/cli/dist/cli.mjs.map +1 -1
- package/cli/version.ts +1 -1
- package/dist/account.d.ts +0 -2
- package/dist/account.d.ts.map +1 -1
- package/dist/app_login.d.ts +79 -0
- package/dist/app_login.d.ts.map +1 -0
- package/dist/browser.cjs +1 -1
- package/dist/browser.mjs +144 -135
- package/dist/{executor_client-d2c9e854.mjs → executor_client-4fbf0c3c.mjs} +273 -279
- package/dist/executor_client-4fbf0c3c.mjs.map +1 -0
- package/dist/executor_client-5fa2d501.js +13 -0
- package/dist/executor_client-5fa2d501.js.map +1 -0
- package/dist/executor_client.d.ts +1 -1
- package/dist/executor_client.d.ts.map +1 -1
- package/dist/hybrid_sso.d.ts +1 -1
- package/dist/hybrid_sso.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +147 -138
- package/dist/namelib.d.ts +1 -10
- package/dist/namelib.d.ts.map +1 -1
- package/dist/ndn_types-08dc9ef1.js +2 -0
- package/dist/ndn_types-08dc9ef1.js.map +1 -0
- package/dist/{ndn_types-dcb74613.mjs → ndn_types-bbb1f6a6.mjs} +54 -101
- package/dist/ndn_types-bbb1f6a6.mjs.map +1 -0
- package/dist/node.cjs +1 -1
- package/dist/node.mjs +144 -135
- package/dist/provision.cjs +2 -2
- package/dist/provision.cjs.map +1 -1
- package/dist/provision.mjs +18 -12
- package/dist/provision.mjs.map +1 -1
- package/dist/provision_activate.d.ts.map +1 -1
- package/dist/runtime.d.ts +1 -4
- package/dist/runtime.d.ts.map +1 -1
- package/dist/sdk_core.d.ts +1 -0
- package/dist/sdk_core.d.ts.map +1 -1
- package/dist/{tus_client-a2f73d53.js → tus_client-65c5fc5e.js} +2 -2
- package/dist/{tus_client-a2f73d53.js.map → tus_client-65c5fc5e.js.map} +1 -1
- package/dist/{tus_client-8fd4d937.mjs → tus_client-d313689e.mjs} +2 -2
- package/dist/{tus_client-8fd4d937.mjs.map → tus_client-d313689e.mjs.map} +1 -1
- package/dist/types.d.ts +0 -9
- package/dist/types.d.ts.map +1 -1
- package/dist/verify-hub-client.d.ts +1 -9
- package/dist/verify-hub-client.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/executor_client-978a8e1b.js +0 -13
- package/dist/executor_client-978a8e1b.js.map +0 -1
- package/dist/executor_client-d2c9e854.mjs.map +0 -1
- package/dist/ndn_types-324121ae.js +0 -2
- package/dist/ndn_types-324121ae.js.map +0 -1
- package/dist/ndn_types-dcb74613.mjs.map +0 -1
|
@@ -35,7 +35,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
35
35
|
return method;
|
|
36
36
|
};
|
|
37
37
|
var _listener, _listeners, _cancelled, _allowInsecure, _gzip, _headers, _method, _timeout, _url, _body, _bodyType, _creds, _preflight, _process, _retry, _signal, _throttle, _getUrlFunc, _send, send_fn, _statusCode, _statusMessage, _headers2, _body2, _request, _error, _names, _data, _dataLength, _writeData, writeData_fn, _data2, _offset, _bytesRead, _parent, _maxInflation, _incrementBytesRead, incrementBytesRead_fn, _peekBytes, peekBytes_fn, _r, _s, _v, _networkV, _privateKey, _options, _type, _to, _data3, _nonce, _gasLimit, _gasPrice, _maxPriorityFeePerGas, _maxFeePerGas, _value, _chainId, _sig, _accessList, _maxFeePerBlobGas, _blobVersionedHashes, _kzg, _blobs, _auths, _blobWrapperVersion, _getSerialized, getSerialized_fn, _types, _fullTypes, _encoderCache, _getEncoder, getEncoder_fn, _offset2, _tokens, _subTokenString, subTokenString_fn, _walkAsync, walkAsync_fn, _getCoder, getCoder_fn, _errors, _events, _functions, _abiCoder, _getFunction, getFunction_fn, _getEvent, getEvent_fn, _transactions, _logs, _startBlock, _iface, _iface2, _filter, _a, _supports2544, _resolver, _fetch, fetch_fn, _getResolver, getResolver_fn, _url2, _processFunc, _name, _chainId2, _plugins, _provider, _poller, _interval, _blockNumber, _poll, poll_fn, _provider2, _poll2, _running, _tag, _lastBlock, _filter2, _hash, _provider3, _filter3, _poller2, _running2, _blockNumber2, _poll3, poll_fn2, _subs, _plugins2, _pausedState, _destroyed, _networkPromise, _anyNetwork, _performCache, _lastBlockNumber, _nextTimer, _timers, _disableCcipRead, _requestRate, _requestTimes, _options2, _getDelay, getDelay_fn, _perform, perform_fn, _call, call_fn, _checkNetwork, checkNetwork_fn, _getAccountValue, getAccountValue_fn, _getBlock, getBlock_fn, _hasSub, hasSub_fn, _getSub, getSub_fn, _throwUnsupported, throwUnsupported_fn, _provider4, _filterIdPromise, _poller3, _running3, _network, _hault, _poll4, poll_fn3, _teardown, teardown_fn, _event, _options3, _nextId, _payloads, _drainTimer, _notReady, _network2, _pendingDetectNetwork, _scheduleDrain, scheduleDrain_fn, _pollingInterval, _connect, _signingKey, _data4, _checksum, _words, _loadWords, loadWords_fn, _account, account_fn, _fromSeed, fromSeed_fn, _fromAccount, fromAccount_fn;
|
|
38
|
-
import {
|
|
38
|
+
import { u as DID, v as getBrowserIdentityRaw, w as clearBrowserUserInfo, x as saveBrowserIdentity, y as saveBrowserUserInfo, z as getBrowserUserInfo, A as clearBrowserIdentity, N as NODE_IDENTITY_SCHEMA_V2, f as isBuckyOSLocalNodeIdentityConfig, o as parseBuckyOSOwnerDocument, h as hashPassword, B as saveLocalAccountInfo, C as cleanLocalAccountInfo, E as canonicalize, F as signJwtEdDSA, G as ChunkId, H as sha256Bytes, I as FileObject, O as ObjId, J as DirObject, S as SimpleChunkList } from "./ndn_types-bbb1f6a6.mjs";
|
|
39
39
|
class RPCError extends Error {
|
|
40
40
|
constructor(message, code, data) {
|
|
41
41
|
super(message);
|
|
@@ -231,15 +231,15 @@ const DENY_REASONS = [
|
|
|
231
231
|
"authorization_unavailable"
|
|
232
232
|
];
|
|
233
233
|
const ACCESS_DENIED_ERROR_CODE = "access_denied";
|
|
234
|
-
function isRecord(value) {
|
|
234
|
+
function isRecord$1(value) {
|
|
235
235
|
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
236
236
|
}
|
|
237
237
|
function parseAccessDenial(value) {
|
|
238
|
-
if (!isRecord(value) || typeof value.reason !== "string")
|
|
238
|
+
if (!isRecord$1(value) || typeof value.reason !== "string")
|
|
239
239
|
return null;
|
|
240
240
|
if (!DENY_REASONS.includes(value.reason))
|
|
241
241
|
return null;
|
|
242
|
-
const adjust = isRecord(value.adjust) && typeof value.adjust.party === "string" ? value.adjust : null;
|
|
242
|
+
const adjust = isRecord$1(value.adjust) && typeof value.adjust.party === "string" ? value.adjust : null;
|
|
243
243
|
if (!adjust)
|
|
244
244
|
return null;
|
|
245
245
|
return value;
|
|
@@ -251,7 +251,7 @@ function accessDenialOf(error) {
|
|
|
251
251
|
}
|
|
252
252
|
const ANONYMOUS_IDENTITY = { kind: "anonymous" };
|
|
253
253
|
function parseCurrentIdentity(value) {
|
|
254
|
-
if (!isRecord(value))
|
|
254
|
+
if (!isRecord$1(value))
|
|
255
255
|
return null;
|
|
256
256
|
if (value.kind === "anonymous")
|
|
257
257
|
return ANONYMOUS_IDENTITY;
|
|
@@ -497,21 +497,6 @@ class VerifyHubClient {
|
|
|
497
497
|
}
|
|
498
498
|
return this.rpcClient.call("verify_token", payload);
|
|
499
499
|
}
|
|
500
|
-
static normalizeLoginResponse(response) {
|
|
501
|
-
if ("user_info" in response) {
|
|
502
|
-
return {
|
|
503
|
-
user_name: response.user_info.show_name,
|
|
504
|
-
user_id: response.user_info.user_id,
|
|
505
|
-
user_type: response.user_info.user_type,
|
|
506
|
-
session_token: response.session_token,
|
|
507
|
-
refresh_token: response.refresh_token
|
|
508
|
-
};
|
|
509
|
-
}
|
|
510
|
-
if (!response.session_token) {
|
|
511
|
-
throw new RPCError("login_by_password response missing session_token");
|
|
512
|
-
}
|
|
513
|
-
return response;
|
|
514
|
-
}
|
|
515
500
|
}
|
|
516
501
|
const TASK_MANAGER_SERVICE_UNIQUE_ID = "task-manager";
|
|
517
502
|
const TASK_MANAGER_SERVICE_NAME = "task-manager";
|
|
@@ -3926,27 +3911,22 @@ class BuckyOSRuntime {
|
|
|
3926
3911
|
}, claims, material.keyPem);
|
|
3927
3912
|
}
|
|
3928
3913
|
async loadLocalSigningMaterial() {
|
|
3929
|
-
await importNodeModule$1("node:fs/promises");
|
|
3930
3914
|
const path = await importNodeModule$1("node:path");
|
|
3931
3915
|
const configuredUserId = this.getOwnerUserId();
|
|
3932
3916
|
if (!configuredUserId) {
|
|
3933
3917
|
const etcDir = await this.getBuckyOSEtcDir();
|
|
3934
|
-
const
|
|
3935
|
-
|
|
3936
|
-
|
|
3918
|
+
const nodeIdentityPath = path.join(etcDir, "node_identity.json");
|
|
3919
|
+
const metadata = await this.readNodeIdentityMetadata(nodeIdentityPath);
|
|
3920
|
+
if (!metadata) {
|
|
3921
|
+
throw new Error(`failed to load ${NODE_IDENTITY_SCHEMA_V2} node identity from ${nodeIdentityPath}`);
|
|
3937
3922
|
}
|
|
3938
|
-
const
|
|
3939
|
-
if (!
|
|
3940
|
-
throw new Error(`failed to load
|
|
3923
|
+
const material = await this.loadDeviceSigningMaterial(etcDir, metadata);
|
|
3924
|
+
if (!material) {
|
|
3925
|
+
throw new Error(`failed to load authentication private key of ${metadata.deviceDid}`);
|
|
3941
3926
|
}
|
|
3942
|
-
this.config.userid = deviceName;
|
|
3943
|
-
this.config.ownerUserId = deviceName;
|
|
3944
|
-
return
|
|
3945
|
-
keyPem,
|
|
3946
|
-
issuer: deviceName,
|
|
3947
|
-
subject: deviceName,
|
|
3948
|
-
sourcePath: path.join(etcDir, "node_private_key.pem")
|
|
3949
|
-
};
|
|
3927
|
+
this.config.userid = metadata.deviceName;
|
|
3928
|
+
this.config.ownerUserId = metadata.deviceName;
|
|
3929
|
+
return material;
|
|
3950
3930
|
}
|
|
3951
3931
|
const roots = await this.getPrivateKeySearchRoots();
|
|
3952
3932
|
const deviceMaterial = await this.tryLoadDeviceSigningMaterial(configuredUserId, roots);
|
|
@@ -4005,45 +3985,19 @@ class BuckyOSRuntime {
|
|
|
4005
3985
|
async readNodeIdentityMetadata(nodeIdentityPath) {
|
|
4006
3986
|
const fs = await importNodeModule$1("node:fs/promises");
|
|
4007
3987
|
try {
|
|
4008
|
-
const
|
|
4009
|
-
|
|
4010
|
-
|
|
3988
|
+
const parsed = JSON.parse(await fs.readFile(nodeIdentityPath, "utf8"));
|
|
3989
|
+
if (!isBuckyOSLocalNodeIdentityConfig(parsed)) {
|
|
3990
|
+
return null;
|
|
3991
|
+
}
|
|
4011
3992
|
return {
|
|
4012
|
-
deviceName,
|
|
4013
|
-
deviceDid:
|
|
4014
|
-
zoneDid:
|
|
4015
|
-
zoneName: typeof parsed.zone_name === "string" ? parsed.zone_name.trim() || null : null
|
|
3993
|
+
deviceName: parsed.device_name,
|
|
3994
|
+
deviceDid: parsed.device_did,
|
|
3995
|
+
zoneDid: parsed.zone_did
|
|
4016
3996
|
};
|
|
4017
3997
|
} catch {
|
|
4018
3998
|
return null;
|
|
4019
3999
|
}
|
|
4020
4000
|
}
|
|
4021
|
-
extractDeviceNameFromIdentityPayload(payload) {
|
|
4022
|
-
const directName = typeof payload.device_name === "string" ? payload.device_name.trim() : "";
|
|
4023
|
-
if (directName) {
|
|
4024
|
-
return directName;
|
|
4025
|
-
}
|
|
4026
|
-
const miniDocJwt = typeof payload.device_mini_doc_jwt === "string" ? payload.device_mini_doc_jwt : null;
|
|
4027
|
-
const miniDocClaims = parseSessionTokenClaims(miniDocJwt);
|
|
4028
|
-
const miniDocName = typeof (miniDocClaims == null ? void 0 : miniDocClaims.n) === "string" ? miniDocClaims.n.trim() : "";
|
|
4029
|
-
if (miniDocName) {
|
|
4030
|
-
return miniDocName;
|
|
4031
|
-
}
|
|
4032
|
-
const deviceDocJwt = typeof payload.device_doc_jwt === "string" ? payload.device_doc_jwt : null;
|
|
4033
|
-
const deviceDocClaims = parseSessionTokenClaims(deviceDocJwt);
|
|
4034
|
-
for (const claimKey of ["name", "sub"]) {
|
|
4035
|
-
const claimValue = deviceDocClaims == null ? void 0 : deviceDocClaims[claimKey];
|
|
4036
|
-
const candidate = typeof claimValue === "string" ? claimValue.trim() : "";
|
|
4037
|
-
if (candidate) {
|
|
4038
|
-
return candidate;
|
|
4039
|
-
}
|
|
4040
|
-
}
|
|
4041
|
-
return null;
|
|
4042
|
-
}
|
|
4043
|
-
async readDeviceNameFromNodeIdentityPath(nodeIdentityPath) {
|
|
4044
|
-
const metadata = await this.readNodeIdentityMetadata(nodeIdentityPath);
|
|
4045
|
-
return (metadata == null ? void 0 : metadata.deviceName) ?? null;
|
|
4046
|
-
}
|
|
4047
4001
|
async tryLoadDeviceSigningMaterial(userId, roots) {
|
|
4048
4002
|
const path = await importNodeModule$1("node:path");
|
|
4049
4003
|
const candidateDirs = [
|
|
@@ -4052,44 +4006,41 @@ class BuckyOSRuntime {
|
|
|
4052
4006
|
];
|
|
4053
4007
|
for (const dir of Array.from(new Set(candidateDirs))) {
|
|
4054
4008
|
const metadata = await this.readNodeIdentityMetadata(path.join(dir, "node_identity.json"));
|
|
4055
|
-
|
|
4056
|
-
if (!deviceName || deviceName !== userId) {
|
|
4009
|
+
if (!metadata || metadata.deviceName !== userId) {
|
|
4057
4010
|
continue;
|
|
4058
4011
|
}
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
continue;
|
|
4063
|
-
}
|
|
4064
|
-
return {
|
|
4065
|
-
keyPem,
|
|
4066
|
-
issuer: deviceName,
|
|
4067
|
-
subject: deviceName,
|
|
4068
|
-
sourcePath: keyPath
|
|
4069
|
-
};
|
|
4012
|
+
const material = await this.loadDeviceSigningMaterial(dir, metadata);
|
|
4013
|
+
if (material) {
|
|
4014
|
+
return material;
|
|
4070
4015
|
}
|
|
4071
4016
|
}
|
|
4072
4017
|
return null;
|
|
4073
4018
|
}
|
|
4074
|
-
//
|
|
4075
|
-
//
|
|
4076
|
-
|
|
4077
|
-
async deviceKeyPathCandidates(identityDir, deviceDid) {
|
|
4019
|
+
// The device authentication key lives in the identity-roots security dir,
|
|
4020
|
+
// keyed by the device DID.
|
|
4021
|
+
async loadDeviceSigningMaterial(identityDir, metadata) {
|
|
4078
4022
|
const path = await importNodeModule$1("node:path");
|
|
4079
|
-
const
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4023
|
+
const dirName = DID.fromStr(metadata.deviceDid).toFilename();
|
|
4024
|
+
const keyFileName = "authentication.private.pem";
|
|
4025
|
+
const securityRoot = trimToNull$2(getProcessEnv().BUCKYOS_SECURITY_ROOT) ?? path.join(await this.getBuckyOSRootDir(), "security");
|
|
4026
|
+
const keyPaths = [
|
|
4027
|
+
// dev/test layout: security root under the node dir itself
|
|
4028
|
+
path.join(identityDir, "security", dirName, keyFileName),
|
|
4029
|
+
// deployed layout: $BUCKYOS_SECURITY_ROOT or $BUCKYOS_ROOT/security
|
|
4030
|
+
path.join(securityRoot, dirName, keyFileName)
|
|
4031
|
+
];
|
|
4032
|
+
for (const keyPath of keyPaths) {
|
|
4033
|
+
const keyPem = await this.readPemFile(keyPath);
|
|
4034
|
+
if (keyPem) {
|
|
4035
|
+
return {
|
|
4036
|
+
keyPem,
|
|
4037
|
+
issuer: metadata.deviceName,
|
|
4038
|
+
subject: metadata.deviceName,
|
|
4039
|
+
sourcePath: keyPath
|
|
4040
|
+
};
|
|
4089
4041
|
}
|
|
4090
4042
|
}
|
|
4091
|
-
|
|
4092
|
-
return candidates;
|
|
4043
|
+
return null;
|
|
4093
4044
|
}
|
|
4094
4045
|
async tryLoadUserSigningMaterial(userId, roots) {
|
|
4095
4046
|
var _a2;
|
|
@@ -4121,35 +4072,6 @@ class BuckyOSRuntime {
|
|
|
4121
4072
|
}
|
|
4122
4073
|
return null;
|
|
4123
4074
|
}
|
|
4124
|
-
async tryResolveDeviceNameFromSearchRoots(roots) {
|
|
4125
|
-
const path = await importNodeModule$1("node:path");
|
|
4126
|
-
const env = getProcessEnv();
|
|
4127
|
-
const fromEnv = trimToNull$2(env.BUCKYOS_THIS_DEVICE_NAME);
|
|
4128
|
-
if (fromEnv) {
|
|
4129
|
-
return fromEnv;
|
|
4130
|
-
}
|
|
4131
|
-
for (const key of ["BUCKYOS_THIS_DEVICE", "BUCKYOS_THIS_DEVICE_INFO"]) {
|
|
4132
|
-
const raw = trimToNull$2(env[key]);
|
|
4133
|
-
if (!raw) {
|
|
4134
|
-
continue;
|
|
4135
|
-
}
|
|
4136
|
-
try {
|
|
4137
|
-
const parsed = JSON.parse(raw);
|
|
4138
|
-
if (typeof parsed.name === "string" && parsed.name.trim().length > 0) {
|
|
4139
|
-
return parsed.name.trim();
|
|
4140
|
-
}
|
|
4141
|
-
} catch {
|
|
4142
|
-
}
|
|
4143
|
-
}
|
|
4144
|
-
for (const root of roots) {
|
|
4145
|
-
const nodeIdentityPath = path.join(root, "node_identity.json");
|
|
4146
|
-
const deviceName = await this.readDeviceNameFromNodeIdentityPath(nodeIdentityPath);
|
|
4147
|
-
if (deviceName) {
|
|
4148
|
-
return deviceName;
|
|
4149
|
-
}
|
|
4150
|
-
}
|
|
4151
|
-
return null;
|
|
4152
|
-
}
|
|
4153
4075
|
async tryResolveZoneHostFromSearchRoots(roots) {
|
|
4154
4076
|
var _a2;
|
|
4155
4077
|
const fs = await importNodeModule$1("node:fs/promises");
|
|
@@ -4162,16 +4084,9 @@ class BuckyOSRuntime {
|
|
|
4162
4084
|
for (const root of roots) {
|
|
4163
4085
|
const nodeIdentityPath = path.join(root, "node_identity.json");
|
|
4164
4086
|
const metadata = await this.readNodeIdentityMetadata(nodeIdentityPath);
|
|
4165
|
-
if (
|
|
4166
|
-
|
|
4167
|
-
}
|
|
4168
|
-
if (metadata.zoneName) {
|
|
4169
|
-
return metadata.zoneName;
|
|
4087
|
+
if (metadata) {
|
|
4088
|
+
return resolveZoneHostFromDid(metadata.zoneDid);
|
|
4170
4089
|
}
|
|
4171
|
-
if (!metadata.zoneDid) {
|
|
4172
|
-
continue;
|
|
4173
|
-
}
|
|
4174
|
-
return resolveZoneHostFromDid(metadata.zoneDid);
|
|
4175
4090
|
}
|
|
4176
4091
|
for (const root of roots) {
|
|
4177
4092
|
const userConfigPath = path.join(root, "user_config.json");
|
|
@@ -4954,6 +4869,86 @@ class KEventClient {
|
|
|
4954
4869
|
};
|
|
4955
4870
|
}
|
|
4956
4871
|
}
|
|
4872
|
+
const APP_LOGIN_ISSUE_METHOD = "user.app_login.issue";
|
|
4873
|
+
const APP_LOGIN_EXCHANGE_METHOD = "auth.app_login.exchange";
|
|
4874
|
+
const APP_LOGIN_SETTINGS_GET_METHOD = "apps.app_login.get";
|
|
4875
|
+
const APP_LOGIN_SETTINGS_SET_METHOD = "apps.app_login.set";
|
|
4876
|
+
function isRecord(value) {
|
|
4877
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4878
|
+
}
|
|
4879
|
+
async function issue(client, params, kind) {
|
|
4880
|
+
const result = await client.call(APP_LOGIN_ISSUE_METHOD, { ...params, kind });
|
|
4881
|
+
if (!isRecord(result) || typeof result[kind] !== "string" || typeof result.user_id !== "string") {
|
|
4882
|
+
throw new Error(`invalid ${APP_LOGIN_ISSUE_METHOD} response`);
|
|
4883
|
+
}
|
|
4884
|
+
return result;
|
|
4885
|
+
}
|
|
4886
|
+
async function issueAppLoginCode(client, params) {
|
|
4887
|
+
const result = await issue(client, params, "code");
|
|
4888
|
+
return {
|
|
4889
|
+
user_id: result.user_id,
|
|
4890
|
+
code: result.code,
|
|
4891
|
+
expires_at: Number(result.expires_at ?? 0),
|
|
4892
|
+
new_account: result.new_account === true,
|
|
4893
|
+
invite: isRecord(result.invite) ? result.invite : {}
|
|
4894
|
+
};
|
|
4895
|
+
}
|
|
4896
|
+
async function issueAppCustomerLink(client, params) {
|
|
4897
|
+
const result = await issue(client, params, "link");
|
|
4898
|
+
return {
|
|
4899
|
+
user_id: result.user_id,
|
|
4900
|
+
link: result.link,
|
|
4901
|
+
expires_at: Number(result.expires_at ?? 0),
|
|
4902
|
+
new_account: result.new_account === true,
|
|
4903
|
+
invite: isRecord(result.invite) ? result.invite : {}
|
|
4904
|
+
};
|
|
4905
|
+
}
|
|
4906
|
+
function parseAppLoginExchangeResult(value) {
|
|
4907
|
+
if (!isRecord(value))
|
|
4908
|
+
return null;
|
|
4909
|
+
if (value.status === "ready") {
|
|
4910
|
+
if (typeof value.callback_url !== "string" || typeof value.user_id !== "string")
|
|
4911
|
+
return null;
|
|
4912
|
+
return { status: "ready", callback_url: value.callback_url, user_id: value.user_id };
|
|
4913
|
+
}
|
|
4914
|
+
if (value.status === "denied") {
|
|
4915
|
+
const denial = parseAccessDenial(value.denial);
|
|
4916
|
+
return denial ? { status: "denied", denial } : null;
|
|
4917
|
+
}
|
|
4918
|
+
return null;
|
|
4919
|
+
}
|
|
4920
|
+
function randomAppLoginNonce() {
|
|
4921
|
+
var _a2;
|
|
4922
|
+
const bytes2 = new Uint8Array(16);
|
|
4923
|
+
if (typeof ((_a2 = globalThis.crypto) == null ? void 0 : _a2.getRandomValues) === "function") {
|
|
4924
|
+
globalThis.crypto.getRandomValues(bytes2);
|
|
4925
|
+
} else {
|
|
4926
|
+
for (let i = 0; i < bytes2.length; i += 1)
|
|
4927
|
+
bytes2[i] = Math.floor(Math.random() * 256);
|
|
4928
|
+
}
|
|
4929
|
+
return Array.from(bytes2, (b2) => b2.toString(16).padStart(2, "0")).join("");
|
|
4930
|
+
}
|
|
4931
|
+
async function loginByAppAccessToken(params) {
|
|
4932
|
+
const client = params.client ?? new kRPCClient(params.controlPanelUrl ?? "/kapi/control-panel");
|
|
4933
|
+
const request = {
|
|
4934
|
+
code: params.code,
|
|
4935
|
+
nonce: params.nonce ?? randomAppLoginNonce()
|
|
4936
|
+
};
|
|
4937
|
+
if (params.return_path)
|
|
4938
|
+
request.return_path = params.return_path;
|
|
4939
|
+
const result = parseAppLoginExchangeResult(await client.call(APP_LOGIN_EXCHANGE_METHOD, request));
|
|
4940
|
+
if (!result)
|
|
4941
|
+
throw new Error(`invalid ${APP_LOGIN_EXCHANGE_METHOD} response`);
|
|
4942
|
+
return result;
|
|
4943
|
+
}
|
|
4944
|
+
async function completeAppAccessTokenLogin(params, navigate = (url) => {
|
|
4945
|
+
window.location.assign(url);
|
|
4946
|
+
}) {
|
|
4947
|
+
const result = await loginByAppAccessToken(params);
|
|
4948
|
+
if (result.status === "ready")
|
|
4949
|
+
navigate(result.callback_url);
|
|
4950
|
+
return result;
|
|
4951
|
+
}
|
|
4957
4952
|
const WEB3_BRIDGE_HOST = "web3.buckyos.ai";
|
|
4958
4953
|
const BS_SERVICE_VERIFY_HUB = "verify-hub";
|
|
4959
4954
|
const BS_SERVICE_TASK_MANAGER = "task-manager";
|
|
@@ -5129,7 +5124,6 @@ class BuckyOSSDK {
|
|
|
5129
5124
|
var _a2;
|
|
5130
5125
|
const finalConfig = this.buildRuntimeConfig(appid, config);
|
|
5131
5126
|
if (this.target !== "node" && isBrowserRuntime() && !config) {
|
|
5132
|
-
localStorage.removeItem("zone_host_name");
|
|
5133
5127
|
let zoneHostName = localStorage.getItem("zone_host_name_v2");
|
|
5134
5128
|
if (zoneHostName) {
|
|
5135
5129
|
finalConfig.zoneHost = zoneHostName;
|
|
@@ -5269,20 +5263,19 @@ class BuckyOSSDK {
|
|
|
5269
5263
|
try {
|
|
5270
5264
|
const verifyHubClient = this.getVerifyHubClient();
|
|
5271
5265
|
verifyHubClient.setSeq(loginNonce);
|
|
5272
|
-
const
|
|
5266
|
+
const response = await verifyHubClient.loginByPassword({
|
|
5273
5267
|
username,
|
|
5274
5268
|
password: passwordHash,
|
|
5275
5269
|
target: resolvedTarget,
|
|
5276
5270
|
login_nonce: loginNonce,
|
|
5277
5271
|
source_url: typeof window !== "undefined" ? window.location.href : void 0
|
|
5278
5272
|
});
|
|
5279
|
-
const normalized = VerifyHubClient.normalizeLoginResponse(accountResponse);
|
|
5280
5273
|
const accountInfo = {
|
|
5281
|
-
user_name:
|
|
5282
|
-
user_id:
|
|
5283
|
-
user_type:
|
|
5284
|
-
session_token:
|
|
5285
|
-
refresh_token:
|
|
5274
|
+
user_name: response.user_info.show_name,
|
|
5275
|
+
user_id: response.user_info.user_id,
|
|
5276
|
+
user_type: response.user_info.user_type,
|
|
5277
|
+
session_token: response.session_token,
|
|
5278
|
+
refresh_token: response.refresh_token
|
|
5286
5279
|
};
|
|
5287
5280
|
if (isBrowserStorageAvailable()) {
|
|
5288
5281
|
saveLocalAccountInfo(appId, accountInfo);
|
|
@@ -5290,7 +5283,7 @@ class BuckyOSSDK {
|
|
|
5290
5283
|
saveBrowserUserInfo({
|
|
5291
5284
|
user_name: accountInfo.user_name,
|
|
5292
5285
|
user_id: accountInfo.user_id,
|
|
5293
|
-
user_type:
|
|
5286
|
+
user_type: response.user_info.user_type
|
|
5294
5287
|
});
|
|
5295
5288
|
}
|
|
5296
5289
|
this.currentAccountInfo = accountInfo;
|
|
@@ -5573,16 +5566,7 @@ class BuckyOSSDK {
|
|
|
5573
5566
|
}
|
|
5574
5567
|
const doc = await response.json();
|
|
5575
5568
|
const hostname = typeof doc.hostname === "string" ? doc.hostname.trim() : "";
|
|
5576
|
-
|
|
5577
|
-
return hostname;
|
|
5578
|
-
}
|
|
5579
|
-
if (typeof doc.id === "string") {
|
|
5580
|
-
const match = doc.id.match(/^did:web:([^/?#]+)/);
|
|
5581
|
-
if (match && match[1]) {
|
|
5582
|
-
return match[1];
|
|
5583
|
-
}
|
|
5584
|
-
}
|
|
5585
|
-
return null;
|
|
5569
|
+
return hostname.length > 0 ? hostname : null;
|
|
5586
5570
|
} catch {
|
|
5587
5571
|
return null;
|
|
5588
5572
|
}
|
|
@@ -28627,7 +28611,7 @@ async function uploadChunkViaTus(endpoint, file, chunkInfo, chunkIndex, fileHash
|
|
|
28627
28611
|
const logicalPath = chunkInfo.chunkId;
|
|
28628
28612
|
let tusModule;
|
|
28629
28613
|
try {
|
|
28630
|
-
tusModule = await import("./tus_client-
|
|
28614
|
+
tusModule = await import("./tus_client-d313689e.mjs");
|
|
28631
28615
|
} catch (error) {
|
|
28632
28616
|
const message = error instanceof Error ? error.message : String(error);
|
|
28633
28617
|
throw new NdmError("UPLOAD_FAILED", `Failed to load tus-js-client: ${message}`);
|
|
@@ -29758,7 +29742,7 @@ export {
|
|
|
29758
29742
|
ZONE_USER_TYPES as Z,
|
|
29759
29743
|
CONTACT_TAG_ZONE_AGENT as _,
|
|
29760
29744
|
ndm_proxy as a,
|
|
29761
|
-
|
|
29745
|
+
TASK_ERR_CONTROL_ALREADY_PENDING as a$,
|
|
29762
29746
|
CONTACT_CHANGED_EVENT_BOX as a0,
|
|
29763
29747
|
WELL_KNOWN_CONTACT_TAGS as a1,
|
|
29764
29748
|
USER_TYPE_GROUP_REF_PREFIX as a2,
|
|
@@ -29769,33 +29753,33 @@ export {
|
|
|
29769
29753
|
DENY_REASONS as a7,
|
|
29770
29754
|
ACCESS_DENIED_ERROR_CODE as a8,
|
|
29771
29755
|
parseAccessDenial as a9,
|
|
29772
|
-
|
|
29773
|
-
|
|
29774
|
-
|
|
29775
|
-
|
|
29776
|
-
|
|
29777
|
-
|
|
29778
|
-
|
|
29779
|
-
|
|
29780
|
-
|
|
29781
|
-
|
|
29782
|
-
|
|
29783
|
-
|
|
29784
|
-
|
|
29785
|
-
|
|
29786
|
-
|
|
29787
|
-
|
|
29788
|
-
|
|
29789
|
-
|
|
29790
|
-
|
|
29791
|
-
|
|
29792
|
-
|
|
29793
|
-
|
|
29794
|
-
|
|
29795
|
-
|
|
29796
|
-
|
|
29797
|
-
|
|
29798
|
-
|
|
29756
|
+
DOWNLOAD_TASK_SCHEMA_ID as aA,
|
|
29757
|
+
SCHEDULER_DISPATCH_THUNK_TASK_SCHEMA_ID as aB,
|
|
29758
|
+
WORKFLOW_RUN_TREE_TASK_SCHEMA_ID as aC,
|
|
29759
|
+
WORKFLOW_STEP_TASK_SCHEMA_ID as aD,
|
|
29760
|
+
WORKFLOW_MAP_SHARD_TASK_SCHEMA_ID as aE,
|
|
29761
|
+
WORKFLOW_THUNK_TASK_SCHEMA_ID as aF,
|
|
29762
|
+
WORKFLOW_SCHEDULE_TASK_SCHEMA_ID as aG,
|
|
29763
|
+
WORKFLOW_SEND_MESSAGE_TASK_SCHEMA_ID as aH,
|
|
29764
|
+
WORKFLOW_EXECUTE_RPC_TASK_SCHEMA_ID as aI,
|
|
29765
|
+
WORKFLOW_RUN_TARGET_TASK_SCHEMA_ID as aJ,
|
|
29766
|
+
AGENT_DELEGATE_TASK_SCHEMA_ID as aK,
|
|
29767
|
+
HUMAN_INPUT_TASK_SCHEMA_ID as aL,
|
|
29768
|
+
OPENDAN_ASYNC_TOOL_TASK_SCHEMA_ID as aM,
|
|
29769
|
+
OPENDAN_COMMAND_TASK_SCHEMA_ID as aN,
|
|
29770
|
+
TOOL_EXEC_BASH_TASK_SCHEMA_ID as aO,
|
|
29771
|
+
AICC_COMPUTE_TASK_SCHEMA_ID as aP,
|
|
29772
|
+
APP_INSTALL_TASK_SCHEMA_ID as aQ,
|
|
29773
|
+
APP_UNINSTALL_TASK_SCHEMA_ID as aR,
|
|
29774
|
+
APP_START_TASK_SCHEMA_ID as aS,
|
|
29775
|
+
APP_UPDATE_TASK_SCHEMA_ID as aT,
|
|
29776
|
+
APP_UPDATE_BATCH_TASK_SCHEMA_ID as aU,
|
|
29777
|
+
TASK_ERR_NOT_FOUND as aV,
|
|
29778
|
+
TASK_ERR_PERMISSION_DENIED as aW,
|
|
29779
|
+
TASK_ERR_REVISION_CONFLICT as aX,
|
|
29780
|
+
TASK_ERR_STALE_RUNNER_EPOCH as aY,
|
|
29781
|
+
TASK_ERR_INVALID_PHASE as aZ,
|
|
29782
|
+
TASK_ERR_CONTROL_NOT_AVAILABLE as a_,
|
|
29799
29783
|
accessDenialOf as aa,
|
|
29800
29784
|
ANONYMOUS_IDENTITY as ab,
|
|
29801
29785
|
parseCurrentIdentity as ac,
|
|
@@ -29806,103 +29790,113 @@ export {
|
|
|
29806
29790
|
normalizeZoneHostname as ah,
|
|
29807
29791
|
zoneActionUrl as ai,
|
|
29808
29792
|
buildJumpUrl as aj,
|
|
29809
|
-
|
|
29810
|
-
|
|
29811
|
-
|
|
29812
|
-
|
|
29813
|
-
|
|
29814
|
-
|
|
29815
|
-
|
|
29816
|
-
|
|
29817
|
-
|
|
29818
|
-
|
|
29819
|
-
|
|
29820
|
-
|
|
29821
|
-
|
|
29822
|
-
|
|
29823
|
-
|
|
29824
|
-
|
|
29793
|
+
APP_LOGIN_ISSUE_METHOD as ak,
|
|
29794
|
+
APP_LOGIN_EXCHANGE_METHOD as al,
|
|
29795
|
+
APP_LOGIN_SETTINGS_GET_METHOD as am,
|
|
29796
|
+
APP_LOGIN_SETTINGS_SET_METHOD as an,
|
|
29797
|
+
issueAppLoginCode as ao,
|
|
29798
|
+
issueAppCustomerLink as ap,
|
|
29799
|
+
parseAppLoginExchangeResult as aq,
|
|
29800
|
+
randomAppLoginNonce as ar,
|
|
29801
|
+
loginByAppAccessToken as as,
|
|
29802
|
+
completeAppAccessTokenLogin as at,
|
|
29803
|
+
TASK_MANAGER_SERVICE_UNIQUE_ID as au,
|
|
29804
|
+
TASK_MANAGER_SERVICE_NAME as av,
|
|
29805
|
+
TASK_MANAGER_SERVICE_PORT as aw,
|
|
29806
|
+
TASK_POLICY_PRESET_COLLABORATIVE_TREE_V1 as ax,
|
|
29807
|
+
RAW_TASK_SCHEMA_ID as ay,
|
|
29808
|
+
HUMAN_APPROVAL_SCHEMA_ID as az,
|
|
29825
29809
|
bns_client as b,
|
|
29826
|
-
|
|
29827
|
-
|
|
29828
|
-
|
|
29829
|
-
|
|
29830
|
-
|
|
29831
|
-
|
|
29832
|
-
|
|
29833
|
-
|
|
29834
|
-
|
|
29835
|
-
|
|
29836
|
-
|
|
29837
|
-
|
|
29838
|
-
|
|
29839
|
-
|
|
29840
|
-
|
|
29841
|
-
|
|
29842
|
-
|
|
29843
|
-
|
|
29844
|
-
|
|
29845
|
-
|
|
29846
|
-
|
|
29847
|
-
|
|
29848
|
-
|
|
29849
|
-
|
|
29850
|
-
|
|
29851
|
-
|
|
29852
|
-
|
|
29853
|
-
|
|
29854
|
-
|
|
29855
|
-
|
|
29856
|
-
|
|
29857
|
-
|
|
29858
|
-
|
|
29859
|
-
|
|
29860
|
-
|
|
29861
|
-
|
|
29862
|
-
|
|
29863
|
-
|
|
29864
|
-
|
|
29865
|
-
|
|
29866
|
-
|
|
29867
|
-
|
|
29868
|
-
|
|
29869
|
-
|
|
29870
|
-
|
|
29871
|
-
|
|
29872
|
-
|
|
29873
|
-
|
|
29874
|
-
|
|
29875
|
-
|
|
29876
|
-
|
|
29877
|
-
|
|
29878
|
-
|
|
29879
|
-
|
|
29880
|
-
|
|
29881
|
-
|
|
29882
|
-
|
|
29883
|
-
|
|
29884
|
-
|
|
29885
|
-
|
|
29886
|
-
|
|
29887
|
-
|
|
29888
|
-
|
|
29889
|
-
|
|
29810
|
+
KEventClient as b$,
|
|
29811
|
+
TASK_ERR_ALREADY_COMPLETED as b0,
|
|
29812
|
+
TASK_ERR_INPUT_SCHEMA_MISMATCH as b1,
|
|
29813
|
+
TASK_ERR_RESULT_SCHEMA_MISMATCH as b2,
|
|
29814
|
+
TASK_ERR_IDEMPOTENCY_CONFLICT as b3,
|
|
29815
|
+
TASK_ERR_SCHEMA_NOT_FOUND as b4,
|
|
29816
|
+
TASK_MGR_ERROR_CODES as b5,
|
|
29817
|
+
taskMgrTaskEventPath as b6,
|
|
29818
|
+
taskMgrTreeEventPath as b7,
|
|
29819
|
+
taskMgrErrorCode as b8,
|
|
29820
|
+
TaskExecutorKind as b9,
|
|
29821
|
+
AICC_SERVICE_UNIQUE_ID as bA,
|
|
29822
|
+
AICC_SERVICE_SERVICE_NAME as bB,
|
|
29823
|
+
AICC_SERVICE_SERVICE_PORT as bC,
|
|
29824
|
+
AICC_AI_METHODS as bD,
|
|
29825
|
+
AICC_CORE_METHODS as bE,
|
|
29826
|
+
AICC_MANAGEMENT_METHODS as bF,
|
|
29827
|
+
AICC_QUOTA_METHODS as bG,
|
|
29828
|
+
AICC_METHODS as bH,
|
|
29829
|
+
AICC_FEATURES as bI,
|
|
29830
|
+
AICC_EXECUTION_MODES as bJ,
|
|
29831
|
+
AICC_POLICY_REFUSAL_CODES as bK,
|
|
29832
|
+
aiccRefusalOf as bL,
|
|
29833
|
+
isAiccAiMethod as bM,
|
|
29834
|
+
aiccTextMessage as bN,
|
|
29835
|
+
aiccMessageTextContent as bO,
|
|
29836
|
+
aiccMessageFirstText as bP,
|
|
29837
|
+
validateAiccMessage as bQ,
|
|
29838
|
+
AiccClient as bR,
|
|
29839
|
+
decisionRequirements as bS,
|
|
29840
|
+
validateDecisionRequest as bT,
|
|
29841
|
+
validateDecisionAnswers as bU,
|
|
29842
|
+
parseVideoPrompt as bV,
|
|
29843
|
+
validateVideoOutput as bW,
|
|
29844
|
+
validateVideoGeneration as bX,
|
|
29845
|
+
validateVideoEdit as bY,
|
|
29846
|
+
videoGenerationRequirement as bZ,
|
|
29847
|
+
KEventReader as b_,
|
|
29848
|
+
TaskPhase as ba,
|
|
29849
|
+
isTerminalTaskPhase as bb,
|
|
29850
|
+
TaskWaitReasonKind as bc,
|
|
29851
|
+
TaskOutcome as bd,
|
|
29852
|
+
TaskControlAction as be,
|
|
29853
|
+
baselineTaskControlProfile as bf,
|
|
29854
|
+
DEFAULT_CHILD_CONTROL_POLICY as bg,
|
|
29855
|
+
TaskAction as bh,
|
|
29856
|
+
TaskGrantScope as bi,
|
|
29857
|
+
TaskDataScope as bj,
|
|
29858
|
+
StorageDomain as bk,
|
|
29859
|
+
TaskEventType as bl,
|
|
29860
|
+
TaskManagerClient as bm,
|
|
29861
|
+
WORKFLOW_SERVICE_NAME as bn,
|
|
29862
|
+
WorkflowStepType as bo,
|
|
29863
|
+
WorkflowOutputMode as bp,
|
|
29864
|
+
WorkflowJoinMode as bq,
|
|
29865
|
+
WorkflowRetryFallback as br,
|
|
29866
|
+
WorkflowDefinitionStatus as bs,
|
|
29867
|
+
WorkflowRunStatus as bt,
|
|
29868
|
+
WorkflowNodeRunState as bu,
|
|
29869
|
+
WorkflowHumanActionKind as bv,
|
|
29870
|
+
WorkflowScheduledTaskStatus as bw,
|
|
29871
|
+
WorkflowScheduledTaskMisfirePolicy as bx,
|
|
29872
|
+
WorkflowScheduledTaskFireStatus as by,
|
|
29873
|
+
WorkflowClient as bz,
|
|
29890
29874
|
createSDKModule as c,
|
|
29891
|
-
|
|
29892
|
-
|
|
29893
|
-
|
|
29894
|
-
|
|
29895
|
-
|
|
29896
|
-
|
|
29897
|
-
|
|
29898
|
-
|
|
29899
|
-
|
|
29900
|
-
|
|
29901
|
-
|
|
29902
|
-
|
|
29903
|
-
|
|
29904
|
-
|
|
29905
|
-
|
|
29875
|
+
appIdFromDid as c0,
|
|
29876
|
+
parseAppId as c1,
|
|
29877
|
+
appDidFromId as c2,
|
|
29878
|
+
createAppInstanceId as c3,
|
|
29879
|
+
parseAppInstanceId as c4,
|
|
29880
|
+
BNS_EVM_DEFAULT_GAS_LIMIT as c5,
|
|
29881
|
+
BNS_EVM_DEFAULT_MAX_FEE_PER_GAS as c6,
|
|
29882
|
+
BNS_EVM_DEFAULT_MAX_PRIORITY_FEE_PER_GAS as c7,
|
|
29883
|
+
BNS_MAX_INLINE_DOCUMENT_BYTES as c8,
|
|
29884
|
+
BNS_DNS_TXT_DEFAULT_TTL as c9,
|
|
29885
|
+
BNS_DNS_TXT_DOC_TYPE as ca,
|
|
29886
|
+
BNS_PUBLISH_DOCUMENT_ABI as cb,
|
|
29887
|
+
BnsEvmTxError as cc,
|
|
29888
|
+
BnsEvmTxBuilder as cd,
|
|
29889
|
+
decodeBnsPublishDocumentCalldata as ce,
|
|
29890
|
+
BnsTxExecutorError as cf,
|
|
29891
|
+
walletUserHasSnAccount as cg,
|
|
29892
|
+
BnsTxExecutor as ch,
|
|
29893
|
+
ExecutorClient as ci,
|
|
29894
|
+
ExecutorStreamError as cj,
|
|
29895
|
+
encodeExecutorControl as ck,
|
|
29896
|
+
ExecutorCommandStream as cl,
|
|
29897
|
+
AIWORKSPACE_SERVICE_NAME as cm,
|
|
29898
|
+
AiwsFailure as cn,
|
|
29899
|
+
AiWorkspaceClient as co,
|
|
29906
29900
|
BS_SERVICE_TASK_MANAGER as d,
|
|
29907
29901
|
getActiveRuntimeType as e,
|
|
29908
29902
|
getActiveZoneGatewayOrigin as f,
|
|
@@ -29927,4 +29921,4 @@ export {
|
|
|
29927
29921
|
NOTIFY_TEXT_CONTROL_ID as y,
|
|
29928
29922
|
NOTIFY_ACTION_ANSWER as z
|
|
29929
29923
|
};
|
|
29930
|
-
//# sourceMappingURL=executor_client-
|
|
29924
|
+
//# sourceMappingURL=executor_client-4fbf0c3c.mjs.map
|