@oaath/server 0.3.1 → 0.3.3
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/apns.d.ts +2 -2
- package/dist/apns.js +2 -2
- package/dist/{challenge-DmpGSogj.js → challenge-WmeNbyox.js} +2 -2
- package/dist/{challenge-DmpGSogj.js.map → challenge-WmeNbyox.js.map} +1 -1
- package/dist/{inbox-B80EUVht.js → inbox-BKXNtsX3.js} +4 -4
- package/dist/{inbox-B80EUVht.js.map → inbox-BKXNtsX3.js.map} +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/dist/{interface-DHpwP0wr.d.ts → interface-BVKJY6sm.d.ts} +2 -2
- package/dist/interface-BVKJY6sm.d.ts.map +1 -0
- package/dist/kernel.d.ts +1 -1
- package/dist/kernel.js +3 -3
- package/dist/native.d.ts +2 -2
- package/dist/native.js +4 -4
- package/dist/postgres.d.ts +2 -2
- package/dist/postgres.js +2 -2
- package/dist/{projection-B7IB9irs.d.ts → projection-CrtZYvxz.d.ts} +2 -2
- package/dist/{projection-B7IB9irs.d.ts.map → projection-CrtZYvxz.d.ts.map} +1 -1
- package/dist/{records-BQNDxbPg.js → records-Bh8rOpBa.js} +10 -8
- package/dist/records-Bh8rOpBa.js.map +1 -0
- package/dist/{records-BUvqmp0D.js → records-lPGo4RxO.js} +2 -2
- package/dist/{records-BUvqmp0D.js.map → records-lPGo4RxO.js.map} +1 -1
- package/dist/{service-Cf4f-9KP.js → service-DT0vkKop.js} +4 -4
- package/dist/{service-Cf4f-9KP.js.map → service-DT0vkKop.js.map} +1 -1
- package/dist/{service-J51bOVe6.d.ts → service-Dv3zIiNr.d.ts} +3 -3
- package/dist/{service-J51bOVe6.d.ts.map → service-Dv3zIiNr.d.ts.map} +1 -1
- package/package.json +3 -3
- package/dist/interface-DHpwP0wr.d.ts.map +0 -1
- package/dist/records-BQNDxbPg.js.map +0 -1
|
@@ -98,7 +98,7 @@ declare class OaathRelayError extends Error {
|
|
|
98
98
|
readonly bundlerRejection: Readonly<BundlerRejection> | null;
|
|
99
99
|
readonly code: RelayErrorCode;
|
|
100
100
|
readonly diagnostic: Readonly<ValidationGasDiagnostic> | null;
|
|
101
|
-
constructor(code: RelayErrorCode, message: string, diagnostic?: Readonly<ValidationGasDiagnostic> | null, bundlerRejection?: Readonly<BundlerRejection> | null);
|
|
101
|
+
constructor(code: RelayErrorCode, message: string, diagnostic?: Readonly<ValidationGasDiagnostic> | null, bundlerRejection?: Readonly<BundlerRejection> | null, options?: ErrorOptions);
|
|
102
102
|
}
|
|
103
103
|
//#endregion
|
|
104
104
|
//#region src/store/records.d.ts
|
|
@@ -242,4 +242,4 @@ interface RelayStore {
|
|
|
242
242
|
}
|
|
243
243
|
//#endregion
|
|
244
244
|
export { OAATH_REVOCATION_REQUEST_RECORD_VERSION as _, AuthorizationDecisionRecord as a, RelayClock as b, EncryptedArtifactRecord as c, OAATH_AUTHORIZATION_REQUEST_RECORD_VERSION as d, OAATH_ENCRYPTED_ARTIFACT_RECORD_VERSION as f, OAATH_REVOCATION_DECISION_RECORD_VERSION as g, RelayErrorCode as h, AuthorizationDecisionOutcome as i, OAATH_AUTHORIZATION_CODE_RECORD_VERSION as l, RELAY_ERROR_STATUS as m, RelayTransaction as n, AuthorizationOwnerRoute as o, OaathRelayError as p, AuthorizationCodeRecord as r, AuthorizationRequestRecord as s, RelayStore as t, OAATH_AUTHORIZATION_DECISION_RECORD_VERSION as u, RevocationDecisionRecord as v, RevocationRequestRecord as y };
|
|
245
|
-
//# sourceMappingURL=interface-
|
|
245
|
+
//# sourceMappingURL=interface-BVKJY6sm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interface-BVKJY6sm.d.ts","names":[],"sources":["../src/clock.ts","../src/revocation/records.ts","../src/relay/errors.ts","../src/store/records.ts","../src/store/interface.ts"],"mappings":";;;;;;;;UAUiB;;EAEf;;;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A2B,kBAAkB,QAAQ;;EAErD,6BAA6B,QAAQ,+BAA+B;EAEpE,sBAAsB,qBAAqB,QAAQ;;EAEnD,iCAAiC,oBAAoB,QAAQ;EAC7D,wBAAwB,QAAQ,0BAA0B;;EAE1D,uBAAuB,oBAAoB,oBAAoB;;EAG/D,UAAU;;EAEV,YAAY;;UAGG;EACf,SAAS,QAAQ;EACjB,SAAS"}
|
package/dist/kernel.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as RelayClock, t as RelayStore } from "./interface-
|
|
1
|
+
import { b as RelayClock, t as RelayStore } from "./interface-BVKJY6sm.js";
|
|
2
2
|
import { t as RelayKms } from "./kms-BWkywdJM.js";
|
|
3
3
|
import { OperationObserveResult, OperationObserverCapabilities, OperationStartResult, OperationStoreAdapter } from "@oaath/sdk/advanced";
|
|
4
4
|
import { PreparedUserOperation } from "@oaath/sdk/kernel";
|
package/dist/kernel.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { b as relayFailure } from "./records-
|
|
2
|
-
import { a as relayNow } from "./challenge-
|
|
3
|
-
import { S as withRelayTransaction, b as openArtifact, r as readRevocationState } from "./service-
|
|
1
|
+
import { b as relayFailure } from "./records-Bh8rOpBa.js";
|
|
2
|
+
import { a as relayNow } from "./challenge-WmeNbyox.js";
|
|
3
|
+
import { S as withRelayTransaction, b as openArtifact, r as readRevocationState } from "./service-DT0vkKop.js";
|
|
4
4
|
import { parseOwnerSigningArtifact } from "@oaath/protocol";
|
|
5
5
|
import { OperationStore, createOperationObserver, createOperationRunner } from "@oaath/sdk/advanced";
|
|
6
6
|
import { restoreKernelPermissionRevocation } from "@oaath/sdk/kernel";
|
package/dist/native.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as ProjectOwnerPhoneRequestInput, c as OwnerPhoneRevocationDecision, d as OwnerPhonePermissionApprovals, f as PreparedOwnerPhonePermissionApproval, i as OwnerPhoneScopeProjection, l as OwnerPhoneRevocationScopeProjection, n as OwnerPhonePushProjection, o as projectOwnerPhonePermissionSigning, r as OwnerPhoneRequestProjection, s as projectOwnerPhoneRequest, t as OAATH_NATIVE_PROJECTION_VERSION, u as projectOwnerPhoneRevocation } from "./projection-
|
|
2
|
-
import { A as listOwnerPhoneRequests, B as createMemoryOwnerDeviceCredentialStore, C as RequestOwnerPhoneRevocationInput, D as submitOwnerPhoneRevocationDecision, E as requestOwnerPhoneRevocation, F as OAATH_OWNER_DEVICE_CREDENTIAL_VERSION, I as OwnerDeviceAuthentication, L as OwnerDeviceCredentialRecord, M as OwnerPhoneDecision, N as SubmitOwnerPhoneDecisionInput, O as OAATH_NATIVE_INBOX_VERSION, P as submitOwnerPhoneDecision, R as OwnerDeviceCredentialStore, S as OwnerPhoneRevocationStatus, T as fetchOwnerPhoneRevocation, V as createOwnerDeviceAuthentication, j as NATIVE_DISPLAY_PAYLOAD_LENGTH, k as OwnerPhoneInbox, w as fetchClientPhoneRevocation, z as OwnerDeviceReference } from "./service-
|
|
1
|
+
import { a as ProjectOwnerPhoneRequestInput, c as OwnerPhoneRevocationDecision, d as OwnerPhonePermissionApprovals, f as PreparedOwnerPhonePermissionApproval, i as OwnerPhoneScopeProjection, l as OwnerPhoneRevocationScopeProjection, n as OwnerPhonePushProjection, o as projectOwnerPhonePermissionSigning, r as OwnerPhoneRequestProjection, s as projectOwnerPhoneRequest, t as OAATH_NATIVE_PROJECTION_VERSION, u as projectOwnerPhoneRevocation } from "./projection-CrtZYvxz.js";
|
|
2
|
+
import { A as listOwnerPhoneRequests, B as createMemoryOwnerDeviceCredentialStore, C as RequestOwnerPhoneRevocationInput, D as submitOwnerPhoneRevocationDecision, E as requestOwnerPhoneRevocation, F as OAATH_OWNER_DEVICE_CREDENTIAL_VERSION, I as OwnerDeviceAuthentication, L as OwnerDeviceCredentialRecord, M as OwnerPhoneDecision, N as SubmitOwnerPhoneDecisionInput, O as OAATH_NATIVE_INBOX_VERSION, P as submitOwnerPhoneDecision, R as OwnerDeviceCredentialStore, S as OwnerPhoneRevocationStatus, T as fetchOwnerPhoneRevocation, V as createOwnerDeviceAuthentication, j as NATIVE_DISPLAY_PAYLOAD_LENGTH, k as OwnerPhoneInbox, w as fetchClientPhoneRevocation, z as OwnerDeviceReference } from "./service-Dv3zIiNr.js";
|
|
3
3
|
export { NATIVE_DISPLAY_PAYLOAD_LENGTH, OAATH_NATIVE_INBOX_VERSION, OAATH_NATIVE_PROJECTION_VERSION, OAATH_OWNER_DEVICE_CREDENTIAL_VERSION, type OwnerDeviceAuthentication, type OwnerDeviceCredentialRecord, type OwnerDeviceCredentialStore, type OwnerDeviceReference, type OwnerPhoneDecision, type OwnerPhoneInbox, type OwnerPhonePermissionApprovals, type OwnerPhonePushProjection, type OwnerPhoneRequestProjection, type OwnerPhoneRevocationDecision, type OwnerPhoneRevocationScopeProjection, type OwnerPhoneRevocationStatus, type OwnerPhoneScopeProjection, type PreparedOwnerPhonePermissionApproval, type ProjectOwnerPhoneRequestInput, type RequestOwnerPhoneRevocationInput, type SubmitOwnerPhoneDecisionInput, createMemoryOwnerDeviceCredentialStore, createOwnerDeviceAuthentication, fetchClientPhoneRevocation, fetchOwnerPhoneRevocation, listOwnerPhoneRequests, projectOwnerPhonePermissionSigning, projectOwnerPhoneRequest, projectOwnerPhoneRevocation, requestOwnerPhoneRevocation, submitOwnerPhoneDecision, submitOwnerPhoneRevocationDecision };
|
package/dist/native.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { b as relayFailure, c as canonicalIdentifier } from "./records-
|
|
2
|
-
import { n as randomIdentifier, r as sha256Base64Url } from "./challenge-
|
|
3
|
-
import { a as submitOwnerPhoneRevocationDecision, c as projectOwnerPhonePermissionSigning, h as NATIVE_DISPLAY_PAYLOAD_LENGTH, i as requestOwnerPhoneRevocation, l as projectOwnerPhoneRequest, n as fetchOwnerPhoneRevocation, o as projectOwnerPhoneRevocation, s as OAATH_NATIVE_PROJECTION_VERSION, t as fetchClientPhoneRevocation } from "./service-
|
|
4
|
-
import { n as listOwnerPhoneRequests, r as submitOwnerPhoneDecision, t as OAATH_NATIVE_INBOX_VERSION } from "./inbox-
|
|
1
|
+
import { b as relayFailure, c as canonicalIdentifier } from "./records-Bh8rOpBa.js";
|
|
2
|
+
import { n as randomIdentifier, r as sha256Base64Url } from "./challenge-WmeNbyox.js";
|
|
3
|
+
import { a as submitOwnerPhoneRevocationDecision, c as projectOwnerPhonePermissionSigning, h as NATIVE_DISPLAY_PAYLOAD_LENGTH, i as requestOwnerPhoneRevocation, l as projectOwnerPhoneRequest, n as fetchOwnerPhoneRevocation, o as projectOwnerPhoneRevocation, s as OAATH_NATIVE_PROJECTION_VERSION, t as fetchClientPhoneRevocation } from "./service-DT0vkKop.js";
|
|
4
|
+
import { n as listOwnerPhoneRequests, r as submitOwnerPhoneDecision, t as OAATH_NATIVE_INBOX_VERSION } from "./inbox-BKXNtsX3.js";
|
|
5
5
|
import { captureRecord, exactCapturedRecord } from "@oaath/protocol";
|
|
6
6
|
//#region src/native/authentication.ts
|
|
7
7
|
const OAATH_OWNER_DEVICE_CREDENTIAL_VERSION = "oaath.owner-device-credential/v1";
|
package/dist/postgres.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as RelayStore } from "./interface-
|
|
2
|
-
import { R as OwnerDeviceCredentialStore, i as ServiceDirectoryStore } from "./service-
|
|
1
|
+
import { t as RelayStore } from "./interface-BVKJY6sm.js";
|
|
2
|
+
import { R as OwnerDeviceCredentialStore, i as ServiceDirectoryStore } from "./service-Dv3zIiNr.js";
|
|
3
3
|
import { Pool } from "pg";
|
|
4
4
|
import { OperationStoreAdapter } from "@oaath/sdk/advanced";
|
|
5
5
|
//#region src/directory/postgres.d.ts
|
package/dist/postgres.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { b as relayFailure, d as parseAuthorizationRequestRecord, f as parseCapabilityInvalidationRecord, l as parseAuthorizationCodeRecord, p as parseEncryptedArtifactRecord, u as parseAuthorizationDecisionRecord } from "./records-
|
|
2
|
-
import { a as parseRevocationRequestRecord, i as parseRevocationDecisionRecord } from "./records-
|
|
1
|
+
import { b as relayFailure, d as parseAuthorizationRequestRecord, f as parseCapabilityInvalidationRecord, l as parseAuthorizationCodeRecord, p as parseEncryptedArtifactRecord, u as parseAuthorizationDecisionRecord } from "./records-Bh8rOpBa.js";
|
|
2
|
+
import { a as parseRevocationRequestRecord, i as parseRevocationDecisionRecord } from "./records-lPGo4RxO.js";
|
|
3
3
|
import pg from "pg";
|
|
4
4
|
//#region src/directory/postgres.ts
|
|
5
5
|
/** Creates the current directory schema; existing/older tables are never migrated. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as RelayClock, t as RelayStore } from "./interface-
|
|
1
|
+
import { b as RelayClock, t as RelayStore } from "./interface-BVKJY6sm.js";
|
|
2
2
|
import { KernelReplayableInstallOwnerSigningRequest, KernelRevocationSigningRequest, OwnerSigningArtifact, OwnerSigningRequest, PermissionRequest, WorkspaceAccountContext } from "@oaath/protocol";
|
|
3
3
|
//#region src/security/authentication.d.ts
|
|
4
4
|
/**
|
|
@@ -225,4 +225,4 @@ declare function projectOwnerPhonePermissionSigning(input: ProjectOwnerPhoneRequ
|
|
|
225
225
|
}): Promise<OwnerPhoneRequestProjection>;
|
|
226
226
|
//#endregion
|
|
227
227
|
export { ProjectOwnerPhoneRequestInput as a, OwnerPhoneRevocationDecision as c, OwnerPhonePermissionApprovals as d, PreparedOwnerPhonePermissionApproval as f, RelayCallerRole as h, OwnerPhoneScopeProjection as i, OwnerPhoneRevocationScopeProjection as l, RelayCaller as m, OwnerPhonePushProjection as n, projectOwnerPhonePermissionSigning as o, RelayAuthentication as p, OwnerPhoneRequestProjection as r, projectOwnerPhoneRequest as s, OAATH_NATIVE_PROJECTION_VERSION as t, projectOwnerPhoneRevocation as u };
|
|
228
|
-
//# sourceMappingURL=projection-
|
|
228
|
+
//# sourceMappingURL=projection-CrtZYvxz.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"projection-
|
|
1
|
+
{"version":3,"file":"projection-CrtZYvxz.d.ts","names":[],"sources":["../src/security/authentication.ts","../src/native/permission-approval.ts","../src/native/revocation.ts","../src/native/projection.ts"],"mappings":";;;;;;;;;;;;;KAoBY;UAIK;WACN,MAAM;WACN;;WAEA;;;;;;WAMA;;;;;;;;;WASA;;UAGM;;;;;EAKf,aAAa,SAAS,UAAU;;;;UCtCjB;WACN,gBAAgB,SAAS;;EAElC,SAAS,UAAU,SAAS,uBAAuB,oBAAoB;;UAGxD;;EAEf,QACE,SAAS,SAAS,qBACjB,QAAQ,SAAS;;;;UCPL;WACN;WACA;;WAEA;WACA,YAAY;WACZ,SAAS;IAChB;IACA;IACA;IACA,SAAS;;WAEF,QAAQ;WACR;WACA;WACA,WAAW;WACX;;;UAIM;WACN;WACA;WACA;WACA;WACA;;;;;;;iBAQW,4BAA4B;WACvC;WACA;WACA;WACA;IACP,QAAQ;;;;cCIC;;KAUD,iCACR;EAAW;EAAe;KAC1B;EAAW;EAAc;KACzB;EAAW;EAAkB;EAAmB;;;;;;;;;;KAUxC,sCAAsC;EAChD;EACA;;EAEA,SAAS,SAAS;;EAElB,aAAa;IACX;IACA;IACA;;IAEA;;;EAGF,SAAS;IACP;IACA;IACA;IACA;IACA,iBAAiB;;;EAGnB,oBAAoB;;;;;;;EAOpB,eAAe;IACb;IACA;;EAEF;EACA,gBAAgB;IACd;IACA;IACA;IACA,yBAAyB;MAAW;MAAe;;;EAErD;;EAEA;;EAEA;EACA;EACA;;EAEA;;KAGU,4BACR,sCACA,sCACA;EACE;EACA;;EAEA;;EAEA,SAAS,SAAS;KAEpB;EACE;EACA;;EAEA;;EAEA,SAAS,SAAS;KAEpB;EAAW;EAAa;EAAyB;;UAEpC;WACN,gBAAgB;;;;;;WAMhB;;WAEA;;WAEA;;WAEA,QAAQ;IAAW;IAAkB;;WACrC,OAAO;;;;;;;KAQN,2BAA2B,KACrC;UAIe;WACN,OAAO;WACP,OAAO;;WAEP,QAAQ;WACR;;iBA+JW,yBACpB,OAAO,gCACN,QAAQ;;iBAUW,mCACpB,OAAO;WACI,sBAAsB;IAEhC,QAAQ"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { captureBundlerRejection, captureValidationGasDiagnostic, exactRecord } from "@oaath/protocol";
|
|
1
|
+
import { captureBundlerRejection, captureValidationGasDiagnostic, exactRecord, serializeUserOperationFailure } from "@oaath/protocol";
|
|
2
2
|
//#region src/relay/errors.ts
|
|
3
3
|
/**
|
|
4
4
|
* Closed relay failure codes and their stable HTTP projection.
|
|
@@ -38,16 +38,16 @@ var OaathRelayError = class extends Error {
|
|
|
38
38
|
bundlerRejection;
|
|
39
39
|
code;
|
|
40
40
|
diagnostic;
|
|
41
|
-
constructor(code, message, diagnostic = null, bundlerRejection = null) {
|
|
42
|
-
super(message);
|
|
41
|
+
constructor(code, message, diagnostic = null, bundlerRejection = null, options) {
|
|
42
|
+
super(message, options);
|
|
43
43
|
this.name = "OaathRelayError";
|
|
44
44
|
this.code = code;
|
|
45
45
|
this.diagnostic = captureValidationGasDiagnostic(diagnostic);
|
|
46
46
|
this.bundlerRejection = code === "relay_chain_unavailable" ? captureBundlerRejection(bundlerRejection) : null;
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
|
-
function relayFailure(code, message, diagnostic = null, bundlerRejection = null) {
|
|
50
|
-
throw new OaathRelayError(code, message, diagnostic, bundlerRejection);
|
|
49
|
+
function relayFailure(code, message, diagnostic = null, bundlerRejection = null, options) {
|
|
50
|
+
throw new OaathRelayError(code, message, diagnostic, bundlerRejection, options);
|
|
51
51
|
}
|
|
52
52
|
/** Any non-relay throw is an unreadable internal failure, never caller-visible detail. */
|
|
53
53
|
function relayErrorCode(error) {
|
|
@@ -57,13 +57,15 @@ const RESPONSE_HEADERS = Object.freeze({
|
|
|
57
57
|
"content-type": "application/json; charset=utf-8",
|
|
58
58
|
"cache-control": "no-store"
|
|
59
59
|
});
|
|
60
|
-
function relayErrorResponse(code, diagnostic = null, bundlerRejection = null) {
|
|
60
|
+
function relayErrorResponse(code, diagnostic = null, bundlerRejection = null, cause) {
|
|
61
|
+
const failure = code === "relay_chain_unavailable" ? serializeUserOperationFailure(cause) : null;
|
|
61
62
|
const captured = code === "relay_chain_unavailable" ? captureValidationGasDiagnostic(diagnostic) : null;
|
|
62
63
|
const rejection = code === "relay_chain_unavailable" ? captureBundlerRejection(bundlerRejection) : null;
|
|
63
64
|
return jsonResponse(RELAY_ERROR_STATUS[code], { error: {
|
|
64
65
|
code,
|
|
65
66
|
...captured === null ? {} : { diagnostic: captured },
|
|
66
|
-
...rejection === null ? {} : { bundlerRejection: rejection }
|
|
67
|
+
...rejection === null ? {} : { bundlerRejection: rejection },
|
|
68
|
+
...failure === null ? {} : { failure }
|
|
67
69
|
} });
|
|
68
70
|
}
|
|
69
71
|
function jsonResponse(status, body) {
|
|
@@ -252,4 +254,4 @@ function parseEncryptedArtifactRecord(value) {
|
|
|
252
254
|
//#endregion
|
|
253
255
|
export { jsonResponse as _, OAATH_ENCRYPTED_ARTIFACT_RECORD_VERSION as a, relayFailure as b, canonicalIdentifier as c, parseAuthorizationRequestRecord as d, parseCapabilityInvalidationRecord as f, RELAY_ERROR_STATUS as g, OaathRelayError as h, OAATH_CAPABILITY_INVALIDATION_RECORD_VERSION as i, parseAuthorizationCodeRecord as l, timestamp as m, OAATH_AUTHORIZATION_DECISION_RECORD_VERSION as n, RELAY_LIMITS as o, parseEncryptedArtifactRecord as p, OAATH_AUTHORIZATION_REQUEST_RECORD_VERSION as r, boundedText as s, OAATH_AUTHORIZATION_CODE_RECORD_VERSION as t, parseAuthorizationDecisionRecord as u, relayErrorCode as v, relayErrorResponse as y };
|
|
254
256
|
|
|
255
|
-
//# sourceMappingURL=records-
|
|
257
|
+
//# sourceMappingURL=records-Bh8rOpBa.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"records-Bh8rOpBa.js","names":[],"sources":["../src/relay/errors.ts","../src/store/records.ts"],"sourcesContent":["/**\n * Closed relay failure codes and their stable HTTP projection.\n *\n * Machine decisions and wire responses use these codes only. `Error.message`\n * exists for local diagnostics and never reaches a response body.\n *\n * @author taek <leekt216@gmail.com>\n */\n\nimport {\n type BundlerRejection,\n captureBundlerRejection,\n captureValidationGasDiagnostic,\n serializeUserOperationFailure,\n type ValidationGasDiagnostic,\n} from \"@oaath/protocol\";\n\nexport type RelayErrorCode =\n /** Wire input is missing, malformed, oversized, or contains unknown fields. */\n | \"relay_request_invalid\"\n /** The deployment authentication port did not authenticate the caller. */\n | \"relay_unauthenticated\"\n /** Authenticated caller may not act in the required role. */\n | \"relay_forbidden\"\n /** Route, or a record the caller is entitled to see, does not exist. */\n | \"relay_not_found\"\n /** Route exists with a different method. */\n | \"relay_method_not_allowed\"\n /** The authorization request or code is past its injected-clock expiry. */\n | \"relay_expired\"\n /** The authorization request already reached a terminal decision. */\n | \"relay_already_decided\"\n /** The one-time authorization code was already consumed. */\n | \"relay_code_already_consumed\"\n /** The one-time encrypted artifact was already claimed. */\n | \"relay_artifact_already_claimed\"\n /**\n * Authorization code redemption failed. One code for every reason it can\n * fail — unknown code, another client's code, wrong redirect URI, wrong PKCE\n * verifier — so the endpoint never confirms that a guessed code was correct.\n * A code that existed is burned.\n */\n | \"relay_code_invalid\"\n /** The optional deployment limiter rejected the call. */\n | \"relay_rate_limited\"\n /** A durable record could not be read as the current schema version. */\n | \"relay_record_unreadable\"\n /** The KMS port was unavailable or returned an unusable result. */\n | \"relay_kms_unavailable\"\n /** The store failed before any state change could have been committed. */\n | \"relay_store_unavailable\"\n /**\n * The store could not prove whether a transition committed. The caller must\n * treat the transition as neither applied nor retryable: an ambiguous commit\n * never authorizes resubmission.\n */\n | \"relay_state_ambiguous\"\n /**\n * EXPERIMENTAL PREVIEW (`@oaath/server/apns`): the constructed APNs payload\n * exceeded Apple's 4096-byte limit, so nothing was sent.\n */\n | \"relay_apns_payload_too_large\"\n /**\n * EXPERIMENTAL PREVIEW (`@oaath/server/apns`): the injected Apple credential\n * capability is not a usable P-256 signing key, key id, team id, or topic.\n */\n | \"relay_apns_credentials_invalid\"\n /** A deployment-injected chain execution port failed or answered unusably. */\n | \"relay_chain_unavailable\"\n /** The Grant's capability is durably invalidated; nothing more executes here. */\n | \"relay_capability_invalidated\"\n /** An invariant the relay owns was violated. */\n | \"relay_internal\";\n\n/**\n * Status projection. `relay_state_ambiguous` is deliberately 500 and not 503,\n * because 503 invites the retry that an ambiguous commit forbids.\n */\nexport const RELAY_ERROR_STATUS: Readonly<Record<RelayErrorCode, number>> = Object.freeze({\n relay_request_invalid: 400,\n relay_unauthenticated: 401,\n relay_forbidden: 403,\n relay_not_found: 404,\n relay_method_not_allowed: 405,\n relay_expired: 410,\n relay_already_decided: 409,\n relay_code_already_consumed: 409,\n relay_artifact_already_claimed: 409,\n relay_code_invalid: 400,\n relay_rate_limited: 429,\n relay_record_unreadable: 500,\n relay_kms_unavailable: 503,\n relay_store_unavailable: 503,\n relay_state_ambiguous: 500,\n // The preview codes have no route. They are projected only so the union stays\n // closed and one owner keeps every code's status.\n relay_apns_payload_too_large: 500,\n relay_apns_credentials_invalid: 500,\n relay_chain_unavailable: 503,\n relay_capability_invalidated: 409,\n relay_internal: 500,\n});\n\nexport class OaathRelayError extends Error {\n readonly bundlerRejection: Readonly<BundlerRejection> | null;\n readonly code: RelayErrorCode;\n readonly diagnostic: Readonly<ValidationGasDiagnostic> | null;\n\n constructor(\n code: RelayErrorCode,\n message: string,\n diagnostic: Readonly<ValidationGasDiagnostic> | null = null,\n bundlerRejection: Readonly<BundlerRejection> | null = null,\n options?: ErrorOptions,\n ) {\n super(message, options);\n this.name = \"OaathRelayError\";\n this.code = code;\n this.diagnostic = captureValidationGasDiagnostic(diagnostic);\n this.bundlerRejection =\n code === \"relay_chain_unavailable\" ? captureBundlerRejection(bundlerRejection) : null;\n }\n}\n\nexport function relayFailure(\n code: RelayErrorCode,\n message: string,\n diagnostic: Readonly<ValidationGasDiagnostic> | null = null,\n bundlerRejection: Readonly<BundlerRejection> | null = null,\n options?: ErrorOptions,\n): never {\n throw new OaathRelayError(code, message, diagnostic, bundlerRejection, options);\n}\n\n/** Any non-relay throw is an unreadable internal failure, never caller-visible detail. */\nexport function relayErrorCode(error: unknown): RelayErrorCode {\n return error instanceof OaathRelayError ? error.code : \"relay_internal\";\n}\n\nconst RESPONSE_HEADERS: Readonly<Record<string, string>> = Object.freeze({\n \"content-type\": \"application/json; charset=utf-8\",\n \"cache-control\": \"no-store\",\n});\n\nexport function relayErrorResponse(\n code: RelayErrorCode,\n diagnostic: Readonly<ValidationGasDiagnostic> | null = null,\n bundlerRejection: Readonly<BundlerRejection> | null = null,\n cause?: unknown,\n): Response {\n const failure = code === \"relay_chain_unavailable\" ? serializeUserOperationFailure(cause) : null;\n const captured =\n code === \"relay_chain_unavailable\" ? captureValidationGasDiagnostic(diagnostic) : null;\n const rejection =\n code === \"relay_chain_unavailable\" ? captureBundlerRejection(bundlerRejection) : null;\n return jsonResponse(RELAY_ERROR_STATUS[code], {\n error: {\n code,\n ...(captured === null ? {} : { diagnostic: captured }),\n ...(rejection === null ? {} : { bundlerRejection: rejection }),\n ...(failure === null ? {} : { failure }),\n },\n });\n}\n\nexport function jsonResponse(status: number, body: unknown): Response {\n return new Response(JSON.stringify(body), { status, headers: RESPONSE_HEADERS });\n}\n","/**\n * Exact current-version durable relay records.\n *\n * Durable storage is a trust boundary: every read is captured into an exact,\n * owned, immutable record before typed code consumes it. There is exactly one\n * current version per record and no reader for any older version.\n *\n * These shapes are relay-owned for now. `@oaath/protocol` owns the wire\n * `AuthorizationRequest`, `AuthorizationDecision`, and `AuthorizationCode`\n * contracts; adopting them here is a follow-up because the units differ (this\n * store keeps epoch milliseconds, the protocol speaks whole seconds) and the\n * code digest differs (base64url WebCrypto here, `0x` hex there). Once adopted,\n * this file should keep only the store envelope around those records.\n *\n * @author taek <leekt216@gmail.com>\n */\n\nimport { type CaptureContext, exactRecord } from \"@oaath/protocol\";\nimport { type RelayErrorCode, relayFailure } from \"../relay/errors.js\";\n\nexport const OAATH_AUTHORIZATION_REQUEST_RECORD_VERSION =\n \"oaath.authorization-request-record/v2\" as const;\nexport const OAATH_AUTHORIZATION_DECISION_RECORD_VERSION =\n \"oaath.authorization-decision-record/v1\" as const;\nexport const OAATH_AUTHORIZATION_CODE_RECORD_VERSION =\n \"oaath.authorization-code-record/v1\" as const;\nexport const OAATH_ENCRYPTED_ARTIFACT_RECORD_VERSION =\n \"oaath.encrypted-artifact-record/v1\" as const;\nexport const OAATH_CAPABILITY_INVALIDATION_RECORD_VERSION =\n \"oaath.capability-invalidation-record/v1\" as const;\n\n/** Bounded field limits owned here and shared with wire capture. */\nexport const RELAY_LIMITS = Object.freeze({\n identifier: 256,\n redirectUri: 2048,\n codeChallenge: 128,\n codeVerifier: 128,\n requestedScope: 8192,\n artifactPlaintext: 32_768,\n ciphertextRef: 65_536,\n});\n\nconst MAX_TIMESTAMP = Number.MAX_SAFE_INTEGER;\n\n/** Deployment-selected device reference and its authenticated approving subject. */\nexport interface AuthorizationOwnerRoute {\n readonly ownerDeviceId: string;\n readonly ownerSubject: string;\n}\n\nexport interface AuthorizationRequestRecord extends AuthorizationOwnerRoute {\n readonly version: typeof OAATH_AUTHORIZATION_REQUEST_RECORD_VERSION;\n readonly requestId: string;\n /** Client bound by the deployment authentication port, never by wire input. */\n readonly clientId: string;\n /** Requesting member's subject, independent of the approving device. */\n readonly subject: string;\n /**\n * Organization/audience bound by the authentication port at creation time,\n * or null when the deployment declares none. Grant reference verification\n * compares assertions against this captured value.\n */\n readonly organizationAudience: string | null;\n readonly redirectUri: string;\n /** PKCE S256 challenge; the verifier never reaches the store. */\n readonly codeChallenge: string;\n /** Opaque owner-reviewed scope payload. Migrates to @oaath/protocol. */\n readonly requestedScope: string;\n readonly createdAt: number;\n readonly expiresAt: number;\n}\n\nexport type AuthorizationDecisionOutcome = \"approved\" | \"rejected\";\n\n/**\n * Terminal decision. Its existence is the single authoritative fact that an\n * authorization request was decided; the request record never mutates.\n */\nexport interface AuthorizationDecisionRecord {\n readonly version: typeof OAATH_AUTHORIZATION_DECISION_RECORD_VERSION;\n readonly requestId: string;\n readonly outcome: AuthorizationDecisionOutcome;\n readonly decidedAt: number;\n /**\n * KMS-sealed copy of the released code for authenticated client pickup, and\n * its expiry. The relay mints the code itself, so holding a sealed copy adds\n * no new trust; PKCE still guards consumption. Both are null exactly when\n * the outcome is a rejection.\n */\n readonly codeRef: string | null;\n readonly codeExpiresAt: number | null;\n}\n\nexport interface AuthorizationCodeRecord {\n readonly version: typeof OAATH_AUTHORIZATION_CODE_RECORD_VERSION;\n /** SHA-256 (base64url) of the released code. The code itself is never stored. */\n readonly codeHash: string;\n readonly requestId: string;\n /** Binding snapshot taken at issue time so consume needs exactly one row lock. */\n readonly clientId: string;\n readonly redirectUri: string;\n readonly codeChallenge: string;\n readonly artifactId: string;\n readonly createdAt: number;\n readonly expiresAt: number;\n /** Set exactly once. A non-null value is terminal. */\n readonly consumedAt: number | null;\n}\n\nexport interface EncryptedArtifactRecord {\n readonly version: typeof OAATH_ENCRYPTED_ARTIFACT_RECORD_VERSION;\n readonly artifactId: string;\n readonly requestId: string;\n readonly clientId: string;\n /** Opaque KMS reference. Plaintext never reaches the store. */\n readonly ciphertextRef: string;\n readonly createdAt: number;\n /** Set exactly once. A non-null value is terminal. */\n readonly claimedAt: number | null;\n}\n\n/**\n * One durable capability invalidation: from the moment this record commits,\n * the relay's chain execution routes refuse every submission and usage read\n * for the Grant, so the recorded evidence states an enforced fact — \"this\n * service will no longer act for this capability\" — not a bare digest.\n * Consuming the on-chain install nonce is the chain-local revocation\n * operation's job and stays separate evidence.\n */\nexport interface CapabilityInvalidationRecord {\n readonly version: typeof OAATH_CAPABILITY_INVALIDATION_RECORD_VERSION;\n readonly grantId: string;\n /** The authenticated client that recorded the invalidation. */\n readonly clientId: string;\n readonly capabilityHash: string;\n readonly invalidatedAt: number;\n}\n\nexport function boundedText(\n value: unknown,\n maximum: number,\n label: string,\n code: RelayErrorCode,\n): string {\n if (typeof value !== \"string\" || value.length < 1 || value.length > maximum) {\n return relayFailure(code, `${label} must be a bounded non-empty string`);\n }\n // Control characters would corrupt logs and downstream headers.\n for (let index = 0; index < value.length; index += 1) {\n const unit = value.charCodeAt(index);\n if (unit < 0x20 || unit === 0x7f) {\n return relayFailure(code, `${label} must not contain control characters`);\n }\n }\n return value;\n}\n\nexport function canonicalIdentifier(value: unknown, label: string, code: RelayErrorCode): string {\n const text = boundedText(value, RELAY_LIMITS.identifier, label, code);\n if (!/^[A-Za-z0-9._~-]+$/u.test(text)) {\n return relayFailure(code, `${label} must be URL-safe`);\n }\n return text;\n}\n\nexport function timestamp(value: unknown, label: string, code: RelayErrorCode): number {\n if (\n typeof value !== \"number\" ||\n !Number.isSafeInteger(value) ||\n Object.is(value, -0) ||\n value < 0 ||\n value > MAX_TIMESTAMP\n ) {\n return relayFailure(code, `${label} must be a non-negative safe integer`);\n }\n return value;\n}\n\nfunction nullableTimestamp(value: unknown, label: string, code: RelayErrorCode): number | null {\n return value === null ? null : timestamp(value, label, code);\n}\n\nconst UNREADABLE: RelayErrorCode = \"relay_record_unreadable\";\n\nfunction captured(value: unknown, keys: readonly string[], label: string): Record<string, unknown> {\n const context: CaptureContext = new WeakSet();\n return exactRecord(value, keys, label, context, (message) => relayFailure(UNREADABLE, message));\n}\n\nfunction version<Value extends string>(value: unknown, expected: Value, label: string): Value {\n if (value !== expected) {\n return relayFailure(UNREADABLE, `${label} version is unsupported`);\n }\n return expected;\n}\n\nexport function parseCapabilityInvalidationRecord(value: unknown): CapabilityInvalidationRecord {\n const record = captured(\n value,\n [\"version\", \"grantId\", \"clientId\", \"capabilityHash\", \"invalidatedAt\"],\n \"capability invalidation record\",\n );\n const capabilityHash = boundedText(record.capabilityHash, 66, \"capabilityHash\", UNREADABLE);\n if (!/^0x[0-9a-f]{64}$/u.test(capabilityHash)) {\n return relayFailure(UNREADABLE, \"capabilityHash must be a lowercase 32-byte hash\");\n }\n return Object.freeze({\n version: version(\n record.version,\n OAATH_CAPABILITY_INVALIDATION_RECORD_VERSION,\n \"capability invalidation record\",\n ),\n grantId: canonicalIdentifier(record.grantId, \"grantId\", UNREADABLE),\n clientId: canonicalIdentifier(record.clientId, \"clientId\", UNREADABLE),\n capabilityHash,\n invalidatedAt: timestamp(record.invalidatedAt, \"invalidatedAt\", UNREADABLE),\n });\n}\n\nexport function parseAuthorizationRequestRecord(value: unknown): AuthorizationRequestRecord {\n const record = captured(\n value,\n [\n \"version\",\n \"requestId\",\n \"clientId\",\n \"subject\",\n \"ownerDeviceId\",\n \"ownerSubject\",\n \"organizationAudience\",\n \"redirectUri\",\n \"codeChallenge\",\n \"requestedScope\",\n \"createdAt\",\n \"expiresAt\",\n ],\n \"authorization request record\",\n );\n return Object.freeze({\n version: version(\n record.version,\n OAATH_AUTHORIZATION_REQUEST_RECORD_VERSION,\n \"authorization request record\",\n ),\n requestId: canonicalIdentifier(record.requestId, \"requestId\", UNREADABLE),\n clientId: canonicalIdentifier(record.clientId, \"clientId\", UNREADABLE),\n subject: canonicalIdentifier(record.subject, \"subject\", UNREADABLE),\n ownerDeviceId: canonicalIdentifier(record.ownerDeviceId, \"ownerDeviceId\", UNREADABLE),\n ownerSubject: canonicalIdentifier(record.ownerSubject, \"ownerSubject\", UNREADABLE),\n organizationAudience:\n record.organizationAudience === null\n ? null\n : canonicalIdentifier(record.organizationAudience, \"organizationAudience\", UNREADABLE),\n redirectUri: boundedText(\n record.redirectUri,\n RELAY_LIMITS.redirectUri,\n \"redirectUri\",\n UNREADABLE,\n ),\n codeChallenge: canonicalIdentifier(record.codeChallenge, \"codeChallenge\", UNREADABLE),\n requestedScope: boundedText(\n record.requestedScope,\n RELAY_LIMITS.requestedScope,\n \"requestedScope\",\n UNREADABLE,\n ),\n createdAt: timestamp(record.createdAt, \"createdAt\", UNREADABLE),\n expiresAt: timestamp(record.expiresAt, \"expiresAt\", UNREADABLE),\n });\n}\n\nexport function parseAuthorizationDecisionRecord(value: unknown): AuthorizationDecisionRecord {\n const record = captured(\n value,\n [\"version\", \"requestId\", \"outcome\", \"decidedAt\", \"codeRef\", \"codeExpiresAt\"],\n \"authorization decision record\",\n );\n if (record.outcome !== \"approved\" && record.outcome !== \"rejected\") {\n return relayFailure(UNREADABLE, \"decision outcome is unsupported\");\n }\n // The sealed code exists exactly when a code was released: an approval with\n // no pickup copy or a rejection carrying one is an unreadable record.\n if ((record.outcome === \"approved\") !== (record.codeRef !== null)) {\n return relayFailure(UNREADABLE, \"decision code reference does not match the outcome\");\n }\n if ((record.codeRef === null) !== (record.codeExpiresAt === null)) {\n return relayFailure(UNREADABLE, \"decision code expiry does not match its reference\");\n }\n return Object.freeze({\n version: version(\n record.version,\n OAATH_AUTHORIZATION_DECISION_RECORD_VERSION,\n \"authorization decision record\",\n ),\n requestId: canonicalIdentifier(record.requestId, \"requestId\", UNREADABLE),\n outcome: record.outcome,\n decidedAt: timestamp(record.decidedAt, \"decidedAt\", UNREADABLE),\n codeRef:\n record.codeRef === null\n ? null\n : boundedText(record.codeRef, RELAY_LIMITS.ciphertextRef, \"codeRef\", UNREADABLE),\n codeExpiresAt:\n record.codeExpiresAt === null\n ? null\n : timestamp(record.codeExpiresAt, \"codeExpiresAt\", UNREADABLE),\n });\n}\n\nexport function parseAuthorizationCodeRecord(value: unknown): AuthorizationCodeRecord {\n const record = captured(\n value,\n [\n \"version\",\n \"codeHash\",\n \"requestId\",\n \"clientId\",\n \"redirectUri\",\n \"codeChallenge\",\n \"artifactId\",\n \"createdAt\",\n \"expiresAt\",\n \"consumedAt\",\n ],\n \"authorization code record\",\n );\n return Object.freeze({\n version: version(\n record.version,\n OAATH_AUTHORIZATION_CODE_RECORD_VERSION,\n \"authorization code record\",\n ),\n codeHash: canonicalIdentifier(record.codeHash, \"codeHash\", UNREADABLE),\n requestId: canonicalIdentifier(record.requestId, \"requestId\", UNREADABLE),\n clientId: canonicalIdentifier(record.clientId, \"clientId\", UNREADABLE),\n redirectUri: boundedText(\n record.redirectUri,\n RELAY_LIMITS.redirectUri,\n \"redirectUri\",\n UNREADABLE,\n ),\n codeChallenge: canonicalIdentifier(record.codeChallenge, \"codeChallenge\", UNREADABLE),\n artifactId: canonicalIdentifier(record.artifactId, \"artifactId\", UNREADABLE),\n createdAt: timestamp(record.createdAt, \"createdAt\", UNREADABLE),\n expiresAt: timestamp(record.expiresAt, \"expiresAt\", UNREADABLE),\n consumedAt: nullableTimestamp(record.consumedAt, \"consumedAt\", UNREADABLE),\n });\n}\n\nexport function parseEncryptedArtifactRecord(value: unknown): EncryptedArtifactRecord {\n const record = captured(\n value,\n [\"version\", \"artifactId\", \"requestId\", \"clientId\", \"ciphertextRef\", \"createdAt\", \"claimedAt\"],\n \"encrypted artifact record\",\n );\n return Object.freeze({\n version: version(\n record.version,\n OAATH_ENCRYPTED_ARTIFACT_RECORD_VERSION,\n \"encrypted artifact record\",\n ),\n artifactId: canonicalIdentifier(record.artifactId, \"artifactId\", UNREADABLE),\n requestId: canonicalIdentifier(record.requestId, \"requestId\", UNREADABLE),\n clientId: canonicalIdentifier(record.clientId, \"clientId\", UNREADABLE),\n ciphertextRef: boundedText(\n record.ciphertextRef,\n RELAY_LIMITS.ciphertextRef,\n \"ciphertextRef\",\n UNREADABLE,\n ),\n createdAt: timestamp(record.createdAt, \"createdAt\", UNREADABLE),\n claimedAt: nullableTimestamp(record.claimedAt, \"claimedAt\", UNREADABLE),\n });\n}\n"],"mappings":";;;;;;;;;;;;;;AA8EA,MAAa,qBAA+D,OAAO,OAAO;CACxF,uBAAuB;CACvB,uBAAuB;CACvB,iBAAiB;CACjB,iBAAiB;CACjB,0BAA0B;CAC1B,eAAe;CACf,uBAAuB;CACvB,6BAA6B;CAC7B,gCAAgC;CAChC,oBAAoB;CACpB,oBAAoB;CACpB,yBAAyB;CACzB,uBAAuB;CACvB,yBAAyB;CACzB,uBAAuB;CA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U,OAAO,WAAW,aAAa,UAAU;EAC9D,WAAW,UAAU,OAAO,WAAW,aAAa,UAAU;EAC9D,YAAY,kBAAkB,OAAO,YAAY,cAAc,UAAU;CAC3E,CAAC;AACH;AAEA,SAAgB,6BAA6B,OAAyC;CACpF,MAAM,SAAS,SACb,OACA;EAAC;EAAW;EAAc;EAAa;EAAY;EAAiB;EAAa;CAAW,GAC5F,2BACF;CACA,OAAO,OAAO,OAAO;EACnB,SAAS,QACP,OAAO,SACP,yCACA,2BACF;EACA,YAAY,oBAAoB,OAAO,YAAY,cAAc,UAAU;EAC3E,WAAW,oBAAoB,OAAO,WAAW,aAAa,UAAU;EACxE,UAAU,oBAAoB,OAAO,UAAU,YAAY,UAAU;EACrE,eAAe,YACb,OAAO,eACP,aAAa,eACb,iBACA,UACF;EACA,WAAW,UAAU,OAAO,WAAW,aAAa,UAAU;EAC9D,WAAW,kBAAkB,OAAO,WAAW,aAAa,UAAU;CACxE,CAAC;AACH"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as relayFailure, c as canonicalIdentifier, m as timestamp, o as RELAY_LIMITS, s as boundedText } from "./records-
|
|
1
|
+
import { b as relayFailure, c as canonicalIdentifier, m as timestamp, o as RELAY_LIMITS, s as boundedText } from "./records-Bh8rOpBa.js";
|
|
2
2
|
import { exactRecord, parseKernelRevocationSigningRequest } from "@oaath/protocol";
|
|
3
3
|
//#region src/revocation/records.ts
|
|
4
4
|
/** Current immutable revocation request and terminal phone decision. No submission evidence. */
|
|
@@ -67,4 +67,4 @@ function parseRevocationDecisionRecord(value) {
|
|
|
67
67
|
//#endregion
|
|
68
68
|
export { parseRevocationRequestRecord as a, parseRevocationDecisionRecord as i, OAATH_REVOCATION_REQUEST_RECORD_VERSION as n, REVOCATION_OPERATION_PREFIX as r, OAATH_REVOCATION_DECISION_RECORD_VERSION as t };
|
|
69
69
|
|
|
70
|
-
//# sourceMappingURL=records-
|
|
70
|
+
//# sourceMappingURL=records-lPGo4RxO.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"records-
|
|
1
|
+
{"version":3,"file":"records-lPGo4RxO.js","names":[],"sources":["../src/revocation/records.ts"],"sourcesContent":["/** Current immutable revocation request and terminal phone decision. No submission evidence. */\nimport {\n exactRecord,\n type KernelRevocationSigningRequest,\n parseKernelRevocationSigningRequest,\n} from \"@oaath/protocol\";\nimport { relayFailure } from \"../relay/errors.js\";\nimport { boundedText, canonicalIdentifier, RELAY_LIMITS, timestamp } from \"../store/records.js\";\n\nexport const OAATH_REVOCATION_REQUEST_RECORD_VERSION =\n \"oaath.revocation-request-record/v1\" as const;\nexport const OAATH_REVOCATION_DECISION_RECORD_VERSION =\n \"oaath.revocation-decision-record/v1\" as const;\n/** Separates owner operations from authorization request IDs on the shared phone route. */\nexport const REVOCATION_OPERATION_PREFIX = \"revocation-\";\n\nexport interface RevocationRequestRecord {\n readonly version: typeof OAATH_REVOCATION_REQUEST_RECORD_VERSION;\n readonly operationId: string;\n readonly ownerDeviceId: string;\n readonly ownerSubject: string;\n readonly createdAt: number;\n readonly expiresAt: number;\n readonly signingRequest: Readonly<KernelRevocationSigningRequest>;\n}\nexport interface RevocationDecisionRecord {\n readonly version: typeof OAATH_REVOCATION_DECISION_RECORD_VERSION;\n readonly operationId: string;\n readonly outcome: \"approved\" | \"rejected\";\n readonly decidedAt: number;\n /** Sealed canonical phone artifact; null exactly for rejection. Never an OAuth release. */\n readonly artifactRef: string | null;\n}\nconst UNREADABLE = \"relay_record_unreadable\" as const;\nconst fail = (message: string): never => relayFailure(UNREADABLE, message);\nfunction capture(value: unknown, keys: readonly string[]): Record<string, unknown> {\n return exactRecord(value, keys, \"revocation record\", new WeakSet(), fail);\n}\nfunction operationId(value: unknown): string {\n const id = canonicalIdentifier(value, \"operationId\", UNREADABLE);\n if (!id.startsWith(REVOCATION_OPERATION_PREFIX) || id.length > 64)\n return fail(\"revocation operation ID is invalid\");\n return id;\n}\nexport function parseRevocationRequestRecord(value: unknown): Readonly<RevocationRequestRecord> {\n const record = capture(value, [\n \"version\",\n \"operationId\",\n \"ownerDeviceId\",\n \"ownerSubject\",\n \"createdAt\",\n \"expiresAt\",\n \"signingRequest\",\n ]);\n if (record.version !== OAATH_REVOCATION_REQUEST_RECORD_VERSION)\n return fail(\"revocation request version is unsupported\");\n const createdAt = timestamp(record.createdAt, \"createdAt\", UNREADABLE);\n const expiresAt = timestamp(record.expiresAt, \"expiresAt\", UNREADABLE);\n if (expiresAt < createdAt) return fail(\"revocation request expiry precedes creation\");\n let signingRequest: Readonly<KernelRevocationSigningRequest>;\n try {\n signingRequest = parseKernelRevocationSigningRequest(record.signingRequest);\n } catch {\n return fail(\"stored revocation signing request is unreadable\");\n }\n return Object.freeze({\n version: record.version,\n operationId: operationId(record.operationId),\n ownerDeviceId: canonicalIdentifier(record.ownerDeviceId, \"ownerDeviceId\", UNREADABLE),\n ownerSubject: canonicalIdentifier(record.ownerSubject, \"ownerSubject\", UNREADABLE),\n createdAt,\n expiresAt,\n signingRequest,\n });\n}\nexport function parseRevocationDecisionRecord(value: unknown): Readonly<RevocationDecisionRecord> {\n const record = capture(value, [\"version\", \"operationId\", \"outcome\", \"decidedAt\", \"artifactRef\"]);\n if (\n record.version !== OAATH_REVOCATION_DECISION_RECORD_VERSION ||\n (record.outcome !== \"approved\" && record.outcome !== \"rejected\")\n )\n return fail(\"revocation decision is unsupported\");\n if ((record.outcome === \"rejected\") !== (record.artifactRef === null))\n return fail(\"revocation decision contradicts artifact custody\");\n return Object.freeze({\n version: record.version,\n operationId: operationId(record.operationId),\n outcome: record.outcome,\n decidedAt: timestamp(record.decidedAt, \"decidedAt\", UNREADABLE),\n artifactRef:\n record.artifactRef === null\n ? null\n : boundedText(record.artifactRef, RELAY_LIMITS.ciphertextRef, \"artifactRef\", UNREADABLE),\n });\n}\n"],"mappings":";;;;AASA,MAAa,0CACX;AACF,MAAa,2CACX;;AAEF,MAAa,8BAA8B;AAmB3C,MAAM,aAAa;AACnB,MA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,OAAO,WAAW;EAC3C,SAAS,OAAO;EAChB,WAAW,UAAU,OAAO,WAAW,aAAa,UAAU;EAC9D,aACE,OAAO,gBAAgB,OACnB,OACA,YAAY,OAAO,aAAa,aAAa,eAAe,eAAe,UAAU;CAC7F,CAAC;AACH"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { b as relayFailure, c as canonicalIdentifier, m as timestamp, o as RELAY_LIMITS, r as OAATH_AUTHORIZATION_REQUEST_RECORD_VERSION, s as boundedText } from "./records-
|
|
2
|
-
import { a as relayNow, n as randomIdentifier, r as sha256Base64Url, t as isCodeChallengeS256 } from "./challenge-
|
|
3
|
-
import { n as OAATH_REVOCATION_REQUEST_RECORD_VERSION, r as REVOCATION_OPERATION_PREFIX, t as OAATH_REVOCATION_DECISION_RECORD_VERSION } from "./records-
|
|
1
|
+
import { b as relayFailure, c as canonicalIdentifier, m as timestamp, o as RELAY_LIMITS, r as OAATH_AUTHORIZATION_REQUEST_RECORD_VERSION, s as boundedText } from "./records-Bh8rOpBa.js";
|
|
2
|
+
import { a as relayNow, n as randomIdentifier, r as sha256Base64Url, t as isCodeChallengeS256 } from "./challenge-WmeNbyox.js";
|
|
3
|
+
import { n as OAATH_REVOCATION_REQUEST_RECORD_VERSION, r as REVOCATION_OPERATION_PREFIX, t as OAATH_REVOCATION_DECISION_RECORD_VERSION } from "./records-lPGo4RxO.js";
|
|
4
4
|
import { applyPermissionDecision, captureRecord, createGrantFromPermissionRequest, exactRecord, hashKernelRevocationSigningRequest, hashOwnerSigningRequest, hashPermissionRequest, isKernelExistingAccountProfile, parseKernelReplayableInstallOwnerSigningRequest, parseKernelRevocationSigningRequest, parseOwnerSigningArtifact, parseOwnerSigningRequest, parsePermissionDecision, parsePermissionRequest, sameOwnerCredentialProfile, serializeOwnerSigningArtifact } from "@oaath/protocol";
|
|
5
5
|
import { p256 } from "@noble/curves/nist.js";
|
|
6
6
|
import { hexToBytes } from "@noble/hashes/utils.js";
|
|
@@ -703,4 +703,4 @@ async function submitOwnerPhoneRevocationDecision(input) {
|
|
|
703
703
|
//#endregion
|
|
704
704
|
export { withRelayTransaction as S, verifyKernelV4ReplayableInstallOwnerSigningArtifact as _, submitOwnerPhoneRevocationDecision as a, openArtifact as b, projectOwnerPhonePermissionSigning as c, classifyStoredAuthorizationScope as d, createAuthorizationRequest as f, ownerPhoneDisplayPayload as g, NATIVE_DISPLAY_PAYLOAD_LENGTH as h, requestOwnerPhoneRevocation as i, projectOwnerPhoneRequest as l, readAuthorizationState as m, fetchOwnerPhoneRevocation as n, projectOwnerPhoneRevocation as o, fetchAuthorizationRequest as p, readRevocationState as r, OAATH_NATIVE_PROJECTION_VERSION as s, fetchClientPhoneRevocation as t, prepareOwnerPhonePermissionApproval as u, parseApprovedPermission as v, sealArtifact as x, readApprovedPermission as y };
|
|
705
705
|
|
|
706
|
-
//# sourceMappingURL=service-
|
|
706
|
+
//# sourceMappingURL=service-DT0vkKop.js.map
|