@muhkoo/connect 0.10.10-alpha.0 → 0.10.12-alpha.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/browser/index.js +395 -11
- package/dist/browser/index.js.map +1 -1
- package/dist/connect.d.ts +308 -3
- package/dist/server/index.js +395 -11
- package/dist/server/index.js.map +1 -1
- package/package.json +1 -1
package/dist/connect.d.ts
CHANGED
|
@@ -1905,6 +1905,10 @@ interface VaultFactor {
|
|
|
1905
1905
|
createdAt?: number;
|
|
1906
1906
|
/** Display hint for gated factors ("m•••@gmail.com") — list responses only. */
|
|
1907
1907
|
masked?: string;
|
|
1908
|
+
/** Passkey's origin (RP id) — list responses only. A passkey only unlocks
|
|
1909
|
+
* from this host or a subdomain of it, so apps on several hosts enroll one
|
|
1910
|
+
* per origin. */
|
|
1911
|
+
rpId?: string;
|
|
1908
1912
|
}
|
|
1909
1913
|
interface AuthClientOptions {
|
|
1910
1914
|
/** Absolute URL of the accelerator worker (no trailing slash required). */
|
|
@@ -2001,7 +2005,11 @@ declare class AuthClient {
|
|
|
2001
2005
|
* Read a factor record for `username` (returns an indistinguishable decoy if
|
|
2002
2006
|
* absent). Gated types (email) require the recover `verifyToken`.
|
|
2003
2007
|
*/
|
|
2004
|
-
vaultRead(username: string, factorType: VaultFactor["type"], verifyToken?: string
|
|
2008
|
+
vaultRead(username: string, factorType: VaultFactor["type"], verifyToken?: string,
|
|
2009
|
+
/** Passkeys are per-origin: naming the caller's host returns THAT origin's
|
|
2010
|
+
* passkey instead of whichever was enrolled first (which WebAuthn would
|
|
2011
|
+
* refuse). Ignored for other factor types. */
|
|
2012
|
+
rpId?: string): Promise<{
|
|
2005
2013
|
factor: VaultFactor | null;
|
|
2006
2014
|
}>;
|
|
2007
2015
|
/**
|
|
@@ -2224,6 +2232,29 @@ declare function signMessage(message: string, privateKey: CryptoKey): Promise<st
|
|
|
2224
2232
|
* seed) while moving credential entry onto the Muhkoo origin. The envelope is
|
|
2225
2233
|
* versioned so a future per-app-key handoff (v2) can swap in without a protocol
|
|
2226
2234
|
* change.
|
|
2235
|
+
*
|
|
2236
|
+
* ## v2 — device pairing (TV / no-redirect handoff)
|
|
2237
|
+
*
|
|
2238
|
+
* v1's K_t rides in the redirect URL *fragment*, which works only because the
|
|
2239
|
+
* receiving app is a browser page that can read `location.hash`. A TV app has
|
|
2240
|
+
* no redirect to receive: it polls. So v2 keeps the *entire* v1 shape — the
|
|
2241
|
+
* server relays a sealed envelope it cannot read — and replaces only the key
|
|
2242
|
+
* agreement:
|
|
2243
|
+
*
|
|
2244
|
+
* - the TV generates an ephemeral P-256 ECDH keypair in memory and publishes
|
|
2245
|
+
* the public half ({@link generateDevicePairingKeypair});
|
|
2246
|
+
* - the hosted page (the component that already holds the unlocked seed and
|
|
2247
|
+
* already owns sealing) seals *to that public key* with a fresh ephemeral
|
|
2248
|
+
* keypair of its own ({@link sealSeedToDevice}) — ECDH → HKDF-SHA256 →
|
|
2249
|
+
* AES-256-GCM;
|
|
2250
|
+
* - the TV recovers the seed with its private key
|
|
2251
|
+
* ({@link unsealSeedFromDevice}).
|
|
2252
|
+
*
|
|
2253
|
+
* The server stores and relays the v2 envelope byte-for-byte, exactly as it
|
|
2254
|
+
* does for v1, and can read neither. The one thing ECDH cannot supply is proof
|
|
2255
|
+
* that the public key the hosted page sealed to is *the TV's* rather than an
|
|
2256
|
+
* attacker's — that is what {@link pairingVerificationCode} is for, and it is
|
|
2257
|
+
* the only MITM defence in the flow (see the entropy note on that function).
|
|
2227
2258
|
*/
|
|
2228
2259
|
interface SealedHandoff {
|
|
2229
2260
|
/** base64 JSON envelope — relayed by the server in the grant; server-opaque. */
|
|
@@ -2235,6 +2266,101 @@ interface SealedHandoff {
|
|
|
2235
2266
|
declare function sealSeed(seed: Uint8Array): Promise<SealedHandoff>;
|
|
2236
2267
|
/** Recover the master seed from the sealed envelope + the fragment key. */
|
|
2237
2268
|
declare function unsealSeed(sealedKeys: string, fragmentKey: string): Promise<Uint8Array>;
|
|
2269
|
+
/**
|
|
2270
|
+
* Alphabet for the pairing verification code: 30 symbols, every confusable pair
|
|
2271
|
+
* removed in BOTH directions — no `0`/`O`, no `1`/`I`/`L`, and no `U` (which is
|
|
2272
|
+
* read as `V` on the low-resolution, far-viewed type a TV renders). Because the
|
|
2273
|
+
* user compares this string across two screens by eye, unambiguity beats the
|
|
2274
|
+
* convenience of a power-of-two alphabet; the derivation below rejection-samples
|
|
2275
|
+
* to avoid the modulo bias that costs us.
|
|
2276
|
+
*/
|
|
2277
|
+
declare const PAIRING_CODE_ALPHABET = "ABCDEFGHJKMNPQRSTVWXYZ23456789";
|
|
2278
|
+
/** Length of the pairing verification code, in characters. 30^8 ≈ 39.3 bits. */
|
|
2279
|
+
declare const PAIRING_CODE_LENGTH = 8;
|
|
2280
|
+
/** An ephemeral ECDH keypair generated by the pairing device (the TV). */
|
|
2281
|
+
interface DevicePairingKeypair {
|
|
2282
|
+
/** base64 raw (SEC1 uncompressed, 65 bytes) public key — safe to publish. */
|
|
2283
|
+
publicKeyB64: string;
|
|
2284
|
+
/**
|
|
2285
|
+
* Non-extractable private half. In-memory only, one per pairing attempt:
|
|
2286
|
+
* it is never persisted and never leaves the device, so a captured pairing
|
|
2287
|
+
* transcript is undecryptable once the attempt ends.
|
|
2288
|
+
*/
|
|
2289
|
+
privateKey: CryptoKey;
|
|
2290
|
+
}
|
|
2291
|
+
/**
|
|
2292
|
+
* (Device side) Generate the ephemeral P-256 ECDH keypair for one pairing
|
|
2293
|
+
* attempt. Call this once per attempt and throw it away when the attempt ends —
|
|
2294
|
+
* reusing a keypair across attempts would let an old, observed ciphertext be
|
|
2295
|
+
* decrypted by whoever later obtains the key.
|
|
2296
|
+
*/
|
|
2297
|
+
declare function generateDevicePairingKeypair(): Promise<DevicePairingKeypair>;
|
|
2298
|
+
/**
|
|
2299
|
+
* (Hosted-page side) Seal the master seed *to a device's* pairing public key.
|
|
2300
|
+
*
|
|
2301
|
+
* A fresh ephemeral keypair is generated per call and its public half is
|
|
2302
|
+
* carried in the envelope (`epk`), so sealing the same seed to the same device
|
|
2303
|
+
* twice yields unrelated ciphertext — and the sealer retains nothing that could
|
|
2304
|
+
* later reopen the envelope.
|
|
2305
|
+
*
|
|
2306
|
+
* Returns the v2 `sealedKeys` string, which slots into exactly the same server
|
|
2307
|
+
* field as v1: relayed verbatim, never read.
|
|
2308
|
+
*/
|
|
2309
|
+
declare function sealSeedToDevice(seed: Uint8Array, devicePublicKeyB64: string): Promise<string>;
|
|
2310
|
+
/**
|
|
2311
|
+
* (Device side) Recover the master seed from a v2 envelope using the ephemeral
|
|
2312
|
+
* private key from {@link generateDevicePairingKeypair}.
|
|
2313
|
+
*
|
|
2314
|
+
* Throws on any tamper: a substituted `epk` yields a different shared secret
|
|
2315
|
+
* (or fails point validation outright), and any edit to `iv`/`ct` fails the
|
|
2316
|
+
* AES-GCM tag. There is no path that returns partially-authenticated bytes.
|
|
2317
|
+
*
|
|
2318
|
+
* `devicePublicKeyB64` is the caller's OWN public half (from
|
|
2319
|
+
* {@link generateDevicePairingKeypair}). It is required, not optional, because
|
|
2320
|
+
* it is mixed into the KDF — see {@link deriveDeviceSealKey} for why binding the
|
|
2321
|
+
* recipient matters. A device always holds both halves, so this costs nothing.
|
|
2322
|
+
*/
|
|
2323
|
+
declare function unsealSeedFromDevice(sealedKeys: string, privateKey: CryptoKey, devicePublicKeyB64: string): Promise<Uint8Array>;
|
|
2324
|
+
/**
|
|
2325
|
+
* Short code derived deterministically from the device's pairing public key,
|
|
2326
|
+
* displayed on BOTH the TV and the approving browser so the human can confirm
|
|
2327
|
+
* they match before approving.
|
|
2328
|
+
*
|
|
2329
|
+
* ## What this is worth (be honest about it)
|
|
2330
|
+
*
|
|
2331
|
+
* ~39.3 bits (30^8), rendered in an unambiguous 30-symbol alphabet and grouped
|
|
2332
|
+
* as `XXXX-XXXX` for comparison. Alongside the recipient-key binding in
|
|
2333
|
+
* {@link deriveDeviceSealKey}, this is what stops a substituted device key: the
|
|
2334
|
+
* KDF rejects a *negated* key, and this code is what a human uses to reject a
|
|
2335
|
+
* wholly *attacker-generated* one, which the crypto cannot detect on its own —
|
|
2336
|
+
* ECDH proves nothing about WHOSE public key it is.
|
|
2337
|
+
*
|
|
2338
|
+
* Two attacks, and what each actually costs:
|
|
2339
|
+
*
|
|
2340
|
+
* 1. **Online grind.** Generate keypairs until one's code equals the honest
|
|
2341
|
+
* TV's. ~2^39 trials. Naively that reads as "keygen + hash", but a real
|
|
2342
|
+
* attacker never generates keys: walking `P_{i+1} = P_i + G` while tracking
|
|
2343
|
+
* `d_i = d_0 + i` makes each trial one point-add plus one derivation. With
|
|
2344
|
+
* a plain hash that is well under a core-day — which is why this uses
|
|
2345
|
+
* PBKDF2-SHA256 at {@link PAIRING_CODE_ITERATIONS} iterations instead. The
|
|
2346
|
+
* work factor applies per trial, pushing the same grind to the order of
|
|
2347
|
+
* 10^5 core-days. The target is also only learned when pairing starts, so
|
|
2348
|
+
* the grind is online against the pairing TTL (keep it minutes).
|
|
2349
|
+
* 2. **Precomputed table.** The reason this is not a plain hash. A table over
|
|
2350
|
+
* candidate keys is computed once and reused forever; with SHA-256 that is
|
|
2351
|
+
* cheap enough to be the preferred attack. The iteration count multiplies
|
|
2352
|
+
* the table's build cost by the same 2 * 10^5.
|
|
2353
|
+
*
|
|
2354
|
+
* Neither is a proof of security, and an adversary with ASIC-scale hardware
|
|
2355
|
+
* changes these numbers. If the margin is ever judged insufficient, raise
|
|
2356
|
+
* {@link PAIRING_CODE_LENGTH} — 10 characters buys ~49 bits for two more
|
|
2357
|
+
* characters of human comparison, and is display-only: it does not touch the
|
|
2358
|
+
* envelope or the wire format.
|
|
2359
|
+
*
|
|
2360
|
+
* The cost is paid once per pairing, on two idle devices, so ~200k iterations
|
|
2361
|
+
* is imperceptible here in a way it would not be on a hot path.
|
|
2362
|
+
*/
|
|
2363
|
+
declare function pairingVerificationCode(devicePublicKeyB64: string): Promise<string>;
|
|
2238
2364
|
interface Pkce {
|
|
2239
2365
|
codeVerifier: string;
|
|
2240
2366
|
codeChallenge: string;
|
|
@@ -2669,7 +2795,18 @@ declare class ZkAuth {
|
|
|
2669
2795
|
label?: string;
|
|
2670
2796
|
createdAt?: number;
|
|
2671
2797
|
masked?: string;
|
|
2798
|
+
rpId?: string;
|
|
2672
2799
|
}>>;
|
|
2800
|
+
/**
|
|
2801
|
+
* Is a passkey enrolled that can unlock from THIS origin?
|
|
2802
|
+
*
|
|
2803
|
+
* Passkeys are origin-bound, so an app served on both a custom domain and the
|
|
2804
|
+
* platform host needs one per host. Use this to decide whether to offer
|
|
2805
|
+
* "Unlock with passkey" or go straight to sign-in — prompting with another
|
|
2806
|
+
* origin's passkey fails with a raw WebAuthn error. Requires a session
|
|
2807
|
+
* (metadata read); returns false when signed out or unsupported.
|
|
2808
|
+
*/
|
|
2809
|
+
hasPasskeyForThisOrigin(): Promise<boolean>;
|
|
2673
2810
|
/** Remove a login method by id (can't remove your only one). Session-authed. */
|
|
2674
2811
|
removeFactor(id: string): Promise<void>;
|
|
2675
2812
|
/** Sign out: clears the session, identity, and persisted token. */
|
|
@@ -2767,6 +2904,14 @@ interface HttpClientOptions {
|
|
|
2767
2904
|
* shared-space (messaging) websockets.
|
|
2768
2905
|
*/
|
|
2769
2906
|
apiKey?: string;
|
|
2907
|
+
/**
|
|
2908
|
+
* A scoped, expiring **access token** (`mk_<env>_at_…`) — the non-ZK
|
|
2909
|
+
* machine-to-machine credential. It resolves through the SAME accelerator
|
|
2910
|
+
* path as an app key and rides the same `X-Muhkoo-Key` header; when present
|
|
2911
|
+
* it takes precedence over {@link apiKey}. Use it for server-side / CI
|
|
2912
|
+
* callers that shouldn't carry the app's publishable key.
|
|
2913
|
+
*/
|
|
2914
|
+
accessToken?: string;
|
|
2770
2915
|
/** Returns the current user session token, or `null` when logged out. */
|
|
2771
2916
|
getSessionToken?: () => string | null;
|
|
2772
2917
|
/** Custom fetch — defaults to `globalThis.fetch`. */
|
|
@@ -2795,6 +2940,8 @@ declare class HttpClient {
|
|
|
2795
2940
|
/** Origin of {@link baseUrl} — credentials are only attached same-origin. */
|
|
2796
2941
|
private readonly baseOrigin;
|
|
2797
2942
|
private readonly apiKey;
|
|
2943
|
+
/** Scoped machine access token — takes precedence over {@link apiKey} on `X-Muhkoo-Key`. */
|
|
2944
|
+
private readonly accessToken;
|
|
2798
2945
|
private readonly getSessionToken;
|
|
2799
2946
|
private readonly onUnauthorized;
|
|
2800
2947
|
private readonly fetchFn;
|
|
@@ -4804,6 +4951,78 @@ declare class FunctionsNamespace {
|
|
|
4804
4951
|
private path;
|
|
4805
4952
|
}
|
|
4806
4953
|
|
|
4954
|
+
/**
|
|
4955
|
+
* `client.accessTokens` — manage an app's **access tokens**: scoped, expiring,
|
|
4956
|
+
* non-ZK machine-to-machine credentials (`mk_<env>_at_…`).
|
|
4957
|
+
*
|
|
4958
|
+
* const { plaintext } = await client.accessTokens.create(appId, {
|
|
4959
|
+
* scopes: ["db:read", "db:write"], env: "live", expiresInDays: 30,
|
|
4960
|
+
* label: "ci-runner",
|
|
4961
|
+
* });
|
|
4962
|
+
* // hand `plaintext` to the machine caller as its ClientOptions.accessToken
|
|
4963
|
+
*
|
|
4964
|
+
* These are MANAGEMENT calls — creating/listing/revoking tokens is authorized by
|
|
4965
|
+
* the developer session (same as the `agents`/`functions` namespaces). The token
|
|
4966
|
+
* itself resolves through the SAME accelerator path as an app key (the
|
|
4967
|
+
* `X-Muhkoo-Key` header), but is scoped to a fixed vocabulary of permissions and
|
|
4968
|
+
* expires. The plaintext is returned ONCE, on create — store it then; it can't
|
|
4969
|
+
* be read back.
|
|
4970
|
+
*/
|
|
4971
|
+
|
|
4972
|
+
/** The fixed vocabulary of permissions an access token can be granted. */
|
|
4973
|
+
type Scope = "db:read" | "db:write" | "kv:read" | "kv:write" | "storage:read" | "storage:write" | "messages:read" | "messages:write" | "functions:invoke" | "ai:infer";
|
|
4974
|
+
/** All valid {@link Scope}s, in canonical order. */
|
|
4975
|
+
declare const ACCESS_TOKEN_SCOPES: Scope[];
|
|
4976
|
+
/** A token as returned by {@link AccessTokensNamespace.list} (never the plaintext). */
|
|
4977
|
+
interface AccessTokenInfo {
|
|
4978
|
+
keyId: string;
|
|
4979
|
+
env: "live" | "test";
|
|
4980
|
+
scopes: string[];
|
|
4981
|
+
/** Epoch ms, or absent if the token never expires. */
|
|
4982
|
+
expiresAt?: number;
|
|
4983
|
+
label?: string;
|
|
4984
|
+
createdAt: number;
|
|
4985
|
+
revoked: boolean;
|
|
4986
|
+
/** True once past {@link expiresAt}. */
|
|
4987
|
+
expired: boolean;
|
|
4988
|
+
}
|
|
4989
|
+
/** The editor-settable fields when minting an access token. */
|
|
4990
|
+
interface CreateAccessTokenInput {
|
|
4991
|
+
scopes: string[];
|
|
4992
|
+
/** Defaults to `live` on the accelerator. */
|
|
4993
|
+
env?: "live" | "test";
|
|
4994
|
+
/** Omit for a non-expiring token. */
|
|
4995
|
+
expiresInDays?: number;
|
|
4996
|
+
label?: string;
|
|
4997
|
+
}
|
|
4998
|
+
/** Create response — includes the one-time {@link plaintext} secret. */
|
|
4999
|
+
interface CreatedAccessToken {
|
|
5000
|
+
keyId: string;
|
|
5001
|
+
env: "live" | "test";
|
|
5002
|
+
/** The `mk_<env>_at_…` secret. Returned ONCE — store it now. */
|
|
5003
|
+
plaintext: string;
|
|
5004
|
+
scopes: string[];
|
|
5005
|
+
expiresAt: number;
|
|
5006
|
+
label?: string;
|
|
5007
|
+
createdAt: number;
|
|
5008
|
+
}
|
|
5009
|
+
interface AccessTokensNamespaceDeps {
|
|
5010
|
+
http: HttpClient;
|
|
5011
|
+
}
|
|
5012
|
+
declare class AccessTokensNamespace {
|
|
5013
|
+
private readonly deps;
|
|
5014
|
+
constructor(deps: AccessTokensNamespaceDeps);
|
|
5015
|
+
/** List the app's access tokens (metadata only — never the plaintext). */
|
|
5016
|
+
list(appId: string): Promise<AccessTokenInfo[]>;
|
|
5017
|
+
/** Mint an access token (owner/editor only). The plaintext is returned once. */
|
|
5018
|
+
create(appId: string, input: CreateAccessTokenInput): Promise<CreatedAccessToken>;
|
|
5019
|
+
/** Revoke an access token by its `keyId`. */
|
|
5020
|
+
revoke(appId: string, keyId: string): Promise<{
|
|
5021
|
+
revoked: boolean;
|
|
5022
|
+
}>;
|
|
5023
|
+
private path;
|
|
5024
|
+
}
|
|
5025
|
+
|
|
4807
5026
|
/** The hosted Muhkoo Accelerator — the default {@link ClientOptions.baseUrl}. */
|
|
4808
5027
|
declare const DEFAULT_BASE_URL = "https://api.muhkoo.dev";
|
|
4809
5028
|
/** The hosted auth SPA — the default {@link ClientOptions.authBaseUrl}. */
|
|
@@ -4819,6 +5038,15 @@ interface ClientOptions {
|
|
|
4819
5038
|
* New integrations should always pass one.
|
|
4820
5039
|
*/
|
|
4821
5040
|
apiKey?: string;
|
|
5041
|
+
/**
|
|
5042
|
+
* A scoped, expiring **access token** (`mk_<env>_at_…`) — the non-ZK
|
|
5043
|
+
* machine-to-machine credential. It resolves through the SAME accelerator
|
|
5044
|
+
* path as {@link apiKey} (both ride the `X-Muhkoo-Key` header) and, when
|
|
5045
|
+
* set, takes precedence over it. Use it for server-side / CI callers that
|
|
5046
|
+
* shouldn't carry the app's publishable key. Mint one with
|
|
5047
|
+
* `client.accessTokens.create(...)`.
|
|
5048
|
+
*/
|
|
5049
|
+
accessToken?: string;
|
|
4822
5050
|
/**
|
|
4823
5051
|
* Absolute URL of the accelerator (trailing slash optional). Defaults to
|
|
4824
5052
|
* the hosted Muhkoo Accelerator ({@link DEFAULT_BASE_URL}); override to
|
|
@@ -4900,6 +5128,8 @@ declare class Client {
|
|
|
4900
5128
|
readonly agents: AgentsNamespace;
|
|
4901
5129
|
/** Serverless functions — `client.functions.deploy(appId, …)`, etc. */
|
|
4902
5130
|
readonly functions: FunctionsNamespace;
|
|
5131
|
+
/** Access tokens — `client.accessTokens.create(appId, …)`, etc. */
|
|
5132
|
+
readonly accessTokens: AccessTokensNamespace;
|
|
4903
5133
|
/** Offline cache + sync — `client.offline.status`, `client.offline.snapshot`, etc. */
|
|
4904
5134
|
readonly offline: OfflineManager;
|
|
4905
5135
|
private readonly session;
|
|
@@ -4934,6 +5164,75 @@ declare class Client {
|
|
|
4934
5164
|
recoverSession(): Promise<boolean>;
|
|
4935
5165
|
}
|
|
4936
5166
|
|
|
5167
|
+
/**
|
|
5168
|
+
* Passkey factor (M1.1) — WebAuthn with the **PRF extension**.
|
|
5169
|
+
*
|
|
5170
|
+
* A passkey becomes a device-bound, platform-synced source of a stable secret:
|
|
5171
|
+
* for a fixed salt, the authenticator's PRF returns the same 32 bytes, which we
|
|
5172
|
+
* HKDF into an AES key that wraps the master seed. The server never sees the
|
|
5173
|
+
* passkey — it's purely a local key source; the ZK proof remains the server auth.
|
|
5174
|
+
*
|
|
5175
|
+
* BROWSER ONLY (`navigator.credentials`). The PRF extension fields aren't in the
|
|
5176
|
+
* standard DOM types yet, so they're reached through narrow casts.
|
|
5177
|
+
*/
|
|
5178
|
+
/** Whether this environment can do WebAuthn at all. (PRF support is checked at enroll.) */
|
|
5179
|
+
declare function passkeySupported(): boolean;
|
|
5180
|
+
/**
|
|
5181
|
+
* Whether this browser's authenticator can do the **PRF extension** our passkey
|
|
5182
|
+
* factor needs. A browser can save passkeys (e.g. for password autofill) yet not
|
|
5183
|
+
* expose PRF — PRF is what derives the stable secret we wrap the seed under, so a
|
|
5184
|
+
* passkey without it is useless to us.
|
|
5185
|
+
*
|
|
5186
|
+
* Uses `PublicKeyCredential.getClientCapabilities()` (the `extension:prf` cap)
|
|
5187
|
+
* where available. Returns:
|
|
5188
|
+
* - `true` — PRF is supported,
|
|
5189
|
+
* - `false` — definitively NOT supported (hide the option),
|
|
5190
|
+
* - `null` — couldn't determine (older browser without the capabilities API);
|
|
5191
|
+
* the caller may optimistically allow and let enroll surface a real
|
|
5192
|
+
* error if it turns out PRF isn't there.
|
|
5193
|
+
*/
|
|
5194
|
+
declare function passkeyPrfCapable(): Promise<boolean | null>;
|
|
5195
|
+
/** Best-effort registrable RP id — the host. Apps spanning subdomains should pass
|
|
5196
|
+
* the parent domain (e.g. "muhkoo.dev") explicitly. */
|
|
5197
|
+
declare function defaultRpId(): string;
|
|
5198
|
+
/**
|
|
5199
|
+
* Can a passkey enrolled under `rpId` be used from the CURRENT origin?
|
|
5200
|
+
*
|
|
5201
|
+
* WebAuthn only accepts an RP id that is the origin's own host or a registrable
|
|
5202
|
+
* *parent* of it — so a passkey enrolled on `app.example.com` is unusable on
|
|
5203
|
+
* `app.example.net`, and one enrolled on a full host is unusable from a sibling
|
|
5204
|
+
* host. An app served on BOTH a custom domain and the platform host therefore
|
|
5205
|
+
* needs one passkey per origin.
|
|
5206
|
+
*
|
|
5207
|
+
* Call this BEFORE `navigator.credentials.get()`: passing a foreign rpId throws
|
|
5208
|
+
* a raw "The requested RPID did not match the origin or related origins", which
|
|
5209
|
+
* is a dead end for the user. Checking first lets the caller fall back to normal
|
|
5210
|
+
* sign-in (and offer to enroll a passkey for this origin) instead.
|
|
5211
|
+
*/
|
|
5212
|
+
declare function rpIdUsableForOrigin(rpId: string | undefined | null, host?: string): boolean;
|
|
5213
|
+
/** Thrown when the account's passkey belongs to a different origin. Callers
|
|
5214
|
+
* should treat this as "no passkey here" and fall back to another factor. */
|
|
5215
|
+
declare class PasskeyOriginError extends Error {
|
|
5216
|
+
readonly code = "passkey_wrong_origin";
|
|
5217
|
+
constructor(message?: string);
|
|
5218
|
+
}
|
|
5219
|
+
interface PasskeyEnrollment {
|
|
5220
|
+
credentialId: Uint8Array;
|
|
5221
|
+
prfSalt: Uint8Array;
|
|
5222
|
+
prfOutput: Uint8Array;
|
|
5223
|
+
}
|
|
5224
|
+
/**
|
|
5225
|
+
* Create a passkey with PRF and return its credential id, a fresh PRF salt, and
|
|
5226
|
+
* the PRF output for that salt. Throws if the authenticator can't do PRF.
|
|
5227
|
+
*/
|
|
5228
|
+
declare function createPasskeyWithPrf(opts: {
|
|
5229
|
+
rpId: string;
|
|
5230
|
+
rpName: string;
|
|
5231
|
+
username: string;
|
|
5232
|
+
}): Promise<PasskeyEnrollment>;
|
|
5233
|
+
/** Evaluate a passkey's PRF for `salt` → 32 bytes. Used at recover/login. */
|
|
5234
|
+
declare function evaluatePasskeyPrf(rpId: string, credentialId: Uint8Array, salt: Uint8Array): Promise<Uint8Array>;
|
|
5235
|
+
|
|
4937
5236
|
/**
|
|
4938
5237
|
* Muhkoo app decorators — declare your app's agent-facing surface in code, then
|
|
4939
5238
|
* "eject" a system prompt you hand to a Programmable Agent.
|
|
@@ -4996,6 +5295,11 @@ interface MuhkooDBMeta {
|
|
|
4996
5295
|
table?: string;
|
|
4997
5296
|
/** Read-only by default. */
|
|
4998
5297
|
access?: MuhkooDBAccess;
|
|
5298
|
+
/**
|
|
5299
|
+
* Backend-only table — omitted from {@link ejectAgentPrompt}. Use for tables
|
|
5300
|
+
* an agent should never be told about (server-managed / internal state).
|
|
5301
|
+
*/
|
|
5302
|
+
backend?: boolean;
|
|
4999
5303
|
description: string;
|
|
5000
5304
|
}
|
|
5001
5305
|
/** A serverless function the agent can invoke via `call_function`. */
|
|
@@ -5012,6 +5316,7 @@ interface TableEntry {
|
|
|
5012
5316
|
table: string;
|
|
5013
5317
|
access: MuhkooDBAccess;
|
|
5014
5318
|
description: string;
|
|
5319
|
+
backend: boolean;
|
|
5015
5320
|
}
|
|
5016
5321
|
interface FunctionEntry {
|
|
5017
5322
|
name: string;
|
|
@@ -5832,5 +6137,5 @@ declare class KeyringClient implements KeyringTransport {
|
|
|
5832
6137
|
fetchMetadata(): Promise<SpaceMetadata | null>;
|
|
5833
6138
|
}
|
|
5834
6139
|
|
|
5835
|
-
export { AES_GCM_IV_BYTES, AES_GCM_KEY_BYTES, AES_GCM_TAG_BYTES, AgentsNamespace, AuthClient, AuthNamespace, AuthPublicInput, Authenticator, BlockEngine, BroadcastChannel, BroadcastChannelEvents, ChannelExistsError, ChannelNotFoundError, ChunkCipher, Client, ConnectivityManager, DEFAULT_AUTH_BASE_URL, DEFAULT_BASE_URL, DEFAULT_FN_HOST_SUFFIX, DbCache, DoubleRatchet, DoubleRatchetCipher, DoubleRatchetManager, EncryptedSession, EventCore, EventCoreEvents, Field, Field as FieldElement, FileStorage, FunctionsNamespace, HLC, HashKnowledge, HttpClient, HttpError, IndexedDbStore, KEEPER_MEMBER_ID, KeyStore, KeyringClient, KvCache, KvNamespace, LocalEngineHost, LocalStorageSessionStore, MemorySessionStore, Message, Message as MessageDefault, MessageNamespace, MuhkooAgent, MuhkooDB, MuhkooFunction, MuhkooSpace, NoopStore, OfflineLockedError, OfflineManager, OutboundQueue, P2P_SUBJECT, PBKDF2_DEFAULT_ITERATIONS, PREIMAGE_POK_VERIFICATION_KEY, Packet, PeerExchange, PeerNetwork, PersonalSpaceClient, Poseidon, PreimagePoK, ReedSolomonCodec, Space as Room, SerializeMessage, SessionState, ShardCache, ShardClient, SharedSpaceClient, SnapshotNamespace, Space, SpaceCache, SpaceKeyring, SpaceNamespace, SpacePacketCipher, SpaceSignaler, StorageNamespace, SyncEngine, VaultUnavailableError, WSTransport, WebRtcTransport, WorkerEngineHost, ZERO_HLC, ZkAuth, buildCommitment, compareHlc, compilePrograms, decodeFromHex, decorators, decryptAesGcm, defaultCircuitUrls, defaultSessionStore, deleteBeatsWrite, deleteRegister, deriveAesKeyFromPassphrase, deriveBitsHkdf, deriveIdentity, deriveIdentityFromSeed, deriveMasterSeedFromPassword, ejectAgentPrompt, ejectAgentTools, emptyMap, emptyRegister, encodeToHex, encryptAesGcm, exportPublicKeyBase64, exportPublicKeyHex, generateAuthProof, generatePkce, getMuhkooAppDescriptor, getSubtle, initBn128Wasm, initRsWasm, initializeCircuits, isNewer, isOfflineCapable, isP2pCapable, isProvisional, manifestToStat, materializeRow, mergeMap, mergeMessage, mergeRegister, messageKey, pack, padHandle, poseidonHash, protocol, provisionalHandle, quickVerify, randomBytes, randomState, sealSeed, shardHash, signMessage, stableStringify, toField, tombstoneRow, unpack, unsealSeed, unwrapWithPassphrase, verify, verifyGroth16, verifyHashKnowledge, verifyPreimagePoK, wrapWithPassphrase, writeBeatsTombstone, writeColumns, writeRegister };
|
|
5836
|
-
export type { ACL, ACLEntry, AgentConfig, AgentCreateInput, AgentDbToolMode, AgentProvisioned, AgentScopeOpts, AgentSkill, AgentToolsConfig, AgentTrigger, AgentTriggerType, AgentUpdateInput, AgentsNamespaceDeps, AttachedPeerNetwork, AuthClientOptions, AuthKeyPair, AuthSuccess, AuthToken, AuthType, AuthUser, BlockStore, Bn128WasmInstance, BroadcastChannelEvent, BroadcastChannelOptions, CachedSpaceMessage, ChannelLike, ChunkKeyMaterial, ChunkManifest, CipherFrame, CipherMessage, CipherMessageHeader, CircuitBufferConfig, CircuitUrls, ClientOptions, ConnectivityOptions, ConnectivityState, DbQueryPage, DehydratedKeypair, DehydratedKeys, DoubleRatchetCipherDeps, ECDHCurve, EncodeResult, EngineHandle, EngineHost, EphemeralEvent, EpochKeyProvider, FileManifest, FileNamespaceDeps, FileStat, FileStorageOptions, FunctionCaps, FunctionConfig, FunctionDeployInput, FunctionInvokeOptions, FunctionScopeOpts, FunctionTrigger, FunctionTriggerType, FunctionTriggers, FunctionUpdateInput, FunctionsNamespaceDeps, Groth16Proof, Hasher, HlcParts, HlcState, HttpClientOptions, IncomingFrame, KeyExchangeFrame, KeyPair, Keypair, KeyringClientDeps, KeyringTransport, KvEntry, KvNamespaceDeps, LoginOptions, LwwMap, LwwRegister, MessageBody, MessageDeletedEvent, MessageEntry, MessageEvent, MessageHeaders, MessageNamespaceDeps, MessageOp, MessageOptions, MessageSubscription, MuhkooAgentMeta, MuhkooAgentToolsConfig, MuhkooAppDescriptor, MuhkooDBAccess, MuhkooDBMeta, MuhkooFunctionMeta, MuhkooMessageEvent, MuhkooSpaceMeta, OAuthProvider, OfflineEntry, OfflineManagerDeps, OfflineStore, OutSink, PacketCipher, PacketHeaders, PacketOptions, Participant, PeerBlockSource, PeerExchangeOptions, PeerId, PeerNetworkOptions, PeerTransport, Permission, PermissionCheckRequest, PermissionCheckResult, PersonalSpaceClientOptions, Pkce, PublicKeyJWK, QueueEntry, RatchetState, ReceiveResult, RegisterParams, Replayer, Role, SpaceDeps as RoomDeps, SpaceFileMetadata as RoomFileMetadata, SealedHandoff, SealedHeaders, Session, SessionOptions, SessionStore, SetOptions, ShardByteCache, ShardClientOptions, SharedSpaceClientOptions, SignalEnvelope, SignalKind, SignalingSpace, SnapshotNamespaceDeps, SnarkProof, SpaceChannelLike, SpaceCursor, SpaceDeps, SpaceFileMetadata, SpaceKeyCache, SpaceKeyringDeps, SpaceMessageEvent, SpaceNamespaceDeps, SpaceOfflineAdapter, StorageChangeEvent, StoreName, StoredSession, Subscription, UserIdentity, VaultFactor, VerificationKey, WSMessage, WSMessageType, WSTransportOptions, WebRtcTransportOptions, WrappedPayload, WriteFileInput, WriteFileOptions, WriteToShardsInput, ZkAuthDeps, ZkAuthenticateRequest, ZkChallengeResponse, ZkCompiled, ZkIdentity, ZkRegisterRequest, ZkRegisterResponse };
|
|
6140
|
+
export { ACCESS_TOKEN_SCOPES, AES_GCM_IV_BYTES, AES_GCM_KEY_BYTES, AES_GCM_TAG_BYTES, AccessTokensNamespace, AgentsNamespace, AuthClient, AuthNamespace, AuthPublicInput, Authenticator, BlockEngine, BroadcastChannel, BroadcastChannelEvents, ChannelExistsError, ChannelNotFoundError, ChunkCipher, Client, ConnectivityManager, DEFAULT_AUTH_BASE_URL, DEFAULT_BASE_URL, DEFAULT_FN_HOST_SUFFIX, DbCache, DoubleRatchet, DoubleRatchetCipher, DoubleRatchetManager, EncryptedSession, EventCore, EventCoreEvents, Field, Field as FieldElement, FileStorage, FunctionsNamespace, HLC, HashKnowledge, HttpClient, HttpError, IndexedDbStore, KEEPER_MEMBER_ID, KeyStore, KeyringClient, KvCache, KvNamespace, LocalEngineHost, LocalStorageSessionStore, MemorySessionStore, Message, Message as MessageDefault, MessageNamespace, MuhkooAgent, MuhkooDB, MuhkooFunction, MuhkooSpace, NoopStore, OfflineLockedError, OfflineManager, OutboundQueue, P2P_SUBJECT, PAIRING_CODE_ALPHABET, PAIRING_CODE_LENGTH, PBKDF2_DEFAULT_ITERATIONS, PREIMAGE_POK_VERIFICATION_KEY, Packet, PasskeyOriginError, PeerExchange, PeerNetwork, PersonalSpaceClient, Poseidon, PreimagePoK, ReedSolomonCodec, Space as Room, SerializeMessage, SessionState, ShardCache, ShardClient, SharedSpaceClient, SnapshotNamespace, Space, SpaceCache, SpaceKeyring, SpaceNamespace, SpacePacketCipher, SpaceSignaler, StorageNamespace, SyncEngine, VaultUnavailableError, WSTransport, WebRtcTransport, WorkerEngineHost, ZERO_HLC, ZkAuth, buildCommitment, compareHlc, compilePrograms, createPasskeyWithPrf, decodeFromHex, decorators, decryptAesGcm, defaultCircuitUrls, defaultRpId, defaultSessionStore, deleteBeatsWrite, deleteRegister, deriveAesKeyFromPassphrase, deriveBitsHkdf, deriveIdentity, deriveIdentityFromSeed, deriveMasterSeedFromPassword, ejectAgentPrompt, ejectAgentTools, emptyMap, emptyRegister, encodeToHex, encryptAesGcm, evaluatePasskeyPrf, exportPublicKeyBase64, exportPublicKeyHex, generateAuthProof, generateDevicePairingKeypair, generatePkce, getMuhkooAppDescriptor, getSubtle, initBn128Wasm, initRsWasm, initializeCircuits, isNewer, isOfflineCapable, isP2pCapable, isProvisional, manifestToStat, materializeRow, mergeMap, mergeMessage, mergeRegister, messageKey, pack, padHandle, pairingVerificationCode, passkeyPrfCapable, passkeySupported, poseidonHash, protocol, provisionalHandle, quickVerify, randomBytes, randomState, rpIdUsableForOrigin, sealSeed, sealSeedToDevice, shardHash, signMessage, stableStringify, toField, tombstoneRow, unpack, unsealSeed, unsealSeedFromDevice, unwrapWithPassphrase, verify, verifyGroth16, verifyHashKnowledge, verifyPreimagePoK, wrapWithPassphrase, writeBeatsTombstone, writeColumns, writeRegister };
|
|
6141
|
+
export type { ACL, ACLEntry, AccessTokenInfo, AccessTokensNamespaceDeps, AgentConfig, AgentCreateInput, AgentDbToolMode, AgentProvisioned, AgentScopeOpts, AgentSkill, AgentToolsConfig, AgentTrigger, AgentTriggerType, AgentUpdateInput, AgentsNamespaceDeps, AttachedPeerNetwork, AuthClientOptions, AuthKeyPair, AuthSuccess, AuthToken, AuthType, AuthUser, BlockStore, Bn128WasmInstance, BroadcastChannelEvent, BroadcastChannelOptions, CachedSpaceMessage, ChannelLike, ChunkKeyMaterial, ChunkManifest, CipherFrame, CipherMessage, CipherMessageHeader, CircuitBufferConfig, CircuitUrls, ClientOptions, ConnectivityOptions, ConnectivityState, CreateAccessTokenInput, CreatedAccessToken, DbQueryPage, DehydratedKeypair, DehydratedKeys, DevicePairingKeypair, DoubleRatchetCipherDeps, ECDHCurve, EncodeResult, EngineHandle, EngineHost, EphemeralEvent, EpochKeyProvider, FileManifest, FileNamespaceDeps, FileStat, FileStorageOptions, FunctionCaps, FunctionConfig, FunctionDeployInput, FunctionInvokeOptions, FunctionScopeOpts, FunctionTrigger, FunctionTriggerType, FunctionTriggers, FunctionUpdateInput, FunctionsNamespaceDeps, Groth16Proof, Hasher, HlcParts, HlcState, HttpClientOptions, IncomingFrame, KeyExchangeFrame, KeyPair, Keypair, KeyringClientDeps, KeyringTransport, KvEntry, KvNamespaceDeps, LoginOptions, LwwMap, LwwRegister, MessageBody, MessageDeletedEvent, MessageEntry, MessageEvent, MessageHeaders, MessageNamespaceDeps, MessageOp, MessageOptions, MessageSubscription, MuhkooAgentMeta, MuhkooAgentToolsConfig, MuhkooAppDescriptor, MuhkooDBAccess, MuhkooDBMeta, MuhkooFunctionMeta, MuhkooMessageEvent, MuhkooSpaceMeta, OAuthProvider, OfflineEntry, OfflineManagerDeps, OfflineStore, OutSink, PacketCipher, PacketHeaders, PacketOptions, Participant, PasskeyEnrollment, PeerBlockSource, PeerExchangeOptions, PeerId, PeerNetworkOptions, PeerTransport, Permission, PermissionCheckRequest, PermissionCheckResult, PersonalSpaceClientOptions, Pkce, PublicKeyJWK, QueueEntry, RatchetState, ReceiveResult, RegisterParams, Replayer, Role, SpaceDeps as RoomDeps, SpaceFileMetadata as RoomFileMetadata, Scope, SealedHandoff, SealedHeaders, Session, SessionOptions, SessionStore, SetOptions, ShardByteCache, ShardClientOptions, SharedSpaceClientOptions, SignalEnvelope, SignalKind, SignalingSpace, SnapshotNamespaceDeps, SnarkProof, SpaceChannelLike, SpaceCursor, SpaceDeps, SpaceFileMetadata, SpaceKeyCache, SpaceKeyringDeps, SpaceMessageEvent, SpaceNamespaceDeps, SpaceOfflineAdapter, StorageChangeEvent, StoreName, StoredSession, Subscription, UserIdentity, VaultFactor, VerificationKey, WSMessage, WSMessageType, WSTransportOptions, WebRtcTransportOptions, WrappedPayload, WriteFileInput, WriteFileOptions, WriteToShardsInput, ZkAuthDeps, ZkAuthenticateRequest, ZkChallengeResponse, ZkCompiled, ZkIdentity, ZkRegisterRequest, ZkRegisterResponse };
|