@layervai/qurl 0.6.0 → 0.7.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/README.md +121 -15
- package/dist/cjs/client.d.ts +44 -31
- package/dist/cjs/client.js +412 -154
- package/dist/cjs/crid.d.ts +2 -0
- package/dist/cjs/crid.js +53 -0
- package/dist/cjs/errors.d.ts +10 -2
- package/dist/cjs/errors.js +11 -3
- package/dist/cjs/index.d.ts +5 -3
- package/dist/cjs/index.js +9 -1
- package/dist/cjs/share.d.ts +56 -0
- package/dist/cjs/share.js +113 -0
- package/dist/cjs/types.d.ts +76 -13
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/client.d.ts +44 -31
- package/dist/esm/client.d.ts.map +1 -1
- package/dist/esm/client.js +411 -154
- package/dist/esm/client.js.map +1 -1
- package/dist/esm/crid.d.ts +3 -0
- package/dist/esm/crid.d.ts.map +1 -0
- package/dist/esm/crid.js +50 -0
- package/dist/esm/crid.js.map +1 -0
- package/dist/esm/errors.d.ts +10 -2
- package/dist/esm/errors.d.ts.map +1 -1
- package/dist/esm/errors.js +10 -2
- package/dist/esm/errors.js.map +1 -1
- package/dist/esm/index.d.ts +5 -3
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +3 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/share.d.ts +57 -0
- package/dist/esm/share.d.ts.map +1 -0
- package/dist/esm/share.js +109 -0
- package/dist/esm/share.js.map +1 -0
- package/dist/esm/types.d.ts +76 -13
- package/dist/esm/types.d.ts.map +1 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -88,12 +88,15 @@ checks the non-empty 2048-byte boundary; the API remains authoritative for the
|
|
|
88
88
|
path grammar and the tunnel-only resource gate. `createPortalForUrl` rejects
|
|
89
89
|
this option because it creates a URL resource.
|
|
90
90
|
|
|
91
|
-
`resource.
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
91
|
+
`resource.crid` is the required management identifier. Connector lookup, delete,
|
|
92
|
+
and portal minting use it with no public-key or private-ID fallback. The SDK
|
|
93
|
+
checks that the returned public key matches the CRID.
|
|
94
|
+
|
|
95
|
+
`resource.resourcePublicKey`, `resource.connectorRoutingId`, and
|
|
96
|
+
`resource.knockResourceId` are three distinct server-issued values for verification, reverse routing, and NHP admission. Consume each verbatim; never
|
|
97
|
+
derive or substitute one for another. Use `getConnectorResource(crid)`
|
|
95
98
|
or `getConnectorResourceBySlug(slug)` for read-only lookup and
|
|
96
|
-
`deleteConnectorResource(
|
|
99
|
+
`deleteConnectorResource(crid)` to revoke it. This replaces the old
|
|
97
100
|
alias-based `connectorResource(connectorId)` method.
|
|
98
101
|
`ConnectorResource` instances cannot be constructed directly; the client
|
|
99
102
|
returns them only after validating the complete response contract.
|
|
@@ -101,7 +104,7 @@ returns them only after validating the complete response contract.
|
|
|
101
104
|
`ensureConnectorResource` and `deleteConnectorResource` throw
|
|
102
105
|
`ConnectorResourceOutcomeUnknownError` when a dispatched mutation may have
|
|
103
106
|
committed but its response cannot prove the result. Reconcile by immutable slug
|
|
104
|
-
or
|
|
107
|
+
or CRID before deciding whether to retry. The wrapper deliberately uses
|
|
105
108
|
`status: 0`; the original typed error is available as `cause`, including its
|
|
106
109
|
observed HTTP status.
|
|
107
110
|
|
|
@@ -117,17 +120,20 @@ is terminal: do not retry it. Obtain a new bootstrap key and use normal
|
|
|
117
120
|
owner-authenticated lookup by immutable slug to reconcile the resource first.
|
|
118
121
|
|
|
119
122
|
The API does not apply idempotency replay to DELETE, so after an outcome-unknown
|
|
120
|
-
`deleteConnectorResource` call, reconcile by
|
|
123
|
+
`deleteConnectorResource` call, reconcile by CRID before issuing a
|
|
121
124
|
deliberate retry. A valid exact-201 resource missing only `meta.found_existing`
|
|
122
125
|
is known to have selected that row but still fails as an unwrapped
|
|
123
126
|
`unexpected_response` because required ensure metadata is absent.
|
|
124
127
|
|
|
125
|
-
If you persist the
|
|
128
|
+
If you persist the CRID, future calls do not need to recreate the
|
|
126
129
|
handle (no API call is made until you mint):
|
|
127
130
|
|
|
128
131
|
```typescript
|
|
129
|
-
|
|
130
|
-
|
|
132
|
+
async function createPortalForStoredResource(storedCrid: string) {
|
|
133
|
+
// Pass the CRID previously returned by the API.
|
|
134
|
+
const resource = client.resourceByCrid(storedCrid);
|
|
135
|
+
return resource.createPortal({ validFor: '1h' });
|
|
136
|
+
}
|
|
131
137
|
```
|
|
132
138
|
|
|
133
139
|
For one-off scripts, `client.createPortalForUrl` combines the two API calls
|
|
@@ -162,6 +168,97 @@ NHP UDP. It has no relay or HTTP-resolve fallback. Connector assignment and
|
|
|
162
168
|
registration are separate producer operations and are not part of the portal
|
|
163
169
|
opener.
|
|
164
170
|
|
|
171
|
+
If you already hold a CRID, mint a fresh share link directly:
|
|
172
|
+
|
|
173
|
+
```typescript
|
|
174
|
+
const share = await client.shareResource(crid, { ttlSeconds: 300 });
|
|
175
|
+
// Optional: verify the response CRID against DER SPKI bytes you already trust
|
|
176
|
+
// before the secret leaves this process.
|
|
177
|
+
await share.verifyCrid(resourcePublicKeyDer);
|
|
178
|
+
await deliverToRecipient(share.link); // Secret; returned once and not retrievable
|
|
179
|
+
console.log(share.qurlId); // Safe handle for revoking only this link later
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
`shareResource` returns the current share-safe `#qv2t1...` link. Recipients
|
|
183
|
+
open that URL in the qURL browser flow. For native TypeScript opening, pass
|
|
184
|
+
`share.link` to `createPortalOpener` from `@layervai/qurl/node` with trusted
|
|
185
|
+
`QURL_DEPLOYMENT` configuration. See the native opener example above.
|
|
186
|
+
`verifyCrid` does not open the link or make a network request.
|
|
187
|
+
|
|
188
|
+
`verifyCrid` verifies that the response CRID derives from the trusted resource
|
|
189
|
+
key; it does not independently bind the secret link fragment to that key.
|
|
190
|
+
It intentionally follows qurl-go's environment-agnostic key-match rule: CRID
|
|
191
|
+
version zero is rejected as reserved, while every other structurally valid
|
|
192
|
+
version is accepted and environment classification is not part of key-to-digest
|
|
193
|
+
verification. It compares all 32 digest bytes for a full CRID and all 24 for
|
|
194
|
+
a truncated CRID; the response determines the digest width. CRIDs use their canonical lowercase base32 spelling; uppercase or
|
|
195
|
+
mixed-case spellings fail closed. Binary inputs of any length are hashed;
|
|
196
|
+
`invalid_crid_key` is reserved for non-binary or unreadable (detached) runtime
|
|
197
|
+
values, and a readable binary key that does not match reports `crid_mismatch`.
|
|
198
|
+
Use `error instanceof CRIDVerificationError` (or `error.status === 0`) to
|
|
199
|
+
distinguish these local verification failures from a server error that happens
|
|
200
|
+
to use the same problem code.
|
|
201
|
+
`qurlId` and `singleUse` are undefined when omitted by the service.
|
|
202
|
+
`ShareLink` keeps `.link` directly readable but redacts it from JSON, Node
|
|
203
|
+
inspection, and object spread to reduce accidental credential logging. Read
|
|
204
|
+
`.link` directly before delivery; do not spread or clone a `ShareLink`, because
|
|
205
|
+
those operations deliberately omit the credential. Browser developer consoles
|
|
206
|
+
can still display non-enumerable properties, so do not log the object there.
|
|
207
|
+
The constructor snapshots a caller-provided expiry, and the `ShareLink`
|
|
208
|
+
properties are frozen. Each `expiresAt` read returns a defensive `Date` copy;
|
|
209
|
+
changing that copy does not change the share metadata.
|
|
210
|
+
|
|
211
|
+
Omitting `ttlSeconds` matches qurl-go's zero-value behavior and requests the
|
|
212
|
+
platform default. TypeScript additionally rejects an explicit zero so a
|
|
213
|
+
computed countdown cannot silently become a longer-lived default credential.
|
|
214
|
+
A response can report `expiresInSeconds: 0`; do not reuse that value as a
|
|
215
|
+
request TTL. Expiry parsing uses the SDK's shared API date parser.
|
|
216
|
+
|
|
217
|
+
The service chooses single-use policy; this matches the Go SDK options.
|
|
218
|
+
|
|
219
|
+
qURL Connector assignment and registration use native UDP through
|
|
220
|
+
`qurl-connector` and `qurl-go`. This package does not expose an HTTP enrollment API.
|
|
221
|
+
Like the Go SDK, credential minting uses HTTPS and token consumption uses
|
|
222
|
+
native UDP. The Go SDK currently exposes minting through its restricted
|
|
223
|
+
`RegisteredAgentResourceHTTPDoer` bridge; this SDK uses `createApiKey`.
|
|
224
|
+
The service controls which credential kinds each caller can mint.
|
|
225
|
+
It can mint the one-shot credential consumed by that native enrollment flow:
|
|
226
|
+
|
|
227
|
+
```typescript
|
|
228
|
+
const enrollment = await client.createApiKey({
|
|
229
|
+
kind: 'enrollment_token',
|
|
230
|
+
name: 'prod-dashboard enrollment',
|
|
231
|
+
target: 'connector',
|
|
232
|
+
claims: [{ type: 'connector', id: 'prod-dashboard' }],
|
|
233
|
+
expires_in: '15m',
|
|
234
|
+
});
|
|
235
|
+
if (!enrollment.api_key) throw new Error('Enrollment response omitted its one-time token');
|
|
236
|
+
await deliverEnrollmentTokenSecurely(enrollment.api_key);
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
Durable `api_key` credentials require explicit scopes and do not accept
|
|
240
|
+
`expires_in`; enrollment tokens derive their scopes from `target`/`claims` and
|
|
241
|
+
expire within 24 hours. A connector claim's `id` is its immutable connector
|
|
242
|
+
slug. Request enums are validated against the current service contract;
|
|
243
|
+
response types remain additive for forward-compatible reads, and new request
|
|
244
|
+
enum values require a matching SDK release. Use
|
|
245
|
+
`isApiKeyRequestScope(scope)` to validate response scopes before writing them
|
|
246
|
+
back. Reject unknown scopes; do not filter them out, which can remove permissions.
|
|
247
|
+
When changing only a name, omit `scopes` from `updateApiKey`.
|
|
248
|
+
|
|
249
|
+
```typescript
|
|
250
|
+
import { isApiKeyRequestScope } from '@layervai/qurl';
|
|
251
|
+
|
|
252
|
+
const scopes = key.scopes;
|
|
253
|
+
if (!scopes?.length || !scopes.every(isApiKeyRequestScope)) {
|
|
254
|
+
throw new Error('Cannot reuse these scopes; check the current SDK contract');
|
|
255
|
+
}
|
|
256
|
+
await client.updateApiKey(keyId, { scopes });
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
This credential surface requires the kind-first qurl-service contract at or
|
|
260
|
+
after commit `047cf31e1cdf545e3060e0f9294d738a19fb997b`.
|
|
261
|
+
|
|
165
262
|
## Opening Portals
|
|
166
263
|
|
|
167
264
|
Most recipients open qURL links directly and do not use this SDK at all. If
|
|
@@ -378,9 +475,9 @@ console.log(`Access granted to ${access.target_url} for ${access.access_grant?.e
|
|
|
378
475
|
| `resource.createPortal(opts?)` / `createPortal(resourceOrId, opts?)` | Mint a short-lived portal link; existing resources can set `targetPath` |
|
|
379
476
|
| `createPortalForUrl(targetUrl, opts?)` | Protect + mint a URL resource; rejects `targetPath` |
|
|
380
477
|
| `ensureConnectorResource(slug, requestOptions?)` | Find or create an active Connector resource by immutable slug |
|
|
381
|
-
| `getConnectorResource(
|
|
382
|
-
| `deleteConnectorResource(
|
|
383
|
-
| `
|
|
478
|
+
| `getConnectorResource(crid)` / `getConnectorResourceBySlug(slug)` | Load a validated Connector resource by immutable identity |
|
|
479
|
+
| `deleteConnectorResource(crid)` | Revoke a Connector resource by CRID |
|
|
480
|
+
| `resourceByCrid(crid)` | Handle from a stored CRID (no API call) |
|
|
384
481
|
| `enterPortal(linkOrToken)` | Open a qURL link programmatically → `ResourceHandle` |
|
|
385
482
|
|
|
386
483
|
### REST-shaped methods
|
|
@@ -442,7 +539,7 @@ if (result.failed > 0) {
|
|
|
442
539
|
|
|
443
540
|
Non-400 errors (401, 403, 429, 5xx, and unexpected 400 body shapes) still throw the appropriate `QURLError` subclass.
|
|
444
541
|
|
|
445
|
-
**Slimmer per-item shape** — `BatchItemSuccess` returns `{ resource_id, qurl_link, qurl_site, expires_at? }` per item. Unlike single `client.create()`, the batch response intentionally **omits `qurl_id` and `label`** to keep the payload compact. If you migrate a per-item `create()` loop to `batchCreate` and rely on `qurl_id` for downstream addressing, fetch each via `client.get(
|
|
542
|
+
**Slimmer per-item shape** — `BatchItemSuccess` returns `{ crid, resource_id, qurl_link, qurl_site, expires_at? }` per item. Unlike single `client.create()`, the batch response intentionally **omits `qurl_id` and `label`** to keep the payload compact. If you migrate a per-item `create()` loop to `batchCreate` and rely on `qurl_id` for downstream addressing, check `item.crid` is present, then fetch each via `client.get(item.crid)` after the batch (or stay on the single-create path).
|
|
446
543
|
|
|
447
544
|
**Result ordering** — `result.results` is **not** guaranteed to be sorted by `index`. Each entry's `index` field carries the position in the original `items` array, so build per-input-position state by keying on `r.index` (e.g., `for (const r of result.results) { byInputIndex[r.index] = r; }`) rather than relying on iteration order.
|
|
448
545
|
|
|
@@ -504,7 +601,8 @@ const page = await client.list({ limit: 10, status: 'active' });
|
|
|
504
601
|
|
|
505
602
|
// Auto-paginate through all results
|
|
506
603
|
for await (const qurl of client.listAll({ status: 'active' })) {
|
|
507
|
-
|
|
604
|
+
if (!qurl.crid) throw new Error("The API response has no resource CRID");
|
|
605
|
+
console.log(qurl.crid);
|
|
508
606
|
}
|
|
509
607
|
```
|
|
510
608
|
|
|
@@ -588,6 +686,10 @@ SDK-generated keys require `globalThis.crypto.getRandomValues`, which is availab
|
|
|
588
686
|
## Security Notes
|
|
589
687
|
|
|
590
688
|
- Treat API keys and qURL links like credentials. Do not log them.
|
|
689
|
+
- Resource/qURL path arguments reject pasted access tokens and full URLs before
|
|
690
|
+
dispatch without echoing the caller input. Pass the opaque identifier returned
|
|
691
|
+
by the API (public resource key or CRID); never derive it from a secret qURL
|
|
692
|
+
link. Private `r_` storage IDs are not public API identifiers.
|
|
591
693
|
- SDK API requests use manual redirect handling. Redirect-capable HTTP statuses
|
|
592
694
|
(300, 301, 302, 303, 305, 307, 308), filtered `opaqueredirect` responses in
|
|
593
695
|
browsers and Node native fetch, and responses a custom fetch reports as
|
|
@@ -651,3 +753,7 @@ When upgrading, check the release notes for migration guidance — recent breaki
|
|
|
651
753
|
## License
|
|
652
754
|
|
|
653
755
|
MIT
|
|
756
|
+
|
|
757
|
+
Resource verification requires Web Crypto (`crypto.subtle`). In browsers, use
|
|
758
|
+
an HTTPS page or localhost. Raw REST response types keep `crid` optional;
|
|
759
|
+
resource handles and portals require a validated CRID.
|
package/dist/cjs/client.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ShareLink } from "./share.js";
|
|
2
|
+
import type { AccessCodeListOutput, ApiKey, ApiKeyListOutput, ApiKeyRequestScope, BillingInvoiceListOutput, BatchCreateInput, BatchCreateOutput, ClientOptions, ConnectorInstallation, ConnectorInstallationListOutput, CreateAccessCodeInput, CreateAccessCodeOutput, CreateApiKeyInput, CreateApiKeyOutput, CreateBillingCheckoutInput, CreateInput, CreateOutput, CreatePortalOptions, CreateQurlForResourceInput, CreateResourceInput, CreateWebhookInput, Customer, CheckoutSession, Domain, DomainListOutput, DomainVerifyResult, ExtendInput, Invoice, ListInput, ListOutput, ListApiKeysInput, ListBillingInvoicesInput, ListConnectorInstallationsInput, ListDomainsInput, ListWebhookDeliveriesInput, ListWebhooksInput, MintInput, MintOutput, Portal, PortalSession, ProtectUrlOptions, QURL, QurlSummary, Quota, RedeemAccessCodeInput, RedeemAccessCodeOutput, RegisterDomainInput, Resource, ResourceDetail, ResourceHandle, ResourceListInput, ResourceListOutput, RequestOptions, ResolveInput, ResolveOutput, SessionListOutput, SessionTerminateOutput, ShareResourceOptions, UpdateApiKeyInput, UpdateCustomerInput, UpdateInput, UpdateResourceInput, UpdateResourceQurlInput, UpdateWebhookInput, UsageCurrentPeriod, UsageDaily, Webhook, WebhookDelivery, WebhookDeliveryListOutput, WebhookEventTypeInfo, WebhookListOutput, WebhookWithSecret } from "./types.js";
|
|
3
|
+
/** Narrow a response scope before reusing it in a create/update request. */
|
|
4
|
+
export declare function isApiKeyRequestScope(scope: string): scope is ApiKeyRequestScope;
|
|
2
5
|
/**
|
|
3
6
|
* Shape of qurl-go's offline signed-fragment links: three or more
|
|
4
7
|
* dot-separated base64url parts (<version>.<claims>.<secret>.<sig>).
|
|
@@ -77,34 +80,34 @@ export declare class QURLClient {
|
|
|
77
80
|
*/
|
|
78
81
|
protectUrl(targetUrl: string, opts?: ProtectUrlOptions, requestOptions?: RequestOptions): Promise<ProtectedResource>;
|
|
79
82
|
/**
|
|
80
|
-
* Return a portal-minting handle for a stored
|
|
83
|
+
* Return a portal-minting handle for a stored CRID, without an API
|
|
81
84
|
* call.
|
|
82
85
|
*
|
|
83
|
-
* Use when you persisted a LayerV
|
|
84
|
-
* portals for it (qurl-go: `Client.
|
|
86
|
+
* Use when you persisted a LayerV CRID and want to mint more
|
|
87
|
+
* portals for it (qurl-go: `Client.ResourceByCRID`):
|
|
85
88
|
*
|
|
86
89
|
* ```ts
|
|
87
|
-
* const resource = client.
|
|
90
|
+
* const resource = client.resourceByCrid(storedCrid);
|
|
88
91
|
* const portal = await resource.createPortal({ validFor: "1h" });
|
|
89
92
|
* ```
|
|
90
93
|
*
|
|
91
94
|
* The handle carries no server metadata; use {@link getResource} when you
|
|
92
95
|
* need the full resource details.
|
|
93
96
|
*/
|
|
94
|
-
|
|
97
|
+
resourceByCrid(id: string): ProtectedResource;
|
|
95
98
|
/** Find or create the active qURL Connector resource for an immutable slug. */
|
|
96
99
|
ensureConnectorResource(slug: string, requestOptions?: RequestOptions): Promise<EnsureConnectorResourceResult>;
|
|
97
|
-
/** Fetch a qURL Connector resource by its
|
|
98
|
-
getConnectorResource(
|
|
100
|
+
/** Fetch a qURL Connector resource by its CRID. */
|
|
101
|
+
getConnectorResource(crid: string): Promise<ConnectorResource>;
|
|
99
102
|
/** Fetch the single active qURL Connector resource for an immutable slug. */
|
|
100
103
|
getConnectorResourceBySlug(slug: string): Promise<ConnectorResource>;
|
|
101
104
|
/**
|
|
102
|
-
* Revoke a qURL Connector resource by
|
|
105
|
+
* Revoke a qURL Connector resource by CRID.
|
|
103
106
|
*
|
|
104
107
|
* The API does not apply Idempotency-Key replay to DELETE. After an
|
|
105
108
|
* outcome-unknown failure, reconcile by ID before issuing a deliberate retry.
|
|
106
109
|
*/
|
|
107
|
-
deleteConnectorResource(
|
|
110
|
+
deleteConnectorResource(crid: string): Promise<void>;
|
|
108
111
|
/**
|
|
109
112
|
* Mint a short-lived qURL link (a portal) for a protected resource.
|
|
110
113
|
*
|
|
@@ -112,7 +115,7 @@ export declare class QURLClient {
|
|
|
112
115
|
* reach one private resource. Recipients open `portal.link` directly and
|
|
113
116
|
* need no LayerV credentials. Prefer short lifetimes such as
|
|
114
117
|
* `{ validFor: "5m" }`. Accepts a {@link ProtectedResource} handle or a
|
|
115
|
-
*
|
|
118
|
+
* CRID string. REST-shaped equivalents: {@link mintLink} /
|
|
116
119
|
* {@link createQurlForResource}.
|
|
117
120
|
*
|
|
118
121
|
* Duration options take a string (`"5m"`, `"24h"`; server-validated) or a
|
|
@@ -128,7 +131,7 @@ export declare class QURLClient {
|
|
|
128
131
|
*
|
|
129
132
|
* Convenience for one-off scripts (qurl-go: `Client.CreatePortalForURL`).
|
|
130
133
|
* The returned resource handle is reusable for minting more portals but
|
|
131
|
-
* carries
|
|
134
|
+
* carries the CRID, verification key, and the caller-supplied target URL; use
|
|
132
135
|
* {@link protectUrl} when you need the full server-populated resource
|
|
133
136
|
* metadata. Portal options match {@link createPortal}; `targetUrl` gets
|
|
134
137
|
* the same malformed-URL and embedded-credentials rejection as
|
|
@@ -226,8 +229,9 @@ export declare class QURLClient {
|
|
|
226
229
|
/**
|
|
227
230
|
* Get a qURL resource and its access tokens.
|
|
228
231
|
*
|
|
229
|
-
* Accepts
|
|
230
|
-
* prefix); the API resolves
|
|
232
|
+
* Accepts a CRID or qURL
|
|
233
|
+
* display ID (`q_` prefix); the API resolves display IDs to the parent
|
|
234
|
+
* resource automatically.
|
|
231
235
|
*/
|
|
232
236
|
get(id: string): Promise<QURL>;
|
|
233
237
|
/**
|
|
@@ -258,17 +262,17 @@ export declare class QURLClient {
|
|
|
258
262
|
/**
|
|
259
263
|
* Delete (revoke) a qURL resource and all its access tokens.
|
|
260
264
|
*
|
|
261
|
-
*
|
|
262
|
-
*
|
|
263
|
-
*
|
|
264
|
-
*
|
|
265
|
+
* Requires a CRID returned by the API. To revoke one qURL, use
|
|
266
|
+
* {@link revokeResourceQurl} instead.
|
|
267
|
+
*
|
|
268
|
+
* @throws {ValidationError} If `id` is not a canonical CRID.
|
|
265
269
|
*/
|
|
266
270
|
delete(id: string): Promise<void>;
|
|
267
271
|
/**
|
|
268
272
|
* Extend a qURL's expiration.
|
|
269
273
|
*
|
|
270
|
-
* Accepts
|
|
271
|
-
* prefix).
|
|
274
|
+
* Accepts a CRID or qURL
|
|
275
|
+
* display ID (`q_` prefix). Delegates to {@link update} with only the
|
|
272
276
|
* expiration fields. `ExtendInput` shares its `extend_by` / `expires_at`
|
|
273
277
|
* fields with `UpdateInput` but is *narrower in two ways*: (1) exactly
|
|
274
278
|
* one of the two must be present (XOR via `?: never`), where `UpdateInput`
|
|
@@ -283,8 +287,9 @@ export declare class QURLClient {
|
|
|
283
287
|
/**
|
|
284
288
|
* Update a qURL — extend expiration, change description, rename tags.
|
|
285
289
|
*
|
|
286
|
-
* Accepts
|
|
287
|
-
* prefix); the API resolves
|
|
290
|
+
* Accepts a CRID or qURL
|
|
291
|
+
* display ID (`q_` prefix); the API resolves display IDs to the parent
|
|
292
|
+
* resource automatically.
|
|
288
293
|
*/
|
|
289
294
|
update(id: string, input: UpdateInput, options?: RequestOptions): Promise<QURL>;
|
|
290
295
|
/**
|
|
@@ -292,8 +297,9 @@ export declare class QURLClient {
|
|
|
292
297
|
*
|
|
293
298
|
* Portal-flow equivalent: {@link createPortal}.
|
|
294
299
|
*
|
|
295
|
-
* Accepts
|
|
296
|
-
* prefix); the API resolves
|
|
300
|
+
* Accepts a CRID or qURL
|
|
301
|
+
* display ID (`q_` prefix); the API resolves display IDs to the parent
|
|
302
|
+
* resource automatically.
|
|
297
303
|
*
|
|
298
304
|
* Passing `{}` or an object with all fields `null`/`undefined` is
|
|
299
305
|
* equivalent to omitting the second argument: no body is sent, and the
|
|
@@ -342,6 +348,13 @@ export declare class QURLClient {
|
|
|
342
348
|
* Portal-flow equivalent: {@link createPortal} (same endpoint).
|
|
343
349
|
*/
|
|
344
350
|
createQurlForResource(id: string, input?: CreateQurlForResourceInput, options?: RequestOptions): Promise<CreateOutput>;
|
|
351
|
+
/**
|
|
352
|
+
* Mint a fresh, short-lived share link for an existing CRID.
|
|
353
|
+
* The returned link is secret and is not retrievable after this response.
|
|
354
|
+
* If you hold the trusted resource DER SPKI, call `ShareLink.verifyCrid()`
|
|
355
|
+
* before delivery to verify that the response CRID derives from that key.
|
|
356
|
+
*/
|
|
357
|
+
shareResource(id: string, options?: ShareResourceOptions, requestOptions?: RequestOptions): Promise<ShareLink>;
|
|
345
358
|
/** Revoke a specific qURL token on a resource. */
|
|
346
359
|
revokeResourceQurl(id: string, qurlId: string): Promise<void>;
|
|
347
360
|
/** Update a specific qURL token on a resource. */
|
|
@@ -505,19 +518,19 @@ export declare class QURLClient {
|
|
|
505
518
|
/**
|
|
506
519
|
* A LayerV-protected resource, bound to the client that produced it.
|
|
507
520
|
*
|
|
508
|
-
* Obtained from {@link QURLClient.protectUrl} or {@link QURLClient.
|
|
521
|
+
* Obtained from {@link QURLClient.protectUrl} or {@link QURLClient.resourceByCrid} —
|
|
509
522
|
* not constructed directly. Mint short-lived access links for the resource
|
|
510
523
|
* with {@link createPortal} (qurl-go: `qurl.Resource`).
|
|
511
524
|
*/
|
|
512
525
|
export declare class ProtectedResource {
|
|
513
526
|
#private;
|
|
514
|
-
/** The
|
|
515
|
-
readonly
|
|
527
|
+
/** The public resource CRID. */
|
|
528
|
+
readonly crid: string;
|
|
516
529
|
/** The private URL protected by this resource, when known. */
|
|
517
530
|
readonly targetUrl?: string;
|
|
518
531
|
/**
|
|
519
532
|
* Full server-populated {@link Resource} metadata when the handle came
|
|
520
|
-
* from an API response; `undefined` for {@link QURLClient.
|
|
533
|
+
* from an API response; `undefined` for {@link QURLClient.resourceByCrid}
|
|
521
534
|
* handles and for the one-call {@link QURLClient.createPortalForUrl} path.
|
|
522
535
|
*/
|
|
523
536
|
readonly details?: Resource;
|
|
@@ -550,9 +563,9 @@ declare const CONNECTOR_RESOURCE_CONSTRUCTOR_TOKEN: unique symbol;
|
|
|
550
563
|
*/
|
|
551
564
|
export declare class ConnectorResource {
|
|
552
565
|
#private;
|
|
553
|
-
readonly
|
|
554
|
-
/**
|
|
555
|
-
readonly crid
|
|
566
|
+
readonly resourcePublicKey: string;
|
|
567
|
+
/** Required public identifier, verified against the returned resource key. */
|
|
568
|
+
readonly crid: string;
|
|
556
569
|
readonly connectorRoutingId: string;
|
|
557
570
|
readonly knockResourceId: string;
|
|
558
571
|
readonly slug: string;
|