@happyvertical/smrt-users 0.57.45 → 0.57.47
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 +48 -0
- package/dist/chunks/TerminalAuthService-BrYH0wjd.js +4012 -0
- package/dist/chunks/TerminalAuthService-BrYH0wjd.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +160 -46
- package/dist/index.js.map +1 -1
- package/dist/manifest.json +187 -1
- package/dist/services/MailboxEnrollmentService.d.ts +47 -0
- package/dist/services/MailboxEnrollmentService.d.ts.map +1 -0
- package/dist/services/TenantInvitationService.d.ts.map +1 -1
- package/dist/services/canonical-mailbox-identity.d.ts +15 -0
- package/dist/services/canonical-mailbox-identity.d.ts.map +1 -0
- package/dist/smrt-knowledge.json +3 -3
- package/dist/sveltekit.js +1 -1
- package/package.json +13 -13
- package/dist/chunks/TerminalAuthService-CAA9Dtgd.js +0 -4012
- package/dist/chunks/TerminalAuthService-CAA9Dtgd.js.map +0 -1
package/README.md
CHANGED
|
@@ -54,6 +54,54 @@ auth action. Default English messages are registered by the auth module.
|
|
|
54
54
|
The endpoint in this example is application-owned. It must call the package
|
|
55
55
|
handler/service on the server; it is not a generated public identity API.
|
|
56
56
|
|
|
57
|
+
### Source-bound mailbox enrollment
|
|
58
|
+
|
|
59
|
+
`MailboxEnrollmentService` proves mailbox ownership before an application
|
|
60
|
+
creates a destination. Unlike returning-user mailbox authentication, it needs
|
|
61
|
+
no existing User or membership. It creates no session or membership. Both calls
|
|
62
|
+
require an initialized caller transaction executor:
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
const enrollment = await MailboxEnrollmentService.create({
|
|
66
|
+
db: tx, transaction: 'caller', secret, loginLimiter: rootLimiter,
|
|
67
|
+
});
|
|
68
|
+
await enrollment.request({
|
|
69
|
+
email: storedSubmission.recipient,
|
|
70
|
+
binding: canonicalSourceBinding,
|
|
71
|
+
sourceKey: trustedClientAddress,
|
|
72
|
+
deliver: sendMailboxProof,
|
|
73
|
+
}); // { requested: true }; proof goes only to the normalized mailbox callback
|
|
74
|
+
|
|
75
|
+
const identity = await enrollment.authenticate({
|
|
76
|
+
token: submittedProof,
|
|
77
|
+
binding: canonicalSourceBinding,
|
|
78
|
+
expectedUserId: currentUser?.id,
|
|
79
|
+
sessionId: currentSession?.id,
|
|
80
|
+
}); // { userId, profileId, email }; active canonical global User + Person
|
|
81
|
+
// Authorize and write host destination/membership using this same tx.
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Recompute `binding` from trusted immutable source data on every call, for
|
|
85
|
+
example `JSON.stringify(['host:submission:v1', workspaceId, submissionId,
|
|
86
|
+
payloadSha256, normalizedRecipient])`. Never trust a posted binding, workspace,
|
|
87
|
+
recipient or destination. The proof signs its SHA-256 digest with the isolated
|
|
88
|
+
`smrt:mailbox-enrollment:v1` issuer, expires in ten minutes, and is single use.
|
|
89
|
+
It cannot authenticate through login or invitation endpoints.
|
|
90
|
+
|
|
91
|
+
`rootLimiter` must persist independently of `tx`; request budgets survive
|
|
92
|
+
transport failure and rollback. SQLite's single connection needs an independent
|
|
93
|
+
limiter store. The trusted `deliver` callback must send only to its supplied
|
|
94
|
+
`email`, never return or log the token, and reject on transport failure. A proof
|
|
95
|
+
mailed by a rolled-back request is unusable. There is no durable outbox here.
|
|
96
|
+
|
|
97
|
+
Authenticate reuses only an active, unambiguous, canonically owned global
|
|
98
|
+
identity. It refuses pending/suspended/inactive Users and unowned matching
|
|
99
|
+
Profiles instead of adopting them. Existing actor/session constraints use the
|
|
100
|
+
same first-class-session policy as mailbox login. Keep proof consumption,
|
|
101
|
+
identity creation and all host writes in one transaction and roll back on any
|
|
102
|
+
error. Concurrent distinct proofs may hit canonical identity conflicts: retry
|
|
103
|
+
the entire transaction after rollback. The failed proof remains available.
|
|
104
|
+
|
|
57
105
|
### Application discovery conformance
|
|
58
106
|
|
|
59
107
|
The SvelteKit `createResourceListHandler()` export produces the app CLI
|