@tinycloud/cli 1.0.0-beta.10 → 1.0.0-beta.11
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 +260 -81
- package/dist/index.js.map +1 -1
- package/dist/legacy-entry.js +85 -49
- package/dist/legacy-entry.js.map +1 -1
- package/package.json +5 -5
package/dist/legacy-entry.js
CHANGED
|
@@ -17692,6 +17692,45 @@ function validateV3Invariants(value, ctx) {
|
|
|
17692
17692
|
ctx.addIssue({ code: external_exports2.ZodIssueCode.custom, path: ["policy", "capabilityCeiling"], message: "policy ceiling must contain exact decrypt network" });
|
|
17693
17693
|
}
|
|
17694
17694
|
}
|
|
17695
|
+
function assertKey(key32) {
|
|
17696
|
+
if (key32.length !== KEY_LENGTH) {
|
|
17697
|
+
throw new TypeError(`key must be ${KEY_LENGTH} bytes, got ${key32.length}`);
|
|
17698
|
+
}
|
|
17699
|
+
}
|
|
17700
|
+
async function importAesKey(key32, usage) {
|
|
17701
|
+
assertKey(key32);
|
|
17702
|
+
return globalThis.crypto.subtle.importKey(
|
|
17703
|
+
"raw",
|
|
17704
|
+
key32,
|
|
17705
|
+
"AES-GCM",
|
|
17706
|
+
false,
|
|
17707
|
+
[usage]
|
|
17708
|
+
);
|
|
17709
|
+
}
|
|
17710
|
+
async function open(blob, key32) {
|
|
17711
|
+
if (blob.length < HEADER_LENGTH + NONCE_LENGTH + TAG_LENGTH) {
|
|
17712
|
+
throw new TypeError(`sealed blob too short: ${blob.length} bytes`);
|
|
17713
|
+
}
|
|
17714
|
+
if (blob[0] !== SEALED_BLOB_VERSION) {
|
|
17715
|
+
throw new TypeError(`unknown sealed blob version: ${blob[0]}`);
|
|
17716
|
+
}
|
|
17717
|
+
const nonce = blob.subarray(HEADER_LENGTH, HEADER_LENGTH + NONCE_LENGTH);
|
|
17718
|
+
const ciphertext = blob.subarray(HEADER_LENGTH + NONCE_LENGTH);
|
|
17719
|
+
return decryptEnvelope(nonce, ciphertext, key32);
|
|
17720
|
+
}
|
|
17721
|
+
async function decryptEnvelope(nonce, ciphertext, key32) {
|
|
17722
|
+
if (nonce.length !== NONCE_LENGTH) {
|
|
17723
|
+
throw new TypeError(`nonce must be ${NONCE_LENGTH} bytes, got ${nonce.length}`);
|
|
17724
|
+
}
|
|
17725
|
+
const key = await importAesKey(key32, "decrypt");
|
|
17726
|
+
return new Uint8Array(
|
|
17727
|
+
await globalThis.crypto.subtle.decrypt(
|
|
17728
|
+
{ name: "AES-GCM", iv: nonce, additionalData: AAD },
|
|
17729
|
+
key,
|
|
17730
|
+
ciphertext
|
|
17731
|
+
)
|
|
17732
|
+
);
|
|
17733
|
+
}
|
|
17695
17734
|
function isPlainRecord(value) {
|
|
17696
17735
|
const proto = Object.getPrototypeOf(value);
|
|
17697
17736
|
return proto === Object.prototype || proto === null;
|
|
@@ -17891,50 +17930,46 @@ function assertCanonicalCid(cidString) {
|
|
|
17891
17930
|
throw new TypeError(`not a canonical CIDv1 raw sha2-256 base32 CID: ${cidString}`);
|
|
17892
17931
|
}
|
|
17893
17932
|
}
|
|
17894
|
-
function
|
|
17933
|
+
async function parseSealedInlineShareUrl(url, options = {}) {
|
|
17895
17934
|
const parsed = new URL(url);
|
|
17896
|
-
if (parsed.protocol !== "https:" || parsed.username !== "" || parsed.password !== "") throw new TypeError("inline share URL must be canonical HTTPS without userinfo");
|
|
17897
|
-
if (!isCanonicalHttpsOrigin(parsed.origin) || options.expectedOrigin !== void 0 && parsed.origin !== options.expectedOrigin) throw new TypeError("inline share URL origin is not trusted");
|
|
17898
|
-
if (parsed.pathname !== "/
|
|
17899
|
-
|
|
17900
|
-
const
|
|
17901
|
-
if (
|
|
17902
|
-
|
|
17935
|
+
if (parsed.protocol !== "https:" || parsed.username !== "" || parsed.password !== "") throw new TypeError("sealed inline share URL must be canonical HTTPS without userinfo");
|
|
17936
|
+
if (!isCanonicalHttpsOrigin(parsed.origin) || options.expectedOrigin !== void 0 && parsed.origin !== options.expectedOrigin) throw new TypeError("sealed inline share URL origin is not trusted");
|
|
17937
|
+
if (parsed.pathname !== "/s/inline" || parsed.search !== "") throw new TypeError("not a Node sealed-inline share URL");
|
|
17938
|
+
if (url !== `${parsed.origin}/s/inline${parsed.hash}`) throw new TypeError("sealed inline share URL is not lexically canonical");
|
|
17939
|
+
const prefix = "#v=2&p=";
|
|
17940
|
+
if (!parsed.hash.startsWith(prefix)) throw new TypeError("sealed inline URL is missing its canonical fragment");
|
|
17941
|
+
const encoded = parsed.hash.slice(prefix.length);
|
|
17942
|
+
if (encoded.length === 0 || parsed.hash !== `${prefix}${encoded}`) throw new TypeError("sealed inline URL fragment is not canonical");
|
|
17903
17943
|
let payloadBytes;
|
|
17904
17944
|
try {
|
|
17905
|
-
payloadBytes = fromBase64Url(
|
|
17945
|
+
payloadBytes = fromBase64Url(encoded);
|
|
17906
17946
|
} catch {
|
|
17907
|
-
throw new TypeError("inline payload is not canonical base64url");
|
|
17947
|
+
throw new TypeError("sealed inline payload is not canonical base64url");
|
|
17908
17948
|
}
|
|
17909
|
-
if (payloadBytes.byteLength === 0 || payloadBytes.byteLength > MAX_INLINE_BYTES * 2) throw new TypeError("inline payload is too large");
|
|
17949
|
+
if (payloadBytes.byteLength === 0 || payloadBytes.byteLength > MAX_INLINE_BYTES * 2) throw new TypeError("sealed inline payload is too large");
|
|
17950
|
+
const payloadText = new TextDecoder("utf-8", { fatal: true }).decode(payloadBytes);
|
|
17910
17951
|
let value;
|
|
17911
17952
|
try {
|
|
17912
|
-
value = JSON.parse(
|
|
17953
|
+
value = JSON.parse(payloadText);
|
|
17913
17954
|
} catch {
|
|
17914
|
-
throw new TypeError("inline payload is not valid JSON");
|
|
17955
|
+
throw new TypeError("sealed inline payload is not valid JSON");
|
|
17915
17956
|
}
|
|
17916
|
-
if (typeof value !== "object" || value === null || Array.isArray(value)) throw new TypeError("inline payload
|
|
17917
|
-
if (canonicalize2(value) !== new TextDecoder("utf-8").decode(payloadBytes)) throw new TypeError("inline payload is not canonical JSON");
|
|
17957
|
+
if (typeof value !== "object" || value === null || Array.isArray(value) || canonicalize2(value) !== payloadText) throw new TypeError("sealed inline payload is not canonical JSON");
|
|
17918
17958
|
const record = value;
|
|
17919
|
-
|
|
17920
|
-
if (!keys.every((key) => key === "v" || key === "c" || key === "cid" || key === "k") || record.v !== 2 || typeof record.c !== "string" || typeof record.cid !== "string" || publicPayload !== void 0 && (keys.length !== 3 || record.k !== void 0)) throw new TypeError("inline payload has invalid fields");
|
|
17959
|
+
if (Object.keys(record).length !== 4 || record.v !== 2 || typeof record.c !== "string" || typeof record.cid !== "string" || typeof record.k !== "string") throw new TypeError("sealed inline payload has invalid fields");
|
|
17921
17960
|
let ciphertext;
|
|
17961
|
+
let key32;
|
|
17922
17962
|
try {
|
|
17923
17963
|
ciphertext = fromBase64Url(record.c);
|
|
17964
|
+
key32 = fromBase64Url(record.k);
|
|
17924
17965
|
} catch {
|
|
17925
|
-
throw new TypeError("inline
|
|
17966
|
+
throw new TypeError("sealed inline payload has invalid base64url material");
|
|
17926
17967
|
}
|
|
17927
|
-
if (ciphertext.byteLength === 0 || ciphertext.byteLength > MAX_INLINE_BYTES) throw new TypeError("inline ciphertext is outside the allowed size");
|
|
17968
|
+
if (ciphertext.byteLength === 0 || ciphertext.byteLength > MAX_INLINE_BYTES) throw new TypeError("sealed inline ciphertext is outside the allowed size");
|
|
17969
|
+
if (key32.byteLength !== KEY_LENGTH2) throw new TypeError("sealed inline key must be 32 bytes");
|
|
17928
17970
|
assertCanonicalCid(record.cid);
|
|
17929
|
-
if (
|
|
17930
|
-
|
|
17931
|
-
try {
|
|
17932
|
-
key32 = record.k === void 0 ? void 0 : fromBase64Url(record.k);
|
|
17933
|
-
} catch {
|
|
17934
|
-
throw new TypeError("inline key is not canonical base64url");
|
|
17935
|
-
}
|
|
17936
|
-
if (key32 !== void 0 && key32.length !== KEY_LENGTH2) throw new TypeError("inline key must be 32 bytes");
|
|
17937
|
-
return { kind: "inline", ciphertextCid: record.cid, ciphertext, ...key32 === void 0 ? {} : { key32 } };
|
|
17971
|
+
if (await computeCid(ciphertext) !== record.cid) throw new TypeError("sealed inline ciphertext does not match its CID");
|
|
17972
|
+
return { kind: "inline", ciphertextCid: record.cid, ciphertext, key32 };
|
|
17938
17973
|
}
|
|
17939
17974
|
function metadataFor(envelope, origin) {
|
|
17940
17975
|
const kind = envelope.recipientMatcher.kind === "recipientDid" ? "recipientDid" : envelope.recipientMatcher.kind === "exactEmail" ? "email" : "emailDomain";
|
|
@@ -17960,19 +17995,17 @@ async function resolvePolicyShare(link2, options) {
|
|
|
17960
17995
|
let parsed;
|
|
17961
17996
|
try {
|
|
17962
17997
|
url = new URL(link2);
|
|
17963
|
-
|
|
17964
|
-
parsed = parseInlineShareUrl(link2, { ...options.expectedOrigin === void 0 ? {} : { expectedOrigin: options.expectedOrigin } });
|
|
17965
|
-
if (parsed.key32 !== void 0) throw new Error("secret inline transport is retired");
|
|
17998
|
+
parsed = await parseSealedInlineShareUrl(link2, { ...options.expectedOrigin === void 0 ? {} : { expectedOrigin: options.expectedOrigin } });
|
|
17966
17999
|
} catch {
|
|
17967
18000
|
throw new ShareReceiveError("invalid-link", "share link format is invalid");
|
|
17968
18001
|
}
|
|
17969
18002
|
const limit = options.maxSealedBlobBytes ?? DEFAULT_MAX_SEALED_BLOB_BYTES;
|
|
17970
|
-
if (!Number.isSafeInteger(limit) || limit <= 0 || parsed.ciphertext.byteLength > limit) throw new ShareReceiveError("max-bytes-exceeded", "
|
|
17971
|
-
if (await computeCid(parsed.ciphertext) !== parsed.ciphertextCid) throw new ShareReceiveError("cid-mismatch", "
|
|
18003
|
+
if (!Number.isSafeInteger(limit) || limit <= 0 || parsed.ciphertext.byteLength > limit) throw new ShareReceiveError("max-bytes-exceeded", "sealed policy envelope exceeds the configured byte limit");
|
|
18004
|
+
if (await computeCid(parsed.ciphertext) !== parsed.ciphertextCid) throw new ShareReceiveError("cid-mismatch", "sealed envelope bytes do not match the link CID");
|
|
17972
18005
|
options.signal?.throwIfAborted();
|
|
17973
18006
|
let envelope;
|
|
17974
18007
|
try {
|
|
17975
|
-
const encoded = new TextDecoder("utf-8", { fatal: true }).decode(parsed.ciphertext);
|
|
18008
|
+
const encoded = new TextDecoder("utf-8", { fatal: true }).decode(await open(parsed.ciphertext, parsed.key32));
|
|
17976
18009
|
const value = JSON.parse(encoded);
|
|
17977
18010
|
if (canonicalize2(value) !== encoded) throw new Error("non-canonical envelope");
|
|
17978
18011
|
envelope = shareEnvelopeV3Schema.parse(value);
|
|
@@ -18663,7 +18696,7 @@ function parseNativeShareUrl(value) {
|
|
|
18663
18696
|
if (!token || fragment.size !== 1) throw new TypeError("missing native share fragment");
|
|
18664
18697
|
return token;
|
|
18665
18698
|
}
|
|
18666
|
-
var __defProp2, __export2, external_exports2, util2, objectUtil2, ZodParsedType2, getParsedType2, ZodIssueCode2, quotelessJson2, ZodError2, errorMap2, en_default2, overrideErrorMap2, makeIssue2, EMPTY_PATH2, ParseStatus2, INVALID2, DIRTY2, OK2, isAborted2, isDirty2, isValid2, isAsync2, errorUtil2, ParseInputLazyPath2, handleResult2, ZodType2, cuidRegex2, cuid2Regex2, ulidRegex2, uuidRegex2, nanoidRegex2, jwtRegex2, durationRegex2, emailRegex2, _emojiRegex2, emojiRegex2, ipv4Regex2, ipv4CidrRegex2, ipv6Regex2, ipv6CidrRegex2, base64Regex2, base64urlRegex2, dateRegexSource2, dateRegex2, ZodString2, ZodNumber2, ZodBigInt2, ZodBoolean2, ZodDate2, ZodSymbol2, ZodUndefined2, ZodNull2, ZodAny2, ZodUnknown2, ZodNever2, ZodVoid2, ZodArray2, ZodObject2, ZodUnion2, getDiscriminator2, ZodDiscriminatedUnion2, ZodIntersection2, ZodTuple2, ZodRecord2, ZodMap2, ZodSet2, ZodFunction2, ZodLazy2, ZodLiteral2, ZodEnum2, ZodNativeEnum2, ZodPromise2, ZodEffects2, ZodOptional2, ZodNullable2, ZodDefault2, ZodCatch2, ZodNaN2, BRAND2, ZodBranded2, ZodPipeline2, ZodReadonly2, late2, ZodFirstPartyTypeKind2, instanceOfType2, stringType2, numberType2, nanType2, bigIntType2, booleanType2, dateType2, symbolType2, undefinedType2, nullType2, anyType2, unknownType2, neverType2, voidType2, arrayType2, objectType2, strictObjectType2, unionType2, discriminatedUnionType2, intersectionType2, tupleType2, recordType2, mapType2, setType2, functionType2, lazyType2, literalType2, enumType2, nativeEnumType2, promiseType2, effectsType2, optionalType2, nullableType2, preprocessType2, pipelineType2, ostring2, onumber2, oboolean2, coerce2, NEVER2, empty, src, _brrp__multiformats_scope_baseX, base_x_default, Encoder, Decoder, ComposedDecoder, Codec, base32, base32upper, base32pad, base32padupper, base32hex, base32hexupper, base32hexpad, base32hexpadupper, base32z, base36, base36upper, base58btc, base58flickr, encode_1, MSB, REST, MSBALL, INT, decode2, MSB$1, REST$1, N1, N2, N3, N4, N5, N6, N7, N8, N9, length, varint, _brrp_varint, varint_default, Digest, cache, CID, DAG_PB_CODE, SHA_256_CODE, cidSymbol, code, SHA256_CODE, base64, base64pad, base64url, base64urlpad, ED25519_MULTICODEC_PREFIX, PUBLIC_KEY_LENGTH, base64UrlString, sessionJwkCommonFields, okpPrivateJwkSchema, ecPrivateJwkSchema, sessionJwkSchema, policyTargetSchema, bearerKeyTargetSchema, recipientDidTargetSchema, authorizationTargetSchema, resourceSelectorSchema, targetSchema, displaySchema, contentPointerSchema, signatureSchema, unsignedShareEnvelopeSchema, shareEnvelopeSchema, recipientMatcherSchema, shareActionSchema, kvContentSourceSchema, sqlContentSourceSchema, contentSourceSchema, v2TargetSchema, shareDecryptionSchema, ownerAuthoritySchema, contentMetadataSchema, unsignedShareEnvelopeV2BaseSchema, unsignedShareEnvelopeV2Schema, shareEnvelopeV2Schema, unifiedResourceSchema, unifiedEncryptionNetworkSchema, unifiedKvCapabilitySchema, unifiedEncryptionCapabilitySchema, unifiedCapabilitySchema, unifiedContentSourceSchema, unifiedPolicyV1Schema, policyCredentialRequirementV1Schema, unifiedPolicyV2Schema, unifiedPolicySchema, unifiedRootSchema, attestedEnforcerBindingV2Schema, v3TargetSchema, unsignedShareEnvelopeV3BaseSchema, unsignedShareEnvelopeV3Schema, shareEnvelopeV3Schema, ENVELOPE_AAD_LABEL, AAD, ED25519_VERIFY_OPTS2, ENVELOPE_V3_SIGNATURE_DOMAIN, POLICY_V1_SIGNATURE_DOMAIN, POLICY_V2_SIGNATURE_DOMAIN, CONTENT_SOURCE_V1_DOMAIN, POLICY_CAPABILITY_V1_DOMAIN, NATIVE_PROJECTION_V1_DOMAIN, ATTESTED_ENFORCER_V2_DOMAIN, KEY_LENGTH2,
|
|
18699
|
+
var __defProp2, __export2, external_exports2, util2, objectUtil2, ZodParsedType2, getParsedType2, ZodIssueCode2, quotelessJson2, ZodError2, errorMap2, en_default2, overrideErrorMap2, makeIssue2, EMPTY_PATH2, ParseStatus2, INVALID2, DIRTY2, OK2, isAborted2, isDirty2, isValid2, isAsync2, errorUtil2, ParseInputLazyPath2, handleResult2, ZodType2, cuidRegex2, cuid2Regex2, ulidRegex2, uuidRegex2, nanoidRegex2, jwtRegex2, durationRegex2, emailRegex2, _emojiRegex2, emojiRegex2, ipv4Regex2, ipv4CidrRegex2, ipv6Regex2, ipv6CidrRegex2, base64Regex2, base64urlRegex2, dateRegexSource2, dateRegex2, ZodString2, ZodNumber2, ZodBigInt2, ZodBoolean2, ZodDate2, ZodSymbol2, ZodUndefined2, ZodNull2, ZodAny2, ZodUnknown2, ZodNever2, ZodVoid2, ZodArray2, ZodObject2, ZodUnion2, getDiscriminator2, ZodDiscriminatedUnion2, ZodIntersection2, ZodTuple2, ZodRecord2, ZodMap2, ZodSet2, ZodFunction2, ZodLazy2, ZodLiteral2, ZodEnum2, ZodNativeEnum2, ZodPromise2, ZodEffects2, ZodOptional2, ZodNullable2, ZodDefault2, ZodCatch2, ZodNaN2, BRAND2, ZodBranded2, ZodPipeline2, ZodReadonly2, late2, ZodFirstPartyTypeKind2, instanceOfType2, stringType2, numberType2, nanType2, bigIntType2, booleanType2, dateType2, symbolType2, undefinedType2, nullType2, anyType2, unknownType2, neverType2, voidType2, arrayType2, objectType2, strictObjectType2, unionType2, discriminatedUnionType2, intersectionType2, tupleType2, recordType2, mapType2, setType2, functionType2, lazyType2, literalType2, enumType2, nativeEnumType2, promiseType2, effectsType2, optionalType2, nullableType2, preprocessType2, pipelineType2, ostring2, onumber2, oboolean2, coerce2, NEVER2, empty, src, _brrp__multiformats_scope_baseX, base_x_default, Encoder, Decoder, ComposedDecoder, Codec, base32, base32upper, base32pad, base32padupper, base32hex, base32hexupper, base32hexpad, base32hexpadupper, base32z, base36, base36upper, base58btc, base58flickr, encode_1, MSB, REST, MSBALL, INT, decode2, MSB$1, REST$1, N1, N2, N3, N4, N5, N6, N7, N8, N9, length, varint, _brrp_varint, varint_default, Digest, cache, CID, DAG_PB_CODE, SHA_256_CODE, cidSymbol, code, SHA256_CODE, base64, base64pad, base64url, base64urlpad, ED25519_MULTICODEC_PREFIX, PUBLIC_KEY_LENGTH, base64UrlString, sessionJwkCommonFields, okpPrivateJwkSchema, ecPrivateJwkSchema, sessionJwkSchema, policyTargetSchema, bearerKeyTargetSchema, recipientDidTargetSchema, authorizationTargetSchema, resourceSelectorSchema, targetSchema, displaySchema, contentPointerSchema, signatureSchema, unsignedShareEnvelopeSchema, shareEnvelopeSchema, recipientMatcherSchema, shareActionSchema, kvContentSourceSchema, sqlContentSourceSchema, contentSourceSchema, v2TargetSchema, shareDecryptionSchema, ownerAuthoritySchema, contentMetadataSchema, unsignedShareEnvelopeV2BaseSchema, unsignedShareEnvelopeV2Schema, shareEnvelopeV2Schema, unifiedResourceSchema, unifiedEncryptionNetworkSchema, unifiedKvCapabilitySchema, unifiedEncryptionCapabilitySchema, unifiedCapabilitySchema, unifiedContentSourceSchema, unifiedPolicyV1Schema, policyCredentialRequirementV1Schema, unifiedPolicyV2Schema, unifiedPolicySchema, unifiedRootSchema, attestedEnforcerBindingV2Schema, v3TargetSchema, unsignedShareEnvelopeV3BaseSchema, unsignedShareEnvelopeV3Schema, shareEnvelopeV3Schema, ENVELOPE_AAD_LABEL, SEALED_BLOB_VERSION, AAD, KEY_LENGTH, NONCE_LENGTH, TAG_LENGTH, HEADER_LENGTH, ED25519_VERIFY_OPTS2, ENVELOPE_V3_SIGNATURE_DOMAIN, POLICY_V1_SIGNATURE_DOMAIN, POLICY_V2_SIGNATURE_DOMAIN, CONTENT_SOURCE_V1_DOMAIN, POLICY_CAPABILITY_V1_DOMAIN, NATIVE_PROJECTION_V1_DOMAIN, ATTESTED_ENFORCER_V2_DOMAIN, KEY_LENGTH2, MAX_INLINE_BYTES, SHARE_RESULT_VERSION, DEFAULT_MAX_SEALED_BLOB_BYTES, ShareReceiveError, SHARE_CONTENT_LIMIT, SHARE_PUBLISH_RESULT_VERSION, DEFAULT_SHARE_LIFETIME_MS, SharePublishError, empty2, src2, _brrp__multiformats_scope_baseX2, base_x_default2, Encoder2, Decoder2, ComposedDecoder2, Codec2, base58btc2, base58flickr2, textEncoder, base322, base32upper2, base32pad2, base32padupper2, base32hex2, base32hexupper2, base32hexpad2, base32hexpadupper2, base32z2, base362, base36upper2, encode_12, MSB2, REST2, MSBALL2, INT2, decode6, MSB$12, REST$12, N12, N22, N32, N42, N52, N62, N72, N82, N92, length2, varint2, _brrp_varint2, varint_default2, Digest2, cache2, CID2, DAG_PB_CODE2, SHA_256_CODE2, cidSymbol2, MAX_CONTENT_BYTES, ShareNotifyError, SHARE_V2_PROTOCOL, DOMAIN, PRESENTATION_DOMAIN, SESSION_DOMAIN, INVOCATION_DOMAIN, NATIVE_SHARE_FRAGMENT_PARAMETER;
|
|
18667
18700
|
var init_dist3 = __esm({
|
|
18668
18701
|
"../share-sdk/dist/index.js"() {
|
|
18669
18702
|
"use strict";
|
|
@@ -18817,10 +18850,10 @@ var init_dist3 = __esm({
|
|
|
18817
18850
|
return obj[e];
|
|
18818
18851
|
});
|
|
18819
18852
|
};
|
|
18820
|
-
util22.objectKeys = typeof Object.keys === "function" ? (obj) => Object.keys(obj) : (
|
|
18853
|
+
util22.objectKeys = typeof Object.keys === "function" ? (obj) => Object.keys(obj) : (object4) => {
|
|
18821
18854
|
const keys = [];
|
|
18822
|
-
for (const key in
|
|
18823
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
18855
|
+
for (const key in object4) {
|
|
18856
|
+
if (Object.prototype.hasOwnProperty.call(object4, key)) {
|
|
18824
18857
|
keys.push(key);
|
|
18825
18858
|
}
|
|
18826
18859
|
}
|
|
@@ -23279,7 +23312,12 @@ var init_dist3 = __esm({
|
|
|
23279
23312
|
unsignedShareEnvelopeV3Schema = unsignedShareEnvelopeV3BaseSchema.superRefine(validateV3Invariants);
|
|
23280
23313
|
shareEnvelopeV3Schema = unsignedShareEnvelopeV3BaseSchema.extend({ signature: signatureSchema }).strict().superRefine(validateV3Invariants);
|
|
23281
23314
|
ENVELOPE_AAD_LABEL = "tinycloud-share-envelope-v1";
|
|
23315
|
+
SEALED_BLOB_VERSION = 1;
|
|
23282
23316
|
AAD = utf8Bytes(ENVELOPE_AAD_LABEL);
|
|
23317
|
+
KEY_LENGTH = 32;
|
|
23318
|
+
NONCE_LENGTH = 12;
|
|
23319
|
+
TAG_LENGTH = 16;
|
|
23320
|
+
HEADER_LENGTH = 1;
|
|
23283
23321
|
ED25519_VERIFY_OPTS2 = { zip215: false };
|
|
23284
23322
|
ENVELOPE_V3_SIGNATURE_DOMAIN = "xyz.tinycloud.share/envelope/v3\0";
|
|
23285
23323
|
POLICY_V1_SIGNATURE_DOMAIN = "xyz.tinycloud.policy/policy/v1\0";
|
|
@@ -23289,8 +23327,6 @@ var init_dist3 = __esm({
|
|
|
23289
23327
|
NATIVE_PROJECTION_V1_DOMAIN = "xyz.tinycloud.policy/NativeProjection/v1\0";
|
|
23290
23328
|
ATTESTED_ENFORCER_V2_DOMAIN = "xyz.tinycloud.policy/AttestedEnforcerBinding/v2\0";
|
|
23291
23329
|
KEY_LENGTH2 = 32;
|
|
23292
|
-
INLINE_PREFIX = "#tc2=";
|
|
23293
|
-
PUBLIC_INLINE_PARAMETER = "tc2";
|
|
23294
23330
|
MAX_INLINE_BYTES = 256 * 1024;
|
|
23295
23331
|
SHARE_RESULT_VERSION = 1;
|
|
23296
23332
|
DEFAULT_MAX_SEALED_BLOB_BYTES = 100 * 1024 * 1024 + 29;
|
|
@@ -28392,7 +28428,7 @@ var init_profiles = __esm({
|
|
|
28392
28428
|
// src/commands/account.ts
|
|
28393
28429
|
init_profiles();
|
|
28394
28430
|
init_constants();
|
|
28395
|
-
import
|
|
28431
|
+
import open2 from "open";
|
|
28396
28432
|
import { readFile as readFile3 } from "fs/promises";
|
|
28397
28433
|
|
|
28398
28434
|
// src/lib/sdk.ts
|
|
@@ -29763,7 +29799,7 @@ function registerAccountCommand(program) {
|
|
|
29763
29799
|
billing.command(name2).description(`${name2 === "status" ? "Show" : "Open"} account billing page`).option("--open", "Open account.tinycloud.xyz in your browser").action(async (options) => {
|
|
29764
29800
|
try {
|
|
29765
29801
|
if (options.open) {
|
|
29766
|
-
await
|
|
29802
|
+
await open2(ACCOUNT_BILLING_URL);
|
|
29767
29803
|
}
|
|
29768
29804
|
outputJson({ url: ACCOUNT_BILLING_URL, opened: Boolean(options.open) });
|
|
29769
29805
|
} catch (error) {
|
|
@@ -30055,8 +30091,8 @@ async function callbackFlow(did, options = {}) {
|
|
|
30055
30091
|
}
|
|
30056
30092
|
if (openBrowser) {
|
|
30057
30093
|
try {
|
|
30058
|
-
const
|
|
30059
|
-
await
|
|
30094
|
+
const open4 = (await import("open")).default;
|
|
30095
|
+
await open4(authUrl);
|
|
30060
30096
|
} catch {
|
|
30061
30097
|
server.close();
|
|
30062
30098
|
throw new Error("Failed to open browser");
|
|
@@ -33923,8 +33959,8 @@ function registerSecretsCommand(program, openKeyAcquisition) {
|
|
|
33923
33959
|
});
|
|
33924
33960
|
secrets.command("manage").description("Open the TinyCloud Secrets Manager in your browser").action(async () => {
|
|
33925
33961
|
try {
|
|
33926
|
-
const
|
|
33927
|
-
await
|
|
33962
|
+
const open4 = (await import("open")).default;
|
|
33963
|
+
await open4("https://secrets.tinycloud.xyz");
|
|
33928
33964
|
outputJson({ opened: "https://secrets.tinycloud.xyz" });
|
|
33929
33965
|
} catch (error) {
|
|
33930
33966
|
handleError(error);
|
|
@@ -33973,7 +34009,7 @@ function receiveJson(result, path) {
|
|
|
33973
34009
|
|
|
33974
34010
|
// src/share/io.ts
|
|
33975
34011
|
import { constants } from "fs";
|
|
33976
|
-
import { lstat, mkdir as mkdir3, mkdtemp, open as
|
|
34012
|
+
import { lstat, mkdir as mkdir3, mkdtemp, open as open3, readFile as readFile9, realpath, stat as stat2, link, rename as rename2, rm as rm2, unlink } from "fs/promises";
|
|
33977
34013
|
import { randomBytes as randomBytes4 } from "crypto";
|
|
33978
34014
|
import { basename as basename2, join as join6, resolve as resolve2, sep } from "path";
|
|
33979
34015
|
var MAX_SHARE_STDIN_BYTES = 100 * 1024 * 1024;
|
|
@@ -34041,7 +34077,7 @@ async function writeShareOutput(directory, filename, bytes, force) {
|
|
|
34041
34077
|
const outputDirectory = resolve2(directory);
|
|
34042
34078
|
await assertDirectory(outputDirectory);
|
|
34043
34079
|
const safeName = safeFilename(filename);
|
|
34044
|
-
const directoryHandle = await
|
|
34080
|
+
const directoryHandle = await open3(outputDirectory, constants.O_RDONLY | (constants.O_DIRECTORY ?? 0) | (constants.O_NOFOLLOW ?? 0));
|
|
34045
34081
|
const stableDirectory = await realpath(outputDirectory);
|
|
34046
34082
|
const outputPath = join6(stableDirectory, safeName);
|
|
34047
34083
|
const directoryIdentity = await directoryHandle.stat();
|
|
@@ -34065,7 +34101,7 @@ async function writeShareOutput(directory, filename, bytes, force) {
|
|
|
34065
34101
|
if (error.code !== "ENOENT") throw error;
|
|
34066
34102
|
}
|
|
34067
34103
|
temporaryPath = stagingPath;
|
|
34068
|
-
handle = await
|
|
34104
|
+
handle = await open3(temporaryPath, constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | (constants.O_NOFOLLOW ?? 0), 384);
|
|
34069
34105
|
await handle.writeFile(bytes);
|
|
34070
34106
|
await handle.close();
|
|
34071
34107
|
handle = void 0;
|