wallaby-cash 3.15.2 → 3.16.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.
Files changed (41) hide show
  1. package/dist/api.cjs +1 -1
  2. package/dist/api.js +1 -1
  3. package/dist/api.mjs +1 -1
  4. package/dist/eth-crypto-utils/util.d.ts +6 -0
  5. package/dist/generated/api.d.ts +114 -15
  6. package/dist/helpers/bytes.d.ts +37 -0
  7. package/dist/helpers/pem-to-der.d.ts +1 -0
  8. package/dist/index.cjs +12 -10
  9. package/dist/index.cjs.map +1 -1
  10. package/dist/index.d.ts +1 -0
  11. package/dist/index.js +12 -10
  12. package/dist/index.js.map +1 -1
  13. package/dist/index.mjs +12 -10
  14. package/dist/index.mjs.map +1 -1
  15. package/dist/lib/attestation/aws-root-cert.d.ts +19 -0
  16. package/dist/lib/attestation/cbor.d.ts +106 -0
  17. package/dist/lib/attestation/cose.d.ts +70 -0
  18. package/dist/lib/attestation/crypto.d.ts +36 -0
  19. package/dist/lib/attestation/errors.d.ts +44 -0
  20. package/dist/lib/attestation/index.d.ts +7 -0
  21. package/dist/lib/attestation/pinned-measurements.d.ts +37 -0
  22. package/dist/lib/attestation/verify.d.ts +29 -0
  23. package/dist/lib/attestation/x509.d.ts +78 -0
  24. package/dist/package.json +6 -4
  25. package/dist/r/oci-DzAn0PLg.js +1 -0
  26. package/dist/r/oci-DzAn0PLg.js.map +1 -0
  27. package/dist/r/oci-DzAn0PLg.mjs +1 -0
  28. package/dist/r/oci-DzAn0PLg.mjs.map +1 -0
  29. package/dist/r/oci-al0xoD5i.cjs +1 -0
  30. package/dist/r/oci-al0xoD5i.cjs.map +1 -0
  31. package/dist/routes/auth.d.ts +10 -0
  32. package/dist/types/attestation.d.ts +58 -0
  33. package/dist/types/index.d.ts +1 -0
  34. package/package.json +6 -4
  35. package/dist/r/oci-3T3HuAKO.cjs +0 -1
  36. package/dist/r/oci-3T3HuAKO.cjs.map +0 -1
  37. package/dist/r/oci-DsJU4c2w.js +0 -1
  38. package/dist/r/oci-DsJU4c2w.js.map +0 -1
  39. package/dist/r/oci-DsJU4c2w.mjs +0 -1
  40. package/dist/r/oci-DsJU4c2w.mjs.map +0 -1
  41. package/dist/verification/polymesh/bytes.d.ts +0 -4
package/dist/api.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./r/oci-3T3HuAKO.cjs");exports.Api=e.A,exports.HttpClient=e.H;//# sourceMappingURL=api.cjs.map
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./r/oci-al0xoD5i.cjs");exports.Api=e.A,exports.HttpClient=e.H;//# sourceMappingURL=api.cjs.map
package/dist/api.js CHANGED
@@ -1 +1 @@
1
- export{A as Api,H as HttpClient}from"./r/oci-DsJU4c2w.js";//# sourceMappingURL=api.js.map
1
+ export{A as Api,H as HttpClient}from"./r/oci-DzAn0PLg.js";//# sourceMappingURL=api.js.map
package/dist/api.mjs CHANGED
@@ -1 +1 @@
1
- export{A as Api,H as HttpClient}from"./r/oci-DsJU4c2w.mjs";//# sourceMappingURL=api.mjs.map
1
+ export{A as Api,H as HttpClient}from"./r/oci-DzAn0PLg.mjs";//# sourceMappingURL=api.mjs.map
@@ -19,6 +19,12 @@ export declare const stripHexPrefix: (str: string) => string;
19
19
  * @returns output the string is a hex string
20
20
  */
21
21
  export declare const isHexString: (value: string, length?: number) => boolean;
22
+ /**
23
+ * Removes the leading '0x' from a hex string if present
24
+ * @param str the hex string input value
25
+ * @returns the hex string without the '0x' prefix
26
+ */
27
+ export declare const stripLeading0x: (str: string) => string;
22
28
  /**
23
29
  * Adds '0x' to a given `String` if not present
24
30
  * @param str the string input value
@@ -901,20 +901,20 @@ export interface AssetConfig {
901
901
  chainName: "BITCOIN" | "ETHEREUM" | "ALGORAND" | "AVALANCHE" | "POLYGON" | "BASE" | "BSC" | "SUI" | "INJECTIVE" | "SEI" | "APTOS" | "SOLANA" | "POLYMESH" | "HEDERA" | "CANTON";
902
902
  contractAddress?: string | null;
903
903
  /** The version of the RestrictedLockupToken contract */
904
- contractVersion?: string;
904
+ contractVersion?: string | null;
905
905
  /** The merchant who created the asset */
906
- createdByMerchant?: AssetConfigMerchantDto;
906
+ createdByMerchant?: AssetConfigMerchantDto | null;
907
907
  /** The merchant id who created the asset */
908
908
  createdByMerchantId?: string | null;
909
- createdByUser?: User;
909
+ createdByUser?: User | null;
910
910
  /** The user id who created the asset */
911
911
  createdByUserId?: string | null;
912
912
  /** @example 18 */
913
913
  decimals: number;
914
914
  description?: string | null;
915
915
  /** Chain-specific extended configuration for the asset (arbitrary key-value pairs) */
916
- extendedConfiguration?: Record<string, any>;
917
- iconUrl?: string;
916
+ extendedConfiguration?: Record<string, any> | null;
917
+ iconUrl?: string | null;
918
918
  /** Asset ID */
919
919
  id: string;
920
920
  /**
@@ -935,7 +935,7 @@ export interface AssetConfig {
935
935
  /** This field specify if an asset owned by a single wallet or requires multiple signatures to broadcast a transaction */
936
936
  ownershipType?: "SINGLE_OWNER" | "MULTI_SIG";
937
937
  /** The address of the forwarder contract to use with this token */
938
- relayerAddress?: string;
938
+ relayerAddress?: string | null;
939
939
  /**
940
940
  * Whether the asset requires KYC verification
941
941
  * @example false
@@ -1124,6 +1124,32 @@ export interface AsymmetricEncryptedDto {
1124
1124
  /** Message authentication code */
1125
1125
  mac: string;
1126
1126
  }
1127
+ export interface AttestationPubResponseDto {
1128
+ /**
1129
+ * The enclave's signing/identity public key in uncompressed secp256k1 hex format (128 hex chars), deterministically derived from the master key. This value alone is not proof of anything — pair it with GET /attestation to verify it is attested by the NSM before trusting it.
1130
+ * @pattern /^[0-9a-fA-F]{128}$/
1131
+ * @example "04280dfa5ad65473c28b08d45d943d57ef6c51a3715330a9aee4f359e7a5c935223cd39b18ef84a386989d4ebdefd78772a01503036500353256a6fb3b173ef3"
1132
+ */
1133
+ pub: string;
1134
+ }
1135
+ export interface AttestationResponseDto {
1136
+ /**
1137
+ * The NSM attestation document as base64-encoded COSE_Sign1 CBOR, returned exactly as the enclave produced it — this route does not decode or re-encode it, since doing so would risk breaking the COSE signature. Its payload binds the enclave's signing public key to the PCR measurements of the running image, plus the echoed nonce (see AttestationQueryDto). Verify the COSE signature against the pinned AWS Nitro root CA and confirm the PCRs match the expected EIF before trusting anything else in this response. In dev/TCP mode (mocked=true) this is a non-AWS placeholder, not a verifiable document.
1138
+ * @example "hEShATgioFkBBqlpbW9kdWxlX2lkeCdpLTA..."
1139
+ */
1140
+ attestationDoc: string;
1141
+ /**
1142
+ * True only in dev/TCP mode, where /dev/nsm is unavailable and the document is a non-AWS placeholder. Always false inside a real enclave. Clients must reject mocked documents in production.
1143
+ * @example false
1144
+ */
1145
+ mocked: boolean;
1146
+ /**
1147
+ * The enclave's signing/identity public key (uncompressed secp256k1 hex, 128 chars) that the document attests. Also embedded in the document's public_key field, and matches the pub field returned by GET /attestation/pub.
1148
+ * @pattern /^[0-9a-fA-F]{128}$/
1149
+ * @example "04280dfa5ad65473c28b08d45d943d57ef6c51a3715330a9aee4f359e7a5c935223cd39b18ef84a386989d4ebdefd78772a01503036500353256a6fb3b173ef3"
1150
+ */
1151
+ pub: string;
1152
+ }
1127
1153
  export interface AuthChangePublicKeyDto {
1128
1154
  /** @example "e3421d7f9d6888ea83bef6b28ce0a2ab6eb6fe8a8fbfa3743240992590816b08f9a62edcc63296d056c552054d583fec36d23ef11dffb24c95aaf4a47d50dccc" */
1129
1155
  clientAuthPubKey: string;
@@ -2953,6 +2979,16 @@ export interface GetAssetsConfigurationsParams {
2953
2979
  */
2954
2980
  toDate?: string;
2955
2981
  }
2982
+ export type GetAttestationData = AttestationResponseDto;
2983
+ export interface GetAttestationParams {
2984
+ /**
2985
+ * Client-supplied freshness nonce (hex), forwarded to the enclave unmodified and echoed back inside the signed attestation document's payload. Callers should pass the same value used to derive their ephemeral wrapping key (e.g. the session ID), so one value provides both attestation freshness and session binding. Omitting it produces a document with no freshness guarantee — the caller cannot then distinguish a fresh document from a stale one served from a formerly-trusted build.
2986
+ * @pattern /^[0-9a-fA-F]{32,128}$/
2987
+ * @example "a1b2c3d4e5f60718293a4b5c6d7e8f90"
2988
+ */
2989
+ nonce?: string;
2990
+ }
2991
+ export type GetAttestationPubData = AttestationPubResponseDto;
2956
2992
  /** @example "9KS7gmuAvvaemARt59QRW2mXP6WesRX7pVqzw4afPXc=" */
2957
2993
  export type GetCallbackPublicKeyData = string;
2958
2994
  export interface GetCallbackPublicKeyParams {
@@ -6257,12 +6293,12 @@ export interface User {
6257
6293
  * User first name
6258
6294
  * @example "Bryan"
6259
6295
  */
6260
- firstName?: string;
6296
+ firstName?: string | null;
6261
6297
  /**
6262
6298
  * User roles with full permissions
6263
6299
  * @example true
6264
6300
  */
6265
- hasFullPermissions: boolean;
6301
+ hasFullPermissions?: boolean;
6266
6302
  /** User primary key */
6267
6303
  id: string;
6268
6304
  /**
@@ -6286,7 +6322,7 @@ export interface User {
6286
6322
  * User Role ID
6287
6323
  * @example "merchant_admin"
6288
6324
  */
6289
- role: "super_admin" | "merchant_admin" | "merchant_user" | "wallet_user" | "contract_admin" | "reserve_admin" | "wallets_admin" | "transfer_admin" | "soft_burn_admin" | "mint_admin" | "automation_admin";
6325
+ role: "super_admin" | "merchant_admin" | "merchant_user" | "wallet_user" | "contract_admin" | "reserve_admin" | "wallets_admin" | "transfer_admin" | "soft_burn_admin" | "mint_admin" | "automation_admin" | null;
6290
6326
  /**
6291
6327
  * Updated at
6292
6328
  * @format date-time
@@ -6599,7 +6635,7 @@ export interface UserDto {
6599
6635
  * User first name
6600
6636
  * @example "Bryan"
6601
6637
  */
6602
- firstName?: string;
6638
+ firstName?: string | null;
6603
6639
  /** User primary key */
6604
6640
  id: string;
6605
6641
  /**
@@ -6611,9 +6647,9 @@ export interface UserDto {
6611
6647
  * User's Polymesh identity
6612
6648
  * @example "0x73ecca5cf1ecaa365a7d1f1e5dbc91737c73fe0a96b41386f574dfb915a913a7"
6613
6649
  */
6614
- polymeshDID?: string;
6650
+ polymeshDID?: string | null;
6615
6651
  /** @example "wallet_user" */
6616
- role?: "super_admin" | "merchant_admin" | "merchant_user" | "wallet_user" | "contract_admin" | "reserve_admin" | "wallets_admin" | "transfer_admin" | "soft_burn_admin" | "mint_admin" | "automation_admin";
6652
+ role?: "super_admin" | "merchant_admin" | "merchant_user" | "wallet_user" | "contract_admin" | "reserve_admin" | "wallets_admin" | "transfer_admin" | "soft_burn_admin" | "mint_admin" | "automation_admin" | null;
6617
6653
  /**
6618
6654
  * Updated at
6619
6655
  * @format date-time
@@ -7362,6 +7398,49 @@ export declare namespace Auth {
7362
7398
  };
7363
7399
  type ResponseBody = GetPasskeyCredentialsData;
7364
7400
  }
7401
+ /**
7402
+ * No description
7403
+ * @tags Auth
7404
+ * @name GetAttestation
7405
+ * @summary Get the enclave's signed attestation document
7406
+ * @request GET:/api/v1/auth/attestation
7407
+ * @secure
7408
+ */
7409
+ namespace GetAttestation {
7410
+ type RequestParams = {};
7411
+ type RequestQuery = {
7412
+ /**
7413
+ * Client-supplied freshness nonce (hex), forwarded to the enclave unmodified and echoed back inside the signed attestation document's payload. Callers should pass the same value used to derive their ephemeral wrapping key (e.g. the session ID), so one value provides both attestation freshness and session binding. Omitting it produces a document with no freshness guarantee — the caller cannot then distinguish a fresh document from a stale one served from a formerly-trusted build.
7414
+ * @pattern /^[0-9a-fA-F]{32,128}$/
7415
+ * @example "a1b2c3d4e5f60718293a4b5c6d7e8f90"
7416
+ */
7417
+ nonce?: string;
7418
+ };
7419
+ type RequestBody = never;
7420
+ type RequestHeaders = {
7421
+ /** A unique identifier for the request, used for tracing and debugging */
7422
+ "x-client-request-id"?: string;
7423
+ };
7424
+ type ResponseBody = GetAttestationData;
7425
+ }
7426
+ /**
7427
+ * No description
7428
+ * @tags Auth
7429
+ * @name GetAttestationPub
7430
+ * @summary Get the enclave's signing/identity public key
7431
+ * @request GET:/api/v1/auth/attestation/pub
7432
+ * @secure
7433
+ */
7434
+ namespace GetAttestationPub {
7435
+ type RequestParams = {};
7436
+ type RequestQuery = {};
7437
+ type RequestBody = never;
7438
+ type RequestHeaders = {
7439
+ /** A unique identifier for the request, used for tracing and debugging */
7440
+ "x-client-request-id"?: string;
7441
+ };
7442
+ type ResponseBody = GetAttestationPubData;
7443
+ }
7365
7444
  }
7366
7445
  export declare namespace Chains {
7367
7446
  /**
@@ -10851,12 +10930,12 @@ export declare class HttpClient<SecurityDataType = unknown> {
10851
10930
  request: <T = any, E = any>({ body, secure, path, type, query, format, baseUrl, cancelToken, ...params }: FullRequestParams) => Promise<T>;
10852
10931
  }
10853
10932
  /**
10854
- * @title STAGING
10855
- * @version 1.0
10933
+ * @title NCW Wallets Service
10934
+ * @version 0.0.1
10856
10935
  * @baseUrl https://dev-testnet.wallaby.cash
10857
10936
  * @contact
10858
10937
  *
10859
- * The STAGING is an API that manages the wallets of the Republic Crypto
10938
+ * The NCW Wallets Service is an API that manages the wallets of the Republic Crypto
10860
10939
  */
10861
10940
  export declare class Api<SecurityDataType extends unknown> {
10862
10941
  http: HttpClient<SecurityDataType>;
@@ -10994,6 +11073,26 @@ export declare class Api<SecurityDataType extends unknown> {
10994
11073
  * @secure
10995
11074
  */
10996
11075
  getPasskeyCredentials: (params?: RequestParams) => Promise<PasskeyCredentialResponseDto>;
11076
+ /**
11077
+ * No description
11078
+ *
11079
+ * @tags Auth
11080
+ * @name GetAttestation
11081
+ * @summary Get the enclave's signed attestation document
11082
+ * @request GET:/api/v1/auth/attestation
11083
+ * @secure
11084
+ */
11085
+ getAttestation: (query?: GetAttestationParams, params?: RequestParams) => Promise<AttestationResponseDto>;
11086
+ /**
11087
+ * No description
11088
+ *
11089
+ * @tags Auth
11090
+ * @name GetAttestationPub
11091
+ * @summary Get the enclave's signing/identity public key
11092
+ * @request GET:/api/v1/auth/attestation/pub
11093
+ * @secure
11094
+ */
11095
+ getAttestationPub: (params?: RequestParams) => Promise<AttestationPubResponseDto>;
10997
11096
  };
10998
11097
  chains: {
10999
11098
  /**
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Converts a hex string to a byte array.
3
+ * @param hex The hex string to convert to a byte array.
4
+ * @returns A `Uint8Array` representing the bytes of the hex string.
5
+ */
6
+ export declare function hexToU8a(hex: string): Uint8Array;
7
+ /**
8
+ * Converts a byte array to a hex string.
9
+ * @param bytes The byte array to convert to a hex string.
10
+ * @returns A hex string representation of the byte array, prefixed with `0x`.
11
+ */
12
+ export declare function u8aToHex(bytes: Uint8Array): string;
13
+ /**
14
+ * Concatenates multiple `Uint8Array` instances into a single `Uint8Array`.
15
+ * @param parts The byte arrays to concatenate.
16
+ * @returns A new `Uint8Array` containing the concatenated bytes.
17
+ */
18
+ export declare function concatU8a(...parts: Uint8Array[]): Uint8Array;
19
+ /**
20
+ * Non-constant-time byte comparison.
21
+ * @param a The first byte array to compare.
22
+ * @param b The second byte array to compare.
23
+ * @returns `true` if the byte arrays are equal, `false` otherwise.
24
+ */
25
+ export declare function u8aEquals(a: Uint8Array, b: Uint8Array): boolean;
26
+ /**
27
+ * Constant-time byte comparison, for the nonce check in `verify.ts` step 5.
28
+ * `a` is the value read out of the (already signature-verified) attestation
29
+ * document; `b` is the value the caller expected. Unlike `u8aEquals`, this
30
+ * never returns early on a length mismatch and never short-circuits on the
31
+ * first differing byte — both would let response timing leak information
32
+ * about how much of the expected nonce an attacker-controlled document
33
+ * matched. The nonce here is not secret once the document is verified, but
34
+ * this comparison is written the same way regardless, rather than assuming
35
+ * from context that timing safety doesn't matter.
36
+ */
37
+ export declare function constantTimeEqual(a: Uint8Array, b: Uint8Array): boolean;
@@ -0,0 +1 @@
1
+ export declare function pemToDer(pem: string): Uint8Array;