@cubist-labs/cubesigner-sdk 0.4.247 → 0.4.252

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/src/key.ts CHANGED
@@ -30,6 +30,7 @@ import type {
30
30
  KeyInfoJwt,
31
31
  KeyAttestationQuery,
32
32
  BinanceApiProperties,
33
+ CoinbaseApiProperties,
33
34
  } from "./schema_types";
34
35
  import type {
35
36
  ApiClient,
@@ -101,6 +102,7 @@ export enum Ed25519 {
101
102
  Substrate = "Ed25519SubstrateAddr",
102
103
  Tendermint = "Ed25519TendermintAddr",
103
104
  BinanceApi = "Ed25519BinanceApi",
105
+ CoinbaseApi = "Ed25519CoinbaseApi",
104
106
  Ton = "Ed25519TonAddr",
105
107
  Xrp = "Ed25519XrpAddr",
106
108
  }
@@ -128,7 +130,9 @@ export type BabyJubjub = typeof BabyJubjub;
128
130
  export type KeyType = Secp256k1 | Bls | Ed25519 | Mnemonic | Stark | P256 | BabyJubjub;
129
131
 
130
132
  /** The type representing all different kinds of key properties. */
131
- export type KeyPropertiesPatch = { kind: "BinanceApi" } & BinanceApiProperties;
133
+ export type KeyPropertiesPatch =
134
+ | ({ kind: "BinanceApi" } & BinanceApiProperties)
135
+ | ({ kind: "CoinbaseApi" } & CoinbaseApiProperties);
132
136
 
133
137
  /**
134
138
  * A representation of a signing key.
@@ -844,6 +848,8 @@ export function fromSchemaKeyType(ty: SchemaKeyType): KeyType {
844
848
  return Ed25519.Ton;
845
849
  case "Ed25519BinanceApi":
846
850
  return Ed25519.BinanceApi;
851
+ case "Ed25519CoinbaseApi":
852
+ return Ed25519.CoinbaseApi;
847
853
  case "Stark":
848
854
  return Stark;
849
855
  case "Mnemonic":
package/src/org.ts CHANGED
@@ -27,6 +27,8 @@ import type {
27
27
  ContactAddressData,
28
28
  OrgExtProps,
29
29
  OrgExtData,
30
+ AuditLogEntry,
31
+ AuditLogRequest,
30
32
  } from ".";
31
33
  import { Contact } from "./contact";
32
34
  import { C2FFunction, Key, MfaRequest, Role } from ".";
@@ -250,11 +252,39 @@ export class Org {
250
252
  metric_name: metricName,
251
253
  ...opt,
252
254
  start_time: startTime,
255
+ // Must set end_time before fetchAll: without it the backend defaults to now()
256
+ // on each page request, and a changing window invalidates the pagination token.
253
257
  end_time: opt?.end_time ?? Math.floor(Date.now() / 1000),
254
258
  };
255
259
  return await this.#apiClient.orgQueryMetrics(req, pageOpts).fetchAll();
256
260
  }
257
261
 
262
+ /**
263
+ * Query the org audit log.
264
+ *
265
+ * @param startTime The start date in seconds since unix epoch.
266
+ * @param opt Other optional arguments
267
+ * @param opt.end_time The end date in seconds since unix epoch. Defaults to 'now'.
268
+ * @param opt.events Filter by event name. If omitted, all events are included.
269
+ * @param pageOpts Pagination options. Defaults to fetching the entire result set.
270
+ * @returns Matching audit log entries.
271
+ */
272
+ async queryAuditLog(
273
+ startTime: EpochTimeStamp,
274
+ opt?: Omit<AuditLogRequest, "start_time">,
275
+ pageOpts?: PageOpts,
276
+ ): Promise<AuditLogEntry[]> {
277
+ const req: AuditLogRequest = {
278
+ ...opt,
279
+ start_time: startTime,
280
+ // Must set end_time before fetchAll: without it the backend defaults to now()
281
+ // on each page request, and a changing window invalidates the pagination token.
282
+ end_time: opt?.end_time ?? Math.floor(Date.now() / 1000),
283
+ };
284
+
285
+ return await this.#apiClient.orgQueryAuditLog(req, pageOpts).fetchAll();
286
+ }
287
+
258
288
  /**
259
289
  * Fetch the org information.
260
290
  *
package/src/passkey.ts CHANGED
@@ -2,6 +2,7 @@ import {
2
2
  ApiClient,
3
3
  decodeBase64Url,
4
4
  encodeToBase64Url,
5
+ type MultiRegionEnv,
5
6
  type EnvInterface,
6
7
  type PasskeyAssertChallenge,
7
8
  type schemas,
@@ -132,7 +133,7 @@ export function credentialToJSON(cred: PublicKeyCredential): schemas["PublicKeyC
132
133
  * Helper class for answering a passkey login challenge.
133
134
  */
134
135
  export class PasskeyLoginChallenge {
135
- readonly #env: EnvInterface;
136
+ readonly #env: EnvInterface | MultiRegionEnv;
136
137
  readonly challenge: Omit<PasskeyAssertChallenge, "options">;
137
138
  readonly options: PublicKeyCredentialRequestOptions;
138
139
 
@@ -144,7 +145,7 @@ export class PasskeyLoginChallenge {
144
145
  * @param purpose Optional descriptive purpose of the new session
145
146
  */
146
147
  constructor(
147
- env: EnvInterface,
148
+ env: EnvInterface | MultiRegionEnv,
148
149
  challenge: PasskeyAssertChallenge,
149
150
  readonly purpose: string | null | undefined,
150
151
  ) {