@aastar/sdk 0.24.2 → 0.25.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/dist/UserClient-5PQP6APK.js +6 -0
- package/dist/{UserClient-DPJ6E2XL.js.map → UserClient-5PQP6APK.js.map} +1 -1
- package/dist/UserClient-CD7R3335.cjs +15 -0
- package/dist/{UserClient-4MRK2D7W.cjs.map → UserClient-CD7R3335.cjs.map} +1 -1
- package/dist/account.cjs +8 -8
- package/dist/account.js +3 -3
- package/dist/addresses-D12T3kLs.d.cts +210 -0
- package/dist/addresses-D12T3kLs.d.ts +210 -0
- package/dist/admin.cjs +4 -4
- package/dist/admin.js +3 -3
- package/dist/airaccount.cjs +111 -103
- package/dist/airaccount.d.cts +1 -1
- package/dist/airaccount.d.ts +1 -1
- package/dist/airaccount.js +3 -3
- package/dist/channel.cjs +7 -7
- package/dist/channel.js +3 -3
- package/dist/{chunk-S7IUUQ5E.cjs → chunk-2RHBOBL7.cjs} +6 -6
- package/dist/{chunk-S7IUUQ5E.cjs.map → chunk-2RHBOBL7.cjs.map} +1 -1
- package/dist/{chunk-EEWLL7GE.js → chunk-6DZCDV4Q.js} +2137 -13
- package/dist/chunk-6DZCDV4Q.js.map +1 -0
- package/dist/{chunk-4Q6FADF6.cjs → chunk-6IZASQSB.cjs} +236 -109
- package/dist/chunk-6IZASQSB.cjs.map +1 -0
- package/dist/{chunk-MCDFQ5JH.cjs → chunk-7HTUDNH3.cjs} +11 -11
- package/dist/{chunk-MCDFQ5JH.cjs.map → chunk-7HTUDNH3.cjs.map} +1 -1
- package/dist/{chunk-UJPW54CK.js → chunk-7JVL5CU3.js} +3 -3
- package/dist/{chunk-UJPW54CK.js.map → chunk-7JVL5CU3.js.map} +1 -1
- package/dist/{chunk-7FLPD3V4.js → chunk-A4FO6FKN.js} +3 -3
- package/dist/{chunk-7FLPD3V4.js.map → chunk-A4FO6FKN.js.map} +1 -1
- package/dist/{chunk-MANVOQY7.cjs → chunk-CI4UJW5Y.cjs} +5 -5
- package/dist/{chunk-MANVOQY7.cjs.map → chunk-CI4UJW5Y.cjs.map} +1 -1
- package/dist/{chunk-PUE5GEKK.js → chunk-COTHBCR2.js} +3 -3
- package/dist/{chunk-PUE5GEKK.js.map → chunk-COTHBCR2.js.map} +1 -1
- package/dist/{chunk-BPAAWQQA.js → chunk-D2RDBN46.js} +227 -102
- package/dist/chunk-D2RDBN46.js.map +1 -0
- package/dist/{chunk-TQIRRSGL.cjs → chunk-FIMXPANS.cjs} +4 -4
- package/dist/{chunk-TQIRRSGL.cjs.map → chunk-FIMXPANS.cjs.map} +1 -1
- package/dist/{chunk-MXJEULSE.cjs → chunk-G33MXEHU.cjs} +29 -2
- package/dist/chunk-G33MXEHU.cjs.map +1 -0
- package/dist/{chunk-FUY4MHPM.cjs → chunk-GASCTLKR.cjs} +9 -9
- package/dist/{chunk-FUY4MHPM.cjs.map → chunk-GASCTLKR.cjs.map} +1 -1
- package/dist/{chunk-W73Y6JWZ.js → chunk-IG4BG25C.js} +6 -6
- package/dist/{chunk-W73Y6JWZ.js.map → chunk-IG4BG25C.js.map} +1 -1
- package/dist/{chunk-TGEVD7OR.cjs → chunk-J3UAXGNP.cjs} +16 -16
- package/dist/{chunk-TGEVD7OR.cjs.map → chunk-J3UAXGNP.cjs.map} +1 -1
- package/dist/{chunk-Y5QM4LI4.js → chunk-JCEUTCFZ.js} +4 -4
- package/dist/{chunk-Y5QM4LI4.js.map → chunk-JCEUTCFZ.js.map} +1 -1
- package/dist/{chunk-IB3KOSHW.cjs → chunk-KOWTQJIX.cjs} +2177 -49
- package/dist/chunk-KOWTQJIX.cjs.map +1 -0
- package/dist/chunk-L6D2AGTF.js +500 -0
- package/dist/chunk-L6D2AGTF.js.map +1 -0
- package/dist/{chunk-KYXXIKEI.cjs → chunk-LRPAX5AG.cjs} +32 -32
- package/dist/{chunk-KYXXIKEI.cjs.map → chunk-LRPAX5AG.cjs.map} +1 -1
- package/dist/{chunk-UCLK6LTB.js → chunk-MBWBHKUE.js} +28 -3
- package/dist/chunk-MBWBHKUE.js.map +1 -0
- package/dist/{chunk-3FRNYRWI.cjs → chunk-NHDZQPDE.cjs} +26 -26
- package/dist/{chunk-3FRNYRWI.cjs.map → chunk-NHDZQPDE.cjs.map} +1 -1
- package/dist/{chunk-HP44S5U5.cjs → chunk-OBPTMV5W.cjs} +5 -5
- package/dist/{chunk-HP44S5U5.cjs.map → chunk-OBPTMV5W.cjs.map} +1 -1
- package/dist/{chunk-SX5GUCTF.js → chunk-QTXPAGNX.js} +9 -9
- package/dist/{chunk-SX5GUCTF.js.map → chunk-QTXPAGNX.js.map} +1 -1
- package/dist/{chunk-PTVXBXZX.js → chunk-UANSP3OK.js} +3 -3
- package/dist/{chunk-PTVXBXZX.js.map → chunk-UANSP3OK.js.map} +1 -1
- package/dist/{chunk-P3B6UTED.js → chunk-UTSFTWFC.js} +3 -3
- package/dist/{chunk-P3B6UTED.js.map → chunk-UTSFTWFC.js.map} +1 -1
- package/dist/chunk-WTURYJEA.cjs +504 -0
- package/dist/chunk-WTURYJEA.cjs.map +1 -0
- package/dist/{chunk-XBZGVJ5K.js → chunk-YR7CTWY6.js} +3 -3
- package/dist/{chunk-XBZGVJ5K.js.map → chunk-YR7CTWY6.js.map} +1 -1
- package/dist/{contract-addresses-RABD77VP.cjs → contract-addresses-6K6IB5OB.cjs} +13 -13
- package/dist/{contract-addresses-RABD77VP.cjs.map → contract-addresses-6K6IB5OB.cjs.map} +1 -1
- package/dist/{contract-addresses-TVXSRQ7I.js → contract-addresses-CHZ7PK5H.js} +3 -3
- package/dist/{contract-addresses-TVXSRQ7I.js.map → contract-addresses-CHZ7PK5H.js.map} +1 -1
- package/dist/core.cjs +285 -261
- package/dist/core.d.cts +6 -175
- package/dist/core.d.ts +6 -175
- package/dist/core.js +2 -2
- package/dist/dapp.cjs +6 -6
- package/dist/dapp.js +3 -3
- package/dist/enduser.cjs +7 -7
- package/dist/enduser.js +4 -4
- package/dist/identity.cjs +6 -6
- package/dist/identity.js +3 -3
- package/dist/index.cjs +406 -374
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +17 -17
- package/dist/kms.cjs +111 -103
- package/dist/kms.d.cts +199 -19
- package/dist/kms.d.ts +199 -19
- package/dist/kms.js +3 -3
- package/dist/operator.cjs +7 -7
- package/dist/operator.js +3 -3
- package/dist/paymaster.cjs +16 -16
- package/dist/paymaster.js +3 -3
- package/dist/{src-VO7TXJPG.cjs → src-DNURNUIA.cjs} +287 -263
- package/dist/src-DNURNUIA.cjs.map +1 -0
- package/dist/{src-RM6DDR7K.cjs → src-DZDH3BSU.cjs} +18 -18
- package/dist/src-DZDH3BSU.cjs.map +1 -0
- package/dist/{src-HKOFZ4V3.js → src-EVM7OESP.js} +5 -5
- package/dist/src-EVM7OESP.js.map +1 -0
- package/dist/src-FY3KAPPC.js +5 -0
- package/dist/src-FY3KAPPC.js.map +1 -0
- package/dist/tokens.cjs +12 -4
- package/dist/tokens.d.cts +133 -1
- package/dist/tokens.d.ts +133 -1
- package/dist/tokens.js +3 -3
- package/dist/x402.cjs +26 -26
- package/dist/x402.js +3 -3
- package/package.json +1 -1
- package/dist/UserClient-4MRK2D7W.cjs +0 -15
- package/dist/UserClient-DPJ6E2XL.js +0 -6
- package/dist/chunk-4Q6FADF6.cjs.map +0 -1
- package/dist/chunk-BPAAWQQA.js.map +0 -1
- package/dist/chunk-EEWLL7GE.js.map +0 -1
- package/dist/chunk-IB3KOSHW.cjs.map +0 -1
- package/dist/chunk-MXJEULSE.cjs.map +0 -1
- package/dist/chunk-O2CN77MV.js +0 -226
- package/dist/chunk-O2CN77MV.js.map +0 -1
- package/dist/chunk-UCLK6LTB.js.map +0 -1
- package/dist/chunk-V23XPVHO.cjs +0 -228
- package/dist/chunk-V23XPVHO.cjs.map +0 -1
- package/dist/src-HKOFZ4V3.js.map +0 -1
- package/dist/src-L2BLX34S.js +0 -5
- package/dist/src-L2BLX34S.js.map +0 -1
- package/dist/src-RM6DDR7K.cjs.map +0 -1
- package/dist/src-VO7TXJPG.cjs.map +0 -1
package/dist/kms.d.cts
CHANGED
|
@@ -334,7 +334,28 @@ interface RunCeremonyOptions {
|
|
|
334
334
|
rpId?: string;
|
|
335
335
|
origin?: string;
|
|
336
336
|
signCount?: number;
|
|
337
|
+
/**
|
|
338
|
+
* The 32-byte payload digest being authorized (e.g. the SignHash hash). When set,
|
|
339
|
+
* the WebAuthn challenge is bound to it as `SHA-256(nonce ‖ payload)` instead of the
|
|
340
|
+
* raw nonce — this is the "what you see is what you sign" (WYSIWYS) commitment the
|
|
341
|
+
* TA verifies (AirAccount #68). REQUIRED once the KMS runs in strict mode
|
|
342
|
+
* (`--features strict-challenge`); in the default transition mode the raw nonce is
|
|
343
|
+
* still accepted. Omit only for non-signing ceremonies (none today). Accepts a
|
|
344
|
+
* Uint8Array or a `0x` hex string.
|
|
345
|
+
*/
|
|
346
|
+
payload?: Uint8Array | `0x${string}`;
|
|
337
347
|
}
|
|
348
|
+
/**
|
|
349
|
+
* Compute the WYSIWYS-bound WebAuthn challenge for a signing ceremony:
|
|
350
|
+
* `base64url( SHA-256( decode(nonce) ‖ payload ) )`.
|
|
351
|
+
*
|
|
352
|
+
* `nonce` is the base64url challenge from BeginAuthentication; `payload` is the 32-byte
|
|
353
|
+
* digest about to be signed (the SignHash hash). The KMS/TA recomputes this exact value
|
|
354
|
+
* and rejects the signature if it doesn't match (AirAccount #68). Use this in a browser
|
|
355
|
+
* frontend that builds its own WebAuthn assertion for a device passkey, so the per-call
|
|
356
|
+
* `webAuthnAssertion` it sends commits to the operation hash.
|
|
357
|
+
*/
|
|
358
|
+
declare function commitChallenge(nonceBase64Url: string, payload: Uint8Array | `0x${string}`): string;
|
|
338
359
|
/**
|
|
339
360
|
* Run a full WebAuthn challenge-binding ceremony (AirAccount #49):
|
|
340
361
|
* 1. fetch a one-time TA challenge from the `begin` endpoint,
|
|
@@ -769,37 +790,115 @@ declare class KmsManager {
|
|
|
769
790
|
* challenge from {@link beginGrantSessionAuth} instead.)
|
|
770
791
|
*/
|
|
771
792
|
beginWebAuthnAuth(keyId: string): Promise<KmsBeginAuthenticationResponse>;
|
|
793
|
+
/**
|
|
794
|
+
* Create a KMS signer that authorizes each signature with a LEGACY raw passkey
|
|
795
|
+
* assertion (reusable, no challenge consumption).
|
|
796
|
+
*
|
|
797
|
+
* @deprecated The KMS (v0.20.0+) rejects legacy raw passkey assertions for
|
|
798
|
+
* signing/mutating operations (`/SignHash` → 400, "no challenge binding —
|
|
799
|
+
* replayable"), unless `KMS_ALLOW_LEGACY_PASSKEY=1` is set on the KMS (test
|
|
800
|
+
* only). Prefer {@link createKmsSignerWithCeremony}, which runs a one-time
|
|
801
|
+
* challenge-bound WebAuthn ceremony per signature.
|
|
802
|
+
*/
|
|
772
803
|
createKmsSigner(keyId: string, address: string, assertionProvider: () => Promise<LegacyPasskeyAssertion>): KmsSigner;
|
|
804
|
+
/**
|
|
805
|
+
* Create a KMS signer that authorizes each signature with a one-time,
|
|
806
|
+
* challenge-bound WebAuthn ceremony (production-safe; replay-protected).
|
|
807
|
+
*
|
|
808
|
+
* Every `signMessage` call runs a FRESH ceremony (BeginAuthentication →
|
|
809
|
+
* authenticator assertion → `/SignHash` with the `WebAuthn` field), because the
|
|
810
|
+
* KMS consumes the challenge atomically (one challenge ⇒ one signature). A
|
|
811
|
+
* Tier-2/3 BLS transfer that needs N owner signatures therefore triggers N
|
|
812
|
+
* ceremonies — see {@link BLSSignatureService} (which now skips the unused
|
|
813
|
+
* userOpHash owner-ECDSA for tiered signatures, so Tier-2 needs only one).
|
|
814
|
+
*
|
|
815
|
+
* @param ceremonySigner authenticator that signs the WebAuthn challenge
|
|
816
|
+
* (a browser passkey on the client, or {@link P256PasskeySigner} server-side).
|
|
817
|
+
*/
|
|
818
|
+
createKmsSignerWithCeremony(keyId: string, address: string, ceremonySigner: PasskeyCeremonySigner, ceremonyOptions?: Omit<RunCeremonyOptions, "signer">, commitPayload?: boolean): KmsSigner;
|
|
773
819
|
}
|
|
820
|
+
/** How a {@link KmsSigner} authorizes each `/SignHash` call. */
|
|
821
|
+
type KmsSignerAuth = {
|
|
822
|
+
mode: "legacy";
|
|
823
|
+
assertionProvider: () => Promise<LegacyPasskeyAssertion>;
|
|
824
|
+
} | {
|
|
825
|
+
mode: "ceremony";
|
|
826
|
+
ceremonySigner: PasskeyCeremonySigner;
|
|
827
|
+
ceremonyOptions?: Omit<RunCeremonyOptions, "signer">;
|
|
828
|
+
/**
|
|
829
|
+
* Bind each ceremony challenge to the payload via `SHA-256(nonce ‖ hash)`
|
|
830
|
+
* (WYSIWYS, AirAccount #68). DEFAULT `false` (raw nonce) because the LIVE KMS
|
|
831
|
+
* host (kms.aastar.io) still verifies the WebAuthn assertion against the raw
|
|
832
|
+
* nonce — sending the commitment is rejected with "Challenge mismatch". Enable
|
|
833
|
+
* only once the KMS host recomputes `expected = SHA-256(nonce ‖ payload)` for
|
|
834
|
+
* signing ops (tracked AirAccount-side). The commitment IS already correct vs
|
|
835
|
+
* the TA; the gap is the host verify.
|
|
836
|
+
*/
|
|
837
|
+
commitPayload?: boolean;
|
|
838
|
+
};
|
|
774
839
|
/**
|
|
775
|
-
* KMS-backed signer
|
|
840
|
+
* KMS-backed signer (EIP-191 personal-sign over a digest).
|
|
776
841
|
*
|
|
777
|
-
*
|
|
778
|
-
*
|
|
779
|
-
*
|
|
842
|
+
* Two authorization modes (see {@link KmsSignerAuth}):
|
|
843
|
+
* - `ceremony` (preferred): each signature runs a fresh one-time WebAuthn
|
|
844
|
+
* ceremony and calls KMS `SignHash` with the challenge-bound `WebAuthn` field
|
|
845
|
+
* (replay-safe; what the KMS now requires).
|
|
846
|
+
* - `legacy` (deprecated): each signature reuses a raw passkey assertion via
|
|
847
|
+
* KMS `SignHash` `Passkey` field — rejected by KMS unless
|
|
848
|
+
* `KMS_ALLOW_LEGACY_PASSKEY=1` (test only).
|
|
780
849
|
*
|
|
781
850
|
* Narrowed during the ethers -> viem migration: only the EIP-191 personal-sign
|
|
782
|
-
* and address-read behaviour is
|
|
783
|
-
* ethers.AbstractSigner surface (signTransaction / signTypedData / connect /
|
|
784
|
-
* provider) has been dropped.
|
|
851
|
+
* and address-read behaviour is consumed by the SDK.
|
|
785
852
|
*/
|
|
786
853
|
declare class KmsSigner {
|
|
787
854
|
private readonly keyId;
|
|
788
855
|
private readonly _address;
|
|
789
856
|
private readonly kmsManager;
|
|
790
|
-
private readonly
|
|
791
|
-
constructor(keyId: string, _address: string, kmsManager: KmsManager,
|
|
857
|
+
private readonly auth;
|
|
858
|
+
constructor(keyId: string, _address: string, kmsManager: KmsManager, auth: KmsSignerAuth);
|
|
792
859
|
getAddress(): Promise<string>;
|
|
793
|
-
|
|
860
|
+
/**
|
|
861
|
+
* EIP-191 personal-sign over a digest. A string is hashed as UTF-8 text, a byte
|
|
862
|
+
* array as raw bytes — byte-identical to ethers `hashMessage`.
|
|
863
|
+
*
|
|
864
|
+
* @param webAuthnAssertion OPTIONAL pre-built, one-time ceremony assertion. Use
|
|
865
|
+
* this in server flows where the passkey lives on the USER's device: the
|
|
866
|
+
* frontend runs the BeginAuthentication ceremony and the backend forwards the
|
|
867
|
+
* resulting `{ ChallengeId, Credential }` here. When supplied it takes
|
|
868
|
+
* precedence over the signer's baked-in auth mode. Each assertion is one-time
|
|
869
|
+
* (the KMS consumes the challenge), so a caller that needs N signatures must
|
|
870
|
+
* supply N distinct assertions.
|
|
871
|
+
*
|
|
872
|
+
* WYSIWYS (AirAccount #68): the frontend MUST build the assertion over the
|
|
873
|
+
* payload-committed challenge `commitChallenge(nonce, hashOf(message))`, not the
|
|
874
|
+
* raw nonce — otherwise a compromised host could swap the signed payload. The
|
|
875
|
+
* raw-nonce assertion only works while the KMS runs in transition mode. (The
|
|
876
|
+
* signer's own ceremony mode does this automatically.)
|
|
877
|
+
*/
|
|
878
|
+
signMessage(message: string | Uint8Array, webAuthnAssertion?: WebAuthnAssertion): Promise<string>;
|
|
794
879
|
}
|
|
795
880
|
|
|
796
881
|
/**
|
|
797
|
-
* Context for passing
|
|
798
|
-
*
|
|
882
|
+
* Context for passing a LEGACY raw passkey assertion through the signing chain.
|
|
883
|
+
*
|
|
884
|
+
* @deprecated KMS v0.20.0+ rejects legacy raw passkey assertions for signing
|
|
885
|
+
* (no challenge binding → replayable). Prefer {@link WebAuthnCeremonyContext}.
|
|
799
886
|
*/
|
|
800
887
|
interface PasskeyAssertionContext {
|
|
801
888
|
assertion: LegacyPasskeyAssertion;
|
|
802
889
|
}
|
|
890
|
+
/**
|
|
891
|
+
* Context carrying a one-time, challenge-bound WebAuthn ceremony assertion
|
|
892
|
+
* (the replay-safe path the KMS now requires). In server transfer flows the
|
|
893
|
+
* passkey lives on the USER's device: the frontend runs the BeginAuthentication
|
|
894
|
+
* ceremony and the backend forwards the resulting `{ ChallengeId, Credential }`.
|
|
895
|
+
* Each assertion is one-time — a flow needing N signatures supplies N of them.
|
|
896
|
+
*/
|
|
897
|
+
interface WebAuthnCeremonyContext {
|
|
898
|
+
webAuthnAssertion: WebAuthnAssertion;
|
|
899
|
+
}
|
|
900
|
+
/** Either auth context accepted by a KMS-backed signer. */
|
|
901
|
+
type SignerAuthContext = PasskeyAssertionContext | WebAuthnCeremonyContext;
|
|
803
902
|
/**
|
|
804
903
|
* Pluggable signer adapter — replaces NestJS AuthService wallet management.
|
|
805
904
|
* Implement this to provide signing capabilities from your key management system.
|
|
@@ -817,9 +916,11 @@ interface ISignerAdapter {
|
|
|
817
916
|
* `account.signMessage({ raw: bytes })`). A `Uint8Array` (or raw `0x` hex) is
|
|
818
917
|
* signed as raw bytes — callers pass a 32-byte digest, NOT UTF-8 text.
|
|
819
918
|
*
|
|
820
|
-
* @param ctx optional
|
|
919
|
+
* @param ctx optional auth context for KMS-backed signers — a one-time
|
|
920
|
+
* {@link WebAuthnCeremonyContext} (preferred) or a legacy
|
|
921
|
+
* {@link PasskeyAssertionContext}.
|
|
821
922
|
*/
|
|
822
|
-
signMessage(userId: string, message: `0x${string}` | Uint8Array, ctx?:
|
|
923
|
+
signMessage(userId: string, message: `0x${string}` | Uint8Array, ctx?: SignerAuthContext): Promise<`0x${string}`>;
|
|
823
924
|
/**
|
|
824
925
|
* Ensure a signer exists for the user (create on demand if needed).
|
|
825
926
|
* Returns the signer's address.
|
|
@@ -1419,7 +1520,17 @@ declare class BLSSignatureService {
|
|
|
1419
1520
|
/** Lazy-initialize BLSManager on first use. */
|
|
1420
1521
|
private ensureInitialized;
|
|
1421
1522
|
getActiveSignerNodes(): Promise<unknown[]>;
|
|
1422
|
-
generateBLSSignature(userId: string, userOpHash: string, ctx?:
|
|
1523
|
+
generateBLSSignature(userId: string, userOpHash: string, ctx?: SignerAuthContext, options?: {
|
|
1524
|
+
/**
|
|
1525
|
+
* Skip the owner ECDSA over `userOpHash` (`aaSignature`). The cumulative
|
|
1526
|
+
* Tier-2 (algId 0x04) / Tier-3 (0x05) packings do NOT include it — they
|
|
1527
|
+
* carry only `messagePointSignature` (owner intent comes from the P256
|
|
1528
|
+
* passkey signature) — so computing it there is a wasted owner signature.
|
|
1529
|
+
* Under the WebAuthn-ceremony KMS path that wasted signature is also a
|
|
1530
|
+
* wasted user gesture, so tiered callers set this to `true`.
|
|
1531
|
+
*/
|
|
1532
|
+
skipOwnerOpSignature?: boolean;
|
|
1533
|
+
}): Promise<BLSSignatureData>;
|
|
1423
1534
|
packSignature(blsData: BLSSignatureData): Promise<string>;
|
|
1424
1535
|
/**
|
|
1425
1536
|
* Generate a tiered signature based on the required tier level.
|
|
@@ -1441,7 +1552,7 @@ declare class BLSSignatureService {
|
|
|
1441
1552
|
userOpHash: string;
|
|
1442
1553
|
p256Signature?: string;
|
|
1443
1554
|
guardianSigner?: GuardianSigner;
|
|
1444
|
-
ctx?:
|
|
1555
|
+
ctx?: SignerAuthContext;
|
|
1445
1556
|
}): Promise<string>;
|
|
1446
1557
|
}
|
|
1447
1558
|
|
|
@@ -1561,7 +1672,20 @@ interface ExecuteTransferParams {
|
|
|
1561
1672
|
* the gas token address appended to paymasterData. Used when the paymaster
|
|
1562
1673
|
* contract does not expose a public token() getter for auto-detection. */
|
|
1563
1674
|
paymasterTokenAddress?: string;
|
|
1675
|
+
/**
|
|
1676
|
+
* LEGACY raw passkey assertion for KMS signing.
|
|
1677
|
+
* @deprecated KMS v0.20.0+ rejects it (replayable). Use {@link webAuthnAssertion}.
|
|
1678
|
+
*/
|
|
1564
1679
|
passkeyAssertion?: LegacyPasskeyAssertion;
|
|
1680
|
+
/**
|
|
1681
|
+
* One-time, challenge-bound WebAuthn ceremony assertion for KMS owner signing
|
|
1682
|
+
* (replay-safe; what the KMS now requires). The frontend runs the
|
|
1683
|
+
* BeginAuthentication ceremony with the user's device passkey and passes the
|
|
1684
|
+
* resulting `{ ChallengeId, Credential }` here. The challenge is consumed once,
|
|
1685
|
+
* so this authorizes exactly ONE owner signature — use the tiered path
|
|
1686
|
+
* (`useAirAccountTiering: true`), which needs a single owner signature.
|
|
1687
|
+
*/
|
|
1688
|
+
webAuthnAssertion?: WebAuthnAssertion;
|
|
1565
1689
|
/** P256 passkey signature (64 bytes hex). Required for AirAccount Tier 2/3. */
|
|
1566
1690
|
p256Signature?: string;
|
|
1567
1691
|
/** Guardian signer instance. Required for AirAccount Tier 3. */
|
|
@@ -1639,7 +1763,7 @@ declare class WalletManager {
|
|
|
1639
1763
|
private readonly signer;
|
|
1640
1764
|
constructor(signer: ISignerAdapter);
|
|
1641
1765
|
getAddress(userId: string): Promise<`0x${string}`>;
|
|
1642
|
-
signMessage(userId: string, message: `0x${string}` | Uint8Array, ctx?:
|
|
1766
|
+
signMessage(userId: string, message: `0x${string}` | Uint8Array, ctx?: SignerAuthContext): Promise<`0x${string}`>;
|
|
1643
1767
|
ensureSigner(userId: string): Promise<{
|
|
1644
1768
|
address: `0x${string}`;
|
|
1645
1769
|
}>;
|
|
@@ -1670,6 +1794,26 @@ declare class WalletManager {
|
|
|
1670
1794
|
*
|
|
1671
1795
|
* const account = await client.accounts.createAccount('user-123');
|
|
1672
1796
|
* ```
|
|
1797
|
+
*
|
|
1798
|
+
* @example KMS-backed signing (production) — inject {@link KmsSignerAdapter} as the
|
|
1799
|
+
* `signer`. This is the wiring seam that carries a per-call WebAuthn ceremony
|
|
1800
|
+
* assertion (challenge-bound, replay-safe) from `executeTransfer` through to the
|
|
1801
|
+
* KMS `/SignHash`. The `userId → { keyId, address }` mapping is app-specific.
|
|
1802
|
+
* ```ts
|
|
1803
|
+
* import { AirAccountServerClient, KmsManager, KmsSignerAdapter } from '@aastar/airaccount/server';
|
|
1804
|
+
*
|
|
1805
|
+
* const kms = new KmsManager({ kmsEndpoint, kmsApiKey, kmsEnabled: true });
|
|
1806
|
+
* const client = new AirAccountServerClient({
|
|
1807
|
+
* ...rest,
|
|
1808
|
+
* signer: new KmsSignerAdapter(kms, async (userId) => lookupUserKey(userId)),
|
|
1809
|
+
* });
|
|
1810
|
+
* // Transfer with a one-time WebAuthn assertion (frontend ceremony) on the tiered path:
|
|
1811
|
+
* await client.transfers.executeTransfer(userId, {
|
|
1812
|
+
* ...params,
|
|
1813
|
+
* useAirAccountTiering: true,
|
|
1814
|
+
* webAuthnAssertion, // { ChallengeId, Credential } from BeginAuthentication
|
|
1815
|
+
* });
|
|
1816
|
+
* ```
|
|
1673
1817
|
*/
|
|
1674
1818
|
declare class AirAccountServerClient {
|
|
1675
1819
|
readonly ethereum: EthereumProvider;
|
|
@@ -3334,10 +3478,46 @@ declare class LocalWalletSigner implements ISignerAdapter {
|
|
|
3334
3478
|
private readonly account;
|
|
3335
3479
|
constructor(privateKey: string);
|
|
3336
3480
|
getAddress(_userId: string): Promise<`0x${string}`>;
|
|
3337
|
-
signMessage(_userId: string, message: `0x${string}` | Uint8Array, _ctx?:
|
|
3481
|
+
signMessage(_userId: string, message: `0x${string}` | Uint8Array, _ctx?: SignerAuthContext): Promise<`0x${string}`>;
|
|
3338
3482
|
ensureSigner(_userId: string): Promise<{
|
|
3339
3483
|
address: `0x${string}`;
|
|
3340
3484
|
}>;
|
|
3341
3485
|
}
|
|
3342
3486
|
|
|
3343
|
-
|
|
3487
|
+
/** Resolves an app user id to its KMS key + EOA address. App-specific mapping. */
|
|
3488
|
+
type KmsKeyResolver = (userId: string) => Promise<{
|
|
3489
|
+
keyId: string;
|
|
3490
|
+
address: `0x${string}`;
|
|
3491
|
+
}>;
|
|
3492
|
+
/**
|
|
3493
|
+
* KMS-backed {@link ISignerAdapter} — the bridge between the SDK signing chain
|
|
3494
|
+
* (BLS / transfer pass a {@link SignerAuthContext}) and the KMS `/SignHash` API.
|
|
3495
|
+
*
|
|
3496
|
+
* This is the concrete adapter the BLS/transfer services expect: it unpacks the
|
|
3497
|
+
* per-call auth context and forwards it to the right KMS endpoint.
|
|
3498
|
+
* - {@link WebAuthnCeremonyContext} (preferred) → `signHashWithWebAuthn`
|
|
3499
|
+
* (one-time, challenge-bound; replay-safe — what KMS v0.20.0+ requires).
|
|
3500
|
+
* - {@link PasskeyAssertionContext} (legacy, @deprecated) → `signHash`
|
|
3501
|
+
* (rejected by KMS unless `KMS_ALLOW_LEGACY_PASSKEY=1`, test only).
|
|
3502
|
+
*
|
|
3503
|
+
* The frontend runs the BeginAuthentication ceremony with the user's device
|
|
3504
|
+
* passkey and passes the resulting `{ ChallengeId, Credential }` down as
|
|
3505
|
+
* `ctx.webAuthnAssertion`. Since each challenge is consumed once, a flow needing
|
|
3506
|
+
* N signatures must pass N assertions — use the tiered transfer path, which needs
|
|
3507
|
+
* only one owner signature.
|
|
3508
|
+
*
|
|
3509
|
+
* The `userId → { keyId, address }` mapping is app-specific; inject it via
|
|
3510
|
+
* {@link KmsKeyResolver}.
|
|
3511
|
+
*/
|
|
3512
|
+
declare class KmsSignerAdapter implements ISignerAdapter {
|
|
3513
|
+
private readonly kms;
|
|
3514
|
+
private readonly resolveKey;
|
|
3515
|
+
constructor(kms: KmsManager, resolveKey: KmsKeyResolver);
|
|
3516
|
+
getAddress(userId: string): Promise<`0x${string}`>;
|
|
3517
|
+
ensureSigner(userId: string): Promise<{
|
|
3518
|
+
address: `0x${string}`;
|
|
3519
|
+
}>;
|
|
3520
|
+
signMessage(userId: string, message: `0x${string}` | Uint8Array, ctx?: SignerAuthContext): Promise<`0x${string}`>;
|
|
3521
|
+
}
|
|
3522
|
+
|
|
3523
|
+
export { ACCOUNT_ABI, AGENT_SESSION_KEY_VALIDATOR_ABI, AIRACCOUNT_ABI, AIRACCOUNT_ADDRESSES, AIRACCOUNT_FACTORY_ABI, AIR_ACCOUNT_COMPOSITE_VALIDATOR_ABI, AIR_ACCOUNT_DELEGATE_ABI, AIR_ACCOUNT_DELEGATE_ADDRESS, ALG_ID, AccountManager, type AccountRecord, type ActiveRecovery, AgentRegistryService, type AgentReputationSummary, type AgentSessionConfig, type AgentSessionInfo, AirAccountServerClient, type AirAccountVersion, BLSSignatureData, BLSSignatureService, type BeginCeremonyResponse, type BindERC8004AgentWalletParams, type BlsConfigRecord, type BuildCredentialOptions, CALLDATA_PARSER_REGISTRY_ABI, ConsoleLogger, type CreateAgentAccountParams, type CreateP256SessionKeyRequest, type CreateP256SessionKeyResponse, DEFAULT_CREDENTIAL_ID, DEFAULT_KMS_ENDPOINT, DEFAULT_ORIGIN, DEFAULT_RP_ID, type DelegateInitParams, DvtPendingConfirmationError, type EIP7702Authorization, EIP7702DelegateService, ENTRYPOINT_ABI_V6, ENTRYPOINT_ABI_V7_V8, ENTRYPOINT_ADDRESSES, ERC20_ABI, ERC8004Service, ERC8004_ADDRESSES, EXECUTE_BATCH_SELECTOR, EXECUTE_SELECTOR, EXECUTE_USER_OP_SELECTOR, type EntryPointConfig, EntryPointVersion, type EntryPointVersionConfig, type EstimateGasParams, EthereumProvider, type ExecuteTransferParams, FACTORY_ABI_V6, FACTORY_ABI_V7_V8, FORCE_EXIT_MODULE_ABI, ForceExitService, type FullConfigGuardianParams, GLOBAL_GUARD_ABI, type GrantP256SessionParams, type GrantSessionParams, GuardChecker, type GuardState, GuardStateReader, GuardStatus, type ILogger, type ISignerAdapter, type IStorageAdapter, type InstallModuleParams, KmsAgentService, type KmsAttestationManifestResponse, type KmsAttestationProofResponse, type KmsAttestationResponse, type KmsBeginAuthenticationRequest, type KmsBeginAuthenticationResponse, type KmsBeginGrantSessionAuthRequest, type KmsBeginGrantSessionAuthResponse, type KmsBeginRegistrationRequest, type KmsBeginRegistrationResponse, type KmsChangePasskeyResponse, type KmsCompleteRegistrationRequest, type KmsCompleteRegistrationResponse, type KmsCreateAgentKeyRequest, type KmsCreateAgentKeyResponse, type KmsCreateKeyRequest, type KmsCreateKeyResponse, type KmsDeleteKeyResponse, type KmsDeriveAddressResponse, type KmsDescribeKeyResponse, type KmsEip712Domain, type KmsEip712FieldValue, type KmsEip712TypeDef, type KmsEthereumTransaction, type KmsGetPublicKeyResponse, type KmsHealthResponse, KmsHttpClient, type KmsHttpClientOptions, type KmsKeyResolver, type KmsKeyStatusResponse, type KmsListKeysResponse, KmsManager, KmsMonitorService, type KmsPaymentAuth, type KmsPaymentSignatureResponse, KmsPaymentSigner, type KmsPurgeKeyResponse, type KmsQueueStatusResponse, type KmsRefreshAgentCredentialRequest, type KmsRefreshAgentCredentialResponse, type KmsRevokeAgentCredentialRequest, type KmsRevokeAgentCredentialResponse, type KmsRollbackCounterResponse, KmsSessionService, type KmsSignAgentRequest, type KmsSignAgentResponse, type KmsSignGTokenAuthorizationRequest, type KmsSignGrantSessionRequest, type KmsSignGrantSessionResponse, type KmsSignHashResponse, type KmsSignMicropaymentVoucherRequest, type KmsSignP256GrantSessionRequest, type KmsSignRequest, type KmsSignResponse, type KmsSignTypedDataRequest, type KmsSignTypedDataResponse, type KmsSignX402PaymentRequest, KmsSigner, KmsSignerAdapter, type KmsSignerAuth, type KmsStatsResponse, type KmsVersionResponse, type L2Type, L2_TYPE, type LegacyPasskeyAssertion, LocalWalletSigner, MAX_GUARDIANS, MODULE_TYPE, MemoryStorage, type MintAgentIdentityParams, ModuleManager, type ModuleTypeId, type OapdConfig, type P256GuardianKey, P256PasskeySigner, PackedUserOperation, type PasskeyAssertionContext, type PasskeyCeremonySigner, PaymasterManager, PaymasterPriceStalenessError, type PaymasterRecord, type PendingExit, type PendingWeightChange, PreCheckResult, type QueryAgentReputationParams, RECOVERY_THRESHOLD, RECOVERY_TIMELOCK_SECONDS, RecoveryService, type RevokeP256SessionKeyRequest, type RevokeP256SessionKeyResponse, type RunCeremonyOptions, SESSION_KEY_VALIDATOR_ABI, type SerializedGuardianSpec, type ServerConfig, type SessionInfo, SessionKeyService, type SetAgentWalletParams, type SignP256UserOpRequest, type SignP256UserOpResponse, type SignerAuthContext, SilentLogger, type SubmitAgentReputationParams, TIER_GUARD_HOOK_ABI, TierConfig, TierLevel$1 as TierLevel, type TokenBalance, type TokenGuardState, type TokenInfo, TokenService, TransferManager, type TransferRecord, type TransferResult, type UninstallModuleParams, UserOperation, VALIDATOR_ABI, WEIGHT_CHANGE_EXPIRY_SECONDS, WEIGHT_CHANGE_THRESHOLD, WEIGHT_CHANGE_TIMELOCK_SECONDS, WalletManager, type WebAuthnAssertion, type WebAuthnAuthenticationCredential, type WebAuthnCeremonyContext, type WeightConfig, WeightedSignatureService, YAAAServerClient, base64UrlDecode, base64UrlEncode, beginAuthenticationChallenge, beginGrantSessionChallenge, buildAuthenticationCredential, buildAuthenticatorData, buildClientDataJSON, buildFullInitConfig, buildInstallModuleHash, buildUninstallModuleHash, commitChallenge, computeOapdSalt, erc8004AddressesForChain, getOapdAddress, getOapdAddressWithChainId, initConfigFromRecord, initConfigToTuple, isExecuteUserOpWrapped, isOapdDeployed, isPendingConfirmation, packP256SessionSignature, packSecp256k1SessionSignature, runAuthenticationCeremony, runGrantSessionCeremony, runWebAuthnCeremony, sepoliaV07Config, serializeGuardianSpecs, toGuardianSpecs, validateConfig, wrapExecuteUserOp };
|
package/dist/kms.d.ts
CHANGED
|
@@ -334,7 +334,28 @@ interface RunCeremonyOptions {
|
|
|
334
334
|
rpId?: string;
|
|
335
335
|
origin?: string;
|
|
336
336
|
signCount?: number;
|
|
337
|
+
/**
|
|
338
|
+
* The 32-byte payload digest being authorized (e.g. the SignHash hash). When set,
|
|
339
|
+
* the WebAuthn challenge is bound to it as `SHA-256(nonce ‖ payload)` instead of the
|
|
340
|
+
* raw nonce — this is the "what you see is what you sign" (WYSIWYS) commitment the
|
|
341
|
+
* TA verifies (AirAccount #68). REQUIRED once the KMS runs in strict mode
|
|
342
|
+
* (`--features strict-challenge`); in the default transition mode the raw nonce is
|
|
343
|
+
* still accepted. Omit only for non-signing ceremonies (none today). Accepts a
|
|
344
|
+
* Uint8Array or a `0x` hex string.
|
|
345
|
+
*/
|
|
346
|
+
payload?: Uint8Array | `0x${string}`;
|
|
337
347
|
}
|
|
348
|
+
/**
|
|
349
|
+
* Compute the WYSIWYS-bound WebAuthn challenge for a signing ceremony:
|
|
350
|
+
* `base64url( SHA-256( decode(nonce) ‖ payload ) )`.
|
|
351
|
+
*
|
|
352
|
+
* `nonce` is the base64url challenge from BeginAuthentication; `payload` is the 32-byte
|
|
353
|
+
* digest about to be signed (the SignHash hash). The KMS/TA recomputes this exact value
|
|
354
|
+
* and rejects the signature if it doesn't match (AirAccount #68). Use this in a browser
|
|
355
|
+
* frontend that builds its own WebAuthn assertion for a device passkey, so the per-call
|
|
356
|
+
* `webAuthnAssertion` it sends commits to the operation hash.
|
|
357
|
+
*/
|
|
358
|
+
declare function commitChallenge(nonceBase64Url: string, payload: Uint8Array | `0x${string}`): string;
|
|
338
359
|
/**
|
|
339
360
|
* Run a full WebAuthn challenge-binding ceremony (AirAccount #49):
|
|
340
361
|
* 1. fetch a one-time TA challenge from the `begin` endpoint,
|
|
@@ -769,37 +790,115 @@ declare class KmsManager {
|
|
|
769
790
|
* challenge from {@link beginGrantSessionAuth} instead.)
|
|
770
791
|
*/
|
|
771
792
|
beginWebAuthnAuth(keyId: string): Promise<KmsBeginAuthenticationResponse>;
|
|
793
|
+
/**
|
|
794
|
+
* Create a KMS signer that authorizes each signature with a LEGACY raw passkey
|
|
795
|
+
* assertion (reusable, no challenge consumption).
|
|
796
|
+
*
|
|
797
|
+
* @deprecated The KMS (v0.20.0+) rejects legacy raw passkey assertions for
|
|
798
|
+
* signing/mutating operations (`/SignHash` → 400, "no challenge binding —
|
|
799
|
+
* replayable"), unless `KMS_ALLOW_LEGACY_PASSKEY=1` is set on the KMS (test
|
|
800
|
+
* only). Prefer {@link createKmsSignerWithCeremony}, which runs a one-time
|
|
801
|
+
* challenge-bound WebAuthn ceremony per signature.
|
|
802
|
+
*/
|
|
772
803
|
createKmsSigner(keyId: string, address: string, assertionProvider: () => Promise<LegacyPasskeyAssertion>): KmsSigner;
|
|
804
|
+
/**
|
|
805
|
+
* Create a KMS signer that authorizes each signature with a one-time,
|
|
806
|
+
* challenge-bound WebAuthn ceremony (production-safe; replay-protected).
|
|
807
|
+
*
|
|
808
|
+
* Every `signMessage` call runs a FRESH ceremony (BeginAuthentication →
|
|
809
|
+
* authenticator assertion → `/SignHash` with the `WebAuthn` field), because the
|
|
810
|
+
* KMS consumes the challenge atomically (one challenge ⇒ one signature). A
|
|
811
|
+
* Tier-2/3 BLS transfer that needs N owner signatures therefore triggers N
|
|
812
|
+
* ceremonies — see {@link BLSSignatureService} (which now skips the unused
|
|
813
|
+
* userOpHash owner-ECDSA for tiered signatures, so Tier-2 needs only one).
|
|
814
|
+
*
|
|
815
|
+
* @param ceremonySigner authenticator that signs the WebAuthn challenge
|
|
816
|
+
* (a browser passkey on the client, or {@link P256PasskeySigner} server-side).
|
|
817
|
+
*/
|
|
818
|
+
createKmsSignerWithCeremony(keyId: string, address: string, ceremonySigner: PasskeyCeremonySigner, ceremonyOptions?: Omit<RunCeremonyOptions, "signer">, commitPayload?: boolean): KmsSigner;
|
|
773
819
|
}
|
|
820
|
+
/** How a {@link KmsSigner} authorizes each `/SignHash` call. */
|
|
821
|
+
type KmsSignerAuth = {
|
|
822
|
+
mode: "legacy";
|
|
823
|
+
assertionProvider: () => Promise<LegacyPasskeyAssertion>;
|
|
824
|
+
} | {
|
|
825
|
+
mode: "ceremony";
|
|
826
|
+
ceremonySigner: PasskeyCeremonySigner;
|
|
827
|
+
ceremonyOptions?: Omit<RunCeremonyOptions, "signer">;
|
|
828
|
+
/**
|
|
829
|
+
* Bind each ceremony challenge to the payload via `SHA-256(nonce ‖ hash)`
|
|
830
|
+
* (WYSIWYS, AirAccount #68). DEFAULT `false` (raw nonce) because the LIVE KMS
|
|
831
|
+
* host (kms.aastar.io) still verifies the WebAuthn assertion against the raw
|
|
832
|
+
* nonce — sending the commitment is rejected with "Challenge mismatch". Enable
|
|
833
|
+
* only once the KMS host recomputes `expected = SHA-256(nonce ‖ payload)` for
|
|
834
|
+
* signing ops (tracked AirAccount-side). The commitment IS already correct vs
|
|
835
|
+
* the TA; the gap is the host verify.
|
|
836
|
+
*/
|
|
837
|
+
commitPayload?: boolean;
|
|
838
|
+
};
|
|
774
839
|
/**
|
|
775
|
-
* KMS-backed signer
|
|
840
|
+
* KMS-backed signer (EIP-191 personal-sign over a digest).
|
|
776
841
|
*
|
|
777
|
-
*
|
|
778
|
-
*
|
|
779
|
-
*
|
|
842
|
+
* Two authorization modes (see {@link KmsSignerAuth}):
|
|
843
|
+
* - `ceremony` (preferred): each signature runs a fresh one-time WebAuthn
|
|
844
|
+
* ceremony and calls KMS `SignHash` with the challenge-bound `WebAuthn` field
|
|
845
|
+
* (replay-safe; what the KMS now requires).
|
|
846
|
+
* - `legacy` (deprecated): each signature reuses a raw passkey assertion via
|
|
847
|
+
* KMS `SignHash` `Passkey` field — rejected by KMS unless
|
|
848
|
+
* `KMS_ALLOW_LEGACY_PASSKEY=1` (test only).
|
|
780
849
|
*
|
|
781
850
|
* Narrowed during the ethers -> viem migration: only the EIP-191 personal-sign
|
|
782
|
-
* and address-read behaviour is
|
|
783
|
-
* ethers.AbstractSigner surface (signTransaction / signTypedData / connect /
|
|
784
|
-
* provider) has been dropped.
|
|
851
|
+
* and address-read behaviour is consumed by the SDK.
|
|
785
852
|
*/
|
|
786
853
|
declare class KmsSigner {
|
|
787
854
|
private readonly keyId;
|
|
788
855
|
private readonly _address;
|
|
789
856
|
private readonly kmsManager;
|
|
790
|
-
private readonly
|
|
791
|
-
constructor(keyId: string, _address: string, kmsManager: KmsManager,
|
|
857
|
+
private readonly auth;
|
|
858
|
+
constructor(keyId: string, _address: string, kmsManager: KmsManager, auth: KmsSignerAuth);
|
|
792
859
|
getAddress(): Promise<string>;
|
|
793
|
-
|
|
860
|
+
/**
|
|
861
|
+
* EIP-191 personal-sign over a digest. A string is hashed as UTF-8 text, a byte
|
|
862
|
+
* array as raw bytes — byte-identical to ethers `hashMessage`.
|
|
863
|
+
*
|
|
864
|
+
* @param webAuthnAssertion OPTIONAL pre-built, one-time ceremony assertion. Use
|
|
865
|
+
* this in server flows where the passkey lives on the USER's device: the
|
|
866
|
+
* frontend runs the BeginAuthentication ceremony and the backend forwards the
|
|
867
|
+
* resulting `{ ChallengeId, Credential }` here. When supplied it takes
|
|
868
|
+
* precedence over the signer's baked-in auth mode. Each assertion is one-time
|
|
869
|
+
* (the KMS consumes the challenge), so a caller that needs N signatures must
|
|
870
|
+
* supply N distinct assertions.
|
|
871
|
+
*
|
|
872
|
+
* WYSIWYS (AirAccount #68): the frontend MUST build the assertion over the
|
|
873
|
+
* payload-committed challenge `commitChallenge(nonce, hashOf(message))`, not the
|
|
874
|
+
* raw nonce — otherwise a compromised host could swap the signed payload. The
|
|
875
|
+
* raw-nonce assertion only works while the KMS runs in transition mode. (The
|
|
876
|
+
* signer's own ceremony mode does this automatically.)
|
|
877
|
+
*/
|
|
878
|
+
signMessage(message: string | Uint8Array, webAuthnAssertion?: WebAuthnAssertion): Promise<string>;
|
|
794
879
|
}
|
|
795
880
|
|
|
796
881
|
/**
|
|
797
|
-
* Context for passing
|
|
798
|
-
*
|
|
882
|
+
* Context for passing a LEGACY raw passkey assertion through the signing chain.
|
|
883
|
+
*
|
|
884
|
+
* @deprecated KMS v0.20.0+ rejects legacy raw passkey assertions for signing
|
|
885
|
+
* (no challenge binding → replayable). Prefer {@link WebAuthnCeremonyContext}.
|
|
799
886
|
*/
|
|
800
887
|
interface PasskeyAssertionContext {
|
|
801
888
|
assertion: LegacyPasskeyAssertion;
|
|
802
889
|
}
|
|
890
|
+
/**
|
|
891
|
+
* Context carrying a one-time, challenge-bound WebAuthn ceremony assertion
|
|
892
|
+
* (the replay-safe path the KMS now requires). In server transfer flows the
|
|
893
|
+
* passkey lives on the USER's device: the frontend runs the BeginAuthentication
|
|
894
|
+
* ceremony and the backend forwards the resulting `{ ChallengeId, Credential }`.
|
|
895
|
+
* Each assertion is one-time — a flow needing N signatures supplies N of them.
|
|
896
|
+
*/
|
|
897
|
+
interface WebAuthnCeremonyContext {
|
|
898
|
+
webAuthnAssertion: WebAuthnAssertion;
|
|
899
|
+
}
|
|
900
|
+
/** Either auth context accepted by a KMS-backed signer. */
|
|
901
|
+
type SignerAuthContext = PasskeyAssertionContext | WebAuthnCeremonyContext;
|
|
803
902
|
/**
|
|
804
903
|
* Pluggable signer adapter — replaces NestJS AuthService wallet management.
|
|
805
904
|
* Implement this to provide signing capabilities from your key management system.
|
|
@@ -817,9 +916,11 @@ interface ISignerAdapter {
|
|
|
817
916
|
* `account.signMessage({ raw: bytes })`). A `Uint8Array` (or raw `0x` hex) is
|
|
818
917
|
* signed as raw bytes — callers pass a 32-byte digest, NOT UTF-8 text.
|
|
819
918
|
*
|
|
820
|
-
* @param ctx optional
|
|
919
|
+
* @param ctx optional auth context for KMS-backed signers — a one-time
|
|
920
|
+
* {@link WebAuthnCeremonyContext} (preferred) or a legacy
|
|
921
|
+
* {@link PasskeyAssertionContext}.
|
|
821
922
|
*/
|
|
822
|
-
signMessage(userId: string, message: `0x${string}` | Uint8Array, ctx?:
|
|
923
|
+
signMessage(userId: string, message: `0x${string}` | Uint8Array, ctx?: SignerAuthContext): Promise<`0x${string}`>;
|
|
823
924
|
/**
|
|
824
925
|
* Ensure a signer exists for the user (create on demand if needed).
|
|
825
926
|
* Returns the signer's address.
|
|
@@ -1419,7 +1520,17 @@ declare class BLSSignatureService {
|
|
|
1419
1520
|
/** Lazy-initialize BLSManager on first use. */
|
|
1420
1521
|
private ensureInitialized;
|
|
1421
1522
|
getActiveSignerNodes(): Promise<unknown[]>;
|
|
1422
|
-
generateBLSSignature(userId: string, userOpHash: string, ctx?:
|
|
1523
|
+
generateBLSSignature(userId: string, userOpHash: string, ctx?: SignerAuthContext, options?: {
|
|
1524
|
+
/**
|
|
1525
|
+
* Skip the owner ECDSA over `userOpHash` (`aaSignature`). The cumulative
|
|
1526
|
+
* Tier-2 (algId 0x04) / Tier-3 (0x05) packings do NOT include it — they
|
|
1527
|
+
* carry only `messagePointSignature` (owner intent comes from the P256
|
|
1528
|
+
* passkey signature) — so computing it there is a wasted owner signature.
|
|
1529
|
+
* Under the WebAuthn-ceremony KMS path that wasted signature is also a
|
|
1530
|
+
* wasted user gesture, so tiered callers set this to `true`.
|
|
1531
|
+
*/
|
|
1532
|
+
skipOwnerOpSignature?: boolean;
|
|
1533
|
+
}): Promise<BLSSignatureData>;
|
|
1423
1534
|
packSignature(blsData: BLSSignatureData): Promise<string>;
|
|
1424
1535
|
/**
|
|
1425
1536
|
* Generate a tiered signature based on the required tier level.
|
|
@@ -1441,7 +1552,7 @@ declare class BLSSignatureService {
|
|
|
1441
1552
|
userOpHash: string;
|
|
1442
1553
|
p256Signature?: string;
|
|
1443
1554
|
guardianSigner?: GuardianSigner;
|
|
1444
|
-
ctx?:
|
|
1555
|
+
ctx?: SignerAuthContext;
|
|
1445
1556
|
}): Promise<string>;
|
|
1446
1557
|
}
|
|
1447
1558
|
|
|
@@ -1561,7 +1672,20 @@ interface ExecuteTransferParams {
|
|
|
1561
1672
|
* the gas token address appended to paymasterData. Used when the paymaster
|
|
1562
1673
|
* contract does not expose a public token() getter for auto-detection. */
|
|
1563
1674
|
paymasterTokenAddress?: string;
|
|
1675
|
+
/**
|
|
1676
|
+
* LEGACY raw passkey assertion for KMS signing.
|
|
1677
|
+
* @deprecated KMS v0.20.0+ rejects it (replayable). Use {@link webAuthnAssertion}.
|
|
1678
|
+
*/
|
|
1564
1679
|
passkeyAssertion?: LegacyPasskeyAssertion;
|
|
1680
|
+
/**
|
|
1681
|
+
* One-time, challenge-bound WebAuthn ceremony assertion for KMS owner signing
|
|
1682
|
+
* (replay-safe; what the KMS now requires). The frontend runs the
|
|
1683
|
+
* BeginAuthentication ceremony with the user's device passkey and passes the
|
|
1684
|
+
* resulting `{ ChallengeId, Credential }` here. The challenge is consumed once,
|
|
1685
|
+
* so this authorizes exactly ONE owner signature — use the tiered path
|
|
1686
|
+
* (`useAirAccountTiering: true`), which needs a single owner signature.
|
|
1687
|
+
*/
|
|
1688
|
+
webAuthnAssertion?: WebAuthnAssertion;
|
|
1565
1689
|
/** P256 passkey signature (64 bytes hex). Required for AirAccount Tier 2/3. */
|
|
1566
1690
|
p256Signature?: string;
|
|
1567
1691
|
/** Guardian signer instance. Required for AirAccount Tier 3. */
|
|
@@ -1639,7 +1763,7 @@ declare class WalletManager {
|
|
|
1639
1763
|
private readonly signer;
|
|
1640
1764
|
constructor(signer: ISignerAdapter);
|
|
1641
1765
|
getAddress(userId: string): Promise<`0x${string}`>;
|
|
1642
|
-
signMessage(userId: string, message: `0x${string}` | Uint8Array, ctx?:
|
|
1766
|
+
signMessage(userId: string, message: `0x${string}` | Uint8Array, ctx?: SignerAuthContext): Promise<`0x${string}`>;
|
|
1643
1767
|
ensureSigner(userId: string): Promise<{
|
|
1644
1768
|
address: `0x${string}`;
|
|
1645
1769
|
}>;
|
|
@@ -1670,6 +1794,26 @@ declare class WalletManager {
|
|
|
1670
1794
|
*
|
|
1671
1795
|
* const account = await client.accounts.createAccount('user-123');
|
|
1672
1796
|
* ```
|
|
1797
|
+
*
|
|
1798
|
+
* @example KMS-backed signing (production) — inject {@link KmsSignerAdapter} as the
|
|
1799
|
+
* `signer`. This is the wiring seam that carries a per-call WebAuthn ceremony
|
|
1800
|
+
* assertion (challenge-bound, replay-safe) from `executeTransfer` through to the
|
|
1801
|
+
* KMS `/SignHash`. The `userId → { keyId, address }` mapping is app-specific.
|
|
1802
|
+
* ```ts
|
|
1803
|
+
* import { AirAccountServerClient, KmsManager, KmsSignerAdapter } from '@aastar/airaccount/server';
|
|
1804
|
+
*
|
|
1805
|
+
* const kms = new KmsManager({ kmsEndpoint, kmsApiKey, kmsEnabled: true });
|
|
1806
|
+
* const client = new AirAccountServerClient({
|
|
1807
|
+
* ...rest,
|
|
1808
|
+
* signer: new KmsSignerAdapter(kms, async (userId) => lookupUserKey(userId)),
|
|
1809
|
+
* });
|
|
1810
|
+
* // Transfer with a one-time WebAuthn assertion (frontend ceremony) on the tiered path:
|
|
1811
|
+
* await client.transfers.executeTransfer(userId, {
|
|
1812
|
+
* ...params,
|
|
1813
|
+
* useAirAccountTiering: true,
|
|
1814
|
+
* webAuthnAssertion, // { ChallengeId, Credential } from BeginAuthentication
|
|
1815
|
+
* });
|
|
1816
|
+
* ```
|
|
1673
1817
|
*/
|
|
1674
1818
|
declare class AirAccountServerClient {
|
|
1675
1819
|
readonly ethereum: EthereumProvider;
|
|
@@ -3334,10 +3478,46 @@ declare class LocalWalletSigner implements ISignerAdapter {
|
|
|
3334
3478
|
private readonly account;
|
|
3335
3479
|
constructor(privateKey: string);
|
|
3336
3480
|
getAddress(_userId: string): Promise<`0x${string}`>;
|
|
3337
|
-
signMessage(_userId: string, message: `0x${string}` | Uint8Array, _ctx?:
|
|
3481
|
+
signMessage(_userId: string, message: `0x${string}` | Uint8Array, _ctx?: SignerAuthContext): Promise<`0x${string}`>;
|
|
3338
3482
|
ensureSigner(_userId: string): Promise<{
|
|
3339
3483
|
address: `0x${string}`;
|
|
3340
3484
|
}>;
|
|
3341
3485
|
}
|
|
3342
3486
|
|
|
3343
|
-
|
|
3487
|
+
/** Resolves an app user id to its KMS key + EOA address. App-specific mapping. */
|
|
3488
|
+
type KmsKeyResolver = (userId: string) => Promise<{
|
|
3489
|
+
keyId: string;
|
|
3490
|
+
address: `0x${string}`;
|
|
3491
|
+
}>;
|
|
3492
|
+
/**
|
|
3493
|
+
* KMS-backed {@link ISignerAdapter} — the bridge between the SDK signing chain
|
|
3494
|
+
* (BLS / transfer pass a {@link SignerAuthContext}) and the KMS `/SignHash` API.
|
|
3495
|
+
*
|
|
3496
|
+
* This is the concrete adapter the BLS/transfer services expect: it unpacks the
|
|
3497
|
+
* per-call auth context and forwards it to the right KMS endpoint.
|
|
3498
|
+
* - {@link WebAuthnCeremonyContext} (preferred) → `signHashWithWebAuthn`
|
|
3499
|
+
* (one-time, challenge-bound; replay-safe — what KMS v0.20.0+ requires).
|
|
3500
|
+
* - {@link PasskeyAssertionContext} (legacy, @deprecated) → `signHash`
|
|
3501
|
+
* (rejected by KMS unless `KMS_ALLOW_LEGACY_PASSKEY=1`, test only).
|
|
3502
|
+
*
|
|
3503
|
+
* The frontend runs the BeginAuthentication ceremony with the user's device
|
|
3504
|
+
* passkey and passes the resulting `{ ChallengeId, Credential }` down as
|
|
3505
|
+
* `ctx.webAuthnAssertion`. Since each challenge is consumed once, a flow needing
|
|
3506
|
+
* N signatures must pass N assertions — use the tiered transfer path, which needs
|
|
3507
|
+
* only one owner signature.
|
|
3508
|
+
*
|
|
3509
|
+
* The `userId → { keyId, address }` mapping is app-specific; inject it via
|
|
3510
|
+
* {@link KmsKeyResolver}.
|
|
3511
|
+
*/
|
|
3512
|
+
declare class KmsSignerAdapter implements ISignerAdapter {
|
|
3513
|
+
private readonly kms;
|
|
3514
|
+
private readonly resolveKey;
|
|
3515
|
+
constructor(kms: KmsManager, resolveKey: KmsKeyResolver);
|
|
3516
|
+
getAddress(userId: string): Promise<`0x${string}`>;
|
|
3517
|
+
ensureSigner(userId: string): Promise<{
|
|
3518
|
+
address: `0x${string}`;
|
|
3519
|
+
}>;
|
|
3520
|
+
signMessage(userId: string, message: `0x${string}` | Uint8Array, ctx?: SignerAuthContext): Promise<`0x${string}`>;
|
|
3521
|
+
}
|
|
3522
|
+
|
|
3523
|
+
export { ACCOUNT_ABI, AGENT_SESSION_KEY_VALIDATOR_ABI, AIRACCOUNT_ABI, AIRACCOUNT_ADDRESSES, AIRACCOUNT_FACTORY_ABI, AIR_ACCOUNT_COMPOSITE_VALIDATOR_ABI, AIR_ACCOUNT_DELEGATE_ABI, AIR_ACCOUNT_DELEGATE_ADDRESS, ALG_ID, AccountManager, type AccountRecord, type ActiveRecovery, AgentRegistryService, type AgentReputationSummary, type AgentSessionConfig, type AgentSessionInfo, AirAccountServerClient, type AirAccountVersion, BLSSignatureData, BLSSignatureService, type BeginCeremonyResponse, type BindERC8004AgentWalletParams, type BlsConfigRecord, type BuildCredentialOptions, CALLDATA_PARSER_REGISTRY_ABI, ConsoleLogger, type CreateAgentAccountParams, type CreateP256SessionKeyRequest, type CreateP256SessionKeyResponse, DEFAULT_CREDENTIAL_ID, DEFAULT_KMS_ENDPOINT, DEFAULT_ORIGIN, DEFAULT_RP_ID, type DelegateInitParams, DvtPendingConfirmationError, type EIP7702Authorization, EIP7702DelegateService, ENTRYPOINT_ABI_V6, ENTRYPOINT_ABI_V7_V8, ENTRYPOINT_ADDRESSES, ERC20_ABI, ERC8004Service, ERC8004_ADDRESSES, EXECUTE_BATCH_SELECTOR, EXECUTE_SELECTOR, EXECUTE_USER_OP_SELECTOR, type EntryPointConfig, EntryPointVersion, type EntryPointVersionConfig, type EstimateGasParams, EthereumProvider, type ExecuteTransferParams, FACTORY_ABI_V6, FACTORY_ABI_V7_V8, FORCE_EXIT_MODULE_ABI, ForceExitService, type FullConfigGuardianParams, GLOBAL_GUARD_ABI, type GrantP256SessionParams, type GrantSessionParams, GuardChecker, type GuardState, GuardStateReader, GuardStatus, type ILogger, type ISignerAdapter, type IStorageAdapter, type InstallModuleParams, KmsAgentService, type KmsAttestationManifestResponse, type KmsAttestationProofResponse, type KmsAttestationResponse, type KmsBeginAuthenticationRequest, type KmsBeginAuthenticationResponse, type KmsBeginGrantSessionAuthRequest, type KmsBeginGrantSessionAuthResponse, type KmsBeginRegistrationRequest, type KmsBeginRegistrationResponse, type KmsChangePasskeyResponse, type KmsCompleteRegistrationRequest, type KmsCompleteRegistrationResponse, type KmsCreateAgentKeyRequest, type KmsCreateAgentKeyResponse, type KmsCreateKeyRequest, type KmsCreateKeyResponse, type KmsDeleteKeyResponse, type KmsDeriveAddressResponse, type KmsDescribeKeyResponse, type KmsEip712Domain, type KmsEip712FieldValue, type KmsEip712TypeDef, type KmsEthereumTransaction, type KmsGetPublicKeyResponse, type KmsHealthResponse, KmsHttpClient, type KmsHttpClientOptions, type KmsKeyResolver, type KmsKeyStatusResponse, type KmsListKeysResponse, KmsManager, KmsMonitorService, type KmsPaymentAuth, type KmsPaymentSignatureResponse, KmsPaymentSigner, type KmsPurgeKeyResponse, type KmsQueueStatusResponse, type KmsRefreshAgentCredentialRequest, type KmsRefreshAgentCredentialResponse, type KmsRevokeAgentCredentialRequest, type KmsRevokeAgentCredentialResponse, type KmsRollbackCounterResponse, KmsSessionService, type KmsSignAgentRequest, type KmsSignAgentResponse, type KmsSignGTokenAuthorizationRequest, type KmsSignGrantSessionRequest, type KmsSignGrantSessionResponse, type KmsSignHashResponse, type KmsSignMicropaymentVoucherRequest, type KmsSignP256GrantSessionRequest, type KmsSignRequest, type KmsSignResponse, type KmsSignTypedDataRequest, type KmsSignTypedDataResponse, type KmsSignX402PaymentRequest, KmsSigner, KmsSignerAdapter, type KmsSignerAuth, type KmsStatsResponse, type KmsVersionResponse, type L2Type, L2_TYPE, type LegacyPasskeyAssertion, LocalWalletSigner, MAX_GUARDIANS, MODULE_TYPE, MemoryStorage, type MintAgentIdentityParams, ModuleManager, type ModuleTypeId, type OapdConfig, type P256GuardianKey, P256PasskeySigner, PackedUserOperation, type PasskeyAssertionContext, type PasskeyCeremonySigner, PaymasterManager, PaymasterPriceStalenessError, type PaymasterRecord, type PendingExit, type PendingWeightChange, PreCheckResult, type QueryAgentReputationParams, RECOVERY_THRESHOLD, RECOVERY_TIMELOCK_SECONDS, RecoveryService, type RevokeP256SessionKeyRequest, type RevokeP256SessionKeyResponse, type RunCeremonyOptions, SESSION_KEY_VALIDATOR_ABI, type SerializedGuardianSpec, type ServerConfig, type SessionInfo, SessionKeyService, type SetAgentWalletParams, type SignP256UserOpRequest, type SignP256UserOpResponse, type SignerAuthContext, SilentLogger, type SubmitAgentReputationParams, TIER_GUARD_HOOK_ABI, TierConfig, TierLevel$1 as TierLevel, type TokenBalance, type TokenGuardState, type TokenInfo, TokenService, TransferManager, type TransferRecord, type TransferResult, type UninstallModuleParams, UserOperation, VALIDATOR_ABI, WEIGHT_CHANGE_EXPIRY_SECONDS, WEIGHT_CHANGE_THRESHOLD, WEIGHT_CHANGE_TIMELOCK_SECONDS, WalletManager, type WebAuthnAssertion, type WebAuthnAuthenticationCredential, type WebAuthnCeremonyContext, type WeightConfig, WeightedSignatureService, YAAAServerClient, base64UrlDecode, base64UrlEncode, beginAuthenticationChallenge, beginGrantSessionChallenge, buildAuthenticationCredential, buildAuthenticatorData, buildClientDataJSON, buildFullInitConfig, buildInstallModuleHash, buildUninstallModuleHash, commitChallenge, computeOapdSalt, erc8004AddressesForChain, getOapdAddress, getOapdAddressWithChainId, initConfigFromRecord, initConfigToTuple, isExecuteUserOpWrapped, isOapdDeployed, isPendingConfirmation, packP256SessionSignature, packSecp256k1SessionSignature, runAuthenticationCeremony, runGrantSessionCeremony, runWebAuthnCeremony, sepoliaV07Config, serializeGuardianSpecs, toGuardianSpecs, validateConfig, wrapExecuteUserOp };
|