@hyper.authio/client 0.8.0 → 0.9.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/README.md +9 -3
- package/dist/index.cjs +30 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +48 -4
- package/dist/index.d.ts +48 -4
- package/dist/index.js +29 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -151,6 +151,10 @@ declare const AuthioWebhookEventTypes: {
|
|
|
151
151
|
readonly UserSuspensionEnded: "user_suspension_ended";
|
|
152
152
|
readonly AttackDetected: "attack_detected";
|
|
153
153
|
readonly CredentialCompromised: "credential_compromised";
|
|
154
|
+
readonly UserAuthenticatorAppEnrolled: "user_authenticator_app_enrolled";
|
|
155
|
+
readonly UserAuthenticatorAppRemoved: "user_authenticator_app_removed";
|
|
156
|
+
readonly UserRecoveryCodesRegenerated: "user_recovery_codes_regenerated";
|
|
157
|
+
readonly UserRecoveryCodeUsed: "user_recovery_code_used";
|
|
154
158
|
readonly Ping: "ping";
|
|
155
159
|
};
|
|
156
160
|
/**
|
|
@@ -216,6 +220,8 @@ declare const AuthioDefaults: {
|
|
|
216
220
|
readonly CredentialClientIdPrefix: "cred_";
|
|
217
221
|
readonly ApiKeyHeader: "x-api-key";
|
|
218
222
|
readonly RequestIdHeader: "X-Request-Id";
|
|
223
|
+
/** The header `typ` of an access token (RFC 9068 §2.1). */
|
|
224
|
+
readonly AccessTokenType: "at+jwt";
|
|
219
225
|
/** The header `typ` of a back-channel logout token. */
|
|
220
226
|
readonly LogoutTokenType: "logout+jwt";
|
|
221
227
|
/** The event a back-channel logout token carries. */
|
|
@@ -717,6 +723,15 @@ declare function toTokenValidationError(error: unknown, audiences: readonly stri
|
|
|
717
723
|
* digest, base64url-encoded (OpenID Connect Core §3.1.3.6).
|
|
718
724
|
*/
|
|
719
725
|
declare function computeAuthioTokenHash(value: string, algorithm: string): Promise<string>;
|
|
726
|
+
/**
|
|
727
|
+
* Requires the header `typ` of an access token to be `at+jwt` (or `application/at+jwt`), as RFC 9068 §4 asks a
|
|
728
|
+
* resource server to check, so an ID token or any other JWT is never taken for an access token.
|
|
729
|
+
*
|
|
730
|
+
* @param header The protected header of the verified token.
|
|
731
|
+
* @throws AuthioTokenValidationError with the reason `not_access_token` otherwise.
|
|
732
|
+
* @internal
|
|
733
|
+
*/
|
|
734
|
+
declare function requireAccessTokenType(header: Record<string, unknown>): void;
|
|
720
735
|
|
|
721
736
|
/**
|
|
722
737
|
* The PKCE method (RFC 7636). `S256` is the default; `plain` only when asked for, for a client that cannot hash.
|
|
@@ -853,7 +868,9 @@ interface AuthioFrontChannelLogout {
|
|
|
853
868
|
*/
|
|
854
869
|
declare function readAuthioFrontChannelLogout(request: string | URL | URLSearchParams | Readonly<Record<string, unknown>>, issuer: string): AuthioFrontChannelLogout;
|
|
855
870
|
/**
|
|
856
|
-
* Parses a `WWW-Authenticate` bearer challenge, or `undefined` when the header holds none.
|
|
871
|
+
* Parses a `WWW-Authenticate` bearer challenge, or `undefined` when the header holds none. It reads the header only,
|
|
872
|
+
* whatever the status: a step-up challenge (`insufficient_user_authentication`) comes with `401` (RFC 9470 §3), or
|
|
873
|
+
* with `403` from servers before `@hyper.authio/server` 0.8.1 and `@hyper.authio/mcp` 0.4.1.
|
|
857
874
|
*/
|
|
858
875
|
declare function parseAuthioBearerChallenge(header: string | null | undefined): AuthioBearerChallenge | undefined;
|
|
859
876
|
|
|
@@ -1167,7 +1184,8 @@ interface AuthioTokenClient {
|
|
|
1167
1184
|
} & AuthioCallOptions): Promise<AuthioTokenResponse>;
|
|
1168
1185
|
/**
|
|
1169
1186
|
* The `personal_access_token` grant: a `pat_` value presented as `client_secret`, with the consumer's client id for
|
|
1170
|
-
* a consumer's token or
|
|
1187
|
+
* a consumer's token or the platform client (`AuthioDefaults.PlatformClientId`) for an account's token. The client's
|
|
1188
|
+
* own credentials are not sent.
|
|
1171
1189
|
*/
|
|
1172
1190
|
personalAccessToken(options: {
|
|
1173
1191
|
token: string;
|
|
@@ -1279,7 +1297,8 @@ interface AuthioClient {
|
|
|
1279
1297
|
validateFrontChannelLogout(request: string | URL | URLSearchParams | Readonly<Record<string, unknown>>): AuthioFrontChannelLogout;
|
|
1280
1298
|
/**
|
|
1281
1299
|
* Reads an access token this client received from Authio: decrypted with `clientEncryptionKey` when it is a JWE,
|
|
1282
|
-
* then its signature (with `accessTokenSignedResponseAlg`), `iss
|
|
1300
|
+
* then its signature (with `accessTokenSignedResponseAlg`), `iss`, `exp` and the header `typ` `at+jwt` (RFC 9068 §4)
|
|
1301
|
+
* checked. Its audience is the API's, so it is not checked. `undefined` for an
|
|
1283
1302
|
* opaque token, or an encrypted one without `clientEncryptionKey`.
|
|
1284
1303
|
*
|
|
1285
1304
|
* @throws AuthioTokenValidationError naming why it was refused.
|
|
@@ -1489,6 +1508,10 @@ interface AuthioWebhookEvent {
|
|
|
1489
1508
|
/** Seconds since the epoch. */
|
|
1490
1509
|
readonly created_at: number;
|
|
1491
1510
|
readonly realm_id?: string | null;
|
|
1511
|
+
/**
|
|
1512
|
+
* The client the event came through. On a realm endpoint, `null` when there is none, such as a person created in
|
|
1513
|
+
* the realm.
|
|
1514
|
+
*/
|
|
1492
1515
|
readonly client_id?: string | null;
|
|
1493
1516
|
readonly data: unknown;
|
|
1494
1517
|
[member: string]: unknown;
|
|
@@ -1619,6 +1642,19 @@ interface AuthioWebhookCredentialCompromisedData {
|
|
|
1619
1642
|
network_operator?: string | null;
|
|
1620
1643
|
password_change_required?: boolean | null;
|
|
1621
1644
|
}
|
|
1645
|
+
/**
|
|
1646
|
+
* `user_authenticator_app_enrolled`, `user_authenticator_app_removed`, `user_recovery_codes_regenerated` and
|
|
1647
|
+
* `user_recovery_code_used`, as delivered: a change to a person's authenticator app, never a code nor the secret.
|
|
1648
|
+
*/
|
|
1649
|
+
interface AuthioWebhookAuthenticatorAppData {
|
|
1650
|
+
user_id: string;
|
|
1651
|
+
username?: string | null;
|
|
1652
|
+
email?: string | null;
|
|
1653
|
+
/** Who made the change: `user`, or `administrator` when an administrator reset the app. */
|
|
1654
|
+
actor?: string | null;
|
|
1655
|
+
/** The recovery codes the account has left after the change. */
|
|
1656
|
+
recovery_codes_remaining?: number | null;
|
|
1657
|
+
}
|
|
1622
1658
|
/** `ping`, as delivered. */
|
|
1623
1659
|
interface AuthioWebhookPingData {
|
|
1624
1660
|
message?: string | null;
|
|
@@ -1644,6 +1680,10 @@ interface AuthioWebhookDataByType {
|
|
|
1644
1680
|
user_suspension_ended: AuthioWebhookUserSuspensionData;
|
|
1645
1681
|
attack_detected: AuthioWebhookAttackDetectedData;
|
|
1646
1682
|
credential_compromised: AuthioWebhookCredentialCompromisedData;
|
|
1683
|
+
user_authenticator_app_enrolled: AuthioWebhookAuthenticatorAppData;
|
|
1684
|
+
user_authenticator_app_removed: AuthioWebhookAuthenticatorAppData;
|
|
1685
|
+
user_recovery_codes_regenerated: AuthioWebhookAuthenticatorAppData;
|
|
1686
|
+
user_recovery_code_used: AuthioWebhookAuthenticatorAppData;
|
|
1647
1687
|
ping: AuthioWebhookPingData;
|
|
1648
1688
|
}
|
|
1649
1689
|
/**
|
|
@@ -1676,6 +1716,8 @@ type AuthioWebhookUserSuspension = AuthioCamelCased<AuthioWebhookUserSuspensionD
|
|
|
1676
1716
|
type AuthioWebhookAttackDetected = AuthioCamelCased<AuthioWebhookAttackDetectedData>;
|
|
1677
1717
|
/** The data of a compromised credential event, as the typed accessor exposes it. */
|
|
1678
1718
|
type AuthioWebhookCredentialCompromised = AuthioCamelCased<AuthioWebhookCredentialCompromisedData>;
|
|
1719
|
+
/** The data of an authenticator app event, as the typed accessor exposes it. */
|
|
1720
|
+
type AuthioWebhookAuthenticatorApp = AuthioCamelCased<AuthioWebhookAuthenticatorAppData>;
|
|
1679
1721
|
/** The data of a ping, as the typed accessor exposes it. */
|
|
1680
1722
|
type AuthioWebhookPing = AuthioCamelCased<AuthioWebhookPingData>;
|
|
1681
1723
|
/**
|
|
@@ -1739,6 +1781,8 @@ declare const asUserSuspensionEvent: (event: AuthioWebhookEvent) => AuthioCamelC
|
|
|
1739
1781
|
declare const asAttackDetectedEvent: (event: AuthioWebhookEvent) => AuthioCamelCased<AuthioWebhookAttackDetectedData> | undefined;
|
|
1740
1782
|
/** The data of a compromised credential event in camelCase, or `undefined` for any other type. */
|
|
1741
1783
|
declare const asCredentialCompromisedEvent: (event: AuthioWebhookEvent) => AuthioCamelCased<AuthioWebhookCredentialCompromisedData> | undefined;
|
|
1784
|
+
/** The data of an authenticator app event in camelCase, or `undefined` for any other type. */
|
|
1785
|
+
declare const asAuthenticatorAppEvent: (event: AuthioWebhookEvent) => AuthioCamelCased<AuthioWebhookAuthenticatorAppData> | undefined;
|
|
1742
1786
|
/** The data of a ping in camelCase, or `undefined` for any other type. */
|
|
1743
1787
|
declare const asPingEvent: (event: AuthioWebhookEvent) => AuthioCamelCased<AuthioWebhookPingData> | undefined;
|
|
1744
1788
|
/**
|
|
@@ -1755,4 +1799,4 @@ declare function readWebhookEventData(event: AuthioWebhookEvent): Record<string,
|
|
|
1755
1799
|
*/
|
|
1756
1800
|
declare function toCamelCasedMembers<T extends object>(value: T): AuthioCamelCased<T>;
|
|
1757
1801
|
|
|
1758
|
-
export { type AuthioAccountCredential, type AuthioAccountCredentialKind, type AuthioAccountCredentialOptions, type AuthioAdminEnvelope, AuthioAdminError, type AuthioAdminFailure, type AuthioAdminNotification, type AuthioAdminSuccess, AuthioAsymmetricAlgorithms, type AuthioAuthorizationRequest, type AuthioAuthorizationResult, type AuthioAuthorizationTransaction, type AuthioAuthorizationUrl, type AuthioBearerChallenge, type AuthioCallOptions, AuthioCallbackError, type AuthioCallbackFailure, type AuthioCallerKind, AuthioCallerKinds, type AuthioCamelCase, type AuthioCamelCased, type AuthioCheck, AuthioChecks, AuthioClaimTypes, type AuthioClient, AuthioClientAssertionAlgorithms, type AuthioClientCredentialsCache, type AuthioClientCredentialsSettings, type AuthioClientCredentialsToken, type AuthioClientOptions, type AuthioClock, type AuthioCodeChallengeMethod, AuthioConfigurationError, type AuthioConnection, type AuthioConnectionChoice, type AuthioConnectionExchangeResult, type AuthioConnectionGranted, type AuthioConnectionOptions, type AuthioConnectionRefused, type AuthioConnectionRequired, type AuthioConnectionSelectionRequired, AuthioContentEncryptionAlgorithms, type AuthioCredentialForm, AuthioDefaults, type AuthioDeviceAuthorization, type AuthioDevicePollOutcome, type AuthioDiscoveryClient, type AuthioDiscoveryDocument, AuthioDiscoveryError, type AuthioEncryptionKey, type AuthioEncryptionKeySource, type AuthioEndSessionRequest, AuthioError, type AuthioErrorResponse, type AuthioExternalAccount, type AuthioFrontChannelLogout, AuthioGrantTypes, AuthioHmacAlgorithms, AuthioHmacMinimumSecretBytes, type AuthioIdTokenClaims, type AuthioIntrospectionResult, type AuthioJwtExpectations, AuthioKeyManagementAlgorithms, AuthioLegacyKeyManagementAlgorithms, type AuthioLogoutToken, AuthioOAuthErrors, type AuthioPkcePair, type AuthioPrivateKeyInput, type AuthioPrompt, AuthioPrompts, AuthioProtocolError, AuthioResourceAccess, AuthioResourceAccessClaims, type AuthioResourceAccessRole, type AuthioResourceAccessSource, type AuthioResponseMode, AuthioScopes, type AuthioSecretSource, type AuthioSigningKeys, AuthioSupportedContentEncryptionAlgorithms, type AuthioTokenClient, type AuthioTokenDecrypter, type AuthioTokenDecrypterOptions, type AuthioTokenEndpointAuthMethod, AuthioTokenEndpointAuthMethods, type AuthioTokenFailure, type AuthioTokenResponse, AuthioTokenTypes, AuthioTokenValidationError, type AuthioTypedWebhookEvent, type AuthioUserInfo, type AuthioWebhookAdminResource, type AuthioWebhookAdminResourceData, type AuthioWebhookAttackDetected, type AuthioWebhookAttackDetectedData, type AuthioWebhookCredentialCompromised, type AuthioWebhookCredentialCompromisedData, type AuthioWebhookDataByType, type AuthioWebhookEvent, AuthioWebhookEventTypes, AuthioWebhookHeaders, type AuthioWebhookKeysRotated, type AuthioWebhookKeysRotatedData, type AuthioWebhookLogin, type AuthioWebhookLoginData, type AuthioWebhookPing, type AuthioWebhookPingData, type AuthioWebhookTokenReuseDetected, type AuthioWebhookTokenReuseDetectedData, type AuthioWebhookTokenRevoked, type AuthioWebhookTokenRevokedData, type AuthioWebhookUser, type AuthioWebhookUserData, type AuthioWebhookUserLockedOut, type AuthioWebhookUserLockedOutData, type AuthioWebhookUserSuspension, type AuthioWebhookUserSuspensionData, type AuthioWebhookVerificationFailure, type AuthioWebhookVerificationResult, asAdminResourceEvent, asAttackDetectedEvent, asCredentialCompromisedEvent, asKeysRotatedEvent, asLoginEvent, asPingEvent, asTokenReuseDetectedEvent, asTokenRevokedEvent, asUserEvent, asUserLockedOutEvent, asUserSuspensionEvent, computeAuthioTokenHash, computeWebhookSignatureHeader, createAuthioAccountCredential, createAuthioClient, createAuthioDiscoveryClient, createAuthioPkce, createAuthioSigningKeys, createAuthioTokenDecrypter, encryptionKeyFromFile, escapeDataString, isAllowedUrl, isAuthioTokenEncrypted, isKnownWebhookEventType, isWebhookEventOfType, parseAuthioAdminEnvelope, parseAuthioBearerChallenge, parseResourceAccess, parseResourceAccessClaim, parseWebhookEvent, randomValue, readAuthioAdminResponse, readAuthioFrontChannelLogout, readWebhookEventData, requireHmacSecretLength, resolveConnection, resolveIssuer, resourceAccessSourceOf, seconds, systemClock, toBasicAuthorization, toCamelCasedMembers, toClientCredentialsToken, toConnectionExchangeResult, toCredentialClientId, toDevicePollOutcome, toScopeString, toTokenValidationError, tryParseWebhookEvent, verifyAuthioJwt, verifyWebhookSignature, withClientSecret };
|
|
1802
|
+
export { type AuthioAccountCredential, type AuthioAccountCredentialKind, type AuthioAccountCredentialOptions, type AuthioAdminEnvelope, AuthioAdminError, type AuthioAdminFailure, type AuthioAdminNotification, type AuthioAdminSuccess, AuthioAsymmetricAlgorithms, type AuthioAuthorizationRequest, type AuthioAuthorizationResult, type AuthioAuthorizationTransaction, type AuthioAuthorizationUrl, type AuthioBearerChallenge, type AuthioCallOptions, AuthioCallbackError, type AuthioCallbackFailure, type AuthioCallerKind, AuthioCallerKinds, type AuthioCamelCase, type AuthioCamelCased, type AuthioCheck, AuthioChecks, AuthioClaimTypes, type AuthioClient, AuthioClientAssertionAlgorithms, type AuthioClientCredentialsCache, type AuthioClientCredentialsSettings, type AuthioClientCredentialsToken, type AuthioClientOptions, type AuthioClock, type AuthioCodeChallengeMethod, AuthioConfigurationError, type AuthioConnection, type AuthioConnectionChoice, type AuthioConnectionExchangeResult, type AuthioConnectionGranted, type AuthioConnectionOptions, type AuthioConnectionRefused, type AuthioConnectionRequired, type AuthioConnectionSelectionRequired, AuthioContentEncryptionAlgorithms, type AuthioCredentialForm, AuthioDefaults, type AuthioDeviceAuthorization, type AuthioDevicePollOutcome, type AuthioDiscoveryClient, type AuthioDiscoveryDocument, AuthioDiscoveryError, type AuthioEncryptionKey, type AuthioEncryptionKeySource, type AuthioEndSessionRequest, AuthioError, type AuthioErrorResponse, type AuthioExternalAccount, type AuthioFrontChannelLogout, AuthioGrantTypes, AuthioHmacAlgorithms, AuthioHmacMinimumSecretBytes, type AuthioIdTokenClaims, type AuthioIntrospectionResult, type AuthioJwtExpectations, AuthioKeyManagementAlgorithms, AuthioLegacyKeyManagementAlgorithms, type AuthioLogoutToken, AuthioOAuthErrors, type AuthioPkcePair, type AuthioPrivateKeyInput, type AuthioPrompt, AuthioPrompts, AuthioProtocolError, AuthioResourceAccess, AuthioResourceAccessClaims, type AuthioResourceAccessRole, type AuthioResourceAccessSource, type AuthioResponseMode, AuthioScopes, type AuthioSecretSource, type AuthioSigningKeys, AuthioSupportedContentEncryptionAlgorithms, type AuthioTokenClient, type AuthioTokenDecrypter, type AuthioTokenDecrypterOptions, type AuthioTokenEndpointAuthMethod, AuthioTokenEndpointAuthMethods, type AuthioTokenFailure, type AuthioTokenResponse, AuthioTokenTypes, AuthioTokenValidationError, type AuthioTypedWebhookEvent, type AuthioUserInfo, type AuthioWebhookAdminResource, type AuthioWebhookAdminResourceData, type AuthioWebhookAttackDetected, type AuthioWebhookAttackDetectedData, type AuthioWebhookAuthenticatorApp, type AuthioWebhookAuthenticatorAppData, type AuthioWebhookCredentialCompromised, type AuthioWebhookCredentialCompromisedData, type AuthioWebhookDataByType, type AuthioWebhookEvent, AuthioWebhookEventTypes, AuthioWebhookHeaders, type AuthioWebhookKeysRotated, type AuthioWebhookKeysRotatedData, type AuthioWebhookLogin, type AuthioWebhookLoginData, type AuthioWebhookPing, type AuthioWebhookPingData, type AuthioWebhookTokenReuseDetected, type AuthioWebhookTokenReuseDetectedData, type AuthioWebhookTokenRevoked, type AuthioWebhookTokenRevokedData, type AuthioWebhookUser, type AuthioWebhookUserData, type AuthioWebhookUserLockedOut, type AuthioWebhookUserLockedOutData, type AuthioWebhookUserSuspension, type AuthioWebhookUserSuspensionData, type AuthioWebhookVerificationFailure, type AuthioWebhookVerificationResult, asAdminResourceEvent, asAttackDetectedEvent, asAuthenticatorAppEvent, asCredentialCompromisedEvent, asKeysRotatedEvent, asLoginEvent, asPingEvent, asTokenReuseDetectedEvent, asTokenRevokedEvent, asUserEvent, asUserLockedOutEvent, asUserSuspensionEvent, computeAuthioTokenHash, computeWebhookSignatureHeader, createAuthioAccountCredential, createAuthioClient, createAuthioDiscoveryClient, createAuthioPkce, createAuthioSigningKeys, createAuthioTokenDecrypter, encryptionKeyFromFile, escapeDataString, isAllowedUrl, isAuthioTokenEncrypted, isKnownWebhookEventType, isWebhookEventOfType, parseAuthioAdminEnvelope, parseAuthioBearerChallenge, parseResourceAccess, parseResourceAccessClaim, parseWebhookEvent, randomValue, readAuthioAdminResponse, readAuthioFrontChannelLogout, readWebhookEventData, requireAccessTokenType, requireHmacSecretLength, resolveConnection, resolveIssuer, resourceAccessSourceOf, seconds, systemClock, toBasicAuthorization, toCamelCasedMembers, toClientCredentialsToken, toConnectionExchangeResult, toCredentialClientId, toDevicePollOutcome, toScopeString, toTokenValidationError, tryParseWebhookEvent, verifyAuthioJwt, verifyWebhookSignature, withClientSecret };
|
package/dist/index.d.ts
CHANGED
|
@@ -151,6 +151,10 @@ declare const AuthioWebhookEventTypes: {
|
|
|
151
151
|
readonly UserSuspensionEnded: "user_suspension_ended";
|
|
152
152
|
readonly AttackDetected: "attack_detected";
|
|
153
153
|
readonly CredentialCompromised: "credential_compromised";
|
|
154
|
+
readonly UserAuthenticatorAppEnrolled: "user_authenticator_app_enrolled";
|
|
155
|
+
readonly UserAuthenticatorAppRemoved: "user_authenticator_app_removed";
|
|
156
|
+
readonly UserRecoveryCodesRegenerated: "user_recovery_codes_regenerated";
|
|
157
|
+
readonly UserRecoveryCodeUsed: "user_recovery_code_used";
|
|
154
158
|
readonly Ping: "ping";
|
|
155
159
|
};
|
|
156
160
|
/**
|
|
@@ -216,6 +220,8 @@ declare const AuthioDefaults: {
|
|
|
216
220
|
readonly CredentialClientIdPrefix: "cred_";
|
|
217
221
|
readonly ApiKeyHeader: "x-api-key";
|
|
218
222
|
readonly RequestIdHeader: "X-Request-Id";
|
|
223
|
+
/** The header `typ` of an access token (RFC 9068 §2.1). */
|
|
224
|
+
readonly AccessTokenType: "at+jwt";
|
|
219
225
|
/** The header `typ` of a back-channel logout token. */
|
|
220
226
|
readonly LogoutTokenType: "logout+jwt";
|
|
221
227
|
/** The event a back-channel logout token carries. */
|
|
@@ -717,6 +723,15 @@ declare function toTokenValidationError(error: unknown, audiences: readonly stri
|
|
|
717
723
|
* digest, base64url-encoded (OpenID Connect Core §3.1.3.6).
|
|
718
724
|
*/
|
|
719
725
|
declare function computeAuthioTokenHash(value: string, algorithm: string): Promise<string>;
|
|
726
|
+
/**
|
|
727
|
+
* Requires the header `typ` of an access token to be `at+jwt` (or `application/at+jwt`), as RFC 9068 §4 asks a
|
|
728
|
+
* resource server to check, so an ID token or any other JWT is never taken for an access token.
|
|
729
|
+
*
|
|
730
|
+
* @param header The protected header of the verified token.
|
|
731
|
+
* @throws AuthioTokenValidationError with the reason `not_access_token` otherwise.
|
|
732
|
+
* @internal
|
|
733
|
+
*/
|
|
734
|
+
declare function requireAccessTokenType(header: Record<string, unknown>): void;
|
|
720
735
|
|
|
721
736
|
/**
|
|
722
737
|
* The PKCE method (RFC 7636). `S256` is the default; `plain` only when asked for, for a client that cannot hash.
|
|
@@ -853,7 +868,9 @@ interface AuthioFrontChannelLogout {
|
|
|
853
868
|
*/
|
|
854
869
|
declare function readAuthioFrontChannelLogout(request: string | URL | URLSearchParams | Readonly<Record<string, unknown>>, issuer: string): AuthioFrontChannelLogout;
|
|
855
870
|
/**
|
|
856
|
-
* Parses a `WWW-Authenticate` bearer challenge, or `undefined` when the header holds none.
|
|
871
|
+
* Parses a `WWW-Authenticate` bearer challenge, or `undefined` when the header holds none. It reads the header only,
|
|
872
|
+
* whatever the status: a step-up challenge (`insufficient_user_authentication`) comes with `401` (RFC 9470 §3), or
|
|
873
|
+
* with `403` from servers before `@hyper.authio/server` 0.8.1 and `@hyper.authio/mcp` 0.4.1.
|
|
857
874
|
*/
|
|
858
875
|
declare function parseAuthioBearerChallenge(header: string | null | undefined): AuthioBearerChallenge | undefined;
|
|
859
876
|
|
|
@@ -1167,7 +1184,8 @@ interface AuthioTokenClient {
|
|
|
1167
1184
|
} & AuthioCallOptions): Promise<AuthioTokenResponse>;
|
|
1168
1185
|
/**
|
|
1169
1186
|
* The `personal_access_token` grant: a `pat_` value presented as `client_secret`, with the consumer's client id for
|
|
1170
|
-
* a consumer's token or
|
|
1187
|
+
* a consumer's token or the platform client (`AuthioDefaults.PlatformClientId`) for an account's token. The client's
|
|
1188
|
+
* own credentials are not sent.
|
|
1171
1189
|
*/
|
|
1172
1190
|
personalAccessToken(options: {
|
|
1173
1191
|
token: string;
|
|
@@ -1279,7 +1297,8 @@ interface AuthioClient {
|
|
|
1279
1297
|
validateFrontChannelLogout(request: string | URL | URLSearchParams | Readonly<Record<string, unknown>>): AuthioFrontChannelLogout;
|
|
1280
1298
|
/**
|
|
1281
1299
|
* Reads an access token this client received from Authio: decrypted with `clientEncryptionKey` when it is a JWE,
|
|
1282
|
-
* then its signature (with `accessTokenSignedResponseAlg`), `iss
|
|
1300
|
+
* then its signature (with `accessTokenSignedResponseAlg`), `iss`, `exp` and the header `typ` `at+jwt` (RFC 9068 §4)
|
|
1301
|
+
* checked. Its audience is the API's, so it is not checked. `undefined` for an
|
|
1283
1302
|
* opaque token, or an encrypted one without `clientEncryptionKey`.
|
|
1284
1303
|
*
|
|
1285
1304
|
* @throws AuthioTokenValidationError naming why it was refused.
|
|
@@ -1489,6 +1508,10 @@ interface AuthioWebhookEvent {
|
|
|
1489
1508
|
/** Seconds since the epoch. */
|
|
1490
1509
|
readonly created_at: number;
|
|
1491
1510
|
readonly realm_id?: string | null;
|
|
1511
|
+
/**
|
|
1512
|
+
* The client the event came through. On a realm endpoint, `null` when there is none, such as a person created in
|
|
1513
|
+
* the realm.
|
|
1514
|
+
*/
|
|
1492
1515
|
readonly client_id?: string | null;
|
|
1493
1516
|
readonly data: unknown;
|
|
1494
1517
|
[member: string]: unknown;
|
|
@@ -1619,6 +1642,19 @@ interface AuthioWebhookCredentialCompromisedData {
|
|
|
1619
1642
|
network_operator?: string | null;
|
|
1620
1643
|
password_change_required?: boolean | null;
|
|
1621
1644
|
}
|
|
1645
|
+
/**
|
|
1646
|
+
* `user_authenticator_app_enrolled`, `user_authenticator_app_removed`, `user_recovery_codes_regenerated` and
|
|
1647
|
+
* `user_recovery_code_used`, as delivered: a change to a person's authenticator app, never a code nor the secret.
|
|
1648
|
+
*/
|
|
1649
|
+
interface AuthioWebhookAuthenticatorAppData {
|
|
1650
|
+
user_id: string;
|
|
1651
|
+
username?: string | null;
|
|
1652
|
+
email?: string | null;
|
|
1653
|
+
/** Who made the change: `user`, or `administrator` when an administrator reset the app. */
|
|
1654
|
+
actor?: string | null;
|
|
1655
|
+
/** The recovery codes the account has left after the change. */
|
|
1656
|
+
recovery_codes_remaining?: number | null;
|
|
1657
|
+
}
|
|
1622
1658
|
/** `ping`, as delivered. */
|
|
1623
1659
|
interface AuthioWebhookPingData {
|
|
1624
1660
|
message?: string | null;
|
|
@@ -1644,6 +1680,10 @@ interface AuthioWebhookDataByType {
|
|
|
1644
1680
|
user_suspension_ended: AuthioWebhookUserSuspensionData;
|
|
1645
1681
|
attack_detected: AuthioWebhookAttackDetectedData;
|
|
1646
1682
|
credential_compromised: AuthioWebhookCredentialCompromisedData;
|
|
1683
|
+
user_authenticator_app_enrolled: AuthioWebhookAuthenticatorAppData;
|
|
1684
|
+
user_authenticator_app_removed: AuthioWebhookAuthenticatorAppData;
|
|
1685
|
+
user_recovery_codes_regenerated: AuthioWebhookAuthenticatorAppData;
|
|
1686
|
+
user_recovery_code_used: AuthioWebhookAuthenticatorAppData;
|
|
1647
1687
|
ping: AuthioWebhookPingData;
|
|
1648
1688
|
}
|
|
1649
1689
|
/**
|
|
@@ -1676,6 +1716,8 @@ type AuthioWebhookUserSuspension = AuthioCamelCased<AuthioWebhookUserSuspensionD
|
|
|
1676
1716
|
type AuthioWebhookAttackDetected = AuthioCamelCased<AuthioWebhookAttackDetectedData>;
|
|
1677
1717
|
/** The data of a compromised credential event, as the typed accessor exposes it. */
|
|
1678
1718
|
type AuthioWebhookCredentialCompromised = AuthioCamelCased<AuthioWebhookCredentialCompromisedData>;
|
|
1719
|
+
/** The data of an authenticator app event, as the typed accessor exposes it. */
|
|
1720
|
+
type AuthioWebhookAuthenticatorApp = AuthioCamelCased<AuthioWebhookAuthenticatorAppData>;
|
|
1679
1721
|
/** The data of a ping, as the typed accessor exposes it. */
|
|
1680
1722
|
type AuthioWebhookPing = AuthioCamelCased<AuthioWebhookPingData>;
|
|
1681
1723
|
/**
|
|
@@ -1739,6 +1781,8 @@ declare const asUserSuspensionEvent: (event: AuthioWebhookEvent) => AuthioCamelC
|
|
|
1739
1781
|
declare const asAttackDetectedEvent: (event: AuthioWebhookEvent) => AuthioCamelCased<AuthioWebhookAttackDetectedData> | undefined;
|
|
1740
1782
|
/** The data of a compromised credential event in camelCase, or `undefined` for any other type. */
|
|
1741
1783
|
declare const asCredentialCompromisedEvent: (event: AuthioWebhookEvent) => AuthioCamelCased<AuthioWebhookCredentialCompromisedData> | undefined;
|
|
1784
|
+
/** The data of an authenticator app event in camelCase, or `undefined` for any other type. */
|
|
1785
|
+
declare const asAuthenticatorAppEvent: (event: AuthioWebhookEvent) => AuthioCamelCased<AuthioWebhookAuthenticatorAppData> | undefined;
|
|
1742
1786
|
/** The data of a ping in camelCase, or `undefined` for any other type. */
|
|
1743
1787
|
declare const asPingEvent: (event: AuthioWebhookEvent) => AuthioCamelCased<AuthioWebhookPingData> | undefined;
|
|
1744
1788
|
/**
|
|
@@ -1755,4 +1799,4 @@ declare function readWebhookEventData(event: AuthioWebhookEvent): Record<string,
|
|
|
1755
1799
|
*/
|
|
1756
1800
|
declare function toCamelCasedMembers<T extends object>(value: T): AuthioCamelCased<T>;
|
|
1757
1801
|
|
|
1758
|
-
export { type AuthioAccountCredential, type AuthioAccountCredentialKind, type AuthioAccountCredentialOptions, type AuthioAdminEnvelope, AuthioAdminError, type AuthioAdminFailure, type AuthioAdminNotification, type AuthioAdminSuccess, AuthioAsymmetricAlgorithms, type AuthioAuthorizationRequest, type AuthioAuthorizationResult, type AuthioAuthorizationTransaction, type AuthioAuthorizationUrl, type AuthioBearerChallenge, type AuthioCallOptions, AuthioCallbackError, type AuthioCallbackFailure, type AuthioCallerKind, AuthioCallerKinds, type AuthioCamelCase, type AuthioCamelCased, type AuthioCheck, AuthioChecks, AuthioClaimTypes, type AuthioClient, AuthioClientAssertionAlgorithms, type AuthioClientCredentialsCache, type AuthioClientCredentialsSettings, type AuthioClientCredentialsToken, type AuthioClientOptions, type AuthioClock, type AuthioCodeChallengeMethod, AuthioConfigurationError, type AuthioConnection, type AuthioConnectionChoice, type AuthioConnectionExchangeResult, type AuthioConnectionGranted, type AuthioConnectionOptions, type AuthioConnectionRefused, type AuthioConnectionRequired, type AuthioConnectionSelectionRequired, AuthioContentEncryptionAlgorithms, type AuthioCredentialForm, AuthioDefaults, type AuthioDeviceAuthorization, type AuthioDevicePollOutcome, type AuthioDiscoveryClient, type AuthioDiscoveryDocument, AuthioDiscoveryError, type AuthioEncryptionKey, type AuthioEncryptionKeySource, type AuthioEndSessionRequest, AuthioError, type AuthioErrorResponse, type AuthioExternalAccount, type AuthioFrontChannelLogout, AuthioGrantTypes, AuthioHmacAlgorithms, AuthioHmacMinimumSecretBytes, type AuthioIdTokenClaims, type AuthioIntrospectionResult, type AuthioJwtExpectations, AuthioKeyManagementAlgorithms, AuthioLegacyKeyManagementAlgorithms, type AuthioLogoutToken, AuthioOAuthErrors, type AuthioPkcePair, type AuthioPrivateKeyInput, type AuthioPrompt, AuthioPrompts, AuthioProtocolError, AuthioResourceAccess, AuthioResourceAccessClaims, type AuthioResourceAccessRole, type AuthioResourceAccessSource, type AuthioResponseMode, AuthioScopes, type AuthioSecretSource, type AuthioSigningKeys, AuthioSupportedContentEncryptionAlgorithms, type AuthioTokenClient, type AuthioTokenDecrypter, type AuthioTokenDecrypterOptions, type AuthioTokenEndpointAuthMethod, AuthioTokenEndpointAuthMethods, type AuthioTokenFailure, type AuthioTokenResponse, AuthioTokenTypes, AuthioTokenValidationError, type AuthioTypedWebhookEvent, type AuthioUserInfo, type AuthioWebhookAdminResource, type AuthioWebhookAdminResourceData, type AuthioWebhookAttackDetected, type AuthioWebhookAttackDetectedData, type AuthioWebhookCredentialCompromised, type AuthioWebhookCredentialCompromisedData, type AuthioWebhookDataByType, type AuthioWebhookEvent, AuthioWebhookEventTypes, AuthioWebhookHeaders, type AuthioWebhookKeysRotated, type AuthioWebhookKeysRotatedData, type AuthioWebhookLogin, type AuthioWebhookLoginData, type AuthioWebhookPing, type AuthioWebhookPingData, type AuthioWebhookTokenReuseDetected, type AuthioWebhookTokenReuseDetectedData, type AuthioWebhookTokenRevoked, type AuthioWebhookTokenRevokedData, type AuthioWebhookUser, type AuthioWebhookUserData, type AuthioWebhookUserLockedOut, type AuthioWebhookUserLockedOutData, type AuthioWebhookUserSuspension, type AuthioWebhookUserSuspensionData, type AuthioWebhookVerificationFailure, type AuthioWebhookVerificationResult, asAdminResourceEvent, asAttackDetectedEvent, asCredentialCompromisedEvent, asKeysRotatedEvent, asLoginEvent, asPingEvent, asTokenReuseDetectedEvent, asTokenRevokedEvent, asUserEvent, asUserLockedOutEvent, asUserSuspensionEvent, computeAuthioTokenHash, computeWebhookSignatureHeader, createAuthioAccountCredential, createAuthioClient, createAuthioDiscoveryClient, createAuthioPkce, createAuthioSigningKeys, createAuthioTokenDecrypter, encryptionKeyFromFile, escapeDataString, isAllowedUrl, isAuthioTokenEncrypted, isKnownWebhookEventType, isWebhookEventOfType, parseAuthioAdminEnvelope, parseAuthioBearerChallenge, parseResourceAccess, parseResourceAccessClaim, parseWebhookEvent, randomValue, readAuthioAdminResponse, readAuthioFrontChannelLogout, readWebhookEventData, requireHmacSecretLength, resolveConnection, resolveIssuer, resourceAccessSourceOf, seconds, systemClock, toBasicAuthorization, toCamelCasedMembers, toClientCredentialsToken, toConnectionExchangeResult, toCredentialClientId, toDevicePollOutcome, toScopeString, toTokenValidationError, tryParseWebhookEvent, verifyAuthioJwt, verifyWebhookSignature, withClientSecret };
|
|
1802
|
+
export { type AuthioAccountCredential, type AuthioAccountCredentialKind, type AuthioAccountCredentialOptions, type AuthioAdminEnvelope, AuthioAdminError, type AuthioAdminFailure, type AuthioAdminNotification, type AuthioAdminSuccess, AuthioAsymmetricAlgorithms, type AuthioAuthorizationRequest, type AuthioAuthorizationResult, type AuthioAuthorizationTransaction, type AuthioAuthorizationUrl, type AuthioBearerChallenge, type AuthioCallOptions, AuthioCallbackError, type AuthioCallbackFailure, type AuthioCallerKind, AuthioCallerKinds, type AuthioCamelCase, type AuthioCamelCased, type AuthioCheck, AuthioChecks, AuthioClaimTypes, type AuthioClient, AuthioClientAssertionAlgorithms, type AuthioClientCredentialsCache, type AuthioClientCredentialsSettings, type AuthioClientCredentialsToken, type AuthioClientOptions, type AuthioClock, type AuthioCodeChallengeMethod, AuthioConfigurationError, type AuthioConnection, type AuthioConnectionChoice, type AuthioConnectionExchangeResult, type AuthioConnectionGranted, type AuthioConnectionOptions, type AuthioConnectionRefused, type AuthioConnectionRequired, type AuthioConnectionSelectionRequired, AuthioContentEncryptionAlgorithms, type AuthioCredentialForm, AuthioDefaults, type AuthioDeviceAuthorization, type AuthioDevicePollOutcome, type AuthioDiscoveryClient, type AuthioDiscoveryDocument, AuthioDiscoveryError, type AuthioEncryptionKey, type AuthioEncryptionKeySource, type AuthioEndSessionRequest, AuthioError, type AuthioErrorResponse, type AuthioExternalAccount, type AuthioFrontChannelLogout, AuthioGrantTypes, AuthioHmacAlgorithms, AuthioHmacMinimumSecretBytes, type AuthioIdTokenClaims, type AuthioIntrospectionResult, type AuthioJwtExpectations, AuthioKeyManagementAlgorithms, AuthioLegacyKeyManagementAlgorithms, type AuthioLogoutToken, AuthioOAuthErrors, type AuthioPkcePair, type AuthioPrivateKeyInput, type AuthioPrompt, AuthioPrompts, AuthioProtocolError, AuthioResourceAccess, AuthioResourceAccessClaims, type AuthioResourceAccessRole, type AuthioResourceAccessSource, type AuthioResponseMode, AuthioScopes, type AuthioSecretSource, type AuthioSigningKeys, AuthioSupportedContentEncryptionAlgorithms, type AuthioTokenClient, type AuthioTokenDecrypter, type AuthioTokenDecrypterOptions, type AuthioTokenEndpointAuthMethod, AuthioTokenEndpointAuthMethods, type AuthioTokenFailure, type AuthioTokenResponse, AuthioTokenTypes, AuthioTokenValidationError, type AuthioTypedWebhookEvent, type AuthioUserInfo, type AuthioWebhookAdminResource, type AuthioWebhookAdminResourceData, type AuthioWebhookAttackDetected, type AuthioWebhookAttackDetectedData, type AuthioWebhookAuthenticatorApp, type AuthioWebhookAuthenticatorAppData, type AuthioWebhookCredentialCompromised, type AuthioWebhookCredentialCompromisedData, type AuthioWebhookDataByType, type AuthioWebhookEvent, AuthioWebhookEventTypes, AuthioWebhookHeaders, type AuthioWebhookKeysRotated, type AuthioWebhookKeysRotatedData, type AuthioWebhookLogin, type AuthioWebhookLoginData, type AuthioWebhookPing, type AuthioWebhookPingData, type AuthioWebhookTokenReuseDetected, type AuthioWebhookTokenReuseDetectedData, type AuthioWebhookTokenRevoked, type AuthioWebhookTokenRevokedData, type AuthioWebhookUser, type AuthioWebhookUserData, type AuthioWebhookUserLockedOut, type AuthioWebhookUserLockedOutData, type AuthioWebhookUserSuspension, type AuthioWebhookUserSuspensionData, type AuthioWebhookVerificationFailure, type AuthioWebhookVerificationResult, asAdminResourceEvent, asAttackDetectedEvent, asAuthenticatorAppEvent, asCredentialCompromisedEvent, asKeysRotatedEvent, asLoginEvent, asPingEvent, asTokenReuseDetectedEvent, asTokenRevokedEvent, asUserEvent, asUserLockedOutEvent, asUserSuspensionEvent, computeAuthioTokenHash, computeWebhookSignatureHeader, createAuthioAccountCredential, createAuthioClient, createAuthioDiscoveryClient, createAuthioPkce, createAuthioSigningKeys, createAuthioTokenDecrypter, encryptionKeyFromFile, escapeDataString, isAllowedUrl, isAuthioTokenEncrypted, isKnownWebhookEventType, isWebhookEventOfType, parseAuthioAdminEnvelope, parseAuthioBearerChallenge, parseResourceAccess, parseResourceAccessClaim, parseWebhookEvent, randomValue, readAuthioAdminResponse, readAuthioFrontChannelLogout, readWebhookEventData, requireAccessTokenType, requireHmacSecretLength, resolveConnection, resolveIssuer, resourceAccessSourceOf, seconds, systemClock, toBasicAuthorization, toCamelCasedMembers, toClientCredentialsToken, toConnectionExchangeResult, toCredentialClientId, toDevicePollOutcome, toScopeString, toTokenValidationError, tryParseWebhookEvent, verifyAuthioJwt, verifyWebhookSignature, withClientSecret };
|
package/dist/index.js
CHANGED
|
@@ -127,6 +127,10 @@ var AuthioWebhookEventTypes = {
|
|
|
127
127
|
UserSuspensionEnded: "user_suspension_ended",
|
|
128
128
|
AttackDetected: "attack_detected",
|
|
129
129
|
CredentialCompromised: "credential_compromised",
|
|
130
|
+
UserAuthenticatorAppEnrolled: "user_authenticator_app_enrolled",
|
|
131
|
+
UserAuthenticatorAppRemoved: "user_authenticator_app_removed",
|
|
132
|
+
UserRecoveryCodesRegenerated: "user_recovery_codes_regenerated",
|
|
133
|
+
UserRecoveryCodeUsed: "user_recovery_code_used",
|
|
130
134
|
Ping: "ping"
|
|
131
135
|
};
|
|
132
136
|
var AuthioWebhookHeaders = {
|
|
@@ -162,6 +166,8 @@ var AuthioDefaults = {
|
|
|
162
166
|
CredentialClientIdPrefix: "cred_",
|
|
163
167
|
ApiKeyHeader: "x-api-key",
|
|
164
168
|
RequestIdHeader: "X-Request-Id",
|
|
169
|
+
/** The header `typ` of an access token (RFC 9068 §2.1). */
|
|
170
|
+
AccessTokenType: "at+jwt",
|
|
165
171
|
/** The header `typ` of a back-channel logout token. */
|
|
166
172
|
LogoutTokenType: "logout+jwt",
|
|
167
173
|
/** The event a back-channel logout token carries. */
|
|
@@ -960,6 +966,14 @@ async function validateAuthioIdToken(token, context, expectations = {}) {
|
|
|
960
966
|
}
|
|
961
967
|
return payload;
|
|
962
968
|
}
|
|
969
|
+
function requireAccessTokenType(header) {
|
|
970
|
+
const type = typeof header.typ === "string" ? header.typ.toLowerCase() : void 0;
|
|
971
|
+
if (type !== AuthioDefaults.AccessTokenType && type !== `application/${AuthioDefaults.AccessTokenType}`)
|
|
972
|
+
throw new AuthioTokenValidationError(
|
|
973
|
+
"not_access_token",
|
|
974
|
+
`Only access tokens are accepted; this token's header typ is '${header.typ ?? ""}', not '${AuthioDefaults.AccessTokenType}'.`
|
|
975
|
+
);
|
|
976
|
+
}
|
|
963
977
|
async function validateAuthioLogoutToken(token, context) {
|
|
964
978
|
const signed = isAuthioTokenEncrypted(token) ? await context.decrypt(token) : token;
|
|
965
979
|
const invalid = (message) => new AuthioTokenValidationError("invalid_logout_token", message);
|
|
@@ -1291,12 +1305,13 @@ function createAuthioClient(options) {
|
|
|
1291
1305
|
const signed = await decrypt(accessToken);
|
|
1292
1306
|
if (signed.split(".").length !== 3) return void 0;
|
|
1293
1307
|
const document = await discovery.get(callOptions.signal);
|
|
1294
|
-
const { payload } = await verifyAuthioJwt(signed, withClientSecret(await signingKeys(callOptions.signal), clientSecret), {
|
|
1308
|
+
const { payload, header } = await verifyAuthioJwt(signed, withClientSecret(await signingKeys(callOptions.signal), clientSecret), {
|
|
1295
1309
|
issuer: connection.issuer,
|
|
1296
1310
|
algorithms: acceptedSigningAlgorithms(accessTokenAlgorithm, document.id_token_signing_alg_values_supported),
|
|
1297
1311
|
clockSkew,
|
|
1298
1312
|
now: connection.clock.now()
|
|
1299
1313
|
});
|
|
1314
|
+
requireAccessTokenType(header);
|
|
1300
1315
|
return payload;
|
|
1301
1316
|
},
|
|
1302
1317
|
async createEndSessionUrl(request = {}) {
|
|
@@ -1337,13 +1352,16 @@ function createAuthioClient(options) {
|
|
|
1337
1352
|
};
|
|
1338
1353
|
const token = await clientCredentials.getToken({ ...key, signal: request.signal });
|
|
1339
1354
|
const response = await attempt(token);
|
|
1340
|
-
if (response.status !== 401) return response;
|
|
1355
|
+
if (response.status !== 401 || isStepUpChallenge(response)) return response;
|
|
1341
1356
|
clientCredentials.invalidate({ ...key, accessToken: token.accessToken });
|
|
1342
1357
|
return attempt(await clientCredentials.getToken({ ...key, signal: request.signal }));
|
|
1343
1358
|
};
|
|
1344
1359
|
}
|
|
1345
1360
|
};
|
|
1346
1361
|
}
|
|
1362
|
+
function isStepUpChallenge(response) {
|
|
1363
|
+
return parseAuthioBearerChallenge(response.headers.get("www-authenticate"))?.error === AuthioOAuthErrors.InsufficientUserAuthentication;
|
|
1364
|
+
}
|
|
1347
1365
|
function createTokenClient(connection, discovery, authenticator) {
|
|
1348
1366
|
const requestToken = async (parameters, signal, authenticate = true) => {
|
|
1349
1367
|
const response = await postForm(connection, discovery, authenticate ? authenticator : void 0, "token_endpoint", parameters, signal);
|
|
@@ -1706,7 +1724,7 @@ function createAuthioAccountCredential(options) {
|
|
|
1706
1724
|
if (cached && clock.now() < cached.refreshAt) return cached;
|
|
1707
1725
|
pending ??= (async () => {
|
|
1708
1726
|
const issuedAt = clock.now();
|
|
1709
|
-
const answer = kind === "client_secret" ? await client.tokens.clientCredentials({ scopes: scope, signal }) : await client.tokens.personalAccessToken({ token: value, scopes: scope, signal });
|
|
1727
|
+
const answer = kind === "client_secret" ? await client.tokens.clientCredentials({ scopes: scope, signal }) : await client.tokens.personalAccessToken({ token: value, clientId: AuthioDefaults.PlatformClientId, scopes: scope, signal });
|
|
1710
1728
|
cached = toClientCredentialsToken(answer, issuedAt, refreshSkewMs);
|
|
1711
1729
|
return cached;
|
|
1712
1730
|
})().finally(() => {
|
|
@@ -2019,6 +2037,13 @@ var asAdminResourceEvent = (event) => dataWhen(
|
|
|
2019
2037
|
var asUserSuspensionEvent = (event) => dataWhen(event, AuthioWebhookEventTypes.UserSuspended, AuthioWebhookEventTypes.UserSuspensionEnded);
|
|
2020
2038
|
var asAttackDetectedEvent = (event) => dataWhen(event, AuthioWebhookEventTypes.AttackDetected);
|
|
2021
2039
|
var asCredentialCompromisedEvent = (event) => dataWhen(event, AuthioWebhookEventTypes.CredentialCompromised);
|
|
2040
|
+
var asAuthenticatorAppEvent = (event) => dataWhen(
|
|
2041
|
+
event,
|
|
2042
|
+
AuthioWebhookEventTypes.UserAuthenticatorAppEnrolled,
|
|
2043
|
+
AuthioWebhookEventTypes.UserAuthenticatorAppRemoved,
|
|
2044
|
+
AuthioWebhookEventTypes.UserRecoveryCodesRegenerated,
|
|
2045
|
+
AuthioWebhookEventTypes.UserRecoveryCodeUsed
|
|
2046
|
+
);
|
|
2022
2047
|
var asPingEvent = (event) => dataWhen(event, AuthioWebhookEventTypes.Ping);
|
|
2023
2048
|
var knownEventTypes = new Set(Object.values(AuthioWebhookEventTypes));
|
|
2024
2049
|
function isKnownWebhookEventType(type) {
|
|
@@ -2072,6 +2097,6 @@ function constantTimeEquals(left, right) {
|
|
|
2072
2097
|
return difference === 0;
|
|
2073
2098
|
}
|
|
2074
2099
|
|
|
2075
|
-
export { AuthioAdminError, AuthioAsymmetricAlgorithms, AuthioCallbackError, AuthioCallerKinds, AuthioChecks, AuthioClaimTypes, AuthioClientAssertionAlgorithms, AuthioConfigurationError, AuthioContentEncryptionAlgorithms, AuthioDefaults, AuthioDiscoveryError, AuthioError, AuthioGrantTypes, AuthioHmacAlgorithms, AuthioHmacMinimumSecretBytes, AuthioKeyManagementAlgorithms, AuthioLegacyKeyManagementAlgorithms, AuthioOAuthErrors, AuthioPrompts, AuthioProtocolError, AuthioResourceAccess, AuthioResourceAccessClaims, AuthioScopes, AuthioSupportedContentEncryptionAlgorithms, AuthioTokenEndpointAuthMethods, AuthioTokenTypes, AuthioTokenValidationError, AuthioWebhookEventTypes, AuthioWebhookHeaders, asAdminResourceEvent, asAttackDetectedEvent, asCredentialCompromisedEvent, asKeysRotatedEvent, asLoginEvent, asPingEvent, asTokenReuseDetectedEvent, asTokenRevokedEvent, asUserEvent, asUserLockedOutEvent, asUserSuspensionEvent, computeAuthioTokenHash, computeWebhookSignatureHeader, createAuthioAccountCredential, createAuthioClient, createAuthioDiscoveryClient, createAuthioPkce, createAuthioSigningKeys, createAuthioTokenDecrypter, encryptionKeyFromFile, escapeDataString, isAllowedUrl, isAuthioTokenEncrypted, isKnownWebhookEventType, isWebhookEventOfType, parseAuthioAdminEnvelope, parseAuthioBearerChallenge, parseResourceAccess, parseResourceAccessClaim, parseWebhookEvent, randomValue, readAuthioAdminResponse, readAuthioFrontChannelLogout, readWebhookEventData, requireHmacSecretLength, resolveConnection, resolveIssuer, resourceAccessSourceOf, seconds, systemClock, toBasicAuthorization, toCamelCasedMembers, toClientCredentialsToken, toConnectionExchangeResult, toCredentialClientId, toDevicePollOutcome, toScopeString, toTokenValidationError, tryParseWebhookEvent, verifyAuthioJwt, verifyWebhookSignature, withClientSecret };
|
|
2100
|
+
export { AuthioAdminError, AuthioAsymmetricAlgorithms, AuthioCallbackError, AuthioCallerKinds, AuthioChecks, AuthioClaimTypes, AuthioClientAssertionAlgorithms, AuthioConfigurationError, AuthioContentEncryptionAlgorithms, AuthioDefaults, AuthioDiscoveryError, AuthioError, AuthioGrantTypes, AuthioHmacAlgorithms, AuthioHmacMinimumSecretBytes, AuthioKeyManagementAlgorithms, AuthioLegacyKeyManagementAlgorithms, AuthioOAuthErrors, AuthioPrompts, AuthioProtocolError, AuthioResourceAccess, AuthioResourceAccessClaims, AuthioScopes, AuthioSupportedContentEncryptionAlgorithms, AuthioTokenEndpointAuthMethods, AuthioTokenTypes, AuthioTokenValidationError, AuthioWebhookEventTypes, AuthioWebhookHeaders, asAdminResourceEvent, asAttackDetectedEvent, asAuthenticatorAppEvent, asCredentialCompromisedEvent, asKeysRotatedEvent, asLoginEvent, asPingEvent, asTokenReuseDetectedEvent, asTokenRevokedEvent, asUserEvent, asUserLockedOutEvent, asUserSuspensionEvent, computeAuthioTokenHash, computeWebhookSignatureHeader, createAuthioAccountCredential, createAuthioClient, createAuthioDiscoveryClient, createAuthioPkce, createAuthioSigningKeys, createAuthioTokenDecrypter, encryptionKeyFromFile, escapeDataString, isAllowedUrl, isAuthioTokenEncrypted, isKnownWebhookEventType, isWebhookEventOfType, parseAuthioAdminEnvelope, parseAuthioBearerChallenge, parseResourceAccess, parseResourceAccessClaim, parseWebhookEvent, randomValue, readAuthioAdminResponse, readAuthioFrontChannelLogout, readWebhookEventData, requireAccessTokenType, requireHmacSecretLength, resolveConnection, resolveIssuer, resourceAccessSourceOf, seconds, systemClock, toBasicAuthorization, toCamelCasedMembers, toClientCredentialsToken, toConnectionExchangeResult, toCredentialClientId, toDevicePollOutcome, toScopeString, toTokenValidationError, tryParseWebhookEvent, verifyAuthioJwt, verifyWebhookSignature, withClientSecret };
|
|
2076
2101
|
//# sourceMappingURL=index.js.map
|
|
2077
2102
|
//# sourceMappingURL=index.js.map
|