@tinycloud/sdk-services 3.2.6-beta.2 → 3.3.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/{BaseService-4wwJq1Gn.d.cts → BaseService-Cc6Ueicm.d.cts} +1 -1
- package/dist/{BaseService-BGr2slUz.d.ts → BaseService-DOdXd7sr.d.ts} +1 -1
- package/dist/encryption/index.cjs +10 -0
- package/dist/encryption/index.cjs.map +1 -1
- package/dist/encryption/index.d.cts +2 -2
- package/dist/encryption/index.d.ts +2 -2
- package/dist/encryption/index.js +10 -0
- package/dist/encryption/index.js.map +1 -1
- package/dist/index.cjs +360 -210
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +116 -13
- package/dist/index.d.ts +116 -13
- package/dist/index.js +359 -210
- package/dist/index.js.map +1 -1
- package/dist/internal/decrypt-transport-response-error.d.cts +1 -1
- package/dist/internal/decrypt-transport-response-error.d.ts +1 -1
- package/dist/kv/index.cjs +68 -21
- package/dist/kv/index.cjs.map +1 -1
- package/dist/kv/index.d.cts +7 -4
- package/dist/kv/index.d.ts +7 -4
- package/dist/kv/index.js +68 -21
- package/dist/kv/index.js.map +1 -1
- package/dist/kv/replication/contractConstants.cjs +115 -0
- package/dist/kv/replication/contractConstants.cjs.map +1 -0
- package/dist/kv/replication/contractConstants.d.cts +77 -0
- package/dist/kv/replication/contractConstants.d.ts +77 -0
- package/dist/kv/replication/contractConstants.js +75 -0
- package/dist/kv/replication/contractConstants.js.map +1 -0
- package/dist/kv/replication/grantPolicy.cjs +82 -0
- package/dist/kv/replication/grantPolicy.cjs.map +1 -0
- package/dist/kv/replication/grantPolicy.d.cts +19 -0
- package/dist/kv/replication/grantPolicy.d.ts +19 -0
- package/dist/kv/replication/grantPolicy.js +50 -0
- package/dist/kv/replication/grantPolicy.js.map +1 -0
- package/dist/kv/replication/grantPolicyConstants.cjs +42 -0
- package/dist/kv/replication/grantPolicyConstants.cjs.map +1 -0
- package/dist/kv/replication/grantPolicyConstants.d.cts +10 -0
- package/dist/kv/replication/grantPolicyConstants.d.ts +10 -0
- package/dist/kv/replication/grantPolicyConstants.js +14 -0
- package/dist/kv/replication/grantPolicyConstants.js.map +1 -0
- package/dist/kv/replication/grantPolicyTypes.cjs +19 -0
- package/dist/kv/replication/grantPolicyTypes.cjs.map +1 -0
- package/dist/kv/replication/grantPolicyTypes.d.cts +87 -0
- package/dist/kv/replication/grantPolicyTypes.d.ts +87 -0
- package/dist/kv/replication/grantPolicyTypes.js +1 -0
- package/dist/kv/replication/grantPolicyTypes.js.map +1 -0
- package/dist/kv/replication/index.cjs +575 -131
- package/dist/kv/replication/index.cjs.map +1 -1
- package/dist/kv/replication/index.d.cts +6 -3
- package/dist/kv/replication/index.d.ts +6 -3
- package/dist/kv/replication/index.js +575 -131
- package/dist/kv/replication/index.js.map +1 -1
- package/dist/scope-B-m6cKH-.d.ts +1962 -0
- package/dist/scope-B7oeKdLM.d.cts +1962 -0
- package/dist/sql/index.cjs +72 -36
- package/dist/sql/index.cjs.map +1 -1
- package/dist/sql/index.d.cts +2 -2
- package/dist/sql/index.d.ts +2 -2
- package/dist/sql/index.js +72 -36
- package/dist/sql/index.js.map +1 -1
- package/dist/{types-D-9A3Sut.d.cts → types-BjH0ZtGy.d.cts} +8 -0
- package/dist/{types-D-9A3Sut.d.ts → types-BjH0ZtGy.d.ts} +8 -0
- package/package.json +55 -2
- package/dist/scope-CoKKmMiI.d.ts +0 -957
- package/dist/scope-D7wmjbMH.d.cts +0 -957
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Default device-grant lifetime from install (24 h). All durations are milliseconds. */
|
|
2
|
+
declare const DEFAULT_GRANT_TTL_MS: number;
|
|
3
|
+
/** `grantTtlMs` above this (7 d) is a config error: TypeError at construction. */
|
|
4
|
+
declare const MAX_GRANT_TTL_MS: number;
|
|
5
|
+
/** Consent deadline = consent anchor + this window (7 d). */
|
|
6
|
+
declare const CONSENT_WINDOW_MS: number;
|
|
7
|
+
/** Silent renewal starts when remaining effective lifetime < this fraction of the effective lifetime. */
|
|
8
|
+
declare const RENEW_BELOW_FRACTION = 0.25;
|
|
9
|
+
|
|
10
|
+
export { CONSENT_WINDOW_MS, DEFAULT_GRANT_TTL_MS, MAX_GRANT_TTL_MS, RENEW_BELOW_FRACTION };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// src/kv/replication/grantPolicyConstants.ts
|
|
2
|
+
var HOUR_MS = 60 * 60 * 1e3;
|
|
3
|
+
var DAY_MS = 24 * HOUR_MS;
|
|
4
|
+
var DEFAULT_GRANT_TTL_MS = DAY_MS;
|
|
5
|
+
var MAX_GRANT_TTL_MS = 7 * DAY_MS;
|
|
6
|
+
var CONSENT_WINDOW_MS = 7 * DAY_MS;
|
|
7
|
+
var RENEW_BELOW_FRACTION = 0.25;
|
|
8
|
+
export {
|
|
9
|
+
CONSENT_WINDOW_MS,
|
|
10
|
+
DEFAULT_GRANT_TTL_MS,
|
|
11
|
+
MAX_GRANT_TTL_MS,
|
|
12
|
+
RENEW_BELOW_FRACTION
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=grantPolicyConstants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/kv/replication/grantPolicyConstants.ts"],"sourcesContent":["/** Grant lifetime constants without browser storage identifiers. */\nconst HOUR_MS = 60 * 60 * 1000;\nconst DAY_MS = 24 * HOUR_MS;\n\n/** Default device-grant lifetime from install (24 h). All durations are milliseconds. */\nexport const DEFAULT_GRANT_TTL_MS = DAY_MS;\n/** `grantTtlMs` above this (7 d) is a config error: TypeError at construction. */\nexport const MAX_GRANT_TTL_MS = 7 * DAY_MS;\n/** Consent deadline = consent anchor + this window (7 d). */\nexport const CONSENT_WINDOW_MS = 7 * DAY_MS;\n/** Silent renewal starts when remaining effective lifetime < this fraction of the effective lifetime. */\nexport const RENEW_BELOW_FRACTION = 0.25;\n"],"mappings":";AACA,IAAM,UAAU,KAAK,KAAK;AAC1B,IAAM,SAAS,KAAK;AAGb,IAAM,uBAAuB;AAE7B,IAAM,mBAAmB,IAAI;AAE7B,IAAM,oBAAoB,IAAI;AAE9B,IAAM,uBAAuB;","names":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
|
|
16
|
+
// src/kv/replication/grantPolicyTypes.ts
|
|
17
|
+
var grantPolicyTypes_exports = {};
|
|
18
|
+
module.exports = __toCommonJS(grantPolicyTypes_exports);
|
|
19
|
+
//# sourceMappingURL=grantPolicyTypes.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/kv/replication/grantPolicyTypes.ts"],"sourcesContent":["/**\n * Grant lifetime and renewal contract (TC-858 Phase 2, CONTRACT.md §3). Types only; S4 implements\n * these signatures in `grantPolicy.ts` using the constants in `contractConstants.ts`.\n * All instants are milliseconds since epoch; all durations are milliseconds.\n */\n\n/** Verified source selected by session form; `first_install` is expiry-only. */\nexport type ReplicaConsentSource =\n /** Verified owner SIWE `issuedAt` with finite signed expiration and exact-space KV witness. */\n | \"siwe\"\n /** `iat` of the oldest independently verified owner-authorizing proof, never a child leaf. */\n | \"delegation_iat\"\n /** `nbf` of that same oldest owner proof; a leaf signature alone is insufficient. */\n | \"delegation_nbf\"\n /** Neither: persisted first grant install time, for expiry only; never session establishment. */\n | \"first_install\";\n\n/**\n * Invariants: `at` is finite milliseconds and clamped to ≤ now by `clampConsentAnchor`. Second-based\n * sources (UCAN `iat`/`nbf`) are converted ×1000 exactly once, at the authority; SIWE `issuedAt`\n * is parsed as an ISO date. Renewals never re-anchor: only a fresh sign-in yields a new anchor.\n */\nexport interface ReplicaConsentAnchor {\n at: number;\n source: ReplicaConsentSource;\n}\n\n/**\n * Returns the eligible anchor with `at` clamped to ≤ now, or null when it is not finite.\n * A full SIWE session with missing/invalid signed expiration or issuedAt remains unanchored;\n * never fall through to a compact leaf or first-install timestamp. Compact-only sessions\n * may try the same independently verified oldest owner proof's `nbf` after invalid `iat`.\n * S4 implements this as `clampConsentAnchor` in `grantPolicy.ts`.\n */\nexport type ClampConsentAnchor = (anchor: ReplicaConsentAnchor, now: number) => ReplicaConsentAnchor | null;\n\n/**\n * Policy the controller passes to storage in `KVReplicaSpec.grantPolicy`. Storage stores the\n * resulting effective expiry with the installed grant and recomputes it at open.\n */\nexport interface ReplicaGrantPolicy {\n /** Validated: 0 < grantTtlMs ≤ MAX_GRANT_TTL_MS. */\n grantTtlMs: number;\n /**\n * From `ReplicationAuthority.consentAnchor()`: a full SIWE session requires an\n * independently verified signed owner `issuedAt`, finite signed expiration and\n * exact-space KV get+sync witness. A compact-only session instead needs the oldest\n * independently verified owner-authorizing proof's `iat`, then its `nbf` (never a\n * fresh child leaf minted under an old owner grant). Invalid SIWE does not fall\n * through to compact/first-install sources.\n * Null means no verified source; storage uses its persisted first-install time only\n * to bound grant expiry, never as freshness proof for a session stamp. That anchor\n * survives partition reset, purge and reinstall, and is cleared only by `deny`.\n */\n consentAnchor: ReplicaConsentAnchor | null;\n}\n\nexport interface EffectiveGrantExpiryInput {\n /** The grant's signed `exp` in ms; null when it has none. */\n signedExpiresAt: number | null;\n installedAt: number;\n grantTtlMs: number;\n /** `min(consentDeadlineMs(policyAnchor), durableGateDeadline)` when browser gate is active. */\n consentDeadline: number;\n}\n\n/** effective expiry = min(signed exp, installedAt + grantTtlMs, consentDeadline). */\nexport type EffectiveGrantExpiry = (input: EffectiveGrantExpiryInput) => number;\n\n/** anchor.at + CONSENT_WINDOW_MS. */\nexport type ConsentDeadlineMs = (anchor: ReplicaConsentAnchor) => number;\n\n/**\n * Duration passed to `ReplicationAuthority.mint` as `expiryMs`:\n * min(grantTtlMs, consentDeadline − now). The caller MUST NOT mint when the result is ≤ 0.\n */\nexport type MintRemainingMs = (input: { now: number; grantTtlMs: number; consentDeadline: number }) => number;\n\n/**\n * True when online-renewal should run: remaining = effectiveExpiresAt − now is STRICTLY below\n * RENEW_BELOW_FRACTION × (effectiveExpiresAt − installedAt) (exactly 25% remaining does not\n * renew), and now < consentDeadline. All inputs finite; otherwise false.\n * Checked on a timer, before each sync, and at open.\n */\nexport type NeedsSilentRenewal = (input: {\n now: number;\n installedAt: number;\n effectiveExpiresAt: number;\n consentDeadline: number;\n}) => boolean;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Grant lifetime and renewal contract (TC-858 Phase 2, CONTRACT.md §3). Types only; S4 implements
|
|
3
|
+
* these signatures in `grantPolicy.ts` using the constants in `contractConstants.ts`.
|
|
4
|
+
* All instants are milliseconds since epoch; all durations are milliseconds.
|
|
5
|
+
*/
|
|
6
|
+
/** Verified source selected by session form; `first_install` is expiry-only. */
|
|
7
|
+
type ReplicaConsentSource =
|
|
8
|
+
/** Verified owner SIWE `issuedAt` with finite signed expiration and exact-space KV witness. */
|
|
9
|
+
"siwe"
|
|
10
|
+
/** `iat` of the oldest independently verified owner-authorizing proof, never a child leaf. */
|
|
11
|
+
| "delegation_iat"
|
|
12
|
+
/** `nbf` of that same oldest owner proof; a leaf signature alone is insufficient. */
|
|
13
|
+
| "delegation_nbf"
|
|
14
|
+
/** Neither: persisted first grant install time, for expiry only; never session establishment. */
|
|
15
|
+
| "first_install";
|
|
16
|
+
/**
|
|
17
|
+
* Invariants: `at` is finite milliseconds and clamped to ≤ now by `clampConsentAnchor`. Second-based
|
|
18
|
+
* sources (UCAN `iat`/`nbf`) are converted ×1000 exactly once, at the authority; SIWE `issuedAt`
|
|
19
|
+
* is parsed as an ISO date. Renewals never re-anchor: only a fresh sign-in yields a new anchor.
|
|
20
|
+
*/
|
|
21
|
+
interface ReplicaConsentAnchor {
|
|
22
|
+
at: number;
|
|
23
|
+
source: ReplicaConsentSource;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Returns the eligible anchor with `at` clamped to ≤ now, or null when it is not finite.
|
|
27
|
+
* A full SIWE session with missing/invalid signed expiration or issuedAt remains unanchored;
|
|
28
|
+
* never fall through to a compact leaf or first-install timestamp. Compact-only sessions
|
|
29
|
+
* may try the same independently verified oldest owner proof's `nbf` after invalid `iat`.
|
|
30
|
+
* S4 implements this as `clampConsentAnchor` in `grantPolicy.ts`.
|
|
31
|
+
*/
|
|
32
|
+
type ClampConsentAnchor = (anchor: ReplicaConsentAnchor, now: number) => ReplicaConsentAnchor | null;
|
|
33
|
+
/**
|
|
34
|
+
* Policy the controller passes to storage in `KVReplicaSpec.grantPolicy`. Storage stores the
|
|
35
|
+
* resulting effective expiry with the installed grant and recomputes it at open.
|
|
36
|
+
*/
|
|
37
|
+
interface ReplicaGrantPolicy {
|
|
38
|
+
/** Validated: 0 < grantTtlMs ≤ MAX_GRANT_TTL_MS. */
|
|
39
|
+
grantTtlMs: number;
|
|
40
|
+
/**
|
|
41
|
+
* From `ReplicationAuthority.consentAnchor()`: a full SIWE session requires an
|
|
42
|
+
* independently verified signed owner `issuedAt`, finite signed expiration and
|
|
43
|
+
* exact-space KV get+sync witness. A compact-only session instead needs the oldest
|
|
44
|
+
* independently verified owner-authorizing proof's `iat`, then its `nbf` (never a
|
|
45
|
+
* fresh child leaf minted under an old owner grant). Invalid SIWE does not fall
|
|
46
|
+
* through to compact/first-install sources.
|
|
47
|
+
* Null means no verified source; storage uses its persisted first-install time only
|
|
48
|
+
* to bound grant expiry, never as freshness proof for a session stamp. That anchor
|
|
49
|
+
* survives partition reset, purge and reinstall, and is cleared only by `deny`.
|
|
50
|
+
*/
|
|
51
|
+
consentAnchor: ReplicaConsentAnchor | null;
|
|
52
|
+
}
|
|
53
|
+
interface EffectiveGrantExpiryInput {
|
|
54
|
+
/** The grant's signed `exp` in ms; null when it has none. */
|
|
55
|
+
signedExpiresAt: number | null;
|
|
56
|
+
installedAt: number;
|
|
57
|
+
grantTtlMs: number;
|
|
58
|
+
/** `min(consentDeadlineMs(policyAnchor), durableGateDeadline)` when browser gate is active. */
|
|
59
|
+
consentDeadline: number;
|
|
60
|
+
}
|
|
61
|
+
/** effective expiry = min(signed exp, installedAt + grantTtlMs, consentDeadline). */
|
|
62
|
+
type EffectiveGrantExpiry = (input: EffectiveGrantExpiryInput) => number;
|
|
63
|
+
/** anchor.at + CONSENT_WINDOW_MS. */
|
|
64
|
+
type ConsentDeadlineMs = (anchor: ReplicaConsentAnchor) => number;
|
|
65
|
+
/**
|
|
66
|
+
* Duration passed to `ReplicationAuthority.mint` as `expiryMs`:
|
|
67
|
+
* min(grantTtlMs, consentDeadline − now). The caller MUST NOT mint when the result is ≤ 0.
|
|
68
|
+
*/
|
|
69
|
+
type MintRemainingMs = (input: {
|
|
70
|
+
now: number;
|
|
71
|
+
grantTtlMs: number;
|
|
72
|
+
consentDeadline: number;
|
|
73
|
+
}) => number;
|
|
74
|
+
/**
|
|
75
|
+
* True when online-renewal should run: remaining = effectiveExpiresAt − now is STRICTLY below
|
|
76
|
+
* RENEW_BELOW_FRACTION × (effectiveExpiresAt − installedAt) (exactly 25% remaining does not
|
|
77
|
+
* renew), and now < consentDeadline. All inputs finite; otherwise false.
|
|
78
|
+
* Checked on a timer, before each sync, and at open.
|
|
79
|
+
*/
|
|
80
|
+
type NeedsSilentRenewal = (input: {
|
|
81
|
+
now: number;
|
|
82
|
+
installedAt: number;
|
|
83
|
+
effectiveExpiresAt: number;
|
|
84
|
+
consentDeadline: number;
|
|
85
|
+
}) => boolean;
|
|
86
|
+
|
|
87
|
+
export type { ClampConsentAnchor, ConsentDeadlineMs, EffectiveGrantExpiry, EffectiveGrantExpiryInput, MintRemainingMs, NeedsSilentRenewal, ReplicaConsentAnchor, ReplicaConsentSource, ReplicaGrantPolicy };
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Grant lifetime and renewal contract (TC-858 Phase 2, CONTRACT.md §3). Types only; S4 implements
|
|
3
|
+
* these signatures in `grantPolicy.ts` using the constants in `contractConstants.ts`.
|
|
4
|
+
* All instants are milliseconds since epoch; all durations are milliseconds.
|
|
5
|
+
*/
|
|
6
|
+
/** Verified source selected by session form; `first_install` is expiry-only. */
|
|
7
|
+
type ReplicaConsentSource =
|
|
8
|
+
/** Verified owner SIWE `issuedAt` with finite signed expiration and exact-space KV witness. */
|
|
9
|
+
"siwe"
|
|
10
|
+
/** `iat` of the oldest independently verified owner-authorizing proof, never a child leaf. */
|
|
11
|
+
| "delegation_iat"
|
|
12
|
+
/** `nbf` of that same oldest owner proof; a leaf signature alone is insufficient. */
|
|
13
|
+
| "delegation_nbf"
|
|
14
|
+
/** Neither: persisted first grant install time, for expiry only; never session establishment. */
|
|
15
|
+
| "first_install";
|
|
16
|
+
/**
|
|
17
|
+
* Invariants: `at` is finite milliseconds and clamped to ≤ now by `clampConsentAnchor`. Second-based
|
|
18
|
+
* sources (UCAN `iat`/`nbf`) are converted ×1000 exactly once, at the authority; SIWE `issuedAt`
|
|
19
|
+
* is parsed as an ISO date. Renewals never re-anchor: only a fresh sign-in yields a new anchor.
|
|
20
|
+
*/
|
|
21
|
+
interface ReplicaConsentAnchor {
|
|
22
|
+
at: number;
|
|
23
|
+
source: ReplicaConsentSource;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Returns the eligible anchor with `at` clamped to ≤ now, or null when it is not finite.
|
|
27
|
+
* A full SIWE session with missing/invalid signed expiration or issuedAt remains unanchored;
|
|
28
|
+
* never fall through to a compact leaf or first-install timestamp. Compact-only sessions
|
|
29
|
+
* may try the same independently verified oldest owner proof's `nbf` after invalid `iat`.
|
|
30
|
+
* S4 implements this as `clampConsentAnchor` in `grantPolicy.ts`.
|
|
31
|
+
*/
|
|
32
|
+
type ClampConsentAnchor = (anchor: ReplicaConsentAnchor, now: number) => ReplicaConsentAnchor | null;
|
|
33
|
+
/**
|
|
34
|
+
* Policy the controller passes to storage in `KVReplicaSpec.grantPolicy`. Storage stores the
|
|
35
|
+
* resulting effective expiry with the installed grant and recomputes it at open.
|
|
36
|
+
*/
|
|
37
|
+
interface ReplicaGrantPolicy {
|
|
38
|
+
/** Validated: 0 < grantTtlMs ≤ MAX_GRANT_TTL_MS. */
|
|
39
|
+
grantTtlMs: number;
|
|
40
|
+
/**
|
|
41
|
+
* From `ReplicationAuthority.consentAnchor()`: a full SIWE session requires an
|
|
42
|
+
* independently verified signed owner `issuedAt`, finite signed expiration and
|
|
43
|
+
* exact-space KV get+sync witness. A compact-only session instead needs the oldest
|
|
44
|
+
* independently verified owner-authorizing proof's `iat`, then its `nbf` (never a
|
|
45
|
+
* fresh child leaf minted under an old owner grant). Invalid SIWE does not fall
|
|
46
|
+
* through to compact/first-install sources.
|
|
47
|
+
* Null means no verified source; storage uses its persisted first-install time only
|
|
48
|
+
* to bound grant expiry, never as freshness proof for a session stamp. That anchor
|
|
49
|
+
* survives partition reset, purge and reinstall, and is cleared only by `deny`.
|
|
50
|
+
*/
|
|
51
|
+
consentAnchor: ReplicaConsentAnchor | null;
|
|
52
|
+
}
|
|
53
|
+
interface EffectiveGrantExpiryInput {
|
|
54
|
+
/** The grant's signed `exp` in ms; null when it has none. */
|
|
55
|
+
signedExpiresAt: number | null;
|
|
56
|
+
installedAt: number;
|
|
57
|
+
grantTtlMs: number;
|
|
58
|
+
/** `min(consentDeadlineMs(policyAnchor), durableGateDeadline)` when browser gate is active. */
|
|
59
|
+
consentDeadline: number;
|
|
60
|
+
}
|
|
61
|
+
/** effective expiry = min(signed exp, installedAt + grantTtlMs, consentDeadline). */
|
|
62
|
+
type EffectiveGrantExpiry = (input: EffectiveGrantExpiryInput) => number;
|
|
63
|
+
/** anchor.at + CONSENT_WINDOW_MS. */
|
|
64
|
+
type ConsentDeadlineMs = (anchor: ReplicaConsentAnchor) => number;
|
|
65
|
+
/**
|
|
66
|
+
* Duration passed to `ReplicationAuthority.mint` as `expiryMs`:
|
|
67
|
+
* min(grantTtlMs, consentDeadline − now). The caller MUST NOT mint when the result is ≤ 0.
|
|
68
|
+
*/
|
|
69
|
+
type MintRemainingMs = (input: {
|
|
70
|
+
now: number;
|
|
71
|
+
grantTtlMs: number;
|
|
72
|
+
consentDeadline: number;
|
|
73
|
+
}) => number;
|
|
74
|
+
/**
|
|
75
|
+
* True when online-renewal should run: remaining = effectiveExpiresAt − now is STRICTLY below
|
|
76
|
+
* RENEW_BELOW_FRACTION × (effectiveExpiresAt − installedAt) (exactly 25% remaining does not
|
|
77
|
+
* renew), and now < consentDeadline. All inputs finite; otherwise false.
|
|
78
|
+
* Checked on a timer, before each sync, and at open.
|
|
79
|
+
*/
|
|
80
|
+
type NeedsSilentRenewal = (input: {
|
|
81
|
+
now: number;
|
|
82
|
+
installedAt: number;
|
|
83
|
+
effectiveExpiresAt: number;
|
|
84
|
+
consentDeadline: number;
|
|
85
|
+
}) => boolean;
|
|
86
|
+
|
|
87
|
+
export type { ClampConsentAnchor, ConsentDeadlineMs, EffectiveGrantExpiry, EffectiveGrantExpiryInput, MintRemainingMs, NeedsSilentRenewal, ReplicaConsentAnchor, ReplicaConsentSource, ReplicaGrantPolicy };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=grantPolicyTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|