own-auth 0.1.5 → 0.1.6

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.
Files changed (2) hide show
  1. package/README.md +47 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -61,6 +61,15 @@ const login = await auth.signInEmailPassword({
61
61
  });
62
62
  ```
63
63
 
64
+ Create a user directly:
65
+
66
+ ```ts
67
+ const user = await auth.createUser({
68
+ email: "teammate@example.com",
69
+ name: "Teammate"
70
+ });
71
+ ```
72
+
64
73
  Sessions:
65
74
 
66
75
  ```ts
@@ -115,12 +124,32 @@ const { organisation } = await auth.createOrganisation({
115
124
  ownerUserId: user.id
116
125
  });
117
126
 
127
+ await auth.updateOrganisation(organisation.id, {
128
+ actorUserId: user.id,
129
+ name: "Acme Inc"
130
+ });
131
+
118
132
  await auth.inviteMember({
119
133
  organisationId: organisation.id,
120
134
  email: "teammate@example.com",
121
135
  invitedByUserId: user.id,
122
136
  role: "member"
123
137
  });
138
+
139
+ await auth.acceptInvitation({ token: invitationToken });
140
+
141
+ await auth.changeMemberRole({
142
+ organisationId: organisation.id,
143
+ memberId,
144
+ actorUserId: user.id,
145
+ role: "admin"
146
+ });
147
+
148
+ await auth.removeMember({
149
+ organisationId: organisation.id,
150
+ memberId,
151
+ actorUserId: user.id
152
+ });
124
153
  ```
125
154
 
126
155
  API keys and permissions:
@@ -135,11 +164,15 @@ const createdKey = await auth.createApiKey({
135
164
 
136
165
  const verifiedKey = await auth.verifyApiKey(createdKey.rawKey, ["users:read"]);
137
166
 
167
+ await auth.revokeApiKey(createdKey.apiKey.keyPrefix, user.id);
168
+
138
169
  const canManageKeys = await auth.checkPermission(
139
170
  organisation.id,
140
171
  user.id,
141
172
  "manage_api_keys"
142
173
  );
174
+
175
+ await auth.requirePermission(organisation.id, user.id, "manage_api_keys");
143
176
  ```
144
177
 
145
178
  Audit events:
@@ -150,6 +183,20 @@ const events = await auth.listAuditEvents({
150
183
  });
151
184
  ```
152
185
 
186
+ ## Method Index
187
+
188
+ - Users: `createUser`, `signUpEmailPassword`, `signInEmailPassword`
189
+ - Sessions: `getCurrentSession`, `requireCurrentSession`, `signOut`, `revokeAllSessions`
190
+ - Magic links: `requestMagicLink`, `verifyMagicLink`
191
+ - Email verification: `requestEmailVerification`, `verifyEmail`
192
+ - Password reset: `requestPasswordReset`, `resetPassword`
193
+ - SMS OTP: `requestSmsOtp`, `verifySmsOtp`
194
+ - API keys: `createApiKey`, `verifyApiKey`, `revokeApiKey`
195
+ - Organisations: `createOrganisation`, `updateOrganisation`
196
+ - Members and invites: `inviteMember`, `acceptInvitation`, `changeMemberRole`, `removeMember`
197
+ - Permissions: `checkPermission`, `requirePermission`
198
+ - Audit logs: `listAuditEvents`
199
+
153
200
  ## Exports
154
201
 
155
202
  - `own-auth`: auth engine, providers, types, test storage
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "own-auth",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "type": "module",
5
5
  "description": "Framework-independent TypeScript auth engine with Postgres storage.",
6
6
  "license": "MIT",