@oatscenter/trellis 0.100.0-rc.13 → 0.100.0-rc.15
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/auth/browser/oauth.js +3 -5
- package/auth/issuer_trust.d.ts +1 -1
- package/auth/issuer_trust.js +2 -2
- package/device/activation.js +2 -0
- package/device.js +4 -0
- package/internal_sdk/generated/apis/auth/mod.d.ts +1 -25
- package/internal_sdk/generated/apis/auth/mod.js +5 -33
- package/internal_sdk/generated/apis/core/mod.js +4 -4
- package/internal_sdk/generated/apis/events/mod.js +4 -4
- package/internal_sdk/generated/apis/health/mod.js +4 -4
- package/internal_sdk/generated/apis/jobs/mod.js +4 -4
- package/internal_sdk/generated/apis/state/mod.js +4 -4
- package/internal_sdk/generated/apps/cli/mod.d.ts +0 -10
- package/internal_sdk/generated/apps/cli/mod.js +0 -12
- package/internal_sdk/generated/apps/console/mod.d.ts +0 -10
- package/internal_sdk/generated/apps/console/mod.js +0 -12
- package/internal_sdk/generated/package.json +2 -2
- package/internal_sdk/generated/participants/eventsRuntime/mod.d.ts +0 -2
- package/internal_sdk/generated/participants/eventsRuntime/mod.js +4 -6
- package/internal_sdk/generated/participants/healthRuntime/mod.js +4 -4
- package/internal_sdk/generated/participants/jobsRuntime/mod.d.ts +0 -2
- package/internal_sdk/generated/participants/jobsRuntime/mod.js +4 -6
- package/internal_sdk/generated/participants/platform/mod.d.ts +1 -3
- package/internal_sdk/generated/participants/platform/mod.js +6 -8
- package/internal_sdk/generated/types/_internal/p0.d.ts +0 -54
- package/internal_sdk/generated/types/_internal/p0.js +0 -27
- package/internal_sdk/generated/types/index.d.ts +0 -10
- package/internal_sdk/generated/types/index.js +0 -5
- package/native/certificate_acceptance.d.ts +45 -0
- package/native/certificate_acceptance.js +171 -0
- package/native/custody.js +3 -1
- package/native/discovery.js +46 -17
- package/native/oauth.js +1 -1
- package/native.d.ts +1 -0
- package/native.js +1 -0
- package/package.json +2 -2
- package/service/runtime/service.js +4 -0
package/auth/browser/oauth.js
CHANGED
|
@@ -74,13 +74,12 @@ export class BrowserOAuthClient {
|
|
|
74
74
|
issuer.password ||
|
|
75
75
|
issuer.hash ||
|
|
76
76
|
issuer.search ||
|
|
77
|
-
issuer.pathname !== "/" ||
|
|
78
77
|
(issuer.protocol !== "https:" &&
|
|
79
78
|
!(options.loopbackDevelopment &&
|
|
80
79
|
loopback &&
|
|
81
80
|
issuer.protocol === "http:")))
|
|
82
81
|
return err(new AuthError({ reason: "InvalidIssuer" }));
|
|
83
|
-
const response = await fetch(
|
|
82
|
+
const response = await fetch(`${issuer.href.replace(/\/+$/, "")}/.well-known/oauth-authorization-server`, {
|
|
84
83
|
redirect: "error",
|
|
85
84
|
credentials: "omit",
|
|
86
85
|
signal: AbortSignal.timeout(30_000),
|
|
@@ -259,7 +258,7 @@ export class BrowserOAuthClient {
|
|
|
259
258
|
}
|
|
260
259
|
async #prepareTrust(metadata) {
|
|
261
260
|
if (!metadata) {
|
|
262
|
-
const response = await fetch(
|
|
261
|
+
const response = await fetch(`${this.scope.issuer.replace(/\/+$/, "")}/.well-known/oauth-authorization-server`, {
|
|
263
262
|
redirect: "error",
|
|
264
263
|
credentials: "omit",
|
|
265
264
|
signal: AbortSignal.timeout(30000),
|
|
@@ -269,8 +268,7 @@ export class BrowserOAuthClient {
|
|
|
269
268
|
metadata = metadataSchema.parse(await boundedJson(response));
|
|
270
269
|
}
|
|
271
270
|
const active = metadata.trellis.issuers.filter((key) => key.state === "active");
|
|
272
|
-
if (
|
|
273
|
-
active.length !== 1)
|
|
271
|
+
if (metadata.issuer !== this.scope.issuer || active.length !== 1)
|
|
274
272
|
throw new AuthError({ reason: "OAuthTrustUnavailable" });
|
|
275
273
|
const owner = await authenticateIssuerChain(this.scope.issuer, this.#owner?.trustSnapshot ?? this.store.trust, {
|
|
276
274
|
instanceId: metadata.trellis.trellisInstanceId,
|
package/auth/issuer_trust.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { SessionAuthorityOwner, type RuntimeAuthorizationTrust } from "./authority.ts";
|
|
2
2
|
/** Authenticate a discovery hint from the credential's existing pin, without consuming OAuth credentials. */
|
|
3
|
-
export declare function authenticateIssuerChain(
|
|
3
|
+
export declare function authenticateIssuerChain(issuer: string, anchor: RuntimeAuthorizationTrust, target: RuntimeAuthorizationTrust, signal?: AbortSignal, existingOwner?: SessionAuthorityOwner): Promise<SessionAuthorityOwner>;
|
package/auth/issuer_trust.js
CHANGED
|
@@ -2,7 +2,7 @@ import { AuthError } from "../errors/AuthError.js";
|
|
|
2
2
|
import { issuerChainSchema, signedBytes } from "./protocol_wasm.js";
|
|
3
3
|
import { SessionAuthorityOwner, } from "./authority.js";
|
|
4
4
|
/** Authenticate a discovery hint from the credential's existing pin, without consuming OAuth credentials. */
|
|
5
|
-
export async function authenticateIssuerChain(
|
|
5
|
+
export async function authenticateIssuerChain(issuer, anchor, target, signal, existingOwner) {
|
|
6
6
|
const owner = existingOwner ??
|
|
7
7
|
new SessionAuthorityOwner({
|
|
8
8
|
instanceId: anchor.instanceId,
|
|
@@ -16,7 +16,7 @@ export async function authenticateIssuerChain(origin, anchor, target, signal, ex
|
|
|
16
16
|
BigInt(target.rotationSequence) < BigInt(anchor.rotationSequence))
|
|
17
17
|
throw new Error("issuer scope or sequence mismatch");
|
|
18
18
|
if (anchor.issuer.keyId !== target.issuer.keyId) {
|
|
19
|
-
const url = new URL("/.well-known/trellis/issuer-chain
|
|
19
|
+
const url = new URL(`${issuer.replace(/\/+$/, "")}/.well-known/trellis/issuer-chain`);
|
|
20
20
|
url.search = new URLSearchParams({
|
|
21
21
|
pinnedKeyId: anchor.issuer.keyId,
|
|
22
22
|
targetKeyId: target.issuer.keyId,
|
package/device/activation.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { mkdir, readFile, rename, unlink, writeFile } from "node:fs/promises";
|
|
2
|
+
import { acceptServerCertificateFor } from "../native/certificate_acceptance.js";
|
|
2
3
|
import { dirname, join } from "node:path";
|
|
3
4
|
import { env, platform } from "node:process";
|
|
4
5
|
import { Type } from "typebox";
|
|
@@ -288,6 +289,7 @@ async function createActivationRequiredStatus(args) {
|
|
|
288
289
|
* local completion alone never grants device access or creates a new review.
|
|
289
290
|
*/
|
|
290
291
|
export async function checkDeviceActivation(args) {
|
|
292
|
+
await acceptServerCertificateFor(args.trellisUrl, args.participant.identity);
|
|
291
293
|
const store = await openDeviceActivationStateStore({
|
|
292
294
|
trellisUrl: args.trellisUrl,
|
|
293
295
|
rootSecret: args.rootSecret,
|
package/device.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// Request-serving participants load the provider protocol build.
|
|
2
|
+
import { acceptServerCertificateFor, trustAcceptedCertificatesFor, } from "./native/certificate_acceptance.js";
|
|
2
3
|
import "./auth/protocol_wasm_provider.js";
|
|
3
4
|
export { checkDeviceActivation } from "./device/activation.js";
|
|
4
5
|
import { AsyncResult, Result, UnexpectedError } from "@oatscenter/result";
|
|
@@ -197,6 +198,7 @@ function createActivationSession(args) {
|
|
|
197
198
|
* @internal Exported for focused tests and platform-specific wrappers.
|
|
198
199
|
*/
|
|
199
200
|
export async function startDeviceActivationWithDeps(args, deps) {
|
|
201
|
+
await acceptServerCertificateFor(args.trellisUrl, args.participant.identity);
|
|
200
202
|
const rootSecret = normalizeRootSecret(args.rootSecret);
|
|
201
203
|
const identity = await deriveDeviceIdentity(rootSecret);
|
|
202
204
|
const nonce = base64urlEncode(crypto.getRandomValues(new Uint8Array(32)));
|
|
@@ -264,6 +266,7 @@ export async function startDeviceActivationWithDeps(args, deps) {
|
|
|
264
266
|
* @internal Exported for focused tests and platform-specific wrappers.
|
|
265
267
|
*/
|
|
266
268
|
export async function resumeDeviceActivationWithDeps(args, deps) {
|
|
269
|
+
await acceptServerCertificateFor(args.trellisUrl, args.participant.identity);
|
|
267
270
|
const rootSecret = normalizeRootSecret(args.rootSecret);
|
|
268
271
|
const identity = await deriveDeviceIdentity(rootSecret);
|
|
269
272
|
return await createActivationSession({
|
|
@@ -281,6 +284,7 @@ export async function resumeDeviceActivationWithDeps(args, deps) {
|
|
|
281
284
|
* `TrellisDevice.connect`.
|
|
282
285
|
*/
|
|
283
286
|
export async function connectDeviceWithDeps(args, deps) {
|
|
287
|
+
await trustAcceptedCertificatesFor(args.participant.identity);
|
|
284
288
|
const connected = await connectProvisioned(args, "device", {}, await deps.loadTransport());
|
|
285
289
|
let companion;
|
|
286
290
|
try {
|
|
@@ -41,10 +41,6 @@ export declare class ValidationError extends TrellisError<ValidationErrorData> {
|
|
|
41
41
|
static fromSerializable(data: unknown): ValidationError;
|
|
42
42
|
override toSerializable(): ValidationErrorData;
|
|
43
43
|
}
|
|
44
|
-
export type AdministrationReviewsDecideInput = Types0.AuthAdministrationReviewDecideRequest;
|
|
45
|
-
export type AdministrationReviewsDecideOutput = Types0.AuthAdministrationReviewResponse;
|
|
46
|
-
export type AdministrationReviewsListInput = Types0.AuthPageRequest;
|
|
47
|
-
export type AdministrationReviewsListOutput = Types0.AuthAdministrationReviewsListResponse;
|
|
48
44
|
export type AdmissionRenewInput = Types0.AuthAdmissionRenewRequest;
|
|
49
45
|
export type AdmissionRenewOutput = Types0.AuthAdmissionRenewResponse;
|
|
50
46
|
export type ApisAcceptInput = Types0.AuthApiAcceptRequest;
|
|
@@ -248,26 +244,6 @@ export type IssuersRotatedEvent = Types0.AuthSecurityEvent;
|
|
|
248
244
|
declare const __api: {
|
|
249
245
|
readonly identity: "trellis.auth@v1";
|
|
250
246
|
readonly actions: {
|
|
251
|
-
readonly "rpc:Administration.Reviews.Decide": {
|
|
252
|
-
readonly kind: "rpc";
|
|
253
|
-
readonly descriptorName: "rpc:Administration.Reviews.Decide";
|
|
254
|
-
readonly subject: "rpc.v1.auth.Administration.Reviews.Decide";
|
|
255
|
-
readonly input: typeof Types0.AuthAdministrationReviewDecideRequestCodec;
|
|
256
|
-
readonly output: typeof Types0.AuthAdministrationReviewResponseCodec;
|
|
257
|
-
readonly errors: readonly [typeof AuthError, typeof UnexpectedError, typeof ValidationError];
|
|
258
|
-
readonly download: false;
|
|
259
|
-
readonly pagination: undefined;
|
|
260
|
-
};
|
|
261
|
-
readonly "rpc:Administration.Reviews.List": {
|
|
262
|
-
readonly kind: "rpc";
|
|
263
|
-
readonly descriptorName: "rpc:Administration.Reviews.List";
|
|
264
|
-
readonly subject: "rpc.v1.auth.Administration.Reviews.List";
|
|
265
|
-
readonly input: typeof Types0.AuthPageRequestCodec;
|
|
266
|
-
readonly output: typeof Types0.AuthAdministrationReviewsListResponseCodec;
|
|
267
|
-
readonly errors: readonly [typeof AuthError, typeof UnexpectedError, typeof ValidationError];
|
|
268
|
-
readonly download: false;
|
|
269
|
-
readonly pagination: "cursor";
|
|
270
|
-
};
|
|
271
247
|
readonly "rpc:Admission.Renew": {
|
|
272
248
|
readonly kind: "rpc";
|
|
273
249
|
readonly descriptorName: "rpc:Admission.Renew";
|
|
@@ -1284,5 +1260,5 @@ declare const __api: {
|
|
|
1284
1260
|
readonly packageEvidence: unknown;
|
|
1285
1261
|
};
|
|
1286
1262
|
export declare const API: typeof __api;
|
|
1287
|
-
export declare const API_DIGEST: "
|
|
1263
|
+
export declare const API_DIGEST: "LUcTB3jviCaJWBgxAKT7p1wmTgbKCTkfICbQTbNv5Xc";
|
|
1288
1264
|
export {};
|