@glyphteck/veyl 0.61.12 → 0.63.0

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/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
- for (let key of __getOwnPropNames(mod))
22
- if (!__hasOwnProp.call(to, key))
23
- __defProp(to, key, {
24
- get: __accessProp.bind(mod, key),
25
- enumerable: true
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}/legal#terms`,
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
- ...operation.termsVersion ? { termsVersion: operation.termsVersion } : {}
481
+ agreement: operation.agreement || CURRENT_AGREEMENT
461
482
  });
462
483
  const attestation = await createCredential(start?.opts, {
463
484
  ...operation,