@stll/auth-model 0.3.0 → 0.5.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/contract.d.ts +15 -1
- package/dist/contract.js +21 -1
- package/dist/invitation-sections.d.ts +33305 -0
- package/dist/invitation-sections.js +22 -0
- package/package.json +6 -2
package/dist/contract.d.ts
CHANGED
|
@@ -59,6 +59,19 @@ export declare const BETTER_AUTH_ORGANIZATION_ROLE_GRANTS: {
|
|
|
59
59
|
* Values that change Better Auth's organization authorization semantics.
|
|
60
60
|
* Hooks, adapters, email delivery, and product-specific options stay local.
|
|
61
61
|
*/
|
|
62
|
+
export declare const ORGANIZATION_SLUG_RULES: {
|
|
63
|
+
readonly minLength: 1;
|
|
64
|
+
readonly maxLength: 128;
|
|
65
|
+
readonly pattern: RegExp;
|
|
66
|
+
};
|
|
67
|
+
/** Random bytes behind an opaque organization slug. */
|
|
68
|
+
export declare const ORGANIZATION_OPAQUE_SLUG_BYTES = 10;
|
|
69
|
+
/**
|
|
70
|
+
* The opaque `org-` slug shared by organization creation and slug changes.
|
|
71
|
+
* The source fills this function's own fixed-size buffer, so it cannot change
|
|
72
|
+
* the identifier's length; organization names never enter the identifier.
|
|
73
|
+
*/
|
|
74
|
+
export declare const createOpaqueOrganizationSlug: (fillRandom?: (bytes: Uint8Array) => void) => string;
|
|
62
75
|
export declare const BETTER_AUTH_ORGANIZATION_OPTIONS: {
|
|
63
76
|
readonly allowUserToCreateOrganization: true;
|
|
64
77
|
readonly cancelPendingInvitationsOnReInvite: false;
|
|
@@ -424,4 +437,5 @@ export declare const BETTER_AUTH_PARITY_MANIFEST: {
|
|
|
424
437
|
};
|
|
425
438
|
};
|
|
426
439
|
};
|
|
427
|
-
//#endregion
|
|
440
|
+
//#endregion
|
|
441
|
+
export {};
|
package/dist/contract.js
CHANGED
|
@@ -104,6 +104,26 @@ const BETTER_AUTH_ORGANIZATION_ROLE_GRANTS = {
|
|
|
104
104
|
* Values that change Better Auth's organization authorization semantics.
|
|
105
105
|
* Hooks, adapters, email delivery, and product-specific options stay local.
|
|
106
106
|
*/
|
|
107
|
+
const ORGANIZATION_SLUG_RULES = {
|
|
108
|
+
minLength: 1,
|
|
109
|
+
maxLength: 128,
|
|
110
|
+
pattern: /^[a-z0-9\x2d]+$/u
|
|
111
|
+
};
|
|
112
|
+
/** Random bytes behind an opaque organization slug. */
|
|
113
|
+
const ORGANIZATION_OPAQUE_SLUG_BYTES = 10;
|
|
114
|
+
const OPAQUE_SLUG_ALPHABET = "abcdefghijklmnopqrstuvwxyz234567";
|
|
115
|
+
/**
|
|
116
|
+
* The opaque `org-` slug shared by organization creation and slug changes.
|
|
117
|
+
* The source fills this function's own fixed-size buffer, so it cannot change
|
|
118
|
+
* the identifier's length; organization names never enter the identifier.
|
|
119
|
+
*/
|
|
120
|
+
const createOpaqueOrganizationSlug = (fillRandom = (bytes) => {
|
|
121
|
+
crypto.getRandomValues(bytes);
|
|
122
|
+
}) => {
|
|
123
|
+
const bytes = /* @__PURE__ */ new Uint8Array(10);
|
|
124
|
+
fillRandom(bytes);
|
|
125
|
+
return `org-${Array.from(bytes, (byte) => OPAQUE_SLUG_ALPHABET.charAt(byte % 32)).join("")}`;
|
|
126
|
+
};
|
|
107
127
|
const BETTER_AUTH_ORGANIZATION_OPTIONS = {
|
|
108
128
|
allowUserToCreateOrganization: true,
|
|
109
129
|
cancelPendingInvitationsOnReInvite: false,
|
|
@@ -544,4 +564,4 @@ const BETTER_AUTH_PARITY_MANIFEST = {
|
|
|
544
564
|
schema: BETTER_AUTH_CORE_SCHEMA
|
|
545
565
|
};
|
|
546
566
|
//#endregion
|
|
547
|
-
export { AUTH_ACCESS_RESET_ERROR_CODE, AUTH_SESSION_STARTUP_HEADER, AUTH_SOCIAL_PROVIDER_IDS, BETTER_AUTH_ADAPTER_INVARIANTS, BETTER_AUTH_ADAPTER_OPTIONS, BETTER_AUTH_CONTRACT_VERSION, BETTER_AUTH_CORE_MODEL_NAMES, BETTER_AUTH_CORE_SCHEMA, BETTER_AUTH_ORGANIZATION_OPTIONS, BETTER_AUTH_ORGANIZATION_ROLE_GRANTS, BETTER_AUTH_ORGANIZATION_STATEMENTS, BETTER_AUTH_PARITY_MANIFEST, ORGANIZATION_ROLE_NAMES, compareBetterAuthSchema };
|
|
567
|
+
export { AUTH_ACCESS_RESET_ERROR_CODE, AUTH_SESSION_STARTUP_HEADER, AUTH_SOCIAL_PROVIDER_IDS, BETTER_AUTH_ADAPTER_INVARIANTS, BETTER_AUTH_ADAPTER_OPTIONS, BETTER_AUTH_CONTRACT_VERSION, BETTER_AUTH_CORE_MODEL_NAMES, BETTER_AUTH_CORE_SCHEMA, BETTER_AUTH_ORGANIZATION_OPTIONS, BETTER_AUTH_ORGANIZATION_ROLE_GRANTS, BETTER_AUTH_ORGANIZATION_STATEMENTS, BETTER_AUTH_PARITY_MANIFEST, ORGANIZATION_OPAQUE_SLUG_BYTES, ORGANIZATION_ROLE_NAMES, ORGANIZATION_SLUG_RULES, compareBetterAuthSchema, createOpaqueOrganizationSlug };
|