@finueva/auth 0.10.1 → 0.11.1

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 CHANGED
@@ -2,7 +2,9 @@
2
2
 
3
3
  Use `@finueva/auth` to add Finueva sign-in, organization access, invitations, and Drive credentials to a browser, server, CLI, or native application.
4
4
 
5
- The current published version is `0.10.0`. The package is ESM-only. Node.js consumers require Node.js 22 or later. Other server runtimes must provide compatible Fetch, Web Crypto, URL, and Web Streams APIs. Its interface is Experimental until version `1.0.0`.
5
+ The current published version is `0.11.0`. The package is ESM-only. Node.js consumers require Node.js 22 or later. Other server runtimes must provide compatible Fetch, Web Crypto, URL, and Web Streams APIs. Its interface is Experimental until version `1.0.0`.
6
+
7
+ The platform-status and organization-authority methods below describe this repository's next package candidate. Published version `0.11.0` does not include them.
6
8
 
7
9
  ## Install
8
10
 
@@ -76,21 +78,25 @@ The browser owns the session cookie. The SDK does not expose or persist it.
76
78
 
77
79
  ## Common Tasks
78
80
 
79
- | Task | Browser | Server | Device |
80
- | ------------------------- | ------------------------------------------- | -------------------------------------- | -------------------------------------- |
81
- | Create an account | `signUp()` | Not available | `signUpWithEmail()` |
82
- | Read the current session | `getSession()` | `getSession()` | `getSession()` |
83
- | Observe session state | `onAuthStateChange()` | Not available | Not available |
84
- | Update a profile | `updateProfile()` | Not available | `updateProfile()` |
85
- | Change a password | `changePassword()` | Not available | `changePassword()` |
86
- | Reset a password | `requestPasswordReset()`, `resetPassword()` | Not available | Not available |
87
- | Verify an email | `sendVerificationEmail()` | Not available | Not available |
88
- | List organizations | `listOrganizations()` | `listOrganizations()` | `listOrganizations()` |
89
- | Create an ordinary team | `createOrganizationTeam()` | `createOrganizationTeam()` | `createOrganizationTeam()` |
90
- | Invite an ordinary member | `createOrganizationMemberInvitation()` | `createOrganizationMemberInvitation()` | `createOrganizationMemberInvitation()` |
91
- | Accept an invitation | `acceptInvitation()` | `acceptInvitation()` | Not available |
92
- | Request Drive access | `getDriveCredential()` | `getDriveCredential()` | `getDriveCredential()` |
93
- | End the current session | `signOut()` | `signOut()` | `revokeCurrentDevice()` |
81
+ | Task | Browser | Server | Device |
82
+ | ----------------------------- | ------------------------------------------- | -------------------------------------- | -------------------------------------- |
83
+ | Create an account | `signUp()` | Not available | `signUpWithEmail()` |
84
+ | Read the current session | `getSession()` | `getSession()` | `getSession()` |
85
+ | Observe session state | `onAuthStateChange()` | Not available | Not available |
86
+ | Update a profile | `updateProfile()` | Not available | `updateProfile()` |
87
+ | Change a password | `changePassword()` | Not available | `changePassword()` |
88
+ | Reset a password | `requestPasswordReset()`, `resetPassword()` | Not available | Not available |
89
+ | Verify an email | `sendVerificationEmail()` | Not available | Not available |
90
+ | List organizations | `listOrganizations()` | `listOrganizations()` | `listOrganizations()` |
91
+ | Create an ordinary team | `createOrganizationTeam()` | `createOrganizationTeam()` | `createOrganizationTeam()` |
92
+ | Invite an ordinary member | `createOrganizationMemberInvitation()` | `createOrganizationMemberInvitation()` | `createOrganizationMemberInvitation()` |
93
+ | Accept an invitation | `acceptInvitation()` | `acceptInvitation()` | Not available |
94
+ | Enroll a passkey | `addPasskey()` | Not available | Not available |
95
+ | Perform recent authentication | Platform and organization action methods | Not available | Not available |
96
+ | Change manual roles or owners | Organization authority methods | Not available | Not available |
97
+ | Read current platform roles | `getPlatformStatus()` | Not available | Not available |
98
+ | Request Drive access | `getDriveCredential()` | `getDriveCredential()` | `getDriveCredential()` |
99
+ | End the current session | `signOut()` | `signOut()` | `revokeCurrentDevice()` |
94
100
 
95
101
  ## Create An Organization Invitation
96
102
 
@@ -108,6 +114,67 @@ console.log(invitation.id, invitation.expiresAt);
108
114
 
109
115
  If the response is lost, repeat the same request with the same key. The SDK does not retry automatically. The result confirms invitation creation. It does not confirm email delivery.
110
116
 
117
+ ## Perform Recent Authentication
118
+
119
+ The experimental passkey methods run only when the browser page uses the exact Auth Origin. To enroll a passkey, first create a new password-authenticated session on that origin:
120
+
121
+ ```ts
122
+ await auth.signIn({ email, password });
123
+ await auth.addPasskey();
124
+ ```
125
+
126
+ The enrollment authorization expires after five minutes. It is single-use. Signup, social sign-in, session refresh, bearer use, and generic session creation do not authorize enrollment. A User without a fresh password sign-in cannot use this path.
127
+
128
+ Start one reviewed platform-role action before invoking passkey authentication:
129
+
130
+ ```ts
131
+ await auth.startPlatformRoleChangeRecentAuthentication({
132
+ targetUserId: "user_01J8R7M6N5P4Q3S2T1",
133
+ requestedRoles: ["administrator", "investigator"],
134
+ expectedTargetRevision: 0,
135
+ expectedGlobalRevision: 0,
136
+ reasonCategory: "initial_bootstrap",
137
+ changeReference: "change_01J8R7M6N5P4Q3S2T1",
138
+ idempotencyKey: crypto.randomUUID(),
139
+ });
140
+
141
+ await auth.verifyRecentAuthenticationWithPasskey();
142
+
143
+ const continuation = await auth.getRecentAuthenticationStatus();
144
+ if (continuation.status === "ready") {
145
+ showReviewedActionIsReady();
146
+ }
147
+ ```
148
+
149
+ The maintained passkey client performs the WebAuthn ceremony for the pending action when a compatible authenticator is present. Auth binds the exact generated challenge to that action. The SDK returns only `pending` or `ready`. It does not expose the challenge, WebAuthn response, session, cookies, proof, or hashes. `ready` does not grant a platform role or reusable administration mode. Bootstrap approval consumes the proof atomically with its state transition.
150
+
151
+ Organization owner changes use the same ceremony. Pass the same input to the start and submit methods:
152
+
153
+ ```ts
154
+ const change = {
155
+ requestedManualRole: "owner" as const,
156
+ expectedActorAuthorityRevision: 3,
157
+ expectedTargetAuthorityRevision: 1,
158
+ idempotencyKey: crypto.randomUUID(),
159
+ };
160
+
161
+ await auth.startOrganizationOwnerRoleChangeRecentAuthentication(organizationId, memberId, change);
162
+ await auth.verifyRecentAuthenticationWithPasskey();
163
+ await auth.changeOrganizationMemberManualRole(organizationId, memberId, change);
164
+ ```
165
+
166
+ Atomic transfer similarly pairs `startOrganizationOwnershipTransferRecentAuthentication()` with `transferOrganizationOwnership()`. The input names distinct outgoing-owner and successor memberships, the outgoing owner's resulting `member` or `admin` role, all exact authority revisions, and one idempotency key. The SDK validates and sends one normalized request and never exposes the consumed proof.
167
+
168
+ If a start result is unavailable, call `startPlatformRoleChangeRecentAuthentication()` again with the same normalized input. The client reuses the current request nonce. A different start or observed account transition removes this local retry state. Only one start request can be active. An overlapping call returns `state_conflict` before network I/O. The SDK does not retry automatically.
169
+
170
+ Read the signed-in User's current effective platform roles on the exact Auth Origin:
171
+
172
+ ```ts
173
+ const platform = await auth.getPlatformStatus();
174
+ ```
175
+
176
+ The result contains `eligible`, `roles`, and `globalRevision`. Use it for display and mutation preparation only. Each platform operation checks current authority again. The browser SDK sends Auth-origin cookie credentials and an exact browser-generated `Origin`. It sends no `Authorization` header. Server and device clients do not expose this method.
177
+
111
178
  ## Request A Drive Credential
112
179
 
113
180
  Request one short-lived credential for one workspace:
@@ -47,6 +47,32 @@ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
47
47
  IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
48
48
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
49
49
 
50
+ ## @simplewebauthn/browser 13.3.0
51
+
52
+ Source: https://github.com/MasterKale/SimpleWebAuthn
53
+
54
+ MIT License
55
+
56
+ Copyright (c) 2020 Matthew Miller
57
+
58
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
59
+ this software and associated documentation files (the "Software"), to deal in
60
+ the Software without restriction, including without limitation the rights to
61
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
62
+ the Software, and to permit persons to whom the Software is furnished to do so,
63
+ subject to the following conditions:
64
+
65
+ The above copyright notice and this permission notice shall be included in all
66
+ copies or substantial portions of the Software.
67
+
68
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
69
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
70
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
71
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
72
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
73
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
74
+ SOFTWARE.
75
+
50
76
  ## ofetch 1.5.1
51
77
 
52
78
  Source: https://github.com/unjs/ofetch
package/dist/device.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { A as ReceivedOrganizationInvitationPage, B as AuthErrorCode, C as OrganizationTeam, E as OrganizationTeamPage, F as UpdateOrganizationDisplayInput, I as UpdateOrganizationTeamDisplayInput, L as UpdateProfileInput, N as SocialIdTokenInput, P as SocialIdTokenProvider, S as OrganizationPageInput, T as OrganizationTeamMemberPage, V as AuthErrorStatus, _ as OrganizationInvitation, b as OrganizationMemberPage, d as CreatedOrganizationTeam, f as DriveCredential, g as OrganizationDisplay, k as ReceivedOrganizationInvitation, l as CreateOrganizationMemberInvitationInput, o as AuthSession, p as DriveCredentialInput, r as AuthOrganization, u as CreatedOrganizationMemberInvitation, v as OrganizationInvitationPage, w as OrganizationTeamDisplay, x as OrganizationPage, y as OrganizationMember, z as AuthError } from "./types-Byw9JQwL.js";
1
+ import { C as OrganizationTeam, E as OrganizationTeamPage, G as UpdateProfileInput, H as SocialIdTokenProvider, I as ReceivedOrganizationInvitation, J as AuthErrorCode, L as ReceivedOrganizationInvitationPage, S as OrganizationPageInput, T as OrganizationTeamMemberPage, U as UpdateOrganizationDisplayInput, V as SocialIdTokenInput, W as UpdateOrganizationTeamDisplayInput, Y as AuthErrorStatus, _ as OrganizationInvitation, b as OrganizationMemberPage, d as CreatedOrganizationTeam, f as DriveCredential, g as OrganizationDisplay, l as CreateOrganizationMemberInvitationInput, o as AuthSession, p as DriveCredentialInput, q as AuthError, r as AuthOrganization, u as CreatedOrganizationMemberInvitation, v as OrganizationInvitationPage, w as OrganizationTeamDisplay, x as OrganizationPage, y as OrganizationMember } from "./types--G_Gwf2r.js";
2
2
  //#region src/device.d.ts
3
3
  type DeviceAuthorizationErrorCode = "device_access_denied" | "device_authorization_cancelled" | "device_code_expired" | "invalid_device_authorization" | "identity_authority_unavailable";
4
4
  declare class DeviceAuthorizationError extends Error {
package/dist/device.js CHANGED
@@ -455,6 +455,9 @@ const messages = {
455
455
  auth_request_rate_limited: "Authentication requests are temporarily limited.",
456
456
  state_conflict: "The authentication state conflicts with the request.",
457
457
  access_denied: "Access is denied.",
458
+ platform_target_unavailable: "The platform administration target is unavailable.",
459
+ platform_quorum_unavailable: "Platform administration quorum is unavailable.",
460
+ platform_recovery_required: "Platform administration requires separate recovery.",
458
461
  identity_authority_unavailable: "Authentication is temporarily unavailable."
459
462
  };
460
463
  var AuthError = class extends Error {
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as ReceivedOrganizationInvitationPage, B as AuthErrorCode, C as OrganizationTeam, D as OrganizationWorkspaceSelection, E as OrganizationTeamPage, F as UpdateOrganizationDisplayInput, I as UpdateOrganizationTeamDisplayInput, L as UpdateProfileInput, M as SignInInput, N as SocialIdTokenInput, O as PersonalWorkspaceSelection, P as SocialIdTokenProvider, R as WorkspaceSelection, S as OrganizationPageInput, T as OrganizationTeamMemberPage, V as AuthErrorStatus, _ as OrganizationInvitation, a as AuthPersistenceDriver, b as OrganizationMemberPage, c as AuthUser, d as CreatedOrganizationTeam, f as DriveCredential, g as OrganizationDisplay, h as InvitationAcceptance, i as AuthPersistence, j as SendVerificationEmailInput, k as ReceivedOrganizationInvitation, l as CreateOrganizationMemberInvitationInput, m as FinuevaAuthClient, n as AuthClientOptions, o as AuthSession, p as DriveCredentialInput, r as AuthOrganization, s as AuthState, t as AcceptInvitationInput, u as CreatedOrganizationMemberInvitation, v as OrganizationInvitationPage, w as OrganizationTeamDisplay, x as OrganizationPage, y as OrganizationMember, z as AuthError } from "./types-Byw9JQwL.js";
1
+ import { A as PlatformRole, B as SignInInput, C as OrganizationTeam, D as OrganizationWorkspaceSelection, E as OrganizationTeamPage, F as PlatformStatus, G as UpdateProfileInput, H as SocialIdTokenProvider, I as ReceivedOrganizationInvitation, J as AuthErrorCode, K as WorkspaceSelection, L as ReceivedOrganizationInvitationPage, M as PlatformRoleApproval, N as PlatformRoleChangeRecentAuthenticationInput, O as PersonalWorkspaceSelection, P as PlatformRoleFirstApproval, R as RecentAuthenticationStatus, S as OrganizationPageInput, T as OrganizationTeamMemberPage, U as UpdateOrganizationDisplayInput, V as SocialIdTokenInput, W as UpdateOrganizationTeamDisplayInput, Y as AuthErrorStatus, _ as OrganizationInvitation, a as AuthPersistenceDriver, b as OrganizationMemberPage, c as AuthUser, d as CreatedOrganizationTeam, f as DriveCredential, g as OrganizationDisplay, h as InvitationAcceptance, i as AuthPersistence, j as PlatformRoleApplied, k as PlatformBootstrapRoleChangeInput, l as CreateOrganizationMemberInvitationInput, m as FinuevaAuthClient, n as AuthClientOptions, o as AuthSession, p as DriveCredentialInput, q as AuthError, r as AuthOrganization, s as AuthState, t as AcceptInvitationInput, u as CreatedOrganizationMemberInvitation, v as OrganizationInvitationPage, w as OrganizationTeamDisplay, x as OrganizationPage, y as OrganizationMember, z as SendVerificationEmailInput } from "./types--G_Gwf2r.js";
2
2
  //#region src/client.d.ts
3
3
  declare function createAuthClient(options: AuthClientOptions): FinuevaAuthClient;
4
4
  //#endregion
5
- export { type AcceptInvitationInput, type AuthClientOptions, AuthError, type AuthErrorCode, type AuthErrorStatus, type AuthOrganization, type AuthPersistence, type AuthPersistenceDriver, type AuthSession, type AuthState, type AuthUser, type CreateOrganizationMemberInvitationInput, type CreatedOrganizationMemberInvitation, type CreatedOrganizationTeam, type DriveCredential, type DriveCredentialInput, type FinuevaAuthClient, type InvitationAcceptance, type OrganizationDisplay, type OrganizationInvitation, type OrganizationInvitationPage, type OrganizationMember, type OrganizationMemberPage, type OrganizationPage, type OrganizationPageInput, type OrganizationTeam, type OrganizationTeamDisplay, type OrganizationTeamMemberPage, type OrganizationTeamPage, type OrganizationWorkspaceSelection, type PersonalWorkspaceSelection, type ReceivedOrganizationInvitation, type ReceivedOrganizationInvitationPage, type SendVerificationEmailInput, type SignInInput, type SocialIdTokenInput, type SocialIdTokenProvider, type UpdateOrganizationDisplayInput, type UpdateOrganizationTeamDisplayInput, type UpdateProfileInput, type WorkspaceSelection, createAuthClient };
5
+ export { type AcceptInvitationInput, type AuthClientOptions, AuthError, type AuthErrorCode, type AuthErrorStatus, type AuthOrganization, type AuthPersistence, type AuthPersistenceDriver, type AuthSession, type AuthState, type AuthUser, type CreateOrganizationMemberInvitationInput, type CreatedOrganizationMemberInvitation, type CreatedOrganizationTeam, type DriveCredential, type DriveCredentialInput, type FinuevaAuthClient, type InvitationAcceptance, type OrganizationDisplay, type OrganizationInvitation, type OrganizationInvitationPage, type OrganizationMember, type OrganizationMemberPage, type OrganizationPage, type OrganizationPageInput, type OrganizationTeam, type OrganizationTeamDisplay, type OrganizationTeamMemberPage, type OrganizationTeamPage, type OrganizationWorkspaceSelection, type PersonalWorkspaceSelection, type PlatformBootstrapRoleChangeInput, type PlatformRole, type PlatformRoleApplied, type PlatformRoleApproval, type PlatformRoleChangeRecentAuthenticationInput, type PlatformRoleFirstApproval, type PlatformStatus, type ReceivedOrganizationInvitation, type ReceivedOrganizationInvitationPage, type RecentAuthenticationStatus, type SendVerificationEmailInput, type SignInInput, type SocialIdTokenInput, type SocialIdTokenProvider, type UpdateOrganizationDisplayInput, type UpdateOrganizationTeamDisplayInput, type UpdateProfileInput, type WorkspaceSelection, createAuthClient };