@absolutejs/auth 0.54.0 → 0.54.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 +15 -8
- package/dist/index.d.ts +0 -1
- package/dist/index.js +1 -101
- package/dist/index.js.map +4 -5
- package/dist/webauthn/simpleWebAuthnAdapter.d.ts +1 -0
- package/dist/webauthn.d.ts +1 -0
- package/dist/webauthn.js +1150 -0
- package/dist/webauthn.js.map +11 -0
- package/package.json +10 -2
package/README.md
CHANGED
|
@@ -8,20 +8,21 @@ Absolute Auth is a TypeScript-based authentication system that provides a compre
|
|
|
8
8
|
|
|
9
9
|
### Prerequisites
|
|
10
10
|
|
|
11
|
-
- [Elysia](https://elysiajs.com/)
|
|
11
|
+
- [Elysia](https://elysiajs.com/)
|
|
12
12
|
|
|
13
13
|
### Steps to Install Dependencies
|
|
14
14
|
|
|
15
15
|
1. Clone the repository:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
git clone https://github.com/alexkahndev/absolute-auth.git
|
|
19
|
+
cd absolute-auth
|
|
20
|
+
```
|
|
20
21
|
|
|
21
22
|
2. Install the dependencies:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
```bash
|
|
24
|
+
bun install
|
|
25
|
+
```
|
|
25
26
|
|
|
26
27
|
## Usage
|
|
27
28
|
|
|
@@ -47,6 +48,12 @@ import { createNodeSamlAdapter } from '@absolutejs/auth/saml';
|
|
|
47
48
|
|
|
48
49
|
Install `@node-saml/node-saml` only in applications that use this adapter.
|
|
49
50
|
|
|
51
|
+
The concrete SimpleWebAuthn adapter follows the same boundary:
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
import { createSimpleWebAuthnAdapter } from '@absolutejs/auth/webauthn';
|
|
55
|
+
```
|
|
56
|
+
|
|
50
57
|
### Features
|
|
51
58
|
|
|
52
59
|
- **Authorization**: Handles the authorization process by generating the authorization URL and redirecting the user to the authentication provider.
|
package/dist/index.d.ts
CHANGED
|
@@ -256,7 +256,6 @@ export * from './webauthn/adapter';
|
|
|
256
256
|
export * from './webauthn/config';
|
|
257
257
|
export * from './webauthn/types';
|
|
258
258
|
export { webauthnRoutes } from './webauthn/routes';
|
|
259
|
-
export { createSimpleWebAuthnAdapter } from './webauthn/simpleWebAuthnAdapter';
|
|
260
259
|
export { createInMemoryWebAuthnCredentialStore } from './webauthn/inMemoryWebAuthnCredentialStore';
|
|
261
260
|
export { createNeonWebAuthnCredentialStore, createPostgresWebAuthnCredentialStore, webauthnCredentialsTable } from './webauthn/postgresWebAuthnCredentialStore';
|
|
262
261
|
export * from './organizations/config';
|
package/dist/index.js
CHANGED
|
@@ -27142,105 +27142,6 @@ var createInMemorySsoConnectionStore = () => {
|
|
|
27142
27142
|
}
|
|
27143
27143
|
};
|
|
27144
27144
|
};
|
|
27145
|
-
// src/webauthn/simpleWebAuthnAdapter.ts
|
|
27146
|
-
var createSimpleWebAuthnAdapter = async () => {
|
|
27147
|
-
const {
|
|
27148
|
-
generateAuthenticationOptions,
|
|
27149
|
-
generateRegistrationOptions,
|
|
27150
|
-
verifyAuthenticationResponse,
|
|
27151
|
-
verifyRegistrationResponse
|
|
27152
|
-
} = await import("@simplewebauthn/server");
|
|
27153
|
-
const toBase64Url3 = (bytes) => Buffer.from(bytes).toString("base64url");
|
|
27154
|
-
const fromBase64Url3 = (value) => new Uint8Array(Buffer.from(value, "base64url"));
|
|
27155
|
-
return {
|
|
27156
|
-
createAuthenticationOptions: async ({ allowCredentials, rpId }) => {
|
|
27157
|
-
const options = await generateAuthenticationOptions({
|
|
27158
|
-
allowCredentials: allowCredentials.map(({ id }) => ({
|
|
27159
|
-
id
|
|
27160
|
-
})),
|
|
27161
|
-
rpID: rpId
|
|
27162
|
-
});
|
|
27163
|
-
return {
|
|
27164
|
-
challenge: options.challenge,
|
|
27165
|
-
options: { ...options }
|
|
27166
|
-
};
|
|
27167
|
-
},
|
|
27168
|
-
createRegistrationOptions: async ({
|
|
27169
|
-
excludeCredentials,
|
|
27170
|
-
rpId,
|
|
27171
|
-
rpName,
|
|
27172
|
-
userDisplayName,
|
|
27173
|
-
userId,
|
|
27174
|
-
userName
|
|
27175
|
-
}) => {
|
|
27176
|
-
const options = await generateRegistrationOptions({
|
|
27177
|
-
excludeCredentials: excludeCredentials.map(({ id }) => ({
|
|
27178
|
-
id
|
|
27179
|
-
})),
|
|
27180
|
-
rpID: rpId,
|
|
27181
|
-
rpName,
|
|
27182
|
-
userDisplayName,
|
|
27183
|
-
userID: Uint8Array.from(new TextEncoder().encode(userId)),
|
|
27184
|
-
userName
|
|
27185
|
-
});
|
|
27186
|
-
return {
|
|
27187
|
-
challenge: options.challenge,
|
|
27188
|
-
options: { ...options }
|
|
27189
|
-
};
|
|
27190
|
-
},
|
|
27191
|
-
verifyAuthentication: async ({
|
|
27192
|
-
credential,
|
|
27193
|
-
expectedChallenge,
|
|
27194
|
-
expectedOrigin,
|
|
27195
|
-
expectedRPID,
|
|
27196
|
-
response
|
|
27197
|
-
}) => {
|
|
27198
|
-
const result = await verifyAuthenticationResponse({
|
|
27199
|
-
credential: {
|
|
27200
|
-
counter: credential.counter,
|
|
27201
|
-
id: credential.credentialId,
|
|
27202
|
-
publicKey: fromBase64Url3(credential.publicKey)
|
|
27203
|
-
},
|
|
27204
|
-
expectedChallenge,
|
|
27205
|
-
expectedOrigin,
|
|
27206
|
-
expectedRPID,
|
|
27207
|
-
response
|
|
27208
|
-
});
|
|
27209
|
-
return {
|
|
27210
|
-
newCounter: result.authenticationInfo?.newCounter,
|
|
27211
|
-
verified: result.verified
|
|
27212
|
-
};
|
|
27213
|
-
},
|
|
27214
|
-
verifyRegistration: async ({
|
|
27215
|
-
expectedChallenge,
|
|
27216
|
-
expectedOrigin,
|
|
27217
|
-
expectedRPID,
|
|
27218
|
-
response
|
|
27219
|
-
}) => {
|
|
27220
|
-
const result = await verifyRegistrationResponse({
|
|
27221
|
-
expectedChallenge,
|
|
27222
|
-
expectedOrigin,
|
|
27223
|
-
expectedRPID,
|
|
27224
|
-
response
|
|
27225
|
-
});
|
|
27226
|
-
if (!result.verified || !result.registrationInfo) {
|
|
27227
|
-
return { verified: false };
|
|
27228
|
-
}
|
|
27229
|
-
const { credential, credentialBackedUp, credentialDeviceType } = result.registrationInfo;
|
|
27230
|
-
return {
|
|
27231
|
-
credential: {
|
|
27232
|
-
backedUp: credentialBackedUp,
|
|
27233
|
-
counter: credential.counter,
|
|
27234
|
-
credentialId: credential.id,
|
|
27235
|
-
deviceType: credentialDeviceType,
|
|
27236
|
-
publicKey: toBase64Url3(credential.publicKey),
|
|
27237
|
-
transports: credential.transports
|
|
27238
|
-
},
|
|
27239
|
-
verified: true
|
|
27240
|
-
};
|
|
27241
|
-
}
|
|
27242
|
-
};
|
|
27243
|
-
};
|
|
27244
27145
|
// src/webauthn/inMemoryWebAuthnCredentialStore.ts
|
|
27245
27146
|
var cloneCredential2 = (value) => ({
|
|
27246
27147
|
...value,
|
|
@@ -27825,7 +27726,6 @@ export {
|
|
|
27825
27726
|
createTotpKeyUri,
|
|
27826
27727
|
createTamperEvidentSink,
|
|
27827
27728
|
createStatusList,
|
|
27828
|
-
createSimpleWebAuthnAdapter,
|
|
27829
27729
|
createSiemLogStream,
|
|
27830
27730
|
createSetupSession,
|
|
27831
27731
|
createSecretCipher,
|
|
@@ -28032,5 +27932,5 @@ export {
|
|
|
28032
27932
|
AuthIdentityConflictError
|
|
28033
27933
|
};
|
|
28034
27934
|
|
|
28035
|
-
//# debugId=
|
|
27935
|
+
//# debugId=0E38321CEDEDD5AF64756E2164756E21
|
|
28036
27936
|
//# sourceMappingURL=index.js.map
|