@cauthyhq/node 1.0.0 → 1.2.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/express.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import { IncomingMessage, ServerResponse } from 'node:http';
2
- import { S as Session, C as Cauthy } from './cauthy-B6Sm3T8M.js';
2
+ import { S as Session, C as Cauthy } from './cauthy-C7gZ-pbv.js';
3
3
  import './keys-D5k0omTb.js';
4
4
  import 'jose';
5
5
  import './theme.js';
6
+ import './identity-BTJ8NB_w.js';
6
7
 
7
8
  declare global {
8
9
  namespace Express {
@@ -1,8 +1,9 @@
1
1
  import { FastifyReply, FastifyPluginAsync, FastifyInstance } from 'fastify';
2
- import { S as Session, C as Cauthy } from './cauthy-ClP5orP4.mjs';
2
+ import { S as Session, C as Cauthy } from './cauthy-CCSSj3Lg.mjs';
3
3
  import './keys-D5k0omTb.mjs';
4
4
  import 'jose';
5
5
  import './theme.mjs';
6
+ import './identity-BTJ8NB_w.mjs';
6
7
 
7
8
  declare module 'fastify' {
8
9
  interface FastifyRequest {
package/dist/fastify.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import { FastifyReply, FastifyPluginAsync, FastifyInstance } from 'fastify';
2
- import { S as Session, C as Cauthy } from './cauthy-B6Sm3T8M.js';
2
+ import { S as Session, C as Cauthy } from './cauthy-C7gZ-pbv.js';
3
3
  import './keys-D5k0omTb.js';
4
4
  import 'jose';
5
5
  import './theme.js';
6
+ import './identity-BTJ8NB_w.js';
6
7
 
7
8
  declare module 'fastify' {
8
9
  interface FastifyRequest {
package/dist/hono.d.mts CHANGED
@@ -1,8 +1,9 @@
1
1
  import { MiddlewareHandler } from 'hono';
2
- import { S as Session, C as Cauthy } from './cauthy-ClP5orP4.mjs';
2
+ import { S as Session, C as Cauthy } from './cauthy-CCSSj3Lg.mjs';
3
3
  import './keys-D5k0omTb.mjs';
4
4
  import 'jose';
5
5
  import './theme.mjs';
6
+ import './identity-BTJ8NB_w.mjs';
6
7
 
7
8
  /** What the middleware keeps on the context: `new Hono<{ Variables: CauthyVariables }>()`. */
8
9
  interface CauthyVariables {
package/dist/hono.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import { MiddlewareHandler } from 'hono';
2
- import { S as Session, C as Cauthy } from './cauthy-B6Sm3T8M.js';
2
+ import { S as Session, C as Cauthy } from './cauthy-C7gZ-pbv.js';
3
3
  import './keys-D5k0omTb.js';
4
4
  import 'jose';
5
5
  import './theme.js';
6
+ import './identity-BTJ8NB_w.js';
6
7
 
7
8
  /** What the middleware keeps on the context: `new Hono<{ Variables: CauthyVariables }>()`. */
8
9
  interface CauthyVariables {
@@ -0,0 +1,27 @@
1
+ /** What `GET /v1/connect/self` answers. */
2
+ interface Identity {
3
+ issuer: string;
4
+ audience: string;
5
+ tenant: {
6
+ id: string;
7
+ slug: string;
8
+ };
9
+ system: string;
10
+ client_id: string;
11
+ sign_in_client_id: string;
12
+ app_urls: string[];
13
+ callback_path: string;
14
+ key: {
15
+ kid: string;
16
+ retires_at: string | null;
17
+ } | null;
18
+ contract: {
19
+ link: string;
20
+ system_proof?: 'off' | 'auto' | 'required';
21
+ require_verified_email?: boolean;
22
+ in_step?: boolean;
23
+ checked_at?: string;
24
+ } | null;
25
+ }
26
+
27
+ export type { Identity as I };
@@ -0,0 +1,27 @@
1
+ /** What `GET /v1/connect/self` answers. */
2
+ interface Identity {
3
+ issuer: string;
4
+ audience: string;
5
+ tenant: {
6
+ id: string;
7
+ slug: string;
8
+ };
9
+ system: string;
10
+ client_id: string;
11
+ sign_in_client_id: string;
12
+ app_urls: string[];
13
+ callback_path: string;
14
+ key: {
15
+ kid: string;
16
+ retires_at: string | null;
17
+ } | null;
18
+ contract: {
19
+ link: string;
20
+ system_proof?: 'off' | 'auto' | 'required';
21
+ require_verified_email?: boolean;
22
+ in_step?: boolean;
23
+ checked_at?: string;
24
+ } | null;
25
+ }
26
+
27
+ export type { Identity as I };
package/dist/index.d.mts CHANGED
@@ -1,8 +1,27 @@
1
- export { A as AttributeType, a as CatalogResource, C as Cauthy, b as CauthyApiError, c as CauthyConfigError, d as CauthyEvent, e as CauthyOptions, f as CauthyPact, g as CauthySystem, h as CauthyTokenError, i as CauthyUnavailableError, j as CauthyWebhookError, k as CheckOf, l as CheckQuestion, m as CheckResult, n as CheckRule, o as ConditionalPermission, p as ContractOptions, J as JsonValue, M as MountTarget, N as NewMember, O as Organization, q as OrganizationMember, r as OrganizationRef, P as PactItem, s as PactStatus, t as PermissionOf, u as Permitted, v as Policy, w as PolicyDefinition, x as PolicyPermission, y as PolicyRole, z as PublicSession, B as PushPolicyOptions, R as ReplayStore, D as Resolved, E as ResolvedContract, F as RoleOf, G as STANDARD_VARIABLES, S as Session, H as SessionOrganization, I as SessionStatus, K as SessionUser, L as SystemKey, Q as SystemOptions, T as SystemPolicy, U as TokenIdentity, V as TokenRefusal, W as VerifyTokenOptions, X as VerifyWebhookOptions, Y as can, Z as createCauthy, _ as createSystem, $ as createTokenVerifier, a0 as definePolicy, a1 as failClosed, a2 as memoryReplayStore, a3 as policySource, a4 as pullCatalog, a5 as pullPolicy, a6 as pushCatalog, a7 as pushPolicy, a8 as readContract, a9 as remoteKeys, aa as verifyToken, ab as verifyWebhook } from './cauthy-ClP5orP4.mjs';
1
+ export { A as AttributeType, a as CatalogResource, C as Cauthy, b as CauthyApiError, c as CauthyConfigError, d as CauthyEvent, e as CauthyKeyError, f as CauthyKeyReason, g as CauthyOptions, h as CauthyPact, i as CauthySystem, j as CauthyTokenError, k as CauthyUnavailableError, l as CauthyWebhookError, m as CheckOf, n as CheckQuestion, o as CheckResult, p as CheckRule, q as ConditionalPermission, r as ContractOptions, J as JsonValue, M as MountTarget, N as NewMember, O as Organization, s as OrganizationMember, t as OrganizationRef, P as PactItem, u as PactStatus, v as PermissionOf, w as Permitted, x as Policy, y as PolicyDefinition, z as PolicyPermission, B as PolicyRole, D as PublicSession, E as PushPolicyOptions, R as ReplayStore, F as Resolved, G as ResolvedContract, H as RoleOf, I as STANDARD_VARIABLES, S as Session, K as SessionOrganization, L as SessionStatus, Q as SessionUser, T as SystemKey, U as SystemOptions, V as SystemPolicy, W as TokenIdentity, X as TokenRefusal, Y as VerifyTokenOptions, Z as VerifyWebhookOptions, _ as can, $ as createCauthy, a0 as createSystem, a1 as createTokenVerifier, a2 as createVerifierFromEnv, a3 as definePolicy, a4 as failClosed, a5 as memoryReplayStore, a6 as policySource, a7 as pullCatalog, a8 as pullPolicy, a9 as pushCatalog, aa as pushPolicy, ab as readContract, ac as remoteKeys, ad as verifyToken, ae as verifyWebhook } from './cauthy-CCSSj3Lg.mjs';
2
+ export { I as Identity } from './identity-BTJ8NB_w.mjs';
2
3
  export { K as KeyStore, P as PactKeys, S as StoredKey } from './keys-D5k0omTb.mjs';
3
4
  export { CauthyTheme, ImportedTheme, PushThemeOptions, StackmythThemeOptions, StackmythTokens, ThemeFont, ThemeTexts, pushTheme, themeFromStackmyth, tokensFromStackmyth } from './theme.mjs';
4
5
  import 'jose';
5
6
 
7
+ /**
8
+ * The variables CAUTHY_KEY replaces: set beside it, each is a second source
9
+ * of the same thing, and the application refuses to start (key/cauthy-key.md §10).
10
+ */
11
+ declare const KEY_REPLACES: readonly ["CAUTHY_ISSUER", "CAUTHY_CLIENT_ID", "CAUTHY_CLIENT_SECRET", "CAUTHY_SYSTEM", "CAUTHY_TENANT", "CAUTHY_SYSTEM_KEY", "CAUTHY_SYSTEM_KEY_ID", "CAUTHY_BASE_URL", "CAUTHY_AUDIENCE", "CAUTHY_TENANT_ID"];
12
+ /** What a CAUTHY_KEY names. Never logged, never printed. */
13
+ interface CauthyKey {
14
+ /** Cauthy's origin, e.g. https://cauthy.api.example.com */
15
+ issuer: string;
16
+ clientId: string;
17
+ /** The 43-character secret segment: the HKDF input, as text. */
18
+ secret: string;
19
+ }
20
+ /** Reads a CAUTHY_KEY; throws CauthyKeyError with the reason, never the value. */
21
+ declare function parseKey(text: string): CauthyKey;
22
+ /** Writes a CAUTHY_KEY (what the dashboard does in the browser; here for tests and tools). */
23
+ declare function composeKey(issuer: string, clientId: string, secret: string): string;
24
+
6
25
  interface ConnectOptions {
7
26
  /** The system's name, as its organizations are filed under: lowercase, digits, - or _. */
8
27
  system: string;
@@ -135,4 +154,4 @@ declare const PROTOCOL_VERSION = "1";
135
154
  */
136
155
  type NextStep = 'done' | 'mfa' | 'verify_email' | 'code' | 'passkey' | 'one_tap' | 'redirect';
137
156
 
138
- export { type AuthField, type ConnectOptions, type Connected, DEFAULT_PASSWORD_POLICY, type FieldProblem, MIN_PASSWORD, type NextStep, PROTOCOL_VERSION, type PasswordClass, type PasswordLocale, type PasswordPolicy, type PasswordReason, checkCode, checkEmail, checkName, checkNewPassword, checkPassword, connectSystem, describePasswordPolicy, explainPasswordProblems, passwordPolicyOf, passwordProblems };
157
+ export { type AuthField, type CauthyKey, type ConnectOptions, type Connected, DEFAULT_PASSWORD_POLICY, type FieldProblem, KEY_REPLACES, MIN_PASSWORD, type NextStep, PROTOCOL_VERSION, type PasswordClass, type PasswordLocale, type PasswordPolicy, type PasswordReason, checkCode, checkEmail, checkName, checkNewPassword, checkPassword, composeKey, connectSystem, describePasswordPolicy, explainPasswordProblems, parseKey, passwordPolicyOf, passwordProblems };
package/dist/index.d.ts CHANGED
@@ -1,8 +1,27 @@
1
- export { A as AttributeType, a as CatalogResource, C as Cauthy, b as CauthyApiError, c as CauthyConfigError, d as CauthyEvent, e as CauthyOptions, f as CauthyPact, g as CauthySystem, h as CauthyTokenError, i as CauthyUnavailableError, j as CauthyWebhookError, k as CheckOf, l as CheckQuestion, m as CheckResult, n as CheckRule, o as ConditionalPermission, p as ContractOptions, J as JsonValue, M as MountTarget, N as NewMember, O as Organization, q as OrganizationMember, r as OrganizationRef, P as PactItem, s as PactStatus, t as PermissionOf, u as Permitted, v as Policy, w as PolicyDefinition, x as PolicyPermission, y as PolicyRole, z as PublicSession, B as PushPolicyOptions, R as ReplayStore, D as Resolved, E as ResolvedContract, F as RoleOf, G as STANDARD_VARIABLES, S as Session, H as SessionOrganization, I as SessionStatus, K as SessionUser, L as SystemKey, Q as SystemOptions, T as SystemPolicy, U as TokenIdentity, V as TokenRefusal, W as VerifyTokenOptions, X as VerifyWebhookOptions, Y as can, Z as createCauthy, _ as createSystem, $ as createTokenVerifier, a0 as definePolicy, a1 as failClosed, a2 as memoryReplayStore, a3 as policySource, a4 as pullCatalog, a5 as pullPolicy, a6 as pushCatalog, a7 as pushPolicy, a8 as readContract, a9 as remoteKeys, aa as verifyToken, ab as verifyWebhook } from './cauthy-B6Sm3T8M.js';
1
+ export { A as AttributeType, a as CatalogResource, C as Cauthy, b as CauthyApiError, c as CauthyConfigError, d as CauthyEvent, e as CauthyKeyError, f as CauthyKeyReason, g as CauthyOptions, h as CauthyPact, i as CauthySystem, j as CauthyTokenError, k as CauthyUnavailableError, l as CauthyWebhookError, m as CheckOf, n as CheckQuestion, o as CheckResult, p as CheckRule, q as ConditionalPermission, r as ContractOptions, J as JsonValue, M as MountTarget, N as NewMember, O as Organization, s as OrganizationMember, t as OrganizationRef, P as PactItem, u as PactStatus, v as PermissionOf, w as Permitted, x as Policy, y as PolicyDefinition, z as PolicyPermission, B as PolicyRole, D as PublicSession, E as PushPolicyOptions, R as ReplayStore, F as Resolved, G as ResolvedContract, H as RoleOf, I as STANDARD_VARIABLES, S as Session, K as SessionOrganization, L as SessionStatus, Q as SessionUser, T as SystemKey, U as SystemOptions, V as SystemPolicy, W as TokenIdentity, X as TokenRefusal, Y as VerifyTokenOptions, Z as VerifyWebhookOptions, _ as can, $ as createCauthy, a0 as createSystem, a1 as createTokenVerifier, a2 as createVerifierFromEnv, a3 as definePolicy, a4 as failClosed, a5 as memoryReplayStore, a6 as policySource, a7 as pullCatalog, a8 as pullPolicy, a9 as pushCatalog, aa as pushPolicy, ab as readContract, ac as remoteKeys, ad as verifyToken, ae as verifyWebhook } from './cauthy-C7gZ-pbv.js';
2
+ export { I as Identity } from './identity-BTJ8NB_w.js';
2
3
  export { K as KeyStore, P as PactKeys, S as StoredKey } from './keys-D5k0omTb.js';
3
4
  export { CauthyTheme, ImportedTheme, PushThemeOptions, StackmythThemeOptions, StackmythTokens, ThemeFont, ThemeTexts, pushTheme, themeFromStackmyth, tokensFromStackmyth } from './theme.js';
4
5
  import 'jose';
5
6
 
7
+ /**
8
+ * The variables CAUTHY_KEY replaces: set beside it, each is a second source
9
+ * of the same thing, and the application refuses to start (key/cauthy-key.md §10).
10
+ */
11
+ declare const KEY_REPLACES: readonly ["CAUTHY_ISSUER", "CAUTHY_CLIENT_ID", "CAUTHY_CLIENT_SECRET", "CAUTHY_SYSTEM", "CAUTHY_TENANT", "CAUTHY_SYSTEM_KEY", "CAUTHY_SYSTEM_KEY_ID", "CAUTHY_BASE_URL", "CAUTHY_AUDIENCE", "CAUTHY_TENANT_ID"];
12
+ /** What a CAUTHY_KEY names. Never logged, never printed. */
13
+ interface CauthyKey {
14
+ /** Cauthy's origin, e.g. https://cauthy.api.example.com */
15
+ issuer: string;
16
+ clientId: string;
17
+ /** The 43-character secret segment: the HKDF input, as text. */
18
+ secret: string;
19
+ }
20
+ /** Reads a CAUTHY_KEY; throws CauthyKeyError with the reason, never the value. */
21
+ declare function parseKey(text: string): CauthyKey;
22
+ /** Writes a CAUTHY_KEY (what the dashboard does in the browser; here for tests and tools). */
23
+ declare function composeKey(issuer: string, clientId: string, secret: string): string;
24
+
6
25
  interface ConnectOptions {
7
26
  /** The system's name, as its organizations are filed under: lowercase, digits, - or _. */
8
27
  system: string;
@@ -135,4 +154,4 @@ declare const PROTOCOL_VERSION = "1";
135
154
  */
136
155
  type NextStep = 'done' | 'mfa' | 'verify_email' | 'code' | 'passkey' | 'one_tap' | 'redirect';
137
156
 
138
- export { type AuthField, type ConnectOptions, type Connected, DEFAULT_PASSWORD_POLICY, type FieldProblem, MIN_PASSWORD, type NextStep, PROTOCOL_VERSION, type PasswordClass, type PasswordLocale, type PasswordPolicy, type PasswordReason, checkCode, checkEmail, checkName, checkNewPassword, checkPassword, connectSystem, describePasswordPolicy, explainPasswordProblems, passwordPolicyOf, passwordProblems };
157
+ export { type AuthField, type CauthyKey, type ConnectOptions, type Connected, DEFAULT_PASSWORD_POLICY, type FieldProblem, KEY_REPLACES, MIN_PASSWORD, type NextStep, PROTOCOL_VERSION, type PasswordClass, type PasswordLocale, type PasswordPolicy, type PasswordReason, checkCode, checkEmail, checkName, checkNewPassword, checkPassword, composeKey, connectSystem, describePasswordPolicy, explainPasswordProblems, parseKey, passwordPolicyOf, passwordProblems };