ccsini 0.1.20 → 0.1.22
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 +608 -191
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -26459,35 +26459,7 @@ var init_dist16 = __esm(() => {
|
|
|
26459
26459
|
dist_default12 = inquirer;
|
|
26460
26460
|
});
|
|
26461
26461
|
|
|
26462
|
-
// ../../node_modules/.bun/commander@13.1.0/node_modules/commander/esm.mjs
|
|
26463
|
-
var import__ = __toESM(require_commander(), 1);
|
|
26464
|
-
var {
|
|
26465
|
-
program,
|
|
26466
|
-
createCommand,
|
|
26467
|
-
createArgument,
|
|
26468
|
-
createOption,
|
|
26469
|
-
CommanderError,
|
|
26470
|
-
InvalidArgumentError,
|
|
26471
|
-
InvalidOptionArgumentError,
|
|
26472
|
-
Command,
|
|
26473
|
-
Argument,
|
|
26474
|
-
Option,
|
|
26475
|
-
Help
|
|
26476
|
-
} = import__.default;
|
|
26477
|
-
|
|
26478
|
-
// src/version.ts
|
|
26479
|
-
var VERSION = "0.1.20";
|
|
26480
|
-
|
|
26481
|
-
// src/commands/init.ts
|
|
26482
|
-
init_source();
|
|
26483
|
-
init_ora();
|
|
26484
|
-
init_dist16();
|
|
26485
|
-
import { platform } from "os";
|
|
26486
|
-
|
|
26487
26462
|
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/lib/buffer_utils.js
|
|
26488
|
-
var encoder = new TextEncoder;
|
|
26489
|
-
var decoder = new TextDecoder;
|
|
26490
|
-
var MAX_INT32 = 2 ** 32;
|
|
26491
26463
|
function concat(...buffers) {
|
|
26492
26464
|
const size = buffers.reduce((acc, { length }) => acc + length, 0);
|
|
26493
26465
|
const buf = new Uint8Array(size);
|
|
@@ -26509,6 +26481,12 @@ function encode(string) {
|
|
|
26509
26481
|
}
|
|
26510
26482
|
return bytes;
|
|
26511
26483
|
}
|
|
26484
|
+
var encoder, decoder, MAX_INT32;
|
|
26485
|
+
var init_buffer_utils = __esm(() => {
|
|
26486
|
+
encoder = new TextEncoder;
|
|
26487
|
+
decoder = new TextDecoder;
|
|
26488
|
+
MAX_INT32 = 2 ** 32;
|
|
26489
|
+
});
|
|
26512
26490
|
|
|
26513
26491
|
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/lib/base64.js
|
|
26514
26492
|
function encodeBase64(input) {
|
|
@@ -26562,34 +26540,74 @@ function encode2(input) {
|
|
|
26562
26540
|
}
|
|
26563
26541
|
return encodeBase64(unencoded).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
|
|
26564
26542
|
}
|
|
26543
|
+
var init_base64url = __esm(() => {
|
|
26544
|
+
init_buffer_utils();
|
|
26545
|
+
});
|
|
26565
26546
|
|
|
26566
26547
|
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/util/errors.js
|
|
26567
|
-
|
|
26568
|
-
|
|
26569
|
-
|
|
26570
|
-
|
|
26571
|
-
|
|
26572
|
-
|
|
26573
|
-
|
|
26574
|
-
|
|
26575
|
-
|
|
26576
|
-
|
|
26577
|
-
|
|
26578
|
-
|
|
26579
|
-
|
|
26580
|
-
|
|
26581
|
-
|
|
26582
|
-
|
|
26583
|
-
|
|
26584
|
-
|
|
26585
|
-
|
|
26586
|
-
|
|
26587
|
-
|
|
26588
|
-
|
|
26548
|
+
var JOSEError, JWTClaimValidationFailed, JWTExpired, JOSEAlgNotAllowed, JOSENotSupported, JWSInvalid, JWTInvalid, JWSSignatureVerificationFailed;
|
|
26549
|
+
var init_errors2 = __esm(() => {
|
|
26550
|
+
JOSEError = class JOSEError extends Error {
|
|
26551
|
+
static code = "ERR_JOSE_GENERIC";
|
|
26552
|
+
code = "ERR_JOSE_GENERIC";
|
|
26553
|
+
constructor(message, options) {
|
|
26554
|
+
super(message, options);
|
|
26555
|
+
this.name = this.constructor.name;
|
|
26556
|
+
Error.captureStackTrace?.(this, this.constructor);
|
|
26557
|
+
}
|
|
26558
|
+
};
|
|
26559
|
+
JWTClaimValidationFailed = class JWTClaimValidationFailed extends JOSEError {
|
|
26560
|
+
static code = "ERR_JWT_CLAIM_VALIDATION_FAILED";
|
|
26561
|
+
code = "ERR_JWT_CLAIM_VALIDATION_FAILED";
|
|
26562
|
+
claim;
|
|
26563
|
+
reason;
|
|
26564
|
+
payload;
|
|
26565
|
+
constructor(message, payload, claim = "unspecified", reason = "unspecified") {
|
|
26566
|
+
super(message, { cause: { claim, reason, payload } });
|
|
26567
|
+
this.claim = claim;
|
|
26568
|
+
this.reason = reason;
|
|
26569
|
+
this.payload = payload;
|
|
26570
|
+
}
|
|
26571
|
+
};
|
|
26572
|
+
JWTExpired = class JWTExpired extends JOSEError {
|
|
26573
|
+
static code = "ERR_JWT_EXPIRED";
|
|
26574
|
+
code = "ERR_JWT_EXPIRED";
|
|
26575
|
+
claim;
|
|
26576
|
+
reason;
|
|
26577
|
+
payload;
|
|
26578
|
+
constructor(message, payload, claim = "unspecified", reason = "unspecified") {
|
|
26579
|
+
super(message, { cause: { claim, reason, payload } });
|
|
26580
|
+
this.claim = claim;
|
|
26581
|
+
this.reason = reason;
|
|
26582
|
+
this.payload = payload;
|
|
26583
|
+
}
|
|
26584
|
+
};
|
|
26585
|
+
JOSEAlgNotAllowed = class JOSEAlgNotAllowed extends JOSEError {
|
|
26586
|
+
static code = "ERR_JOSE_ALG_NOT_ALLOWED";
|
|
26587
|
+
code = "ERR_JOSE_ALG_NOT_ALLOWED";
|
|
26588
|
+
};
|
|
26589
|
+
JOSENotSupported = class JOSENotSupported extends JOSEError {
|
|
26590
|
+
static code = "ERR_JOSE_NOT_SUPPORTED";
|
|
26591
|
+
code = "ERR_JOSE_NOT_SUPPORTED";
|
|
26592
|
+
};
|
|
26593
|
+
JWSInvalid = class JWSInvalid extends JOSEError {
|
|
26594
|
+
static code = "ERR_JWS_INVALID";
|
|
26595
|
+
code = "ERR_JWS_INVALID";
|
|
26596
|
+
};
|
|
26597
|
+
JWTInvalid = class JWTInvalid extends JOSEError {
|
|
26598
|
+
static code = "ERR_JWT_INVALID";
|
|
26599
|
+
code = "ERR_JWT_INVALID";
|
|
26600
|
+
};
|
|
26601
|
+
JWSSignatureVerificationFailed = class JWSSignatureVerificationFailed extends JOSEError {
|
|
26602
|
+
static code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
|
|
26603
|
+
code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
|
|
26604
|
+
constructor(message = "signature verification failed", options) {
|
|
26605
|
+
super(message, options);
|
|
26606
|
+
}
|
|
26607
|
+
};
|
|
26608
|
+
});
|
|
26589
26609
|
|
|
26590
26610
|
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/lib/crypto_key.js
|
|
26591
|
-
var unusable = (name, prop = "algorithm.name") => new TypeError(`CryptoKey does not support this operation, its ${prop} must be ${name}`);
|
|
26592
|
-
var isAlgorithm = (algorithm, name) => algorithm.name === name;
|
|
26593
26611
|
function getHashLength(hash) {
|
|
26594
26612
|
return parseInt(hash.name.slice(4), 10);
|
|
26595
26613
|
}
|
|
@@ -26674,6 +26692,7 @@ function checkSigCryptoKey(key, alg, usage) {
|
|
|
26674
26692
|
}
|
|
26675
26693
|
checkUsage(key, usage);
|
|
26676
26694
|
}
|
|
26695
|
+
var unusable = (name, prop = "algorithm.name") => new TypeError(`CryptoKey does not support this operation, its ${prop} must be ${name}`), isAlgorithm = (algorithm, name) => algorithm.name === name;
|
|
26677
26696
|
|
|
26678
26697
|
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/lib/invalid_key_input.js
|
|
26679
26698
|
function message(msg, actual, ...types) {
|
|
@@ -26697,8 +26716,7 @@ function message(msg, actual, ...types) {
|
|
|
26697
26716
|
}
|
|
26698
26717
|
return msg;
|
|
26699
26718
|
}
|
|
26700
|
-
var invalidKeyInput = (actual, ...types) => message("Key must be ", actual, ...types);
|
|
26701
|
-
var withAlg = (alg, actual, ...types) => message(`Key for the ${alg} algorithm must be `, actual, ...types);
|
|
26719
|
+
var invalidKeyInput = (actual, ...types) => message("Key must be ", actual, ...types), withAlg = (alg, actual, ...types) => message(`Key for the ${alg} algorithm must be `, actual, ...types);
|
|
26702
26720
|
|
|
26703
26721
|
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/lib/is_key_like.js
|
|
26704
26722
|
var isCryptoKey = (key) => {
|
|
@@ -26709,9 +26727,7 @@ var isCryptoKey = (key) => {
|
|
|
26709
26727
|
} catch {
|
|
26710
26728
|
return false;
|
|
26711
26729
|
}
|
|
26712
|
-
};
|
|
26713
|
-
var isKeyObject = (key) => key?.[Symbol.toStringTag] === "KeyObject";
|
|
26714
|
-
var isKeyLike = (key) => isCryptoKey(key) || isKeyObject(key);
|
|
26730
|
+
}, isKeyObject = (key) => key?.[Symbol.toStringTag] === "KeyObject", isKeyLike = (key) => isCryptoKey(key) || isKeyObject(key);
|
|
26715
26731
|
|
|
26716
26732
|
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/lib/is_disjoint.js
|
|
26717
26733
|
function isDisjoint(...headers) {
|
|
@@ -26737,7 +26753,6 @@ function isDisjoint(...headers) {
|
|
|
26737
26753
|
}
|
|
26738
26754
|
|
|
26739
26755
|
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/lib/is_object.js
|
|
26740
|
-
var isObjectLike = (value) => typeof value === "object" && value !== null;
|
|
26741
26756
|
function isObject(input) {
|
|
26742
26757
|
if (!isObjectLike(input) || Object.prototype.toString.call(input) !== "[object Object]") {
|
|
26743
26758
|
return false;
|
|
@@ -26751,6 +26766,7 @@ function isObject(input) {
|
|
|
26751
26766
|
}
|
|
26752
26767
|
return Object.getPrototypeOf(input) === proto2;
|
|
26753
26768
|
}
|
|
26769
|
+
var isObjectLike = (value) => typeof value === "object" && value !== null;
|
|
26754
26770
|
|
|
26755
26771
|
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/lib/check_key_length.js
|
|
26756
26772
|
function checkKeyLength(alg, key) {
|
|
@@ -26871,6 +26887,9 @@ async function jwkToKey(jwk) {
|
|
|
26871
26887
|
delete keyData.use;
|
|
26872
26888
|
return crypto.subtle.importKey("jwk", keyData, algorithm, jwk.ext ?? (jwk.d || jwk.priv ? false : true), jwk.key_ops ?? keyUsages);
|
|
26873
26889
|
}
|
|
26890
|
+
var init_jwk_to_key = __esm(() => {
|
|
26891
|
+
init_errors2();
|
|
26892
|
+
});
|
|
26874
26893
|
|
|
26875
26894
|
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/lib/validate_crit.js
|
|
26876
26895
|
function validateCrit(Err, recognizedDefault, recognizedOption, protectedHeader, joseHeader) {
|
|
@@ -26902,16 +26921,58 @@ function validateCrit(Err, recognizedDefault, recognizedOption, protectedHeader,
|
|
|
26902
26921
|
}
|
|
26903
26922
|
return new Set(protectedHeader.crit);
|
|
26904
26923
|
}
|
|
26924
|
+
var init_validate_crit = __esm(() => {
|
|
26925
|
+
init_errors2();
|
|
26926
|
+
});
|
|
26927
|
+
|
|
26928
|
+
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/lib/validate_algorithms.js
|
|
26929
|
+
function validateAlgorithms(option, algorithms) {
|
|
26930
|
+
if (algorithms !== undefined && (!Array.isArray(algorithms) || algorithms.some((s) => typeof s !== "string"))) {
|
|
26931
|
+
throw new TypeError(`"${option}" option must be an array of strings`);
|
|
26932
|
+
}
|
|
26933
|
+
if (!algorithms) {
|
|
26934
|
+
return;
|
|
26935
|
+
}
|
|
26936
|
+
return new Set(algorithms);
|
|
26937
|
+
}
|
|
26905
26938
|
|
|
26906
26939
|
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/lib/is_jwk.js
|
|
26907
|
-
var isJWK = (key) => isObject(key) && typeof key.kty === "string";
|
|
26908
|
-
var
|
|
26909
|
-
var isPublicJWK = (key) => key.kty !== "oct" && key.d === undefined && key.priv === undefined;
|
|
26910
|
-
var isSecretJWK = (key) => key.kty === "oct" && typeof key.k === "string";
|
|
26940
|
+
var isJWK = (key) => isObject(key) && typeof key.kty === "string", isPrivateJWK = (key) => key.kty !== "oct" && (key.kty === "AKP" && typeof key.priv === "string" || typeof key.d === "string"), isPublicJWK = (key) => key.kty !== "oct" && key.d === undefined && key.priv === undefined, isSecretJWK = (key) => key.kty === "oct" && typeof key.k === "string";
|
|
26941
|
+
var init_is_jwk = () => {};
|
|
26911
26942
|
|
|
26912
26943
|
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/lib/normalize_key.js
|
|
26913
|
-
|
|
26914
|
-
|
|
26944
|
+
async function normalizeKey(key, alg) {
|
|
26945
|
+
if (key instanceof Uint8Array) {
|
|
26946
|
+
return key;
|
|
26947
|
+
}
|
|
26948
|
+
if (isCryptoKey(key)) {
|
|
26949
|
+
return key;
|
|
26950
|
+
}
|
|
26951
|
+
if (isKeyObject(key)) {
|
|
26952
|
+
if (key.type === "secret") {
|
|
26953
|
+
return key.export();
|
|
26954
|
+
}
|
|
26955
|
+
if ("toCryptoKey" in key && typeof key.toCryptoKey === "function") {
|
|
26956
|
+
try {
|
|
26957
|
+
return handleKeyObject(key, alg);
|
|
26958
|
+
} catch (err) {
|
|
26959
|
+
if (err instanceof TypeError) {
|
|
26960
|
+
throw err;
|
|
26961
|
+
}
|
|
26962
|
+
}
|
|
26963
|
+
}
|
|
26964
|
+
let jwk = key.export({ format: "jwk" });
|
|
26965
|
+
return handleJWK(key, jwk, alg);
|
|
26966
|
+
}
|
|
26967
|
+
if (isJWK(key)) {
|
|
26968
|
+
if (key.k) {
|
|
26969
|
+
return decode(key.k);
|
|
26970
|
+
}
|
|
26971
|
+
return handleJWK(key, key, alg, true);
|
|
26972
|
+
}
|
|
26973
|
+
throw new Error("unreachable");
|
|
26974
|
+
}
|
|
26975
|
+
var cache, handleJWK = async (key, jwk, alg, freeze = false) => {
|
|
26915
26976
|
cache ||= new WeakMap;
|
|
26916
26977
|
let cached = cache.get(key);
|
|
26917
26978
|
if (cached?.[alg]) {
|
|
@@ -26926,8 +26987,7 @@ var handleJWK = async (key, jwk, alg, freeze = false) => {
|
|
|
26926
26987
|
cached[alg] = cryptoKey;
|
|
26927
26988
|
}
|
|
26928
26989
|
return cryptoKey;
|
|
26929
|
-
}
|
|
26930
|
-
var handleKeyObject = (keyObject, alg) => {
|
|
26990
|
+
}, handleKeyObject = (keyObject, alg) => {
|
|
26931
26991
|
cache ||= new WeakMap;
|
|
26932
26992
|
let cached = cache.get(keyObject);
|
|
26933
26993
|
if (cached?.[alg]) {
|
|
@@ -27048,41 +27108,27 @@ var handleKeyObject = (keyObject, alg) => {
|
|
|
27048
27108
|
}
|
|
27049
27109
|
return cryptoKey;
|
|
27050
27110
|
};
|
|
27051
|
-
|
|
27052
|
-
|
|
27053
|
-
|
|
27054
|
-
|
|
27055
|
-
|
|
27056
|
-
return key;
|
|
27057
|
-
}
|
|
27058
|
-
if (isKeyObject(key)) {
|
|
27059
|
-
if (key.type === "secret") {
|
|
27060
|
-
return key.export();
|
|
27061
|
-
}
|
|
27062
|
-
if ("toCryptoKey" in key && typeof key.toCryptoKey === "function") {
|
|
27063
|
-
try {
|
|
27064
|
-
return handleKeyObject(key, alg);
|
|
27065
|
-
} catch (err) {
|
|
27066
|
-
if (err instanceof TypeError) {
|
|
27067
|
-
throw err;
|
|
27068
|
-
}
|
|
27069
|
-
}
|
|
27070
|
-
}
|
|
27071
|
-
let jwk = key.export({ format: "jwk" });
|
|
27072
|
-
return handleJWK(key, jwk, alg);
|
|
27073
|
-
}
|
|
27074
|
-
if (isJWK(key)) {
|
|
27075
|
-
if (key.k) {
|
|
27076
|
-
return decode(key.k);
|
|
27077
|
-
}
|
|
27078
|
-
return handleJWK(key, key, alg, true);
|
|
27079
|
-
}
|
|
27080
|
-
throw new Error("unreachable");
|
|
27081
|
-
}
|
|
27111
|
+
var init_normalize_key = __esm(() => {
|
|
27112
|
+
init_is_jwk();
|
|
27113
|
+
init_base64url();
|
|
27114
|
+
init_jwk_to_key();
|
|
27115
|
+
});
|
|
27082
27116
|
|
|
27083
27117
|
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/lib/check_key_type.js
|
|
27084
|
-
|
|
27085
|
-
|
|
27118
|
+
function checkKeyType(alg, key, usage) {
|
|
27119
|
+
switch (alg.substring(0, 2)) {
|
|
27120
|
+
case "A1":
|
|
27121
|
+
case "A2":
|
|
27122
|
+
case "di":
|
|
27123
|
+
case "HS":
|
|
27124
|
+
case "PB":
|
|
27125
|
+
symmetricTypeCheck(alg, key, usage);
|
|
27126
|
+
break;
|
|
27127
|
+
default:
|
|
27128
|
+
asymmetricTypeCheck(alg, key, usage);
|
|
27129
|
+
}
|
|
27130
|
+
}
|
|
27131
|
+
var tag = (key) => key?.[Symbol.toStringTag], jwkMatchesOp = (alg, key, usage) => {
|
|
27086
27132
|
if (key.use !== undefined) {
|
|
27087
27133
|
let expected;
|
|
27088
27134
|
switch (usage) {
|
|
@@ -27132,8 +27178,7 @@ var jwkMatchesOp = (alg, key, usage) => {
|
|
|
27132
27178
|
}
|
|
27133
27179
|
}
|
|
27134
27180
|
return true;
|
|
27135
|
-
}
|
|
27136
|
-
var symmetricTypeCheck = (alg, key, usage) => {
|
|
27181
|
+
}, symmetricTypeCheck = (alg, key, usage) => {
|
|
27137
27182
|
if (key instanceof Uint8Array)
|
|
27138
27183
|
return;
|
|
27139
27184
|
if (isJWK(key)) {
|
|
@@ -27147,8 +27192,7 @@ var symmetricTypeCheck = (alg, key, usage) => {
|
|
|
27147
27192
|
if (key.type !== "secret") {
|
|
27148
27193
|
throw new TypeError(`${tag(key)} instances for symmetric algorithms must be of type "secret"`);
|
|
27149
27194
|
}
|
|
27150
|
-
}
|
|
27151
|
-
var asymmetricTypeCheck = (alg, key, usage) => {
|
|
27195
|
+
}, asymmetricTypeCheck = (alg, key, usage) => {
|
|
27152
27196
|
if (isJWK(key)) {
|
|
27153
27197
|
switch (usage) {
|
|
27154
27198
|
case "decrypt":
|
|
@@ -27186,19 +27230,9 @@ var asymmetricTypeCheck = (alg, key, usage) => {
|
|
|
27186
27230
|
}
|
|
27187
27231
|
}
|
|
27188
27232
|
};
|
|
27189
|
-
|
|
27190
|
-
|
|
27191
|
-
|
|
27192
|
-
case "A2":
|
|
27193
|
-
case "di":
|
|
27194
|
-
case "HS":
|
|
27195
|
-
case "PB":
|
|
27196
|
-
symmetricTypeCheck(alg, key, usage);
|
|
27197
|
-
break;
|
|
27198
|
-
default:
|
|
27199
|
-
asymmetricTypeCheck(alg, key, usage);
|
|
27200
|
-
}
|
|
27201
|
-
}
|
|
27233
|
+
var init_check_key_type = __esm(() => {
|
|
27234
|
+
init_is_jwk();
|
|
27235
|
+
});
|
|
27202
27236
|
|
|
27203
27237
|
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/lib/subtle_dsa.js
|
|
27204
27238
|
function subtleAlgorithm(alg, algorithm) {
|
|
@@ -27231,6 +27265,9 @@ function subtleAlgorithm(alg, algorithm) {
|
|
|
27231
27265
|
throw new JOSENotSupported(`alg ${alg} is not supported either by JOSE or your javascript runtime`);
|
|
27232
27266
|
}
|
|
27233
27267
|
}
|
|
27268
|
+
var init_subtle_dsa = __esm(() => {
|
|
27269
|
+
init_errors2();
|
|
27270
|
+
});
|
|
27234
27271
|
|
|
27235
27272
|
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/lib/get_sign_verify_key.js
|
|
27236
27273
|
async function getSigKey(alg, key, usage) {
|
|
@@ -27243,15 +27280,161 @@ async function getSigKey(alg, key, usage) {
|
|
|
27243
27280
|
checkSigCryptoKey(key, alg, usage);
|
|
27244
27281
|
return key;
|
|
27245
27282
|
}
|
|
27283
|
+
var init_get_sign_verify_key = () => {};
|
|
27284
|
+
|
|
27285
|
+
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/lib/verify.js
|
|
27286
|
+
async function verify(alg, key, signature, data) {
|
|
27287
|
+
const cryptoKey = await getSigKey(alg, key, "verify");
|
|
27288
|
+
checkKeyLength(alg, cryptoKey);
|
|
27289
|
+
const algorithm = subtleAlgorithm(alg, cryptoKey.algorithm);
|
|
27290
|
+
try {
|
|
27291
|
+
return await crypto.subtle.verify(algorithm, cryptoKey, signature, data);
|
|
27292
|
+
} catch {
|
|
27293
|
+
return false;
|
|
27294
|
+
}
|
|
27295
|
+
}
|
|
27296
|
+
var init_verify = __esm(() => {
|
|
27297
|
+
init_subtle_dsa();
|
|
27298
|
+
init_get_sign_verify_key();
|
|
27299
|
+
});
|
|
27300
|
+
|
|
27301
|
+
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/jws/flattened/verify.js
|
|
27302
|
+
async function flattenedVerify(jws, key, options) {
|
|
27303
|
+
if (!isObject(jws)) {
|
|
27304
|
+
throw new JWSInvalid("Flattened JWS must be an object");
|
|
27305
|
+
}
|
|
27306
|
+
if (jws.protected === undefined && jws.header === undefined) {
|
|
27307
|
+
throw new JWSInvalid('Flattened JWS must have either of the "protected" or "header" members');
|
|
27308
|
+
}
|
|
27309
|
+
if (jws.protected !== undefined && typeof jws.protected !== "string") {
|
|
27310
|
+
throw new JWSInvalid("JWS Protected Header incorrect type");
|
|
27311
|
+
}
|
|
27312
|
+
if (jws.payload === undefined) {
|
|
27313
|
+
throw new JWSInvalid("JWS Payload missing");
|
|
27314
|
+
}
|
|
27315
|
+
if (typeof jws.signature !== "string") {
|
|
27316
|
+
throw new JWSInvalid("JWS Signature missing or incorrect type");
|
|
27317
|
+
}
|
|
27318
|
+
if (jws.header !== undefined && !isObject(jws.header)) {
|
|
27319
|
+
throw new JWSInvalid("JWS Unprotected Header incorrect type");
|
|
27320
|
+
}
|
|
27321
|
+
let parsedProt = {};
|
|
27322
|
+
if (jws.protected) {
|
|
27323
|
+
try {
|
|
27324
|
+
const protectedHeader = decode(jws.protected);
|
|
27325
|
+
parsedProt = JSON.parse(decoder.decode(protectedHeader));
|
|
27326
|
+
} catch {
|
|
27327
|
+
throw new JWSInvalid("JWS Protected Header is invalid");
|
|
27328
|
+
}
|
|
27329
|
+
}
|
|
27330
|
+
if (!isDisjoint(parsedProt, jws.header)) {
|
|
27331
|
+
throw new JWSInvalid("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");
|
|
27332
|
+
}
|
|
27333
|
+
const joseHeader = {
|
|
27334
|
+
...parsedProt,
|
|
27335
|
+
...jws.header
|
|
27336
|
+
};
|
|
27337
|
+
const extensions = validateCrit(JWSInvalid, new Map([["b64", true]]), options?.crit, parsedProt, joseHeader);
|
|
27338
|
+
let b64 = true;
|
|
27339
|
+
if (extensions.has("b64")) {
|
|
27340
|
+
b64 = parsedProt.b64;
|
|
27341
|
+
if (typeof b64 !== "boolean") {
|
|
27342
|
+
throw new JWSInvalid('The "b64" (base64url-encode payload) Header Parameter must be a boolean');
|
|
27343
|
+
}
|
|
27344
|
+
}
|
|
27345
|
+
const { alg } = joseHeader;
|
|
27346
|
+
if (typeof alg !== "string" || !alg) {
|
|
27347
|
+
throw new JWSInvalid('JWS "alg" (Algorithm) Header Parameter missing or invalid');
|
|
27348
|
+
}
|
|
27349
|
+
const algorithms = options && validateAlgorithms("algorithms", options.algorithms);
|
|
27350
|
+
if (algorithms && !algorithms.has(alg)) {
|
|
27351
|
+
throw new JOSEAlgNotAllowed('"alg" (Algorithm) Header Parameter value not allowed');
|
|
27352
|
+
}
|
|
27353
|
+
if (b64) {
|
|
27354
|
+
if (typeof jws.payload !== "string") {
|
|
27355
|
+
throw new JWSInvalid("JWS Payload must be a string");
|
|
27356
|
+
}
|
|
27357
|
+
} else if (typeof jws.payload !== "string" && !(jws.payload instanceof Uint8Array)) {
|
|
27358
|
+
throw new JWSInvalid("JWS Payload must be a string or an Uint8Array instance");
|
|
27359
|
+
}
|
|
27360
|
+
let resolvedKey = false;
|
|
27361
|
+
if (typeof key === "function") {
|
|
27362
|
+
key = await key(parsedProt, jws);
|
|
27363
|
+
resolvedKey = true;
|
|
27364
|
+
}
|
|
27365
|
+
checkKeyType(alg, key, "verify");
|
|
27366
|
+
const data = concat(jws.protected !== undefined ? encode(jws.protected) : new Uint8Array, encode("."), typeof jws.payload === "string" ? b64 ? encode(jws.payload) : encoder.encode(jws.payload) : jws.payload);
|
|
27367
|
+
let signature;
|
|
27368
|
+
try {
|
|
27369
|
+
signature = decode(jws.signature);
|
|
27370
|
+
} catch {
|
|
27371
|
+
throw new JWSInvalid("Failed to base64url decode the signature");
|
|
27372
|
+
}
|
|
27373
|
+
const k = await normalizeKey(key, alg);
|
|
27374
|
+
const verified = await verify(alg, k, signature, data);
|
|
27375
|
+
if (!verified) {
|
|
27376
|
+
throw new JWSSignatureVerificationFailed;
|
|
27377
|
+
}
|
|
27378
|
+
let payload;
|
|
27379
|
+
if (b64) {
|
|
27380
|
+
try {
|
|
27381
|
+
payload = decode(jws.payload);
|
|
27382
|
+
} catch {
|
|
27383
|
+
throw new JWSInvalid("Failed to base64url decode the payload");
|
|
27384
|
+
}
|
|
27385
|
+
} else if (typeof jws.payload === "string") {
|
|
27386
|
+
payload = encoder.encode(jws.payload);
|
|
27387
|
+
} else {
|
|
27388
|
+
payload = jws.payload;
|
|
27389
|
+
}
|
|
27390
|
+
const result = { payload };
|
|
27391
|
+
if (jws.protected !== undefined) {
|
|
27392
|
+
result.protectedHeader = parsedProt;
|
|
27393
|
+
}
|
|
27394
|
+
if (jws.header !== undefined) {
|
|
27395
|
+
result.unprotectedHeader = jws.header;
|
|
27396
|
+
}
|
|
27397
|
+
if (resolvedKey) {
|
|
27398
|
+
return { ...result, key: k };
|
|
27399
|
+
}
|
|
27400
|
+
return result;
|
|
27401
|
+
}
|
|
27402
|
+
var init_verify2 = __esm(() => {
|
|
27403
|
+
init_base64url();
|
|
27404
|
+
init_verify();
|
|
27405
|
+
init_errors2();
|
|
27406
|
+
init_buffer_utils();
|
|
27407
|
+
init_check_key_type();
|
|
27408
|
+
init_validate_crit();
|
|
27409
|
+
init_normalize_key();
|
|
27410
|
+
});
|
|
27411
|
+
|
|
27412
|
+
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/jws/compact/verify.js
|
|
27413
|
+
async function compactVerify(jws, key, options) {
|
|
27414
|
+
if (jws instanceof Uint8Array) {
|
|
27415
|
+
jws = decoder.decode(jws);
|
|
27416
|
+
}
|
|
27417
|
+
if (typeof jws !== "string") {
|
|
27418
|
+
throw new JWSInvalid("Compact JWS must be a string or Uint8Array");
|
|
27419
|
+
}
|
|
27420
|
+
const { 0: protectedHeader, 1: payload, 2: signature, length } = jws.split(".");
|
|
27421
|
+
if (length !== 3) {
|
|
27422
|
+
throw new JWSInvalid("Invalid Compact JWS");
|
|
27423
|
+
}
|
|
27424
|
+
const verified = await flattenedVerify({ payload, protected: protectedHeader, signature }, key, options);
|
|
27425
|
+
const result = { payload: verified.payload, protectedHeader: verified.protectedHeader };
|
|
27426
|
+
if (typeof key === "function") {
|
|
27427
|
+
return { ...result, key: verified.key };
|
|
27428
|
+
}
|
|
27429
|
+
return result;
|
|
27430
|
+
}
|
|
27431
|
+
var init_verify3 = __esm(() => {
|
|
27432
|
+
init_verify2();
|
|
27433
|
+
init_errors2();
|
|
27434
|
+
init_buffer_utils();
|
|
27435
|
+
});
|
|
27246
27436
|
|
|
27247
27437
|
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/lib/jwt_claims_set.js
|
|
27248
|
-
var epoch = (date) => Math.floor(date.getTime() / 1000);
|
|
27249
|
-
var minute = 60;
|
|
27250
|
-
var hour = minute * 60;
|
|
27251
|
-
var day = hour * 24;
|
|
27252
|
-
var week = day * 7;
|
|
27253
|
-
var year = day * 365.25;
|
|
27254
|
-
var REGEX = /^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;
|
|
27255
27438
|
function secs(str) {
|
|
27256
27439
|
const matched = REGEX.exec(str);
|
|
27257
27440
|
if (!matched || matched[4] && matched[1]) {
|
|
@@ -27307,6 +27490,90 @@ function validateInput(label, input) {
|
|
|
27307
27490
|
}
|
|
27308
27491
|
return input;
|
|
27309
27492
|
}
|
|
27493
|
+
function validateClaimsSet(protectedHeader, encodedPayload, options = {}) {
|
|
27494
|
+
let payload;
|
|
27495
|
+
try {
|
|
27496
|
+
payload = JSON.parse(decoder.decode(encodedPayload));
|
|
27497
|
+
} catch {}
|
|
27498
|
+
if (!isObject(payload)) {
|
|
27499
|
+
throw new JWTInvalid("JWT Claims Set must be a top-level JSON object");
|
|
27500
|
+
}
|
|
27501
|
+
const { typ } = options;
|
|
27502
|
+
if (typ && (typeof protectedHeader.typ !== "string" || normalizeTyp(protectedHeader.typ) !== normalizeTyp(typ))) {
|
|
27503
|
+
throw new JWTClaimValidationFailed('unexpected "typ" JWT header value', payload, "typ", "check_failed");
|
|
27504
|
+
}
|
|
27505
|
+
const { requiredClaims = [], issuer, subject, audience, maxTokenAge } = options;
|
|
27506
|
+
const presenceCheck = [...requiredClaims];
|
|
27507
|
+
if (maxTokenAge !== undefined)
|
|
27508
|
+
presenceCheck.push("iat");
|
|
27509
|
+
if (audience !== undefined)
|
|
27510
|
+
presenceCheck.push("aud");
|
|
27511
|
+
if (subject !== undefined)
|
|
27512
|
+
presenceCheck.push("sub");
|
|
27513
|
+
if (issuer !== undefined)
|
|
27514
|
+
presenceCheck.push("iss");
|
|
27515
|
+
for (const claim of new Set(presenceCheck.reverse())) {
|
|
27516
|
+
if (!(claim in payload)) {
|
|
27517
|
+
throw new JWTClaimValidationFailed(`missing required "${claim}" claim`, payload, claim, "missing");
|
|
27518
|
+
}
|
|
27519
|
+
}
|
|
27520
|
+
if (issuer && !(Array.isArray(issuer) ? issuer : [issuer]).includes(payload.iss)) {
|
|
27521
|
+
throw new JWTClaimValidationFailed('unexpected "iss" claim value', payload, "iss", "check_failed");
|
|
27522
|
+
}
|
|
27523
|
+
if (subject && payload.sub !== subject) {
|
|
27524
|
+
throw new JWTClaimValidationFailed('unexpected "sub" claim value', payload, "sub", "check_failed");
|
|
27525
|
+
}
|
|
27526
|
+
if (audience && !checkAudiencePresence(payload.aud, typeof audience === "string" ? [audience] : audience)) {
|
|
27527
|
+
throw new JWTClaimValidationFailed('unexpected "aud" claim value', payload, "aud", "check_failed");
|
|
27528
|
+
}
|
|
27529
|
+
let tolerance;
|
|
27530
|
+
switch (typeof options.clockTolerance) {
|
|
27531
|
+
case "string":
|
|
27532
|
+
tolerance = secs(options.clockTolerance);
|
|
27533
|
+
break;
|
|
27534
|
+
case "number":
|
|
27535
|
+
tolerance = options.clockTolerance;
|
|
27536
|
+
break;
|
|
27537
|
+
case "undefined":
|
|
27538
|
+
tolerance = 0;
|
|
27539
|
+
break;
|
|
27540
|
+
default:
|
|
27541
|
+
throw new TypeError("Invalid clockTolerance option type");
|
|
27542
|
+
}
|
|
27543
|
+
const { currentDate } = options;
|
|
27544
|
+
const now = epoch(currentDate || new Date);
|
|
27545
|
+
if ((payload.iat !== undefined || maxTokenAge) && typeof payload.iat !== "number") {
|
|
27546
|
+
throw new JWTClaimValidationFailed('"iat" claim must be a number', payload, "iat", "invalid");
|
|
27547
|
+
}
|
|
27548
|
+
if (payload.nbf !== undefined) {
|
|
27549
|
+
if (typeof payload.nbf !== "number") {
|
|
27550
|
+
throw new JWTClaimValidationFailed('"nbf" claim must be a number', payload, "nbf", "invalid");
|
|
27551
|
+
}
|
|
27552
|
+
if (payload.nbf > now + tolerance) {
|
|
27553
|
+
throw new JWTClaimValidationFailed('"nbf" claim timestamp check failed', payload, "nbf", "check_failed");
|
|
27554
|
+
}
|
|
27555
|
+
}
|
|
27556
|
+
if (payload.exp !== undefined) {
|
|
27557
|
+
if (typeof payload.exp !== "number") {
|
|
27558
|
+
throw new JWTClaimValidationFailed('"exp" claim must be a number', payload, "exp", "invalid");
|
|
27559
|
+
}
|
|
27560
|
+
if (payload.exp <= now - tolerance) {
|
|
27561
|
+
throw new JWTExpired('"exp" claim timestamp check failed', payload, "exp", "check_failed");
|
|
27562
|
+
}
|
|
27563
|
+
}
|
|
27564
|
+
if (maxTokenAge) {
|
|
27565
|
+
const age = now - payload.iat;
|
|
27566
|
+
const max = typeof maxTokenAge === "number" ? maxTokenAge : secs(maxTokenAge);
|
|
27567
|
+
if (age - tolerance > max) {
|
|
27568
|
+
throw new JWTExpired('"iat" claim timestamp check failed (too far in the past)', payload, "iat", "check_failed");
|
|
27569
|
+
}
|
|
27570
|
+
if (age < 0 - tolerance) {
|
|
27571
|
+
throw new JWTClaimValidationFailed('"iat" claim timestamp check failed (it should be in the past)', payload, "iat", "check_failed");
|
|
27572
|
+
}
|
|
27573
|
+
}
|
|
27574
|
+
return payload;
|
|
27575
|
+
}
|
|
27576
|
+
|
|
27310
27577
|
class JWTClaimsBuilder {
|
|
27311
27578
|
#payload;
|
|
27312
27579
|
constructor(payload) {
|
|
@@ -27369,6 +27636,48 @@ class JWTClaimsBuilder {
|
|
|
27369
27636
|
}
|
|
27370
27637
|
}
|
|
27371
27638
|
}
|
|
27639
|
+
var epoch = (date) => Math.floor(date.getTime() / 1000), minute = 60, hour, day, week, year, REGEX, normalizeTyp = (value) => {
|
|
27640
|
+
if (value.includes("/")) {
|
|
27641
|
+
return value.toLowerCase();
|
|
27642
|
+
}
|
|
27643
|
+
return `application/${value.toLowerCase()}`;
|
|
27644
|
+
}, checkAudiencePresence = (audPayload, audOption) => {
|
|
27645
|
+
if (typeof audPayload === "string") {
|
|
27646
|
+
return audOption.includes(audPayload);
|
|
27647
|
+
}
|
|
27648
|
+
if (Array.isArray(audPayload)) {
|
|
27649
|
+
return audOption.some(Set.prototype.has.bind(new Set(audPayload)));
|
|
27650
|
+
}
|
|
27651
|
+
return false;
|
|
27652
|
+
};
|
|
27653
|
+
var init_jwt_claims_set = __esm(() => {
|
|
27654
|
+
init_errors2();
|
|
27655
|
+
init_buffer_utils();
|
|
27656
|
+
hour = minute * 60;
|
|
27657
|
+
day = hour * 24;
|
|
27658
|
+
week = day * 7;
|
|
27659
|
+
year = day * 365.25;
|
|
27660
|
+
REGEX = /^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;
|
|
27661
|
+
});
|
|
27662
|
+
|
|
27663
|
+
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/jwt/verify.js
|
|
27664
|
+
async function jwtVerify(jwt, key, options) {
|
|
27665
|
+
const verified = await compactVerify(jwt, key, options);
|
|
27666
|
+
if (verified.protectedHeader.crit?.includes("b64") && verified.protectedHeader.b64 === false) {
|
|
27667
|
+
throw new JWTInvalid("JWTs MUST NOT use unencoded payload");
|
|
27668
|
+
}
|
|
27669
|
+
const payload = validateClaimsSet(verified.protectedHeader, verified.payload, options);
|
|
27670
|
+
const result = { payload, protectedHeader: verified.protectedHeader };
|
|
27671
|
+
if (typeof key === "function") {
|
|
27672
|
+
return { ...result, key: verified.key };
|
|
27673
|
+
}
|
|
27674
|
+
return result;
|
|
27675
|
+
}
|
|
27676
|
+
var init_verify4 = __esm(() => {
|
|
27677
|
+
init_verify3();
|
|
27678
|
+
init_jwt_claims_set();
|
|
27679
|
+
init_errors2();
|
|
27680
|
+
});
|
|
27372
27681
|
|
|
27373
27682
|
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/lib/sign.js
|
|
27374
27683
|
async function sign(alg, key, data) {
|
|
@@ -27377,6 +27686,10 @@ async function sign(alg, key, data) {
|
|
|
27377
27686
|
const signature = await crypto.subtle.sign(subtleAlgorithm(alg, cryptoKey.algorithm), cryptoKey, data);
|
|
27378
27687
|
return new Uint8Array(signature);
|
|
27379
27688
|
}
|
|
27689
|
+
var init_sign = __esm(() => {
|
|
27690
|
+
init_subtle_dsa();
|
|
27691
|
+
init_get_sign_verify_key();
|
|
27692
|
+
});
|
|
27380
27693
|
|
|
27381
27694
|
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/jws/flattened/sign.js
|
|
27382
27695
|
class FlattenedSign {
|
|
@@ -27461,6 +27774,15 @@ class FlattenedSign {
|
|
|
27461
27774
|
return jws;
|
|
27462
27775
|
}
|
|
27463
27776
|
}
|
|
27777
|
+
var init_sign2 = __esm(() => {
|
|
27778
|
+
init_base64url();
|
|
27779
|
+
init_sign();
|
|
27780
|
+
init_errors2();
|
|
27781
|
+
init_buffer_utils();
|
|
27782
|
+
init_check_key_type();
|
|
27783
|
+
init_validate_crit();
|
|
27784
|
+
init_normalize_key();
|
|
27785
|
+
});
|
|
27464
27786
|
|
|
27465
27787
|
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/jws/compact/sign.js
|
|
27466
27788
|
class CompactSign {
|
|
@@ -27480,6 +27802,9 @@ class CompactSign {
|
|
|
27480
27802
|
return `${jws.protected}.${jws.payload}.${jws.signature}`;
|
|
27481
27803
|
}
|
|
27482
27804
|
}
|
|
27805
|
+
var init_sign3 = __esm(() => {
|
|
27806
|
+
init_sign2();
|
|
27807
|
+
});
|
|
27483
27808
|
|
|
27484
27809
|
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/jwt/sign.js
|
|
27485
27810
|
class SignJWT {
|
|
@@ -27529,57 +27854,87 @@ class SignJWT {
|
|
|
27529
27854
|
return sig.sign(key, options);
|
|
27530
27855
|
}
|
|
27531
27856
|
}
|
|
27857
|
+
var init_sign4 = __esm(() => {
|
|
27858
|
+
init_sign3();
|
|
27859
|
+
init_errors2();
|
|
27860
|
+
init_jwt_claims_set();
|
|
27861
|
+
});
|
|
27862
|
+
|
|
27863
|
+
// ../../node_modules/.bun/jose@6.1.3/node_modules/jose/dist/webapi/index.js
|
|
27864
|
+
var init_webapi = __esm(() => {
|
|
27865
|
+
init_verify4();
|
|
27866
|
+
init_sign4();
|
|
27867
|
+
});
|
|
27532
27868
|
// ../shared/src/constants.ts
|
|
27533
|
-
var DEFAULT_CATEGORY_PATTERNS =
|
|
27534
|
-
|
|
27535
|
-
|
|
27536
|
-
|
|
27537
|
-
|
|
27538
|
-
|
|
27539
|
-
|
|
27540
|
-
|
|
27541
|
-
|
|
27542
|
-
|
|
27543
|
-
|
|
27544
|
-
|
|
27545
|
-
|
|
27546
|
-
|
|
27547
|
-
|
|
27548
|
-
|
|
27549
|
-
|
|
27550
|
-
|
|
27551
|
-
|
|
27552
|
-
|
|
27553
|
-
|
|
27554
|
-
|
|
27555
|
-
|
|
27556
|
-
|
|
27557
|
-
|
|
27558
|
-
|
|
27559
|
-
|
|
27560
|
-
|
|
27561
|
-
|
|
27562
|
-
|
|
27563
|
-
|
|
27564
|
-
|
|
27565
|
-
|
|
27566
|
-
|
|
27567
|
-
|
|
27568
|
-
|
|
27569
|
-
|
|
27570
|
-
|
|
27571
|
-
|
|
27572
|
-
|
|
27573
|
-
|
|
27574
|
-
|
|
27575
|
-
|
|
27576
|
-
|
|
27577
|
-
|
|
27578
|
-
|
|
27579
|
-
|
|
27580
|
-
|
|
27581
|
-
|
|
27869
|
+
var DEFAULT_CATEGORY_PATTERNS, MERGE_STRATEGIES, NEVER_SYNC_PATTERNS, JWT_EXPIRY_SECONDS = 900, MAX_CONCURRENT_TRANSFERS = 50;
|
|
27870
|
+
var init_constants = __esm(() => {
|
|
27871
|
+
DEFAULT_CATEGORY_PATTERNS = {
|
|
27872
|
+
session: ["projects/**/*.jsonl"],
|
|
27873
|
+
memory: ["projects/*/memory/**/*"],
|
|
27874
|
+
skill: ["skills/**/*"],
|
|
27875
|
+
command: ["commands/**/*"],
|
|
27876
|
+
plan: ["plans/**/*"],
|
|
27877
|
+
config: ["settings.json"],
|
|
27878
|
+
keybinding: ["keybindings.json"],
|
|
27879
|
+
mcp: ["mcp.json"],
|
|
27880
|
+
"file-history": ["file-history/**/*"],
|
|
27881
|
+
"claude-md": ["projects/**/CLAUDE.md"],
|
|
27882
|
+
unknown: []
|
|
27883
|
+
};
|
|
27884
|
+
MERGE_STRATEGIES = {
|
|
27885
|
+
session: "append-dedup",
|
|
27886
|
+
memory: "append-sections",
|
|
27887
|
+
skill: "content-hash",
|
|
27888
|
+
command: "content-hash",
|
|
27889
|
+
plan: "merge-by-id",
|
|
27890
|
+
config: "last-write-wins",
|
|
27891
|
+
keybinding: "last-write-wins",
|
|
27892
|
+
mcp: "last-write-wins",
|
|
27893
|
+
"file-history": "append-dedup",
|
|
27894
|
+
"claude-md": "last-write-wins",
|
|
27895
|
+
unknown: "last-write-wins"
|
|
27896
|
+
};
|
|
27897
|
+
NEVER_SYNC_PATTERNS = [
|
|
27898
|
+
".credentials.json",
|
|
27899
|
+
"cache/**",
|
|
27900
|
+
"debug/**",
|
|
27901
|
+
"downloads/**",
|
|
27902
|
+
"paste-cache/**",
|
|
27903
|
+
"session-env/**",
|
|
27904
|
+
"shell-snapshots/**",
|
|
27905
|
+
"statsig/**",
|
|
27906
|
+
"telemetry/**",
|
|
27907
|
+
"stats-cache.json",
|
|
27908
|
+
"image-cache/**",
|
|
27909
|
+
"file-history/**",
|
|
27910
|
+
"**/node_modules/**",
|
|
27911
|
+
"**/cache/**",
|
|
27912
|
+
"**/tool-results/**",
|
|
27913
|
+
"projects/**/*.jsonl",
|
|
27914
|
+
"plugins/**",
|
|
27915
|
+
"plans/**",
|
|
27916
|
+
"todos/**"
|
|
27917
|
+
];
|
|
27918
|
+
});
|
|
27919
|
+
|
|
27920
|
+
// ../shared/src/index.ts
|
|
27921
|
+
var init_src = __esm(() => {
|
|
27922
|
+
init_constants();
|
|
27923
|
+
});
|
|
27924
|
+
|
|
27582
27925
|
// src/core/auth.ts
|
|
27926
|
+
var exports_auth = {};
|
|
27927
|
+
__export(exports_auth, {
|
|
27928
|
+
verifySignature: () => verifySignature,
|
|
27929
|
+
verifyDeviceJWT: () => verifyDeviceJWT,
|
|
27930
|
+
signData: () => signData,
|
|
27931
|
+
importPublicKey: () => importPublicKey,
|
|
27932
|
+
importPrivateKey: () => importPrivateKey,
|
|
27933
|
+
generateDeviceKeypair: () => generateDeviceKeypair,
|
|
27934
|
+
exportPublicKey: () => exportPublicKey,
|
|
27935
|
+
exportPrivateKey: () => exportPrivateKey,
|
|
27936
|
+
createDeviceJWT: () => createDeviceJWT
|
|
27937
|
+
});
|
|
27583
27938
|
async function generateDeviceKeypair() {
|
|
27584
27939
|
const keypair = await crypto.subtle.generateKey("Ed25519", true, ["sign", "verify"]);
|
|
27585
27940
|
return {
|
|
@@ -27599,9 +27954,56 @@ async function importPrivateKey(b64) {
|
|
|
27599
27954
|
const bytes = Buffer.from(b64, "base64url");
|
|
27600
27955
|
return crypto.subtle.importKey("pkcs8", bytes, "Ed25519", true, ["sign"]);
|
|
27601
27956
|
}
|
|
27957
|
+
async function importPublicKey(b64) {
|
|
27958
|
+
const bytes = Buffer.from(b64, "base64url");
|
|
27959
|
+
return crypto.subtle.importKey("raw", bytes, "Ed25519", true, ["verify"]);
|
|
27960
|
+
}
|
|
27961
|
+
async function signData(privateKey, data) {
|
|
27962
|
+
const signature = await crypto.subtle.sign("Ed25519", privateKey, data);
|
|
27963
|
+
return new Uint8Array(signature);
|
|
27964
|
+
}
|
|
27965
|
+
async function verifySignature(publicKey, data, signature) {
|
|
27966
|
+
return crypto.subtle.verify("Ed25519", publicKey, signature, data);
|
|
27967
|
+
}
|
|
27602
27968
|
async function createDeviceJWT(privateKey, deviceId) {
|
|
27603
27969
|
return new SignJWT({}).setProtectedHeader({ alg: "EdDSA" }).setIssuer("ccsini").setSubject(deviceId).setIssuedAt().setExpirationTime(`${JWT_EXPIRY_SECONDS}s`).sign(privateKey);
|
|
27604
27970
|
}
|
|
27971
|
+
async function verifyDeviceJWT(token, publicKey) {
|
|
27972
|
+
const { payload } = await jwtVerify(token, publicKey, {
|
|
27973
|
+
issuer: "ccsini"
|
|
27974
|
+
});
|
|
27975
|
+
return payload;
|
|
27976
|
+
}
|
|
27977
|
+
var init_auth = __esm(() => {
|
|
27978
|
+
init_webapi();
|
|
27979
|
+
init_src();
|
|
27980
|
+
});
|
|
27981
|
+
|
|
27982
|
+
// ../../node_modules/.bun/commander@13.1.0/node_modules/commander/esm.mjs
|
|
27983
|
+
var import__ = __toESM(require_commander(), 1);
|
|
27984
|
+
var {
|
|
27985
|
+
program,
|
|
27986
|
+
createCommand,
|
|
27987
|
+
createArgument,
|
|
27988
|
+
createOption,
|
|
27989
|
+
CommanderError,
|
|
27990
|
+
InvalidArgumentError,
|
|
27991
|
+
InvalidOptionArgumentError,
|
|
27992
|
+
Command,
|
|
27993
|
+
Argument,
|
|
27994
|
+
Option,
|
|
27995
|
+
Help
|
|
27996
|
+
} = import__.default;
|
|
27997
|
+
|
|
27998
|
+
// src/version.ts
|
|
27999
|
+
var VERSION = "0.1.22";
|
|
28000
|
+
|
|
28001
|
+
// src/commands/init.ts
|
|
28002
|
+
init_source();
|
|
28003
|
+
init_ora();
|
|
28004
|
+
init_dist16();
|
|
28005
|
+
init_auth();
|
|
28006
|
+
import { platform } from "os";
|
|
27605
28007
|
|
|
27606
28008
|
// ../../node_modules/.bun/hash-wasm@4.12.0/node_modules/hash-wasm/dist/index.esm.js
|
|
27607
28009
|
/*!
|
|
@@ -28312,6 +28714,7 @@ async function loadKeys(configDir) {
|
|
|
28312
28714
|
}
|
|
28313
28715
|
|
|
28314
28716
|
// src/core/schema.ts
|
|
28717
|
+
init_src();
|
|
28315
28718
|
import { readFile as readFile2, writeFile as writeFile2 } from "fs/promises";
|
|
28316
28719
|
import { join as join2 } from "path";
|
|
28317
28720
|
async function saveDefaultSchema(configDir) {
|
|
@@ -28400,6 +28803,15 @@ class CcsiniClient {
|
|
|
28400
28803
|
}
|
|
28401
28804
|
return res.json();
|
|
28402
28805
|
}
|
|
28806
|
+
async putSalt(salt) {
|
|
28807
|
+
const res = await fetch(`${this.apiUrl}/api/sync/salt`, {
|
|
28808
|
+
method: "PUT",
|
|
28809
|
+
headers: this.getHeaders(),
|
|
28810
|
+
body: JSON.stringify({ salt })
|
|
28811
|
+
});
|
|
28812
|
+
if (!res.ok)
|
|
28813
|
+
throw new Error("Failed to store salt");
|
|
28814
|
+
}
|
|
28403
28815
|
async getManifest() {
|
|
28404
28816
|
const res = await fetch(`${this.apiUrl}/api/sync/manifest`, {
|
|
28405
28817
|
headers: this.getHeaders()
|
|
@@ -28496,6 +28908,7 @@ import { readFile as readFile5, writeFile as writeFile4 } from "fs/promises";
|
|
|
28496
28908
|
import { join as join5 } from "path";
|
|
28497
28909
|
|
|
28498
28910
|
// src/core/scanner.ts
|
|
28911
|
+
init_src();
|
|
28499
28912
|
import { readdir, readFile as readFile4, stat } from "fs/promises";
|
|
28500
28913
|
import { join as join4, relative } from "path";
|
|
28501
28914
|
import { createHash } from "crypto";
|
|
@@ -28664,6 +29077,7 @@ function mergeLastWriteWins(localContent, remoteContent, localModified, remoteMo
|
|
|
28664
29077
|
}
|
|
28665
29078
|
|
|
28666
29079
|
// src/core/sync.ts
|
|
29080
|
+
init_src();
|
|
28667
29081
|
function getClaudeDir() {
|
|
28668
29082
|
return join6(homedir2(), ".claude");
|
|
28669
29083
|
}
|
|
@@ -28892,16 +29306,28 @@ function registerInitCommand(program2) {
|
|
|
28892
29306
|
]);
|
|
28893
29307
|
const spinner = ora("Setting up...").start();
|
|
28894
29308
|
try {
|
|
28895
|
-
spinner.text = "Generating encryption keys...";
|
|
28896
|
-
const salt = crypto.getRandomValues(new Uint8Array(32));
|
|
28897
|
-
await deriveKeyFromPassphrase(password, salt);
|
|
28898
29309
|
spinner.text = "Generating device keypair...";
|
|
28899
29310
|
const keypair = await generateDeviceKeypair();
|
|
28900
29311
|
const publicKeyB64 = await exportPublicKey(keypair.publicKey);
|
|
28901
29312
|
const privateKeyB64 = await exportPrivateKey(keypair.privateKey);
|
|
28902
29313
|
spinner.text = "Registering device...";
|
|
28903
29314
|
const client = new CcsiniClient("https://ccsini-api.anis-maisara190.workers.dev", "");
|
|
28904
|
-
const { deviceId } = await client.registerDevice(token, deviceName, publicKeyB64, detectPlatform());
|
|
29315
|
+
const { deviceId, salt: existingSalt } = await client.registerDevice(token, deviceName, publicKeyB64, detectPlatform());
|
|
29316
|
+
spinner.text = "Setting up encryption...";
|
|
29317
|
+
let salt;
|
|
29318
|
+
if (existingSalt) {
|
|
29319
|
+
salt = new Uint8Array(Buffer.from(existingSalt, "hex"));
|
|
29320
|
+
} else {
|
|
29321
|
+
salt = crypto.getRandomValues(new Uint8Array(32));
|
|
29322
|
+
}
|
|
29323
|
+
await deriveKeyFromPassphrase(password, salt);
|
|
29324
|
+
if (!existingSalt) {
|
|
29325
|
+
const { importPrivateKey: importPrivateKey2, createDeviceJWT: createDeviceJWT2 } = await Promise.resolve().then(() => (init_auth(), exports_auth));
|
|
29326
|
+
const privateKey = await importPrivateKey2(privateKeyB64);
|
|
29327
|
+
const jwt = await createDeviceJWT2(privateKey, deviceId);
|
|
29328
|
+
const authedClient = new CcsiniClient("https://ccsini-api.anis-maisara190.workers.dev", jwt);
|
|
29329
|
+
await authedClient.putSalt(Buffer.from(salt).toString("hex"));
|
|
29330
|
+
}
|
|
28905
29331
|
spinner.text = "Saving configuration...";
|
|
28906
29332
|
await saveKeys(configDir, {
|
|
28907
29333
|
salt,
|
|
@@ -28939,6 +29365,8 @@ function detectPlatform() {
|
|
|
28939
29365
|
}
|
|
28940
29366
|
|
|
28941
29367
|
// src/commands/auto.ts
|
|
29368
|
+
init_auth();
|
|
29369
|
+
init_auth();
|
|
28942
29370
|
import { readFile as readFile7, writeFile as writeFile6 } from "fs/promises";
|
|
28943
29371
|
import { join as join7 } from "path";
|
|
28944
29372
|
async function getMasterKey(configDir) {
|
|
@@ -29116,24 +29544,12 @@ function registerSelfCommands(program2) {
|
|
|
29116
29544
|
console.log(`Updating...
|
|
29117
29545
|
`);
|
|
29118
29546
|
const installedWith = detectInstalledWith();
|
|
29119
|
-
|
|
29120
|
-
try {
|
|
29121
|
-
console.log("Removing bun global install...");
|
|
29122
|
-
execSync("bun remove -g ccsini", { stdio: "inherit" });
|
|
29123
|
-
} catch {}
|
|
29124
|
-
}
|
|
29125
|
-
const cmd = `npm install -g ccsini@${latest}`;
|
|
29547
|
+
const cmd = installedWith === "bun" ? `bun add -g ccsini@${latest} --force` : `npm install -g ccsini@${latest}`;
|
|
29126
29548
|
try {
|
|
29127
29549
|
execSync(cmd, { stdio: "inherit" });
|
|
29128
|
-
|
|
29129
|
-
if (installed === latest) {
|
|
29130
|
-
console.log(`
|
|
29550
|
+
console.log(`
|
|
29131
29551
|
Updated to v${latest}`);
|
|
29132
|
-
|
|
29133
|
-
console.log(`
|
|
29134
|
-
Installed version: ${installed} (expected ${latest})`);
|
|
29135
|
-
console.log("Try: npm install -g ccsini@" + latest);
|
|
29136
|
-
}
|
|
29552
|
+
console.log("Restart your terminal to use the new version.");
|
|
29137
29553
|
} catch {
|
|
29138
29554
|
console.error(`
|
|
29139
29555
|
Update failed. Try manually:`);
|
|
@@ -29166,6 +29582,7 @@ Uninstall failed. Try manually:`);
|
|
|
29166
29582
|
}
|
|
29167
29583
|
|
|
29168
29584
|
// src/commands/sync.ts
|
|
29585
|
+
init_auth();
|
|
29169
29586
|
import { readFile as readFile8 } from "fs/promises";
|
|
29170
29587
|
import { join as join9 } from "path";
|
|
29171
29588
|
async function getMasterKey2(configDir) {
|