@glyphteck/veyl 0.62.0 → 0.63.1
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/LICENSE +1 -1
- package/dist/account.js +134 -26
- package/dist/auth.js +30 -9
- package/dist/cli.js +15632 -15316
- package/dist/index.js +15677 -15361
- package/dist/kdf-worker-thread.js +8 -119
- package/docs/agents.md +1 -1
- package/docs/api.md +2 -2
- package/docs/cli.md +1 -1
- package/package.json +1 -1
- package/readme.md +1 -1
package/LICENSE
CHANGED
|
@@ -19,4 +19,4 @@ Third-party components remain governed by their respective licenses and
|
|
|
19
19
|
notices. Rights that applicable law does not permit to be restricted remain
|
|
20
20
|
unaffected.
|
|
21
21
|
|
|
22
|
-
The Veyl Terms of Service are available at https://veyl.glyphteck.com/
|
|
22
|
+
The Veyl Terms of Service are available at https://veyl.glyphteck.com/terms#terms.
|
package/dist/account.js
CHANGED
|
@@ -18,12 +18,14 @@ var __toESM = (mod, isNodeMode, target) => {
|
|
|
18
18
|
}
|
|
19
19
|
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
20
20
|
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
if (mod && typeof mod === "object" || typeof mod === "function") {
|
|
22
|
+
for (let key of __getOwnPropNames(mod))
|
|
23
|
+
if (!__hasOwnProp.call(to, key))
|
|
24
|
+
__defProp(to, key, {
|
|
25
|
+
get: __accessProp.bind(mod, key),
|
|
26
|
+
enumerable: true
|
|
27
|
+
});
|
|
28
|
+
}
|
|
27
29
|
if (canCache)
|
|
28
30
|
cache.set(mod, to);
|
|
29
31
|
return to;
|
|
@@ -31,7 +33,7 @@ var __toESM = (mod, isNodeMode, target) => {
|
|
|
31
33
|
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
32
34
|
|
|
33
35
|
// ../../node_modules/.bun/bech32@2.0.0/node_modules/bech32/dist/index.js
|
|
34
|
-
var require_dist = __commonJS((exports)
|
|
36
|
+
var require_dist = __commonJS(function(exports) {
|
|
35
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
38
|
exports.bech32m = exports.bech32 = undefined;
|
|
37
39
|
var ALPHABET = "qpzry9x8gf2tvdw0s3jn54khce6mua7l";
|
|
@@ -7404,12 +7406,24 @@ function readAvatarVersion(value) {
|
|
|
7404
7406
|
}
|
|
7405
7407
|
|
|
7406
7408
|
// ../../core/agreement.js
|
|
7407
|
-
var TERMS_VERSION = "2026-
|
|
7408
|
-
var COMMUNITY_RULES_VERSION = "2026-05-11.1";
|
|
7409
|
+
var TERMS_VERSION = "2026-08-22.4";
|
|
7409
7410
|
var CURRENT_AGREEMENT = Object.freeze({
|
|
7410
|
-
termsVersion: TERMS_VERSION
|
|
7411
|
-
communityRulesVersion: COMMUNITY_RULES_VERSION
|
|
7411
|
+
termsVersion: TERMS_VERSION
|
|
7412
7412
|
});
|
|
7413
|
+
var TERMS_VERSION_PATTERN = /^\d{4}-\d{2}-\d{2}(?:\.\d+)?$/u;
|
|
7414
|
+
function agreementContract(value = CURRENT_AGREEMENT) {
|
|
7415
|
+
const termsVersion = typeof value?.termsVersion === "string" ? value.termsVersion.trim() : "";
|
|
7416
|
+
if (!TERMS_VERSION_PATTERN.test(termsVersion)) {
|
|
7417
|
+
throw new Error("valid Terms version required");
|
|
7418
|
+
}
|
|
7419
|
+
return Object.freeze({ termsVersion });
|
|
7420
|
+
}
|
|
7421
|
+
function isAgreementAccepted(agreement, contract = CURRENT_AGREEMENT) {
|
|
7422
|
+
return agreement?.termsVersion === agreementContract(contract).termsVersion && !!agreement?.acceptedAt;
|
|
7423
|
+
}
|
|
7424
|
+
function hasAgreement(user, contract = CURRENT_AGREEMENT) {
|
|
7425
|
+
return isAgreementAccepted(user?.agreement, contract);
|
|
7426
|
+
}
|
|
7413
7427
|
|
|
7414
7428
|
// ../../core/utils/time.js
|
|
7415
7429
|
function timestampMs(value, fallback = null, options = {}) {
|
|
@@ -7615,6 +7629,9 @@ function createUser({ cloud, network, avatarCache = null, diag = null, onSession
|
|
|
7615
7629
|
let userUid = null;
|
|
7616
7630
|
let settingsKey = null;
|
|
7617
7631
|
let settingsStored = null;
|
|
7632
|
+
let agreementStored = null;
|
|
7633
|
+
let agreementOverride = null;
|
|
7634
|
+
let agreementAcceptance = null;
|
|
7618
7635
|
let avatarFetch = { uid: null, key: null, promise: null };
|
|
7619
7636
|
let blockedSource = state.blocked;
|
|
7620
7637
|
let blockedSet = new Set(blockedSource);
|
|
@@ -7840,6 +7857,9 @@ function createUser({ cloud, network, avatarCache = null, diag = null, onSession
|
|
|
7840
7857
|
clearSettingsKey(settingsKey);
|
|
7841
7858
|
settingsKey = null;
|
|
7842
7859
|
settingsStored = null;
|
|
7860
|
+
agreementStored = null;
|
|
7861
|
+
agreementOverride = null;
|
|
7862
|
+
agreementAcceptance = null;
|
|
7843
7863
|
if (signedOutUid) {
|
|
7844
7864
|
keepOnlyCachedAvatar(null);
|
|
7845
7865
|
}
|
|
@@ -7854,6 +7874,9 @@ function createUser({ cloud, network, avatarCache = null, diag = null, onSession
|
|
|
7854
7874
|
clearSettingsKey(settingsKey);
|
|
7855
7875
|
settingsKey = null;
|
|
7856
7876
|
settingsStored = null;
|
|
7877
|
+
agreementStored = null;
|
|
7878
|
+
agreementOverride = null;
|
|
7879
|
+
agreementAcceptance = null;
|
|
7857
7880
|
}
|
|
7858
7881
|
setState((user) => authUidChanged ? { ...defaultUser, authReady: true, uid: authUser.uid } : { ...user, authReady: true, isAdmin: false, adminReady: false });
|
|
7859
7882
|
readCachedAvatar(authUser.uid).then((cached) => {
|
|
@@ -7913,18 +7936,23 @@ function createUser({ cloud, network, avatarCache = null, diag = null, onSession
|
|
|
7913
7936
|
if (!info.fromCache) {
|
|
7914
7937
|
settingsStored = Object.prototype.hasOwnProperty.call(privateData, "settings");
|
|
7915
7938
|
}
|
|
7939
|
+
agreementStored = privateData.agreement ?? null;
|
|
7940
|
+
if (agreementOverride && isAgreementAccepted(agreementStored, agreementOverride.agreement)) {
|
|
7941
|
+
agreementOverride = null;
|
|
7942
|
+
}
|
|
7916
7943
|
setState((user) => ({
|
|
7917
7944
|
...user,
|
|
7918
|
-
agreement:
|
|
7945
|
+
agreement: agreementOverride?.agreement ?? agreementStored,
|
|
7919
7946
|
settingsReady: user.settingsReady || !info.fromCache
|
|
7920
7947
|
}));
|
|
7921
7948
|
}), current((error) => {
|
|
7922
7949
|
markError(diag, "user.settings.snapshot", authStartedAt, error);
|
|
7923
7950
|
settingsStored = null;
|
|
7951
|
+
agreementStored = null;
|
|
7924
7952
|
setState((user) => ({
|
|
7925
7953
|
...user,
|
|
7926
7954
|
settingsReady: true,
|
|
7927
|
-
agreement: null
|
|
7955
|
+
agreement: agreementOverride?.agreement ?? null
|
|
7928
7956
|
}));
|
|
7929
7957
|
})));
|
|
7930
7958
|
userWatches.push(cloud.user.banned(authUser.uid, current((banned) => {
|
|
@@ -8028,6 +8056,9 @@ function createUser({ cloud, network, avatarCache = null, diag = null, onSession
|
|
|
8028
8056
|
clearSettingsKey(settingsKey);
|
|
8029
8057
|
settingsKey = null;
|
|
8030
8058
|
settingsStored = null;
|
|
8059
|
+
agreementStored = null;
|
|
8060
|
+
agreementOverride = null;
|
|
8061
|
+
agreementAcceptance = null;
|
|
8031
8062
|
userUid = null;
|
|
8032
8063
|
avatarFetch = { uid: null, key: null, promise: null };
|
|
8033
8064
|
state = defaultUser;
|
|
@@ -8055,21 +8086,71 @@ function createUser({ cloud, network, avatarCache = null, diag = null, onSession
|
|
|
8055
8086
|
throw new Error("peer uid required");
|
|
8056
8087
|
return cloud.user.blocked.remove(uid, nextPeerUid);
|
|
8057
8088
|
}
|
|
8058
|
-
async function acceptAgreement() {
|
|
8089
|
+
async function acceptAgreement(requestedAgreement = CURRENT_AGREEMENT) {
|
|
8059
8090
|
const uid = cloud.auth.user?.uid;
|
|
8060
8091
|
const session = authSession;
|
|
8061
8092
|
if (!uid)
|
|
8062
8093
|
throw new Error("auth");
|
|
8063
|
-
|
|
8064
|
-
|
|
8065
|
-
|
|
8066
|
-
|
|
8067
|
-
|
|
8094
|
+
const agreement = agreementContract(requestedAgreement);
|
|
8095
|
+
while (agreementAcceptance) {
|
|
8096
|
+
if (agreementAcceptance.termsVersion === agreement.termsVersion) {
|
|
8097
|
+
return agreementAcceptance.promise;
|
|
8098
|
+
}
|
|
8099
|
+
await agreementAcceptance.promise.catch(NOOP);
|
|
8100
|
+
if (!isCurrentUser(uid, session))
|
|
8101
|
+
throw new Error("auth");
|
|
8102
|
+
}
|
|
8103
|
+
const startedAt = Date.now();
|
|
8104
|
+
const override = {
|
|
8068
8105
|
agreement: {
|
|
8069
|
-
...
|
|
8106
|
+
...agreement,
|
|
8070
8107
|
acceptedAt: new Date
|
|
8071
8108
|
}
|
|
8109
|
+
};
|
|
8110
|
+
markDiag(diag, "user.agreement.accept.start", {
|
|
8111
|
+
termsVersion: agreement.termsVersion
|
|
8112
|
+
});
|
|
8113
|
+
agreementOverride = override;
|
|
8114
|
+
setState((user) => ({
|
|
8115
|
+
...user,
|
|
8116
|
+
agreement: override.agreement
|
|
8072
8117
|
}));
|
|
8118
|
+
markDiag(diag, "user.agreement.accept.optimistic", {
|
|
8119
|
+
termsVersion: agreement.termsVersion
|
|
8120
|
+
});
|
|
8121
|
+
const acceptance = {
|
|
8122
|
+
termsVersion: agreement.termsVersion,
|
|
8123
|
+
promise: null
|
|
8124
|
+
};
|
|
8125
|
+
const operation = new Promise((resolve) => setTimeout(resolve, 0)).then(() => {
|
|
8126
|
+
markDiag(diag, "user.agreement.accept.request.start", {
|
|
8127
|
+
termsVersion: agreement.termsVersion
|
|
8128
|
+
});
|
|
8129
|
+
return cloud.user.agreement.accept(uid, agreement);
|
|
8130
|
+
}).then(() => {
|
|
8131
|
+
markDone(diag, "user.agreement.accept", startedAt, {
|
|
8132
|
+
termsVersion: agreement.termsVersion
|
|
8133
|
+
});
|
|
8134
|
+
return agreement;
|
|
8135
|
+
}).catch((error) => {
|
|
8136
|
+
markError(diag, "user.agreement.accept", startedAt, error, {
|
|
8137
|
+
termsVersion: agreement.termsVersion
|
|
8138
|
+
});
|
|
8139
|
+
if (!isCurrentUser(uid, session))
|
|
8140
|
+
throw error;
|
|
8141
|
+
if (agreementOverride === override) {
|
|
8142
|
+
agreementOverride = null;
|
|
8143
|
+
setState((user) => ({ ...user, agreement: agreementStored }));
|
|
8144
|
+
}
|
|
8145
|
+
throw error;
|
|
8146
|
+
}).finally(() => {
|
|
8147
|
+
if (agreementAcceptance === acceptance) {
|
|
8148
|
+
agreementAcceptance = null;
|
|
8149
|
+
}
|
|
8150
|
+
});
|
|
8151
|
+
acceptance.promise = operation;
|
|
8152
|
+
agreementAcceptance = acceptance;
|
|
8153
|
+
return operation;
|
|
8073
8154
|
}
|
|
8074
8155
|
async function unlockSettings(key) {
|
|
8075
8156
|
const uid = cloud.auth.user?.uid;
|
|
@@ -36073,7 +36154,8 @@ function emptyState(user, network) {
|
|
|
36073
36154
|
session: null,
|
|
36074
36155
|
wallet: null,
|
|
36075
36156
|
walletError: null,
|
|
36076
|
-
lockState: "locked"
|
|
36157
|
+
lockState: "locked",
|
|
36158
|
+
agreementSession: null
|
|
36077
36159
|
};
|
|
36078
36160
|
}
|
|
36079
36161
|
function openAccount(options = {}) {
|
|
@@ -36095,6 +36177,7 @@ function openAccount(options = {}) {
|
|
|
36095
36177
|
let stopVault = NOOP8;
|
|
36096
36178
|
let syncingUser = false;
|
|
36097
36179
|
let state;
|
|
36180
|
+
let nextAgreement = agreementContract(options.agreement || CURRENT_AGREEMENT);
|
|
36098
36181
|
const listeners = new Set;
|
|
36099
36182
|
const user = options.user || createUser({
|
|
36100
36183
|
cloud,
|
|
@@ -36282,7 +36365,8 @@ function openAccount(options = {}) {
|
|
|
36282
36365
|
session: null,
|
|
36283
36366
|
wallet: null,
|
|
36284
36367
|
walletError: null,
|
|
36285
|
-
lockState: "locked"
|
|
36368
|
+
lockState: "locked",
|
|
36369
|
+
agreementSession: null
|
|
36286
36370
|
};
|
|
36287
36371
|
if (notify2) {
|
|
36288
36372
|
emitDomains(patch);
|
|
@@ -36341,7 +36425,11 @@ function openAccount(options = {}) {
|
|
|
36341
36425
|
const nextUser = user.getSnapshot();
|
|
36342
36426
|
const uid = nextUser.uid || null;
|
|
36343
36427
|
if (uid === state.uid) {
|
|
36344
|
-
|
|
36428
|
+
const agreementSession = state.agreementSession ? {
|
|
36429
|
+
agreement: state.agreementSession.agreement,
|
|
36430
|
+
accepted: hasAgreement(nextUser, state.agreementSession.agreement)
|
|
36431
|
+
} : null;
|
|
36432
|
+
emitDomains({ user: nextUser, agreementSession });
|
|
36345
36433
|
return;
|
|
36346
36434
|
}
|
|
36347
36435
|
syncingUser = true;
|
|
@@ -36384,6 +36472,7 @@ function openAccount(options = {}) {
|
|
|
36384
36472
|
throw new Error("vault not ready");
|
|
36385
36473
|
const currentAttempt = attempt + 1;
|
|
36386
36474
|
attempt = currentAttempt;
|
|
36475
|
+
const requiredAgreement = nextAgreement;
|
|
36387
36476
|
const source = unlockOptions.source || "password";
|
|
36388
36477
|
const isCurrent = () => !closed && attempt === currentAttempt && state.uid === uid && cloud.auth.user?.uid === uid;
|
|
36389
36478
|
let session = null;
|
|
@@ -36416,7 +36505,11 @@ function openAccount(options = {}) {
|
|
|
36416
36505
|
session,
|
|
36417
36506
|
wallet: null,
|
|
36418
36507
|
walletError: null,
|
|
36419
|
-
lockState: "unlocked"
|
|
36508
|
+
lockState: "unlocked",
|
|
36509
|
+
agreementSession: {
|
|
36510
|
+
agreement: requiredAgreement,
|
|
36511
|
+
accepted: hasAgreement(state.user, requiredAgreement)
|
|
36512
|
+
}
|
|
36420
36513
|
});
|
|
36421
36514
|
setActive(true);
|
|
36422
36515
|
session.walletReady.then(({ wallet: wallet2 }) => {
|
|
@@ -36470,6 +36563,19 @@ function openAccount(options = {}) {
|
|
|
36470
36563
|
}
|
|
36471
36564
|
return vaultCrypto.verifyVaultPassword(state.vault, password);
|
|
36472
36565
|
}
|
|
36566
|
+
function setAgreementContract(value) {
|
|
36567
|
+
nextAgreement = agreementContract(value);
|
|
36568
|
+
return nextAgreement;
|
|
36569
|
+
}
|
|
36570
|
+
async function acceptAgreement() {
|
|
36571
|
+
const agreementSession = state.agreementSession;
|
|
36572
|
+
if (state.lockState !== "unlocked" || !agreementSession) {
|
|
36573
|
+
throw new Error("unlocked agreement session required");
|
|
36574
|
+
}
|
|
36575
|
+
if (agreementSession.accepted)
|
|
36576
|
+
return agreementSession.agreement;
|
|
36577
|
+
return state.user.acceptAgreement(agreementSession.agreement);
|
|
36578
|
+
}
|
|
36473
36579
|
async function deleteAccount(options2 = {}) {
|
|
36474
36580
|
if (options2.confirm !== true) {
|
|
36475
36581
|
throw new Error("account deletion requires confirm: true");
|
|
@@ -36559,17 +36665,19 @@ function openAccount(options = {}) {
|
|
|
36559
36665
|
return () => listeners.delete(listener);
|
|
36560
36666
|
},
|
|
36561
36667
|
unlock,
|
|
36668
|
+
acceptAgreement,
|
|
36562
36669
|
createVault,
|
|
36563
36670
|
verifyPassword,
|
|
36564
36671
|
delete: deleteAccount,
|
|
36565
36672
|
lock,
|
|
36566
36673
|
switchNetwork,
|
|
36567
36674
|
setActive,
|
|
36675
|
+
setAgreementContract,
|
|
36568
36676
|
setNetwork,
|
|
36569
36677
|
close
|
|
36570
36678
|
});
|
|
36571
36679
|
}
|
|
36572
36680
|
export {
|
|
36573
|
-
|
|
36574
|
-
|
|
36681
|
+
isVaultPasswordError,
|
|
36682
|
+
openAccount
|
|
36575
36683
|
};
|
package/dist/auth.js
CHANGED
|
@@ -18,12 +18,14 @@ var __toESM = (mod, isNodeMode, target) => {
|
|
|
18
18
|
}
|
|
19
19
|
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
20
20
|
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
if (mod && typeof mod === "object" || typeof mod === "function") {
|
|
22
|
+
for (let key of __getOwnPropNames(mod))
|
|
23
|
+
if (!__hasOwnProp.call(to, key))
|
|
24
|
+
__defProp(to, key, {
|
|
25
|
+
get: __accessProp.bind(mod, key),
|
|
26
|
+
enumerable: true
|
|
27
|
+
});
|
|
28
|
+
}
|
|
27
29
|
if (canCache)
|
|
28
30
|
cache.set(mod, to);
|
|
29
31
|
return to;
|
|
@@ -92,6 +94,26 @@ function normalizePasskeyRegisterError(error, options = {}) {
|
|
|
92
94
|
return error;
|
|
93
95
|
}
|
|
94
96
|
|
|
97
|
+
// ../../core/agreement.js
|
|
98
|
+
var TERMS_VERSION = "2026-08-22.4";
|
|
99
|
+
var CURRENT_AGREEMENT = Object.freeze({
|
|
100
|
+
termsVersion: TERMS_VERSION
|
|
101
|
+
});
|
|
102
|
+
var TERMS_VERSION_PATTERN = /^\d{4}-\d{2}-\d{2}(?:\.\d+)?$/u;
|
|
103
|
+
function agreementContract(value = CURRENT_AGREEMENT) {
|
|
104
|
+
const termsVersion = typeof value?.termsVersion === "string" ? value.termsVersion.trim() : "";
|
|
105
|
+
if (!TERMS_VERSION_PATTERN.test(termsVersion)) {
|
|
106
|
+
throw new Error("valid Terms version required");
|
|
107
|
+
}
|
|
108
|
+
return Object.freeze({ termsVersion });
|
|
109
|
+
}
|
|
110
|
+
function isAgreementAccepted(agreement, contract = CURRENT_AGREEMENT) {
|
|
111
|
+
return agreement?.termsVersion === agreementContract(contract).termsVersion && !!agreement?.acceptedAt;
|
|
112
|
+
}
|
|
113
|
+
function hasAgreement(user, contract = CURRENT_AGREEMENT) {
|
|
114
|
+
return isAgreementAccepted(user?.agreement, contract);
|
|
115
|
+
}
|
|
116
|
+
|
|
95
117
|
// ../../core/origins.js
|
|
96
118
|
var ROOT_DOMAIN = "glyphteck.com";
|
|
97
119
|
var VEYL_DEV_WEB_PORT_MIN = 3000;
|
|
@@ -138,8 +160,7 @@ var links = Object.freeze({
|
|
|
138
160
|
veyl: origins.veyl,
|
|
139
161
|
veylDev: origins.veylDev,
|
|
140
162
|
veylDevWeb: origins.veylDevWeb,
|
|
141
|
-
terms: `${origins.veyl}/
|
|
142
|
-
communityRules: `${origins.veyl}/community-rules`,
|
|
163
|
+
terms: `${origins.veyl}/terms#terms`,
|
|
143
164
|
contact: `mailto:contact@${ROOT_DOMAIN}`,
|
|
144
165
|
regtestFaucet: "https://app.lightspark.com/regtest-faucet"
|
|
145
166
|
});
|
|
@@ -457,7 +478,7 @@ function openAuth(options = {}) {
|
|
|
457
478
|
const start = await transport.register.start({
|
|
458
479
|
label,
|
|
459
480
|
origin: operationOrigin(operation),
|
|
460
|
-
|
|
481
|
+
agreement: operation.agreement || CURRENT_AGREEMENT
|
|
461
482
|
});
|
|
462
483
|
const attestation = await createCredential(start?.opts, {
|
|
463
484
|
...operation,
|