@inkbox/sdk 0.2.0 → 0.2.2

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 (66) hide show
  1. package/README.md +34 -35
  2. package/dist/agent_identity.d.ts +96 -54
  3. package/dist/agent_identity.d.ts.map +1 -1
  4. package/dist/agent_identity.js +119 -86
  5. package/dist/agent_identity.js.map +1 -1
  6. package/dist/credentials.d.ts +11 -0
  7. package/dist/credentials.d.ts.map +1 -1
  8. package/dist/credentials.js +17 -0
  9. package/dist/credentials.js.map +1 -1
  10. package/dist/identities/resources/identities.d.ts +0 -15
  11. package/dist/identities/resources/identities.d.ts.map +1 -1
  12. package/dist/identities/resources/identities.js +0 -18
  13. package/dist/identities/resources/identities.js.map +1 -1
  14. package/dist/identities/types.d.ts +2 -21
  15. package/dist/identities/types.d.ts.map +1 -1
  16. package/dist/identities/types.js +1 -11
  17. package/dist/identities/types.js.map +1 -1
  18. package/dist/index.d.ts +4 -3
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +1 -0
  21. package/dist/index.js.map +1 -1
  22. package/dist/inkbox.d.ts +21 -6
  23. package/dist/inkbox.d.ts.map +1 -1
  24. package/dist/inkbox.js +30 -9
  25. package/dist/inkbox.js.map +1 -1
  26. package/dist/phone/resources/numbers.d.ts +2 -0
  27. package/dist/phone/resources/numbers.d.ts.map +1 -1
  28. package/dist/phone/resources/numbers.js +6 -0
  29. package/dist/phone/resources/numbers.js.map +1 -1
  30. package/dist/phone/resources/texts.d.ts +93 -0
  31. package/dist/phone/resources/texts.d.ts.map +1 -0
  32. package/dist/phone/resources/texts.js +109 -0
  33. package/dist/phone/resources/texts.js.map +1 -0
  34. package/dist/phone/types.d.ts +62 -0
  35. package/dist/phone/types.d.ts.map +1 -1
  36. package/dist/phone/types.js +34 -0
  37. package/dist/phone/types.js.map +1 -1
  38. package/dist/vault/crypto.d.ts +6 -4
  39. package/dist/vault/crypto.d.ts.map +1 -1
  40. package/dist/vault/crypto.js +22 -14
  41. package/dist/vault/crypto.js.map +1 -1
  42. package/dist/vault/resources/vault.d.ts +35 -1
  43. package/dist/vault/resources/vault.d.ts.map +1 -1
  44. package/dist/vault/resources/vault.js +113 -8
  45. package/dist/vault/resources/vault.js.map +1 -1
  46. package/dist/vault/totp.d.ts +73 -0
  47. package/dist/vault/totp.d.ts.map +1 -0
  48. package/dist/vault/totp.js +230 -0
  49. package/dist/vault/totp.js.map +1 -0
  50. package/dist/vault/types.d.ts +3 -0
  51. package/dist/vault/types.d.ts.map +1 -1
  52. package/dist/vault/types.js +4 -0
  53. package/dist/vault/types.js.map +1 -1
  54. package/package.json +2 -1
  55. package/dist/authenticator/resources/accounts.d.ts +0 -70
  56. package/dist/authenticator/resources/accounts.d.ts.map +0 -1
  57. package/dist/authenticator/resources/accounts.js +0 -91
  58. package/dist/authenticator/resources/accounts.js.map +0 -1
  59. package/dist/authenticator/resources/apps.d.ts +0 -38
  60. package/dist/authenticator/resources/apps.d.ts.map +0 -1
  61. package/dist/authenticator/resources/apps.js +0 -52
  62. package/dist/authenticator/resources/apps.js.map +0 -1
  63. package/dist/authenticator/types.d.ts +0 -83
  64. package/dist/authenticator/types.d.ts.map +0 -1
  65. package/dist/authenticator/types.js +0 -43
  66. package/dist/authenticator/types.js.map +0 -1
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @inkbox/sdk
2
2
 
3
- TypeScript SDK for the [Inkbox API](https://inkbox.ai/docs) — API-first communication infrastructure for AI agents (email, phone, authenticator/OTP, identities).
3
+ TypeScript SDK for the [Inkbox API](https://inkbox.ai/docs) — API-first communication infrastructure for AI agents (email, phone, identities, encrypted vault — login credentials, API keys, key pairs, SSH keys, OTP, etc.).
4
4
 
5
5
  ## Install
6
6
 
@@ -19,10 +19,10 @@ You'll need an API key to use this SDK. Get one at [console.inkbox.ai](https://c
19
19
  ```ts
20
20
  import { Inkbox } from "@inkbox/sdk";
21
21
 
22
- const inkbox = new Inkbox({
22
+ const inkbox = await new Inkbox({
23
23
  apiKey: process.env.INKBOX_API_KEY!,
24
24
  vaultKey: process.env.INKBOX_VAULT_KEY,
25
- });
25
+ }).ready();
26
26
 
27
27
  // Create an agent identity
28
28
  const identity = await inkbox.createIdentity("support-bot");
@@ -215,42 +215,45 @@ for (const t of hits) {
215
215
 
216
216
  ---
217
217
 
218
- ## Authenticator
218
+ ## Text Messages (SMS/MMS)
219
219
 
220
- ```ts
221
- // Create an authenticator app and link it to an identity
222
- const app = await identity.createAuthenticatorApp();
223
-
224
- // Add an OTP account from an otpauth:// URI
225
- const account = await identity.createAuthenticatorAccount({
226
- otpauthUri: "otpauth://totp/Example:user@example.com?secret=EXAMPLESECRET&issuer=Example",
227
- displayName: "My OTP Account", // optional (max 255 chars)
228
- description: "Login MFA for Example", // optional
229
- });
220
+ Receive and read inbound text messages. Outbound SMS sending is coming soon.
230
221
 
231
- // List all accounts in this identity's authenticator app
232
- const accounts = await identity.listAuthenticatorAccounts();
222
+ ```ts
223
+ // List text messages
224
+ const texts = await identity.listTexts({ limit: 20 });
225
+ for (const t of texts) {
226
+ console.log(t.remotePhoneNumber, t.text, t.isRead);
227
+ }
233
228
 
234
- // Get a single account
235
- const acct = await identity.getAuthenticatorAccount("account-uuid");
229
+ // Filter to unread only
230
+ const unread = await identity.listTexts({ isRead: false });
236
231
 
237
- // Update account metadata (pass null to clear a field)
238
- await identity.updateAuthenticatorAccount("account-uuid", { displayName: "New Label" });
232
+ // Get a single text
233
+ const text = await identity.getText("text-uuid");
234
+ console.log(text.type); // "sms" or "mms"
235
+ if (text.media) { // MMS attachments (presigned S3 URLs, 1hr expiry)
236
+ for (const m of text.media) {
237
+ console.log(m.contentType, m.size, m.url);
238
+ }
239
+ }
239
240
 
240
- // Generate an OTP code
241
- const otp = await identity.generateOtp("account-uuid");
242
- console.log(otp.otpCode); // e.g. "482901"
243
- console.log(otp.validForSeconds); // seconds until expiry (null for HOTP)
244
- console.log(otp.otpType); // "totp" or "hotp"
241
+ // List conversation summaries (one row per remote number)
242
+ const convos = await identity.listTextConversations({ limit: 20 });
243
+ for (const c of convos) {
244
+ console.log(c.remotePhoneNumber, c.latestText, c.unreadCount);
245
+ }
245
246
 
246
- // Delete an account
247
- await identity.deleteAuthenticatorAccount("account-uuid");
247
+ // Get messages in a specific conversation
248
+ const msgs = await identity.getTextConversation("+15167251294", { limit: 50 });
248
249
 
249
- // Unlink authenticator app from identity
250
- await identity.unlinkAuthenticatorApp();
250
+ // Mark as read
251
+ await identity.markTextRead("text-uuid");
252
+ await identity.markTextConversationRead("+15167251294");
251
253
 
252
- // Delete the authenticator app (org-level)
253
- await inkbox.authenticatorApps.delete("app-uuid");
254
+ // Org-level: search and delete
255
+ const results = await inkbox.texts.search(phone.id, { q: "invoice", limit: 20 });
256
+ await inkbox.texts.update(phone.id, "text-uuid", { status: "deleted" });
254
257
  ```
255
258
 
256
259
  ---
@@ -431,10 +434,6 @@ Runnable example scripts are available in the [examples/typescript](https://gith
431
434
  | `read-agent-calls.ts` | List calls and print transcripts |
432
435
  | `receive-agent-email-webhook.ts` | Register and delete a mailbox webhook |
433
436
  | `receive-agent-call-webhook.ts` | Register, update, and delete a phone webhook |
434
- | `agent-authenticator-app-e2e.ts` | Full authenticator app lifecycle (create, OTP, cleanup) |
435
- | `create-authenticator.ts` | Create an authenticator app and add an OTP account |
436
- | `generate-otp.ts` | Generate an OTP code for an account |
437
- | `list-authenticator-accounts.ts` | List authenticator accounts for an identity |
438
437
 
439
438
  ## License
440
439
 
@@ -8,19 +8,19 @@
8
8
  * identity's assigned channels so callers never need to pass an email
9
9
  * address or phone number ID explicitly.
10
10
  */
11
- import type { AuthenticatorAccount, AuthenticatorApp, OTPCode } from "./authenticator/types.js";
12
11
  import { Credentials } from "./credentials.js";
12
+ import type { TOTPCode, TOTPConfig } from "./vault/totp.js";
13
+ import type { DecryptedVaultSecret, SecretPayload, VaultSecret } from "./vault/types.js";
13
14
  import { MessageDirection } from "./mail/types.js";
14
15
  import type { Message, MessageDetail, ThreadDetail } from "./mail/types.js";
15
- import type { PhoneCall, PhoneCallWithRateLimit, PhoneTranscript } from "./phone/types.js";
16
- import type { _AgentIdentityData, IdentityAuthenticatorApp, IdentityMailbox, IdentityPhoneNumber } from "./identities/types.js";
16
+ import type { PhoneCall, PhoneCallWithRateLimit, PhoneTranscript, TextConversationSummary, TextMessage } from "./phone/types.js";
17
+ import type { _AgentIdentityData, IdentityMailbox, IdentityPhoneNumber } from "./identities/types.js";
17
18
  import type { Inkbox } from "./inkbox.js";
18
19
  export declare class AgentIdentity {
19
20
  private _data;
20
21
  private readonly _inkbox;
21
22
  private _mailbox;
22
23
  private _phoneNumber;
23
- private _authenticatorApp;
24
24
  private _credentials;
25
25
  private _credentialsVaultRef;
26
26
  constructor(data: _AgentIdentityData, inkbox: Inkbox);
@@ -31,8 +31,6 @@ export declare class AgentIdentity {
31
31
  get mailbox(): IdentityMailbox | null;
32
32
  /** The phone number currently assigned to this identity, or `null` if none. */
33
33
  get phoneNumber(): IdentityPhoneNumber | null;
34
- /** The authenticator app currently assigned to this identity, or `null` if none. */
35
- get authenticatorApp(): IdentityAuthenticatorApp | null;
36
34
  /**
37
35
  * Identity-scoped credential access.
38
36
  *
@@ -56,6 +54,57 @@ export declare class AgentIdentity {
56
54
  * @param secretId - UUID of the secret to revoke access from.
57
55
  */
58
56
  revokeCredentialAccess(secretId: string): Promise<void>;
57
+ /**
58
+ * Create a vault secret and grant this identity access to it.
59
+ *
60
+ * The vault must be unlocked first.
61
+ *
62
+ * @param options.name - Display name (max 255 characters).
63
+ * @param options.payload - The secret payload.
64
+ * @param options.description - Optional description.
65
+ * @returns {@link VaultSecret} metadata.
66
+ */
67
+ createSecret(options: {
68
+ name: string;
69
+ payload: SecretPayload;
70
+ description?: string;
71
+ }): Promise<VaultSecret>;
72
+ /**
73
+ * Fetch and decrypt a vault secret this identity has access to.
74
+ *
75
+ * @param secretId - UUID of the secret.
76
+ */
77
+ getSecret(secretId: string): Promise<DecryptedVaultSecret>;
78
+ /**
79
+ * Add or replace TOTP on a login secret this identity has access to.
80
+ *
81
+ * @param secretId - UUID of the login secret.
82
+ * @param totp - A {@link TOTPConfig} or an `otpauth://totp/...` URI string.
83
+ * @returns Updated {@link VaultSecret} metadata.
84
+ */
85
+ setTotp(secretId: string, totp: TOTPConfig | string): Promise<VaultSecret>;
86
+ /**
87
+ * Remove TOTP from a login secret this identity has access to.
88
+ *
89
+ * @param secretId - UUID of the login secret.
90
+ * @returns Updated {@link VaultSecret} metadata.
91
+ */
92
+ removeTotp(secretId: string): Promise<VaultSecret>;
93
+ /**
94
+ * Generate the current TOTP code for a login secret.
95
+ *
96
+ * Uses cached credentials if available, otherwise fetches fresh.
97
+ *
98
+ * @param secretId - UUID of the login secret.
99
+ * @returns A {@link TOTPCode}.
100
+ */
101
+ getTotpCode(secretId: string): Promise<TOTPCode>;
102
+ /**
103
+ * Delete a vault secret.
104
+ *
105
+ * @param secretId - UUID of the secret to delete.
106
+ */
107
+ deleteSecret(secretId: string): Promise<void>;
59
108
  /**
60
109
  * Create a new mailbox and link it to this identity.
61
110
  *
@@ -100,24 +149,6 @@ export declare class AgentIdentity {
100
149
  * Unlink this identity's phone number (does not release the number).
101
150
  */
102
151
  unlinkPhoneNumber(): Promise<void>;
103
- /**
104
- * Create a new authenticator app and link it to this identity.
105
- *
106
- * @returns The newly created {@link AuthenticatorApp}.
107
- */
108
- createAuthenticatorApp(): Promise<AuthenticatorApp>;
109
- /**
110
- * Link an existing authenticator app to this identity.
111
- *
112
- * @param authenticatorAppId - UUID of the authenticator app to link. Obtain via
113
- * `inkbox.authenticatorApps.list()` or `inkbox.authenticatorApps.get()`.
114
- * @returns The linked {@link IdentityAuthenticatorApp}.
115
- */
116
- assignAuthenticatorApp(authenticatorAppId: string): Promise<IdentityAuthenticatorApp>;
117
- /**
118
- * Unlink this identity's authenticator app (does not delete the app).
119
- */
120
- unlinkAuthenticatorApp(): Promise<void>;
121
152
  /**
122
153
  * Send an email from this identity's mailbox.
123
154
  *
@@ -215,49 +246,61 @@ export declare class AgentIdentity {
215
246
  */
216
247
  listTranscripts(callId: string): Promise<PhoneTranscript[]>;
217
248
  /**
218
- * Create a new authenticator account from an `otpauth://` URI.
249
+ * List text messages for this identity's phone number.
219
250
  *
220
- * @param options.otpauthUri - `otpauth://totp/...` or `otpauth://hotp/...` URI.
221
- * @param options.displayName - Optional user-managed label (max 255 characters).
222
- * @param options.description - Optional free-form notes.
251
+ * @param options.limit - Maximum number of results. Defaults to 50.
252
+ * @param options.offset - Pagination offset. Defaults to 0.
253
+ * @param options.isRead - Filter by read state.
223
254
  */
224
- createAuthenticatorAccount(options: {
225
- otpauthUri: string;
226
- displayName?: string;
227
- description?: string;
228
- }): Promise<AuthenticatorAccount>;
229
- /** List all authenticator accounts in this identity's app. */
230
- listAuthenticatorAccounts(): Promise<AuthenticatorAccount[]>;
255
+ listTexts(options?: {
256
+ limit?: number;
257
+ offset?: number;
258
+ isRead?: boolean;
259
+ }): Promise<TextMessage[]>;
231
260
  /**
232
- * Get a single authenticator account by ID.
261
+ * Get a single text message by ID.
233
262
  *
234
- * @param accountId - UUID of the authenticator account.
263
+ * @param textId - UUID of the text message to fetch.
235
264
  */
236
- getAuthenticatorAccount(accountId: string): Promise<AuthenticatorAccount>;
265
+ getText(textId: string): Promise<TextMessage>;
237
266
  /**
238
- * Update user-managed metadata on an authenticator account.
267
+ * List text conversations (one row per remote number).
239
268
  *
240
- * @param accountId - UUID of the authenticator account to update.
241
- * @param options.displayName - New label (max 255 characters).
242
- * @param options.description - New notes.
269
+ * @param options.limit - Maximum number of results. Defaults to 50.
270
+ * @param options.offset - Pagination offset. Defaults to 0.
243
271
  */
244
- updateAuthenticatorAccount(accountId: string, options: {
245
- displayName?: string | null;
246
- description?: string | null;
247
- }): Promise<AuthenticatorAccount>;
272
+ listTextConversations(options?: {
273
+ limit?: number;
274
+ offset?: number;
275
+ }): Promise<TextConversationSummary[]>;
276
+ /**
277
+ * Get all messages with a specific remote number.
278
+ *
279
+ * @param remoteNumber - E.164 remote phone number.
280
+ * @param options.limit - Maximum number of results. Defaults to 50.
281
+ * @param options.offset - Pagination offset. Defaults to 0.
282
+ */
283
+ getTextConversation(remoteNumber: string, options?: {
284
+ limit?: number;
285
+ offset?: number;
286
+ }): Promise<TextMessage[]>;
248
287
  /**
249
- * Delete an authenticator account.
288
+ * Mark a single text message as read.
250
289
  *
251
- * @param accountId - UUID of the authenticator account to delete.
290
+ * @param textId - UUID of the text message.
252
291
  */
253
- deleteAuthenticatorAccount(accountId: string): Promise<void>;
292
+ markTextRead(textId: string): Promise<TextMessage>;
254
293
  /**
255
- * Generate the current OTP code for an authenticator account.
294
+ * Mark all messages in a conversation as read.
256
295
  *
257
- * @param accountId - UUID of the authenticator account.
258
- * @returns The generated OTP code with metadata.
296
+ * @param remoteNumber - E.164 remote phone number.
297
+ * @returns Object with `remotePhoneNumber`, `isRead`, and `updatedCount`.
259
298
  */
260
- generateOtp(accountId: string): Promise<OTPCode>;
299
+ markTextConversationRead(remoteNumber: string): Promise<{
300
+ remotePhoneNumber: string;
301
+ isRead: boolean;
302
+ updatedCount: number;
303
+ }>;
261
304
  /**
262
305
  * Update this identity's handle or status.
263
306
  *
@@ -283,6 +326,5 @@ export declare class AgentIdentity {
283
326
  private _requireVaultUnlocked;
284
327
  private _requireMailbox;
285
328
  private _requirePhone;
286
- private _requireAuthenticatorApp;
287
329
  }
288
330
  //# sourceMappingURL=agent_identity.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"agent_identity.d.ts","sourceRoot":"","sources":["../src/agent_identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAChG,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,KAAK,EAAE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;
17
17
  _phoneNumber;
18
- _authenticatorApp;
19
18
  _credentials = null;
20
19
  _credentialsVaultRef = null; // tracks which _unlocked built the cache
21
20
  constructor(data, inkbox) {
@@ -23,7 +22,6 @@ export class AgentIdentity {
23
22
  this._inkbox = inkbox;
24
23
  this._mailbox = data.mailbox;
25
24
  this._phoneNumber = data.phoneNumber;
26
- this._authenticatorApp = data.authenticatorApp;
27
25
  }
28
26
  // ------------------------------------------------------------------
29
27
  // Identity properties
@@ -35,8 +33,6 @@ export class AgentIdentity {
35
33
  get mailbox() { return this._mailbox; }
36
34
  /** The phone number currently assigned to this identity, or `null` if none. */
37
35
  get phoneNumber() { return this._phoneNumber; }
38
- /** The authenticator app currently assigned to this identity, or `null` if none. */
39
- get authenticatorApp() { return this._authenticatorApp; }
40
36
  /**
41
37
  * Identity-scoped credential access.
42
38
  *
@@ -89,6 +85,83 @@ export class AgentIdentity {
89
85
  this._credentials = null;
90
86
  }
91
87
  // ------------------------------------------------------------------
88
+ // Vault secret management
89
+ // ------------------------------------------------------------------
90
+ /**
91
+ * Create a vault secret and grant this identity access to it.
92
+ *
93
+ * The vault must be unlocked first.
94
+ *
95
+ * @param options.name - Display name (max 255 characters).
96
+ * @param options.payload - The secret payload.
97
+ * @param options.description - Optional description.
98
+ * @returns {@link VaultSecret} metadata.
99
+ */
100
+ async createSecret(options) {
101
+ this._requireVaultUnlocked();
102
+ const unlocked = this._inkbox._vaultResource._unlocked;
103
+ const secret = await unlocked.createSecret(options);
104
+ await this._inkbox._vaultResource.grantAccess(secret.id, this.id);
105
+ this._credentials = null;
106
+ return secret;
107
+ }
108
+ /**
109
+ * Fetch and decrypt a vault secret this identity has access to.
110
+ *
111
+ * @param secretId - UUID of the secret.
112
+ */
113
+ async getSecret(secretId) {
114
+ this._requireVaultUnlocked();
115
+ return this._inkbox._vaultResource._unlocked.getSecret(secretId);
116
+ }
117
+ /**
118
+ * Add or replace TOTP on a login secret this identity has access to.
119
+ *
120
+ * @param secretId - UUID of the login secret.
121
+ * @param totp - A {@link TOTPConfig} or an `otpauth://totp/...` URI string.
122
+ * @returns Updated {@link VaultSecret} metadata.
123
+ */
124
+ async setTotp(secretId, totp) {
125
+ this._requireVaultUnlocked();
126
+ const result = await this._inkbox._vaultResource._unlocked.setTotp(secretId, totp);
127
+ this._credentials = null;
128
+ return result;
129
+ }
130
+ /**
131
+ * Remove TOTP from a login secret this identity has access to.
132
+ *
133
+ * @param secretId - UUID of the login secret.
134
+ * @returns Updated {@link VaultSecret} metadata.
135
+ */
136
+ async removeTotp(secretId) {
137
+ this._requireVaultUnlocked();
138
+ const result = await this._inkbox._vaultResource._unlocked.removeTotp(secretId);
139
+ this._credentials = null;
140
+ return result;
141
+ }
142
+ /**
143
+ * Generate the current TOTP code for a login secret.
144
+ *
145
+ * Uses cached credentials if available, otherwise fetches fresh.
146
+ *
147
+ * @param secretId - UUID of the login secret.
148
+ * @returns A {@link TOTPCode}.
149
+ */
150
+ async getTotpCode(secretId) {
151
+ this._requireVaultUnlocked();
152
+ return this._inkbox._vaultResource._unlocked.getTotpCode(secretId);
153
+ }
154
+ /**
155
+ * Delete a vault secret.
156
+ *
157
+ * @param secretId - UUID of the secret to delete.
158
+ */
159
+ async deleteSecret(secretId) {
160
+ this._requireVaultUnlocked();
161
+ await this._inkbox._vaultResource._unlocked.deleteSecret(secretId);
162
+ this._credentials = null;
163
+ }
164
+ // ------------------------------------------------------------------
92
165
  // Channel management
93
166
  // ------------------------------------------------------------------
94
167
  /**
@@ -173,46 +246,6 @@ export class AgentIdentity {
173
246
  await this._inkbox._idsResource.unlinkPhoneNumber(this.agentHandle);
174
247
  this._phoneNumber = null;
175
248
  }
176
- /**
177
- * Create a new authenticator app and link it to this identity.
178
- *
179
- * @returns The newly created {@link AuthenticatorApp}.
180
- */
181
- async createAuthenticatorApp() {
182
- const app = await this._inkbox._authApps.create({ agentHandle: this.agentHandle });
183
- this._authenticatorApp = {
184
- id: app.id,
185
- organizationId: app.organizationId,
186
- identityId: app.identityId,
187
- status: app.status,
188
- createdAt: app.createdAt,
189
- updatedAt: app.updatedAt,
190
- };
191
- return app;
192
- }
193
- /**
194
- * Link an existing authenticator app to this identity.
195
- *
196
- * @param authenticatorAppId - UUID of the authenticator app to link. Obtain via
197
- * `inkbox.authenticatorApps.list()` or `inkbox.authenticatorApps.get()`.
198
- * @returns The linked {@link IdentityAuthenticatorApp}.
199
- */
200
- async assignAuthenticatorApp(authenticatorAppId) {
201
- const data = await this._inkbox._idsResource.assignAuthenticatorApp(this.agentHandle, {
202
- authenticatorAppId,
203
- });
204
- this._authenticatorApp = data.authenticatorApp;
205
- this._data = data;
206
- return this._authenticatorApp;
207
- }
208
- /**
209
- * Unlink this identity's authenticator app (does not delete the app).
210
- */
211
- async unlinkAuthenticatorApp() {
212
- this._requireAuthenticatorApp();
213
- await this._inkbox._idsResource.unlinkAuthenticatorApp(this.agentHandle);
214
- this._authenticatorApp = null;
215
- }
216
249
  // ------------------------------------------------------------------
217
250
  // Mail helpers
218
251
  // ------------------------------------------------------------------
@@ -326,62 +359,69 @@ export class AgentIdentity {
326
359
  return this._inkbox._transcripts.list(this._phoneNumber.id, callId);
327
360
  }
328
361
  // ------------------------------------------------------------------
329
- // Authenticator helpers
362
+ // Text message helpers
330
363
  // ------------------------------------------------------------------
331
364
  /**
332
- * Create a new authenticator account from an `otpauth://` URI.
365
+ * List text messages for this identity's phone number.
333
366
  *
334
- * @param options.otpauthUri - `otpauth://totp/...` or `otpauth://hotp/...` URI.
335
- * @param options.displayName - Optional user-managed label (max 255 characters).
336
- * @param options.description - Optional free-form notes.
367
+ * @param options.limit - Maximum number of results. Defaults to 50.
368
+ * @param options.offset - Pagination offset. Defaults to 0.
369
+ * @param options.isRead - Filter by read state.
337
370
  */
338
- async createAuthenticatorAccount(options) {
339
- this._requireAuthenticatorApp();
340
- return this._inkbox._authAccounts.create(this._authenticatorApp.id, options);
371
+ async listTexts(options) {
372
+ this._requirePhone();
373
+ return this._inkbox._texts.list(this._phoneNumber.id, options);
341
374
  }
342
- /** List all authenticator accounts in this identity's app. */
343
- async listAuthenticatorAccounts() {
344
- this._requireAuthenticatorApp();
345
- return this._inkbox._authAccounts.list(this._authenticatorApp.id);
375
+ /**
376
+ * Get a single text message by ID.
377
+ *
378
+ * @param textId - UUID of the text message to fetch.
379
+ */
380
+ async getText(textId) {
381
+ this._requirePhone();
382
+ return this._inkbox._texts.get(this._phoneNumber.id, textId);
346
383
  }
347
384
  /**
348
- * Get a single authenticator account by ID.
385
+ * List text conversations (one row per remote number).
349
386
  *
350
- * @param accountId - UUID of the authenticator account.
387
+ * @param options.limit - Maximum number of results. Defaults to 50.
388
+ * @param options.offset - Pagination offset. Defaults to 0.
351
389
  */
352
- async getAuthenticatorAccount(accountId) {
353
- this._requireAuthenticatorApp();
354
- return this._inkbox._authAccounts.get(this._authenticatorApp.id, accountId);
390
+ async listTextConversations(options) {
391
+ this._requirePhone();
392
+ return this._inkbox._texts.listConversations(this._phoneNumber.id, options);
355
393
  }
356
394
  /**
357
- * Update user-managed metadata on an authenticator account.
395
+ * Get all messages with a specific remote number.
358
396
  *
359
- * @param accountId - UUID of the authenticator account to update.
360
- * @param options.displayName - New label (max 255 characters).
361
- * @param options.description - New notes.
397
+ * @param remoteNumber - E.164 remote phone number.
398
+ * @param options.limit - Maximum number of results. Defaults to 50.
399
+ * @param options.offset - Pagination offset. Defaults to 0.
362
400
  */
363
- async updateAuthenticatorAccount(accountId, options) {
364
- this._requireAuthenticatorApp();
365
- return this._inkbox._authAccounts.update(this._authenticatorApp.id, accountId, options);
401
+ async getTextConversation(remoteNumber, options) {
402
+ this._requirePhone();
403
+ return this._inkbox._texts.getConversation(this._phoneNumber.id, remoteNumber, options);
366
404
  }
367
405
  /**
368
- * Delete an authenticator account.
406
+ * Mark a single text message as read.
369
407
  *
370
- * @param accountId - UUID of the authenticator account to delete.
408
+ * @param textId - UUID of the text message.
371
409
  */
372
- async deleteAuthenticatorAccount(accountId) {
373
- this._requireAuthenticatorApp();
374
- await this._inkbox._authAccounts.delete(this._authenticatorApp.id, accountId);
410
+ async markTextRead(textId) {
411
+ this._requirePhone();
412
+ return this._inkbox._texts.update(this._phoneNumber.id, textId, {
413
+ isRead: true,
414
+ });
375
415
  }
376
416
  /**
377
- * Generate the current OTP code for an authenticator account.
417
+ * Mark all messages in a conversation as read.
378
418
  *
379
- * @param accountId - UUID of the authenticator account.
380
- * @returns The generated OTP code with metadata.
419
+ * @param remoteNumber - E.164 remote phone number.
420
+ * @returns Object with `remotePhoneNumber`, `isRead`, and `updatedCount`.
381
421
  */
382
- async generateOtp(accountId) {
383
- this._requireAuthenticatorApp();
384
- return this._inkbox._authAccounts.generateOtp(this._authenticatorApp.id, accountId);
422
+ async markTextConversationRead(remoteNumber) {
423
+ this._requirePhone();
424
+ return this._inkbox._texts.updateConversation(this._phoneNumber.id, remoteNumber, { isRead: true });
385
425
  }
386
426
  // ------------------------------------------------------------------
387
427
  // Identity management
@@ -398,7 +438,6 @@ export class AgentIdentity {
398
438
  ...result,
399
439
  mailbox: this._mailbox,
400
440
  phoneNumber: this._phoneNumber,
401
- authenticatorApp: this._authenticatorApp,
402
441
  };
403
442
  }
404
443
  /**
@@ -415,7 +454,6 @@ export class AgentIdentity {
415
454
  this._data = data;
416
455
  this._mailbox = data.mailbox;
417
456
  this._phoneNumber = data.phoneNumber;
418
- this._authenticatorApp = data.authenticatorApp;
419
457
  this._credentials = null;
420
458
  return this;
421
459
  }
@@ -441,10 +479,5 @@ export class AgentIdentity {
441
479
  throw new InkboxError(`Identity '${this.agentHandle}' has no phone number assigned. Call identity.provisionPhoneNumber() or identity.assignPhoneNumber() first.`);
442
480
  }
443
481
  }
444
- _requireAuthenticatorApp() {
445
- if (!this._authenticatorApp) {
446
- throw new InkboxError(`Identity '${this.agentHandle}' has no authenticator app assigned. Call identity.createAuthenticatorApp() or identity.assignAuthenticatorApp() first.`);
447
- }
448
- }
449
482
  }
450
483
  //# sourceMappingURL=agent_identity.js.map