axiam-sdk 1.0.0-alpha37 → 1.0.0-alpha39
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 +280 -6
- package/dist/{authzCore-Dzr_x_UK.d.cts → authzCore-CKmtM6Bl.d.cts} +1 -1
- package/dist/{authzCore-DQSXszkj.d.ts → authzCore-DbuYWQj1.d.ts} +1 -1
- package/dist/browser/index.d.cts +90 -0
- package/dist/browser/index.d.ts +90 -0
- package/dist/browser/index.js +213 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/browser/index.mjs +203 -0
- package/dist/browser/index.mjs.map +1 -0
- package/dist/client-YXePgdXG.d.ts +699 -0
- package/dist/client-_Zi0Z1s2.d.cts +699 -0
- package/dist/{cookieJar-CtSD0jwR.d.cts → cookieJar-CNhhy5BG.d.cts} +1 -1
- package/dist/{cookieJar-b1B10RCK.d.ts → cookieJar-CiX_BbqL.d.ts} +1 -1
- package/dist/grpc/index.d.cts +4 -4
- package/dist/grpc/index.d.ts +4 -4
- package/dist/grpc/index.js +385 -0
- package/dist/grpc/index.js.map +1 -1
- package/dist/grpc/index.mjs +385 -0
- package/dist/grpc/index.mjs.map +1 -1
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +442 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +440 -1
- package/dist/index.mjs.map +1 -1
- package/dist/middleware/index.d.cts +5 -5
- package/dist/middleware/index.d.ts +5 -5
- package/dist/middleware/index.js +76 -0
- package/dist/middleware/index.js.map +1 -1
- package/dist/middleware/index.mjs +76 -0
- package/dist/middleware/index.mjs.map +1 -1
- package/dist/nestjs/index.d.cts +2 -2
- package/dist/nestjs/index.d.ts +2 -2
- package/dist/node/index.d.cts +4 -4
- package/dist/node/index.d.ts +4 -4
- package/dist/node/index.js +464 -3
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +464 -3
- package/dist/node/index.mjs.map +1 -1
- package/dist/{oidcState-ziGS0XYP.d.ts → oidcState-BMcyBUz-.d.ts} +92 -1
- package/dist/{oidcState-y6UaPeRx.d.cts → oidcState-C4YtEKPT.d.cts} +92 -1
- package/dist/rest/index.d.cts +3 -2
- package/dist/rest/index.d.ts +3 -2
- package/dist/rest/index.js +442 -0
- package/dist/rest/index.js.map +1 -1
- package/dist/rest/index.mjs +440 -1
- package/dist/rest/index.mjs.map +1 -1
- package/dist/{types-CO10Ainw.d.ts → types-18P57x08.d.cts} +17 -0
- package/dist/{types-CO10Ainw.d.cts → types-DKWdnoE3.d.ts} +17 -0
- package/dist/webauthnErrors-fLgfOflO.d.cts +26 -0
- package/dist/webauthnErrors-fLgfOflO.d.ts +26 -0
- package/package.json +11 -1
- package/dist/client-BI8psWTI.d.cts +0 -352
- package/dist/client-BLxvE44W.d.ts +0 -352
package/README.md
CHANGED
|
@@ -19,13 +19,14 @@ Official TypeScript/JavaScript client SDK for [AXIAM](https://github.com/ilpanic
|
|
|
19
19
|
|
|
20
20
|
## Contract conformance
|
|
21
21
|
|
|
22
|
-
This SDK conforms to CONTRACT.md §1–§13 and §12.7, §14, §15, §17, §19, §20, §21, §22, §23
|
|
23
|
-
|
|
24
|
-
relying-party helpers, and the §13
|
|
22
|
+
This SDK conforms to CONTRACT.md §1–§13 and §12.7, §14, §15, §17, §19, §20, §21, §22, §23,
|
|
23
|
+
§24, §25, §26 (including §6.1 mTLS client certificates, the §10.1 minimum
|
|
24
|
+
local-verification set, the §12 OIDC/SSO relying-party helpers, and the §13
|
|
25
|
+
`verifyWebhook` signature verifier).
|
|
25
26
|
|
|
26
|
-
§12.7, §14, §15 and §
|
|
27
|
-
after this SDK already claimed §1–§13: widening the range silently would turn a
|
|
28
|
-
that was true when written into a different claim without anyone editing it.
|
|
27
|
+
§12.7, §14, §15, §22, §24, §25 and §26 are named rather than folded into the range because
|
|
28
|
+
they landed after this SDK already claimed §1–§13: widening the range silently would turn a
|
|
29
|
+
statement that was true when written into a different claim without anyone editing it.
|
|
29
30
|
|
|
30
31
|
### §10.1 minimum local-verification set
|
|
31
32
|
|
|
@@ -73,6 +74,7 @@ never contains `@grpc/grpc-js` or `amqplib`):
|
|
|
73
74
|
| Entry point | Persona | Contents |
|
|
74
75
|
|-------------------------|-----------------------------|---------------------------------------------------------------------------|
|
|
75
76
|
| `axiam-sdk` / `axiam-sdk/rest` | Browser + Node, REST-only | `AxiamClient`: `login`/`verifyMfa`/`refresh`/`logout`, `can`/`batchCheck` over the FND-04 REST authz endpoint |
|
|
77
|
+
| `axiam-sdk/browser` | Browser only | The WebAuthn **platform ceremony** — `webauthnRegister`/`webauthnLogin`/`webauthnDiscoverableLogin` over `navigator.credentials` (CONTRACT.md §24.6b). The relying-party operations themselves are on `AxiamClient` in `/rest` and work in Node too. |
|
|
76
78
|
| `axiam-sdk/grpc` | Node only | Everything in `/rest` plus `AuthzGrpcClient.checkAccess`/`batchCheck` and `UserInfoGrpcClient.getUserInfo` over gRPC, the Node persona (`createNodeSession`), and the local-JWKS verifier |
|
|
77
79
|
| `axiam-sdk/amqp` | Node only | `consume()` — HMAC-verified AMQP audit/authz event consumer (CONTRACT.md §8) |
|
|
78
80
|
| `axiam-sdk/node` | Node only | The Node persona (`createNodeSession`/`createNodeClient`, cookie jar + local-JWKS verifier) plus the **OIDC/SSO relying-party helpers** — `OidcClient`, `MemoryOidcStateStore`, PKCE primitives (CONTRACT.md §12) |
|
|
@@ -820,6 +822,228 @@ t=2 by default, tens to hundreds of milliseconds of synchronous work. That cost
|
|
|
820
822
|
is the point — it is what makes a stolen record expensive to attack even by
|
|
821
823
|
someone holding the OPRF seed. In a browser, consider a Web Worker.
|
|
822
824
|
|
|
825
|
+
## WebAuthn and passkeys (CONTRACT.md §24)
|
|
826
|
+
|
|
827
|
+
A passkey ceremony is **two exchanges stacked**: one with an *authenticator*,
|
|
828
|
+
which needs a platform API, and one with *AXIAM*, which is four ordinary JSON
|
|
829
|
+
round trips. This SDK splits along that seam, and where you import from tells
|
|
830
|
+
you which half you get.
|
|
831
|
+
|
|
832
|
+
| | Where | Runs in |
|
|
833
|
+
|---|---|---|
|
|
834
|
+
| The six relying-party operations | `AxiamClient`, from `axiam-sdk` / `axiam-sdk/rest` | **Browser and Node** |
|
|
835
|
+
| The ceremony (`navigator.credentials`) | `axiam-sdk/browser` | Browser only |
|
|
836
|
+
|
|
837
|
+
The Node half is not a consolation prize. A service completing a ceremony that
|
|
838
|
+
ran on a handset — an Android app, an iOS app, a hardware client — is the
|
|
839
|
+
relying party, exactly as a browser is, and it never touches
|
|
840
|
+
`navigator.credentials`.
|
|
841
|
+
|
|
842
|
+
### The browser: three calls
|
|
843
|
+
|
|
844
|
+
```ts
|
|
845
|
+
import { AxiamClient } from 'axiam-sdk/rest';
|
|
846
|
+
import {
|
|
847
|
+
isWebauthnSupported,
|
|
848
|
+
webauthnRegister,
|
|
849
|
+
webauthnLogin,
|
|
850
|
+
webauthnDiscoverableLogin,
|
|
851
|
+
classifyWebauthnError,
|
|
852
|
+
webauthnErrorMessage,
|
|
853
|
+
} from 'axiam-sdk/browser';
|
|
854
|
+
|
|
855
|
+
const client = new AxiamClient({ baseUrl, orgSlug: 'globex', tenantSlug: 'acme' });
|
|
856
|
+
|
|
857
|
+
// Enrol, for a user who is already signed in.
|
|
858
|
+
if (isWebauthnSupported()) {
|
|
859
|
+
await webauthnRegister(client, 'Alice’s laptop', 'platform');
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
// Passkey as a SECOND factor, continuing a password login.
|
|
863
|
+
const result = await client.login(email, password);
|
|
864
|
+
if (result.status === 'mfa_required' && result.availableMethods.includes('webauthn')) {
|
|
865
|
+
await webauthnLogin(client, result.mfaToken); // client is authenticated after this
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
// Passkey with NO username at all.
|
|
869
|
+
await webauthnDiscoverableLogin(client);
|
|
870
|
+
```
|
|
871
|
+
|
|
872
|
+
`isWebauthnSupported()` is a query, not a try/catch: hide the button rather than
|
|
873
|
+
offer one that throws. Ceremony failures classify into five outcomes, and
|
|
874
|
+
`already_registered` is the one worth separating — it means the authenticator
|
|
875
|
+
already holds a credential for this account and refused to mint a second, so the
|
|
876
|
+
remedy is a different device rather than another attempt:
|
|
877
|
+
|
|
878
|
+
```ts
|
|
879
|
+
try {
|
|
880
|
+
await webauthnRegister(client, name, kind);
|
|
881
|
+
} catch (err) {
|
|
882
|
+
const failure = classifyWebauthnError(err); // 'cancelled' | 'already_registered' | …
|
|
883
|
+
showBanner(webauthnErrorMessage(failure));
|
|
884
|
+
}
|
|
885
|
+
```
|
|
886
|
+
|
|
887
|
+
`cancelled` covers **both** an explicit refusal and a silent timeout. The
|
|
888
|
+
WebAuthn spec deliberately refuses to distinguish them, because telling a website
|
|
889
|
+
which one happened leaks whether an authenticator was present — so the copy for
|
|
890
|
+
it does not accuse anyone of cancelling, and you should not try to recover the
|
|
891
|
+
distinction by timing the call.
|
|
892
|
+
|
|
893
|
+
Passkey autofill (conditional mediation) is a flag, and everything about it
|
|
894
|
+
degrades quietly:
|
|
895
|
+
|
|
896
|
+
```ts
|
|
897
|
+
if (await isConditionalMediationAvailable()) {
|
|
898
|
+
const abort = new AbortController();
|
|
899
|
+
void webauthnDiscoverableLogin(client, undefined, { conditional: true, signal: abort.signal })
|
|
900
|
+
.catch(() => {/* abandoned, not failed */});
|
|
901
|
+
}
|
|
902
|
+
```
|
|
903
|
+
|
|
904
|
+
That promise may never settle — the user simply may not pick a passkey — so
|
|
905
|
+
abandon it on navigation and never show an error for a prompt nobody engaged
|
|
906
|
+
with.
|
|
907
|
+
|
|
908
|
+
### Anywhere else: the JSON bridge
|
|
909
|
+
|
|
910
|
+
Every platform authenticator API speaks the same WebAuthn **JSON form** — Android's
|
|
911
|
+
Credential Manager takes `requestJson` and returns `registrationResponseJson`;
|
|
912
|
+
browsers use `parseCreationOptionsFromJSON()` and `credential.toJSON()`. So the
|
|
913
|
+
SDK hands you the challenge as that JSON and takes the platform's answer back as
|
|
914
|
+
that JSON, from any runtime:
|
|
915
|
+
|
|
916
|
+
```ts
|
|
917
|
+
import { webauthnRequestJson } from 'axiam-sdk/rest';
|
|
918
|
+
|
|
919
|
+
const { challenge, stateToken } = await client.webauthnDiscoverableStart();
|
|
920
|
+
const requestJson = webauthnRequestJson(challenge); // → give this to the platform
|
|
921
|
+
|
|
922
|
+
// …the platform runs the ceremony and hands back a JSON string…
|
|
923
|
+
await client.webauthnDiscoverableFinish(stateToken, responseJson);
|
|
924
|
+
```
|
|
925
|
+
|
|
926
|
+
Nothing is destructured on the way through, which matters: the response is the
|
|
927
|
+
input to a signature check over bytes this SDK did not produce, and re-encoding
|
|
928
|
+
base64url "to be safe" is the most common way to break a ceremony that was
|
|
929
|
+
otherwise correct.
|
|
930
|
+
|
|
931
|
+
### What the SDK does not do, on purpose
|
|
932
|
+
|
|
933
|
+
**It never adjusts an option.** The server generates the challenge and chooses
|
|
934
|
+
`residentKey`, `userVerification`, the attestation conveyance, the exclusion list
|
|
935
|
+
and the timeout; this SDK passes all of it to the authenticator unchanged and
|
|
936
|
+
posts the answer back unchanged. Not because those fields are hard — because they
|
|
937
|
+
are not, and that is the hazard: relaxing `userVerification` to `"preferred"`
|
|
938
|
+
because a CI authenticator kept prompting weakens a ceremony the server believes
|
|
939
|
+
it configured, and the server cannot detect it, since an assertion produced under
|
|
940
|
+
weaker options is a valid assertion.
|
|
941
|
+
|
|
942
|
+
The single exception is the `authenticatorAttachment` hint, and only when you
|
|
943
|
+
pass one. It selects which authenticator the user is prompted for; without it, a
|
|
944
|
+
user reaching for a security key gets asked for Touch ID.
|
|
945
|
+
|
|
946
|
+
**It never emulates an authenticator.** A "credential" held in process memory is
|
|
947
|
+
not a second factor. Where no platform API is reachable, the JSON bridge is the
|
|
948
|
+
answer and it is a complete one.
|
|
949
|
+
|
|
950
|
+
**There is no user private key anywhere in this API.** The private half never
|
|
951
|
+
leaves the authenticator — that is the property the whole mechanism rests on.
|
|
952
|
+
|
|
953
|
+
### Two error rows that are not the generic mapping
|
|
954
|
+
|
|
955
|
+
- A **`403` on `webauthnRegisterFinish`** is the tenant's attestation policy
|
|
956
|
+
refusing *this authenticator* — an AAGUID that is not allow-listed, a missing
|
|
957
|
+
FIDO certification, a revoked status — not a permission problem with the user.
|
|
958
|
+
The server's message is surfaced verbatim, because it is the only way the person
|
|
959
|
+
holding the key learns that a different one would work.
|
|
960
|
+
- A **`503` on `webauthnRegisterStart`** means the attestation policy requires
|
|
961
|
+
attestation and the FIDO metadata service has no usable snapshot. It is a server
|
|
962
|
+
configuration state, not a transient failure, and it is deliberately **not**
|
|
963
|
+
retried: retrying changes nothing and delays a message an operator needs.
|
|
964
|
+
|
|
965
|
+
## Account lifecycle and MFA enrolment (CONTRACT.md §25)
|
|
966
|
+
|
|
967
|
+
§1 locks the *middle* of an account's life — `login`, `verifyMfa`, `refresh`,
|
|
968
|
+
`logout` all assume an account that already exists, is verified, and already has
|
|
969
|
+
its second factor. These nine operations are how it gets there.
|
|
970
|
+
|
|
971
|
+
```ts
|
|
972
|
+
// Voluntary TOTP enrolment, by a signed-in user. Two calls, deliberately: the
|
|
973
|
+
// human step in the middle is not something a helper can wait for, and one that
|
|
974
|
+
// returned after mfaEnroll would report MFA as enabled when it is not.
|
|
975
|
+
const enrolment = await client.mfaEnroll();
|
|
976
|
+
renderQr(enrolment.totpUri.expose());
|
|
977
|
+
await client.mfaConfirm(codeTypedByUser); // → true once the factor is live
|
|
978
|
+
```
|
|
979
|
+
|
|
980
|
+
`secretBase32` and `totpUri` are both `Sensitive`, and the URI is the one that
|
|
981
|
+
matters: it *is* `otpauth://…?secret=…`, so it contains the secret it sits next
|
|
982
|
+
to. Wrapping only the secret would have wrapped nothing — the URI is the field
|
|
983
|
+
that actually reaches a log, because it is the field you hand to a QR renderer.
|
|
984
|
+
|
|
985
|
+
### `login()` has a third outcome
|
|
986
|
+
|
|
987
|
+
**This is a breaking change** (contract 1.28). The server has always been able to
|
|
988
|
+
answer `POST /api/v1/auth/login` with `403 mfa_setup_required` and a setup token,
|
|
989
|
+
meaning "this tenant requires MFA, this account has none, here is how to finish".
|
|
990
|
+
It used to reach you as an `AuthzError` — which told you that you lacked
|
|
991
|
+
permission to log in, when what the server said was recoverable and came with the
|
|
992
|
+
means to recover.
|
|
993
|
+
|
|
994
|
+
```ts
|
|
995
|
+
switch (result.status) {
|
|
996
|
+
case 'authenticated':
|
|
997
|
+
break;
|
|
998
|
+
case 'mfa_required':
|
|
999
|
+
await client.verifyMfa(result.mfaToken, code);
|
|
1000
|
+
break;
|
|
1001
|
+
case 'mfa_setup_required': { // ← new
|
|
1002
|
+
const enrolment = await client.mfaSetupEnroll(result.setupToken);
|
|
1003
|
+
renderQr(enrolment.totpUri.expose());
|
|
1004
|
+
await client.mfaSetupConfirm(result.setupToken, codeTypedByUser);
|
|
1005
|
+
break; // this completes the login
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
```
|
|
1009
|
+
|
|
1010
|
+
If you match `LoginResult` exhaustively, this is the edit you need. A genuine
|
|
1011
|
+
authorization refusal is still an `AuthzError`: the SDK matches on the body's own
|
|
1012
|
+
discriminant, not on the `403` alone.
|
|
1013
|
+
|
|
1014
|
+
### Email verification and password reset
|
|
1015
|
+
|
|
1016
|
+
```ts
|
|
1017
|
+
await client.verifyEmail(tokenFromLink, tenantId);
|
|
1018
|
+
await client.resendVerification(email, tenantId);
|
|
1019
|
+
|
|
1020
|
+
await client.requestPasswordReset({ email });
|
|
1021
|
+
```
|
|
1022
|
+
|
|
1023
|
+
`requestPasswordReset` resolves **whether or not the address exists**, and this
|
|
1024
|
+
SDK exposes no way to tell the difference. That is not an omission to improve on:
|
|
1025
|
+
any signal distinguishing them — including one inferred from timing — turns the
|
|
1026
|
+
endpoint into the account enumeration oracle its uniform response exists to
|
|
1027
|
+
prevent.
|
|
1028
|
+
|
|
1029
|
+
Setting the new password takes one extra call on any tenant that might have
|
|
1030
|
+
OPAQUE enabled (§23), because the client has to build a registration record and
|
|
1031
|
+
cannot know the parameters before it has a token to ask with:
|
|
1032
|
+
|
|
1033
|
+
```ts
|
|
1034
|
+
const context = await client.passwordResetContext(token);
|
|
1035
|
+
await client.confirmPasswordReset({
|
|
1036
|
+
token,
|
|
1037
|
+
newPassword,
|
|
1038
|
+
tenantId,
|
|
1039
|
+
...(context.opaque ? { opaque: await client.opaqueEnrollment(newPassword) } : {}),
|
|
1040
|
+
});
|
|
1041
|
+
```
|
|
1042
|
+
|
|
1043
|
+
The context discloses no identity — an unauthenticated endpoint that confirmed
|
|
1044
|
+
which account a token belongs to would be an oracle worth not having — and a
|
|
1045
|
+
`404` covers unknown, expired and already-consumed without distinguishing them.
|
|
1046
|
+
|
|
823
1047
|
## Device authorization grant (`axiam-sdk/node`, CONTRACT.md §14)
|
|
824
1048
|
|
|
825
1049
|
RFC 8628 — signing in a device that cannot show a browser: a TV, a CLI, a headless
|
|
@@ -911,6 +1135,56 @@ const exchanged = await oidc.tokenExchange({
|
|
|
911
1135
|
See [`examples/external-token-exchange.ts`](examples/external-token-exchange.ts) and the
|
|
912
1136
|
operator guide, `docs/api/federated-token-exchange.md`.
|
|
913
1137
|
|
|
1138
|
+
## Pushed authorization requests (`axiam-sdk/node`, CONTRACT.md §26)
|
|
1139
|
+
|
|
1140
|
+
PAR (RFC 9126) moves the authorization request off the browser. Instead of
|
|
1141
|
+
putting `scope`, `redirect_uri`, `state` and the PKCE challenge into a URL the
|
|
1142
|
+
user agent carries, the client POSTs them straight to AXIAM over an
|
|
1143
|
+
authenticated back channel and puts an opaque `request_uri` in the redirect.
|
|
1144
|
+
What travels through the browser is then a random string that cannot be edited
|
|
1145
|
+
into meaning something else.
|
|
1146
|
+
|
|
1147
|
+
Required for a FAPI 2.0 client: `profile: "fapi2"` refuses a registration that
|
|
1148
|
+
does not set `require_par`, so such a client cannot authorize any other way.
|
|
1149
|
+
|
|
1150
|
+
```ts
|
|
1151
|
+
const configuration = await oidc.oidcDiscover();
|
|
1152
|
+
const request = oidc.oidcBegin({ configuration, redirectUri, scope: 'openid profile' });
|
|
1153
|
+
|
|
1154
|
+
const pushed = await oidc.oidcPar({ request, redirectUri, scope: 'openid profile', configuration });
|
|
1155
|
+
|
|
1156
|
+
redirect(pushed.authorizationUrl);
|
|
1157
|
+
// …on the callback, unchanged by PAR:
|
|
1158
|
+
const tokens = await oidc.oidcExchange({
|
|
1159
|
+
code, redirectUri, nonce: pushed.nonce, codeVerifier: pushed.codeVerifier,
|
|
1160
|
+
});
|
|
1161
|
+
```
|
|
1162
|
+
|
|
1163
|
+
`oidcBegin` still does the computing — there is no second generator for `state`,
|
|
1164
|
+
`nonce` and PKCE — and `pushed.codeVerifier` is the one it produced, so there is
|
|
1165
|
+
exactly one value to keep.
|
|
1166
|
+
|
|
1167
|
+
Three things about this that are easy to get wrong:
|
|
1168
|
+
|
|
1169
|
+
1. **The endpoint answers `201`, not `200`.** RFC 9126 §2.2 specifies Created,
|
|
1170
|
+
and a success predicate written `status === 200` treats every successful push
|
|
1171
|
+
as a failure.
|
|
1172
|
+
2. **The authorization URL carries exactly `client_id` and `request_uri`.** The
|
|
1173
|
+
server *refuses* a request that mixes a `request_uri` with inline
|
|
1174
|
+
authorization parameters rather than merging them, and re-adding them "for
|
|
1175
|
+
compatibility" restores the parameter-confusion attack the refusal prevents:
|
|
1176
|
+
an attacker supplies the inline value they want and lets the pushed copy
|
|
1177
|
+
satisfy whichever check reads the other one.
|
|
1178
|
+
3. **`request_uri` is single-use and short-lived.** There is nothing to retry
|
|
1179
|
+
with it — the safe recovery is a fresh push, which costs one round trip and
|
|
1180
|
+
cannot double-consume anything. `oidcPar` is correspondingly never retried on
|
|
1181
|
+
a `5xx` or a transport failure: it is a POST that creates server state.
|
|
1182
|
+
|
|
1183
|
+
`invalid_client` on a push has three usual causes: a wrong secret, a secret sent
|
|
1184
|
+
by a client registered for `tls_client_auth` / `private_key_jwt` /
|
|
1185
|
+
`self_signed_tls_client_auth` (which is refused, not ignored), or a client
|
|
1186
|
+
certificate the transport did not present.
|
|
1187
|
+
|
|
914
1188
|
## Logout — RP-initiated and back-channel (`axiam-sdk/node`, CONTRACT.md §12.7)
|
|
915
1189
|
|
|
916
1190
|
`logoutUrl` builds the redirect; `verifyLogoutToken` validates a token the OP **pushed** to
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { S as Sensitive } from './sensitive-BC_s7Rrd.cjs';
|
|
2
|
-
import { A as AccessCheck, a as AccessDecision } from './types-
|
|
2
|
+
import { A as AccessCheck, a as AccessDecision } from './types-18P57x08.cjs';
|
|
3
3
|
import { V as Verifier } from './jwks-CSXHo3DS.cjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { S as Sensitive } from './sensitive-BC_s7Rrd.js';
|
|
2
|
-
import { A as AccessCheck, a as AccessDecision } from './types-
|
|
2
|
+
import { A as AccessCheck, a as AccessDecision } from './types-DKWdnoE3.js';
|
|
3
3
|
import { V as Verifier } from './jwks-CSXHo3DS.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { A as AxiamClient, W as WebauthnWorkspace, a as WebauthnLoginResult, b as WebauthnCredential } from '../client-_Zi0Z1s2.cjs';
|
|
2
|
+
export { W as WebauthnFailure, c as classifyWebauthnError, w as webauthnErrorMessage } from '../webauthnErrors-fLgfOflO.cjs';
|
|
3
|
+
import '../sensitive-BC_s7Rrd.cjs';
|
|
4
|
+
import '../session-CMgYRxLP.cjs';
|
|
5
|
+
import 'axios';
|
|
6
|
+
import '../telemetry-DrGqL4kb.cjs';
|
|
7
|
+
import '../types-18P57x08.cjs';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Whether this runtime can perform a WebAuthn ceremony at all.
|
|
11
|
+
*
|
|
12
|
+
* A query, not an exception (§24.6 rule 6) — a caller hides the enrolment
|
|
13
|
+
* button rather than offering one that throws. Answers `false` in Node, where
|
|
14
|
+
* the §24.1 relying-party layer still works fine.
|
|
15
|
+
*/
|
|
16
|
+
declare function isWebauthnSupported(): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Whether this browser supports **conditional mediation** — passkey autofill,
|
|
19
|
+
* where saved passkeys are offered from inside the username field rather than
|
|
20
|
+
* behind a button.
|
|
21
|
+
*
|
|
22
|
+
* Returns `false` rather than throwing where the probe itself is missing
|
|
23
|
+
* (§24.6 rule 3): conditional UI is a progressive enhancement, and its absence
|
|
24
|
+
* must degrade to the explicit prompt, never to a broken sign-in page.
|
|
25
|
+
*/
|
|
26
|
+
declare function isConditionalMediationAvailable(): Promise<boolean>;
|
|
27
|
+
/**
|
|
28
|
+
* Which kind of authenticator the user reached for.
|
|
29
|
+
*
|
|
30
|
+
* A hint only (§24.6 rule 4). `platform` is a passkey built into the device
|
|
31
|
+
* (Touch ID, Windows Hello, a phone); `cross-platform` is a removable security
|
|
32
|
+
* key.
|
|
33
|
+
*/
|
|
34
|
+
type AuthenticatorKind = 'platform' | 'cross-platform';
|
|
35
|
+
/** Options shared by the two sign-in helpers. */
|
|
36
|
+
interface WebauthnCeremonyOptions {
|
|
37
|
+
/**
|
|
38
|
+
* Use conditional mediation (passkey autofill) instead of a modal prompt.
|
|
39
|
+
*
|
|
40
|
+
* The returned promise may never settle — the user simply may not pick a
|
|
41
|
+
* passkey — so a caller using this must be prepared to abandon it, and MUST
|
|
42
|
+
* NOT surface an abandoned ceremony as an authentication failure (§24.6
|
|
43
|
+
* rule 3). The browser aborts it when the page navigates.
|
|
44
|
+
*/
|
|
45
|
+
conditional?: boolean;
|
|
46
|
+
/** Abort the ceremony. Also how a conditional ceremony is abandoned. */
|
|
47
|
+
signal?: AbortSignal;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Enrol a passkey or security key for the signed-in user (§24.6).
|
|
51
|
+
*
|
|
52
|
+
* Runs the full ceremony: `register/start`, the authenticator, then
|
|
53
|
+
* `register/finish`. The three steps stay individually callable on
|
|
54
|
+
* `AxiamClient` — a caller driving a virtual authenticator in a test needs the
|
|
55
|
+
* pair directly, which is why this helper is additive rather than the only way
|
|
56
|
+
* in (§24.6 rule 1).
|
|
57
|
+
*
|
|
58
|
+
* @param kind optional `authenticatorAttachment` hint. Omitted entirely when
|
|
59
|
+
* not passed — the SDK never infers it and never defaults it.
|
|
60
|
+
*/
|
|
61
|
+
declare function webauthnRegister(client: AxiamClient, credentialName: string, kind?: AuthenticatorKind, options?: WebauthnCeremonyOptions): Promise<WebauthnCredential>;
|
|
62
|
+
/**
|
|
63
|
+
* Sign in with a passkey as a **second factor** (§24.6).
|
|
64
|
+
*
|
|
65
|
+
* `challengeToken` is the `mfaToken` from a `login()` that answered
|
|
66
|
+
* `mfa_required` with `"webauthn"` among its methods.
|
|
67
|
+
*/
|
|
68
|
+
declare function webauthnLogin(client: AxiamClient, challengeToken: string, options?: WebauthnCeremonyOptions): Promise<WebauthnLoginResult>;
|
|
69
|
+
/**
|
|
70
|
+
* Sign in with a passkey **without typing a username first** (§24.6).
|
|
71
|
+
*
|
|
72
|
+
* The workspace still has to be named — a discoverable credential is resolved
|
|
73
|
+
* inside one tenant — but it comes from the client's own configuration unless
|
|
74
|
+
* overridden, and slugs are accepted.
|
|
75
|
+
*/
|
|
76
|
+
declare function webauthnDiscoverableLogin(client: AxiamClient, workspace?: WebauthnWorkspace, options?: WebauthnCeremonyOptions): Promise<WebauthnLoginResult>;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Decode an unpadded (or padded) base64url string to bytes.
|
|
80
|
+
*
|
|
81
|
+
* Typed `Uint8Array<ArrayBuffer>` rather than the bare `Uint8Array`, whose
|
|
82
|
+
* default parameter is `ArrayBufferLike` and therefore admits
|
|
83
|
+
* `SharedArrayBuffer` — which `BufferSource`, and so every WebAuthn DOM
|
|
84
|
+
* option, does not. The buffer is freshly allocated here and is never shared.
|
|
85
|
+
*/
|
|
86
|
+
declare function base64UrlToBytes(value: string): Uint8Array<ArrayBuffer>;
|
|
87
|
+
/** Encode bytes as unpadded base64url. */
|
|
88
|
+
declare function bytesToBase64Url(buffer: ArrayBuffer | Uint8Array): string;
|
|
89
|
+
|
|
90
|
+
export { type AuthenticatorKind, type WebauthnCeremonyOptions, base64UrlToBytes, bytesToBase64Url, isConditionalMediationAvailable, isWebauthnSupported, webauthnDiscoverableLogin, webauthnLogin, webauthnRegister };
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { A as AxiamClient, W as WebauthnWorkspace, a as WebauthnLoginResult, b as WebauthnCredential } from '../client-YXePgdXG.js';
|
|
2
|
+
export { W as WebauthnFailure, c as classifyWebauthnError, w as webauthnErrorMessage } from '../webauthnErrors-fLgfOflO.js';
|
|
3
|
+
import '../sensitive-BC_s7Rrd.js';
|
|
4
|
+
import '../session-BJHqprWm.js';
|
|
5
|
+
import 'axios';
|
|
6
|
+
import '../telemetry-DrGqL4kb.js';
|
|
7
|
+
import '../types-DKWdnoE3.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Whether this runtime can perform a WebAuthn ceremony at all.
|
|
11
|
+
*
|
|
12
|
+
* A query, not an exception (§24.6 rule 6) — a caller hides the enrolment
|
|
13
|
+
* button rather than offering one that throws. Answers `false` in Node, where
|
|
14
|
+
* the §24.1 relying-party layer still works fine.
|
|
15
|
+
*/
|
|
16
|
+
declare function isWebauthnSupported(): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Whether this browser supports **conditional mediation** — passkey autofill,
|
|
19
|
+
* where saved passkeys are offered from inside the username field rather than
|
|
20
|
+
* behind a button.
|
|
21
|
+
*
|
|
22
|
+
* Returns `false` rather than throwing where the probe itself is missing
|
|
23
|
+
* (§24.6 rule 3): conditional UI is a progressive enhancement, and its absence
|
|
24
|
+
* must degrade to the explicit prompt, never to a broken sign-in page.
|
|
25
|
+
*/
|
|
26
|
+
declare function isConditionalMediationAvailable(): Promise<boolean>;
|
|
27
|
+
/**
|
|
28
|
+
* Which kind of authenticator the user reached for.
|
|
29
|
+
*
|
|
30
|
+
* A hint only (§24.6 rule 4). `platform` is a passkey built into the device
|
|
31
|
+
* (Touch ID, Windows Hello, a phone); `cross-platform` is a removable security
|
|
32
|
+
* key.
|
|
33
|
+
*/
|
|
34
|
+
type AuthenticatorKind = 'platform' | 'cross-platform';
|
|
35
|
+
/** Options shared by the two sign-in helpers. */
|
|
36
|
+
interface WebauthnCeremonyOptions {
|
|
37
|
+
/**
|
|
38
|
+
* Use conditional mediation (passkey autofill) instead of a modal prompt.
|
|
39
|
+
*
|
|
40
|
+
* The returned promise may never settle — the user simply may not pick a
|
|
41
|
+
* passkey — so a caller using this must be prepared to abandon it, and MUST
|
|
42
|
+
* NOT surface an abandoned ceremony as an authentication failure (§24.6
|
|
43
|
+
* rule 3). The browser aborts it when the page navigates.
|
|
44
|
+
*/
|
|
45
|
+
conditional?: boolean;
|
|
46
|
+
/** Abort the ceremony. Also how a conditional ceremony is abandoned. */
|
|
47
|
+
signal?: AbortSignal;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Enrol a passkey or security key for the signed-in user (§24.6).
|
|
51
|
+
*
|
|
52
|
+
* Runs the full ceremony: `register/start`, the authenticator, then
|
|
53
|
+
* `register/finish`. The three steps stay individually callable on
|
|
54
|
+
* `AxiamClient` — a caller driving a virtual authenticator in a test needs the
|
|
55
|
+
* pair directly, which is why this helper is additive rather than the only way
|
|
56
|
+
* in (§24.6 rule 1).
|
|
57
|
+
*
|
|
58
|
+
* @param kind optional `authenticatorAttachment` hint. Omitted entirely when
|
|
59
|
+
* not passed — the SDK never infers it and never defaults it.
|
|
60
|
+
*/
|
|
61
|
+
declare function webauthnRegister(client: AxiamClient, credentialName: string, kind?: AuthenticatorKind, options?: WebauthnCeremonyOptions): Promise<WebauthnCredential>;
|
|
62
|
+
/**
|
|
63
|
+
* Sign in with a passkey as a **second factor** (§24.6).
|
|
64
|
+
*
|
|
65
|
+
* `challengeToken` is the `mfaToken` from a `login()` that answered
|
|
66
|
+
* `mfa_required` with `"webauthn"` among its methods.
|
|
67
|
+
*/
|
|
68
|
+
declare function webauthnLogin(client: AxiamClient, challengeToken: string, options?: WebauthnCeremonyOptions): Promise<WebauthnLoginResult>;
|
|
69
|
+
/**
|
|
70
|
+
* Sign in with a passkey **without typing a username first** (§24.6).
|
|
71
|
+
*
|
|
72
|
+
* The workspace still has to be named — a discoverable credential is resolved
|
|
73
|
+
* inside one tenant — but it comes from the client's own configuration unless
|
|
74
|
+
* overridden, and slugs are accepted.
|
|
75
|
+
*/
|
|
76
|
+
declare function webauthnDiscoverableLogin(client: AxiamClient, workspace?: WebauthnWorkspace, options?: WebauthnCeremonyOptions): Promise<WebauthnLoginResult>;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Decode an unpadded (or padded) base64url string to bytes.
|
|
80
|
+
*
|
|
81
|
+
* Typed `Uint8Array<ArrayBuffer>` rather than the bare `Uint8Array`, whose
|
|
82
|
+
* default parameter is `ArrayBufferLike` and therefore admits
|
|
83
|
+
* `SharedArrayBuffer` — which `BufferSource`, and so every WebAuthn DOM
|
|
84
|
+
* option, does not. The buffer is freshly allocated here and is never shared.
|
|
85
|
+
*/
|
|
86
|
+
declare function base64UrlToBytes(value: string): Uint8Array<ArrayBuffer>;
|
|
87
|
+
/** Encode bytes as unpadded base64url. */
|
|
88
|
+
declare function bytesToBase64Url(buffer: ArrayBuffer | Uint8Array): string;
|
|
89
|
+
|
|
90
|
+
export { type AuthenticatorKind, type WebauthnCeremonyOptions, base64UrlToBytes, bytesToBase64Url, isConditionalMediationAvailable, isWebauthnSupported, webauthnDiscoverableLogin, webauthnLogin, webauthnRegister };
|