@inkbox/sdk 0.1.4 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -35
- package/dist/_http.d.ts +7 -1
- package/dist/_http.d.ts.map +1 -1
- package/dist/_http.js +13 -1
- package/dist/_http.js.map +1 -1
- package/dist/agent_identity.d.ts +89 -71
- package/dist/agent_identity.d.ts.map +1 -1
- package/dist/agent_identity.js +145 -113
- package/dist/agent_identity.js.map +1 -1
- package/dist/credentials.d.ts +97 -0
- package/dist/credentials.d.ts.map +1 -0
- package/dist/credentials.js +147 -0
- package/dist/credentials.js.map +1 -0
- package/dist/identities/resources/identities.d.ts +1 -16
- package/dist/identities/resources/identities.d.ts.map +1 -1
- package/dist/identities/resources/identities.js +1 -19
- package/dist/identities/resources/identities.js.map +1 -1
- package/dist/identities/types.d.ts +0 -21
- package/dist/identities/types.d.ts.map +1 -1
- package/dist/identities/types.js +0 -11
- package/dist/identities/types.js.map +1 -1
- package/dist/index.d.ts +11 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/dist/inkbox.d.ts +42 -6
- package/dist/inkbox.d.ts.map +1 -1
- package/dist/inkbox.js +59 -10
- package/dist/inkbox.js.map +1 -1
- package/dist/mail/resources/messages.d.ts +2 -2
- package/dist/mail/resources/messages.d.ts.map +1 -1
- package/dist/mail/resources/messages.js.map +1 -1
- package/dist/mail/types.d.ts +8 -1
- package/dist/mail/types.d.ts.map +1 -1
- package/dist/mail/types.js +8 -0
- package/dist/mail/types.js.map +1 -1
- package/dist/vault/crypto.d.ts +138 -0
- package/dist/vault/crypto.d.ts.map +1 -0
- package/dist/vault/crypto.js +273 -0
- package/dist/vault/crypto.js.map +1 -0
- package/dist/vault/resources/vault.d.ts +183 -0
- package/dist/vault/resources/vault.d.ts.map +1 -0
- package/dist/vault/resources/vault.js +396 -0
- package/dist/vault/resources/vault.js.map +1 -0
- package/dist/vault/totp.d.ts +73 -0
- package/dist/vault/totp.d.ts.map +1 -0
- package/dist/vault/totp.js +230 -0
- package/dist/vault/totp.js.map +1 -0
- package/dist/vault/types.d.ts +239 -0
- package/dist/vault/types.d.ts.map +1 -0
- package/dist/vault/types.js +229 -0
- package/dist/vault/types.js.map +1 -0
- package/package.json +5 -1
- package/dist/authenticator/resources/accounts.d.ts +0 -70
- package/dist/authenticator/resources/accounts.d.ts.map +0 -1
- package/dist/authenticator/resources/accounts.js +0 -91
- package/dist/authenticator/resources/accounts.js.map +0 -1
- package/dist/authenticator/resources/apps.d.ts +0 -38
- package/dist/authenticator/resources/apps.d.ts.map +0 -1
- package/dist/authenticator/resources/apps.js +0 -52
- package/dist/authenticator/resources/apps.js.map +0 -1
- package/dist/authenticator/types.d.ts +0 -83
- package/dist/authenticator/types.d.ts.map +0 -1
- package/dist/authenticator/types.js +0 -43
- 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://
|
|
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,7 +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
|
+
apiKey: process.env.INKBOX_API_KEY!,
|
|
24
|
+
vaultKey: process.env.INKBOX_VAULT_KEY,
|
|
25
|
+
}).ready();
|
|
23
26
|
|
|
24
27
|
// Create an agent identity
|
|
25
28
|
const identity = await inkbox.createIdentity("support-bot");
|
|
@@ -48,6 +51,12 @@ for await (const message of identity.iterEmails()) {
|
|
|
48
51
|
|
|
49
52
|
// List calls
|
|
50
53
|
const calls = await identity.listCalls();
|
|
54
|
+
|
|
55
|
+
// Access credentials (vault unlocked at construction)
|
|
56
|
+
const creds = await identity.getCredentials();
|
|
57
|
+
for (const login of creds.listLogins()) {
|
|
58
|
+
console.log(login.name);
|
|
59
|
+
}
|
|
51
60
|
```
|
|
52
61
|
|
|
53
62
|
## Authentication
|
|
@@ -206,42 +215,33 @@ for (const t of hits) {
|
|
|
206
215
|
|
|
207
216
|
---
|
|
208
217
|
|
|
209
|
-
##
|
|
210
|
-
|
|
211
|
-
```ts
|
|
212
|
-
// Create an authenticator app and link it to an identity
|
|
213
|
-
const app = await identity.createAuthenticatorApp();
|
|
214
|
-
|
|
215
|
-
// Add an OTP account from an otpauth:// URI
|
|
216
|
-
const account = await identity.createAuthenticatorAccount({
|
|
217
|
-
otpauthUri: "otpauth://totp/Example:user@example.com?secret=EXAMPLESECRET&issuer=Example",
|
|
218
|
-
displayName: "My OTP Account", // optional (max 255 chars)
|
|
219
|
-
description: "Login MFA for Example", // optional
|
|
220
|
-
});
|
|
218
|
+
## Credentials
|
|
221
219
|
|
|
222
|
-
|
|
223
|
-
const accounts = await identity.listAuthenticatorAccounts();
|
|
220
|
+
Access credentials stored in the vault through the agent-facing `credentials` surface. The vault must be unlocked first.
|
|
224
221
|
|
|
225
|
-
|
|
226
|
-
|
|
222
|
+
```ts
|
|
223
|
+
// Unlock the vault (once per session)
|
|
224
|
+
await inkbox.vault.unlock("my-Vault-key-01!");
|
|
227
225
|
|
|
228
|
-
|
|
229
|
-
await identity.
|
|
226
|
+
const identity = await inkbox.getIdentity("my-agent");
|
|
227
|
+
const creds = await identity.getCredentials();
|
|
230
228
|
|
|
231
|
-
//
|
|
232
|
-
const
|
|
233
|
-
console.log(
|
|
234
|
-
|
|
235
|
-
console.log(otp.otpType); // "totp" or "hotp"
|
|
229
|
+
// Discovery — list credentials this identity has access to
|
|
230
|
+
for (const login of creds.listLogins()) {
|
|
231
|
+
console.log(login.name, (login.payload as LoginPayload).username);
|
|
232
|
+
}
|
|
236
233
|
|
|
237
|
-
|
|
238
|
-
|
|
234
|
+
for (const key of creds.listApiKeys()) {
|
|
235
|
+
console.log(key.name, (key.payload as APIKeyPayload).accessKey);
|
|
236
|
+
}
|
|
239
237
|
|
|
240
|
-
//
|
|
241
|
-
|
|
238
|
+
// Access by UUID — returns the typed payload directly
|
|
239
|
+
const login = creds.getLogin("secret-uuid"); // → LoginPayload
|
|
240
|
+
const apiKey = creds.getApiKey("secret-uuid"); // → APIKeyPayload
|
|
241
|
+
const sshKey = creds.getSshKey("secret-uuid"); // → SSHKeyPayload
|
|
242
242
|
|
|
243
|
-
//
|
|
244
|
-
|
|
243
|
+
// Generic access
|
|
244
|
+
const secret = creds.get("secret-uuid"); // → DecryptedVaultSecret
|
|
245
245
|
```
|
|
246
246
|
|
|
247
247
|
---
|
|
@@ -391,10 +391,6 @@ Runnable example scripts are available in the [examples/typescript](https://gith
|
|
|
391
391
|
| `read-agent-calls.ts` | List calls and print transcripts |
|
|
392
392
|
| `receive-agent-email-webhook.ts` | Register and delete a mailbox webhook |
|
|
393
393
|
| `receive-agent-call-webhook.ts` | Register, update, and delete a phone webhook |
|
|
394
|
-
| `agent-authenticator-app-e2e.ts` | Full authenticator app lifecycle (create, OTP, cleanup) |
|
|
395
|
-
| `create-authenticator.ts` | Create an authenticator app and add an OTP account |
|
|
396
|
-
| `generate-otp.ts` | Generate an OTP code for an account |
|
|
397
|
-
| `list-authenticator-accounts.ts` | List authenticator accounts for an identity |
|
|
398
394
|
|
|
399
395
|
## License
|
|
400
396
|
|
package/dist/_http.d.ts
CHANGED
|
@@ -3,7 +3,13 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Async HTTP transport (internal). Zero runtime dependencies — uses native fetch.
|
|
5
5
|
*/
|
|
6
|
-
export declare class
|
|
6
|
+
export declare class InkboxError extends Error {
|
|
7
|
+
constructor(message: string);
|
|
8
|
+
}
|
|
9
|
+
export declare class InkboxVaultKeyError extends InkboxError {
|
|
10
|
+
constructor(message: string);
|
|
11
|
+
}
|
|
12
|
+
export declare class InkboxAPIError extends InkboxError {
|
|
7
13
|
readonly statusCode: number;
|
|
8
14
|
readonly detail: string;
|
|
9
15
|
constructor(statusCode: number, detail: string);
|
package/dist/_http.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_http.d.ts","sourceRoot":"","sources":["../src/_http.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,qBAAa,
|
|
1
|
+
{"version":3,"file":"_http.d.ts","sourceRoot":"","sources":["../src/_http.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,qBAAa,WAAY,SAAQ,KAAK;gBACxB,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,mBAAoB,SAAQ,WAAW;gBACtC,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,cAAe,SAAQ,WAAW;IAC7C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAEZ,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAM/C;AAED,KAAK,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,IAAI,CAAC,CAAC;AAE3E,qBAAa,aAAa;IAEtB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAFT,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,SAAS,GAAE,MAAe;IAGvC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAIjD,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;IAIjD,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;IAIjD,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;YAI3B,OAAO;CA6DtB"}
|
package/dist/_http.js
CHANGED
|
@@ -3,7 +3,19 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Async HTTP transport (internal). Zero runtime dependencies — uses native fetch.
|
|
5
5
|
*/
|
|
6
|
-
export class
|
|
6
|
+
export class InkboxError extends Error {
|
|
7
|
+
constructor(message) {
|
|
8
|
+
super(message);
|
|
9
|
+
this.name = "InkboxError";
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export class InkboxVaultKeyError extends InkboxError {
|
|
13
|
+
constructor(message) {
|
|
14
|
+
super(message);
|
|
15
|
+
this.name = "InkboxVaultKeyError";
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export class InkboxAPIError extends InkboxError {
|
|
7
19
|
statusCode;
|
|
8
20
|
detail;
|
|
9
21
|
constructor(statusCode, detail) {
|
package/dist/_http.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_http.js","sourceRoot":"","sources":["../src/_http.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"_http.js","sourceRoot":"","sources":["../src/_http.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,OAAO,WAAY,SAAQ,KAAK;IACpC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;IAC5B,CAAC;CACF;AAED,MAAM,OAAO,mBAAoB,SAAQ,WAAW;IAClD,YAAY,OAAe;QACzB,KAAK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,CAAC,CAAC;QACL,CAAC;gBAAS,CAAC;YACT,YAAY,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC;YACb,IAAI,MAAc,CAAC;YACnB,IAAI,CAAC;gBACH,MAAM,GAAG,GAAG,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,CAAwB,CAAC;gBACvD,MAAM,GAAG,GAAG,CAAC,MAAM,IAAI,IAAI,CAAC,UAAU,CAAC;YACzC,CAAC;YAAC,MAAM,CAAC;gBACP,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC;YAC3B,CAAC;YACD,MAAM,IAAI,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAChD,CAAC;QAED,IAAI,IAAI,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;YACxB,OAAO,SAAc,CAAC;QACxB,CAAC;QAED,OAAO,IAAI,CAAC,IAAI,EAAgB,CAAC;IACnC,CAAC;CACF"}
|
package/dist/agent_identity.d.ts
CHANGED
|
@@ -8,17 +8,21 @@
|
|
|
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
|
|
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";
|
|
14
|
+
import { MessageDirection } from "./mail/types.js";
|
|
12
15
|
import type { Message, MessageDetail, ThreadDetail } from "./mail/types.js";
|
|
13
16
|
import type { PhoneCall, PhoneCallWithRateLimit, PhoneTranscript } from "./phone/types.js";
|
|
14
|
-
import type { _AgentIdentityData,
|
|
17
|
+
import type { _AgentIdentityData, IdentityMailbox, IdentityPhoneNumber } from "./identities/types.js";
|
|
15
18
|
import type { Inkbox } from "./inkbox.js";
|
|
16
19
|
export declare class AgentIdentity {
|
|
17
20
|
private _data;
|
|
18
21
|
private readonly _inkbox;
|
|
19
22
|
private _mailbox;
|
|
20
23
|
private _phoneNumber;
|
|
21
|
-
private
|
|
24
|
+
private _credentials;
|
|
25
|
+
private _credentialsVaultRef;
|
|
22
26
|
constructor(data: _AgentIdentityData, inkbox: Inkbox);
|
|
23
27
|
get agentHandle(): string;
|
|
24
28
|
get id(): string;
|
|
@@ -27,8 +31,80 @@ export declare class AgentIdentity {
|
|
|
27
31
|
get mailbox(): IdentityMailbox | null;
|
|
28
32
|
/** The phone number currently assigned to this identity, or `null` if none. */
|
|
29
33
|
get phoneNumber(): IdentityPhoneNumber | null;
|
|
30
|
-
/**
|
|
31
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Identity-scoped credential access.
|
|
36
|
+
*
|
|
37
|
+
* Returns a {@link Credentials} object filtered to the secrets this
|
|
38
|
+
* identity has been granted access to. The vault must be unlocked
|
|
39
|
+
* first via `inkbox.vault.unlock(vaultKey)`.
|
|
40
|
+
*
|
|
41
|
+
* The result is cached and automatically invalidated when the
|
|
42
|
+
* vault is re-unlocked. Call {@link refresh} to manually clear
|
|
43
|
+
* the cache (e.g. after access-rule changes).
|
|
44
|
+
*
|
|
45
|
+
* @throws Error if the vault has not been unlocked.
|
|
46
|
+
*/
|
|
47
|
+
getCredentials(): Promise<Credentials>;
|
|
48
|
+
/**
|
|
49
|
+
* Revoke this identity's access to a vault secret.
|
|
50
|
+
*
|
|
51
|
+
* Also clears the credentials cache so the next call to
|
|
52
|
+
* {@link getCredentials} reflects the change.
|
|
53
|
+
*
|
|
54
|
+
* @param secretId - UUID of the secret to revoke access from.
|
|
55
|
+
*/
|
|
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>;
|
|
32
108
|
/**
|
|
33
109
|
* Create a new mailbox and link it to this identity.
|
|
34
110
|
*
|
|
@@ -73,24 +149,6 @@ export declare class AgentIdentity {
|
|
|
73
149
|
* Unlink this identity's phone number (does not release the number).
|
|
74
150
|
*/
|
|
75
151
|
unlinkPhoneNumber(): Promise<void>;
|
|
76
|
-
/**
|
|
77
|
-
* Create a new authenticator app and link it to this identity.
|
|
78
|
-
*
|
|
79
|
-
* @returns The newly created {@link AuthenticatorApp}.
|
|
80
|
-
*/
|
|
81
|
-
createAuthenticatorApp(): Promise<AuthenticatorApp>;
|
|
82
|
-
/**
|
|
83
|
-
* Link an existing authenticator app to this identity.
|
|
84
|
-
*
|
|
85
|
-
* @param authenticatorAppId - UUID of the authenticator app to link. Obtain via
|
|
86
|
-
* `inkbox.authenticatorApps.list()` or `inkbox.authenticatorApps.get()`.
|
|
87
|
-
* @returns The linked {@link IdentityAuthenticatorApp}.
|
|
88
|
-
*/
|
|
89
|
-
assignAuthenticatorApp(authenticatorAppId: string): Promise<IdentityAuthenticatorApp>;
|
|
90
|
-
/**
|
|
91
|
-
* Unlink this identity's authenticator app (does not delete the app).
|
|
92
|
-
*/
|
|
93
|
-
unlinkAuthenticatorApp(): Promise<void>;
|
|
94
152
|
/**
|
|
95
153
|
* Send an email from this identity's mailbox.
|
|
96
154
|
*
|
|
@@ -127,7 +185,7 @@ export declare class AgentIdentity {
|
|
|
127
185
|
*/
|
|
128
186
|
iterEmails(options?: {
|
|
129
187
|
pageSize?: number;
|
|
130
|
-
direction?:
|
|
188
|
+
direction?: MessageDirection;
|
|
131
189
|
}): AsyncGenerator<Message>;
|
|
132
190
|
/**
|
|
133
191
|
* Iterate over unread emails in this identity's inbox, newest first.
|
|
@@ -139,7 +197,7 @@ export declare class AgentIdentity {
|
|
|
139
197
|
*/
|
|
140
198
|
iterUnreadEmails(options?: {
|
|
141
199
|
pageSize?: number;
|
|
142
|
-
direction?:
|
|
200
|
+
direction?: MessageDirection;
|
|
143
201
|
}): AsyncGenerator<Message>;
|
|
144
202
|
/**
|
|
145
203
|
* Mark a list of messages as read.
|
|
@@ -187,50 +245,6 @@ export declare class AgentIdentity {
|
|
|
187
245
|
* @param callId - ID of the call to fetch transcripts for.
|
|
188
246
|
*/
|
|
189
247
|
listTranscripts(callId: string): Promise<PhoneTranscript[]>;
|
|
190
|
-
/**
|
|
191
|
-
* Create a new authenticator account from an `otpauth://` URI.
|
|
192
|
-
*
|
|
193
|
-
* @param options.otpauthUri - `otpauth://totp/...` or `otpauth://hotp/...` URI.
|
|
194
|
-
* @param options.displayName - Optional user-managed label (max 255 characters).
|
|
195
|
-
* @param options.description - Optional free-form notes.
|
|
196
|
-
*/
|
|
197
|
-
createAuthenticatorAccount(options: {
|
|
198
|
-
otpauthUri: string;
|
|
199
|
-
displayName?: string;
|
|
200
|
-
description?: string;
|
|
201
|
-
}): Promise<AuthenticatorAccount>;
|
|
202
|
-
/** List all authenticator accounts in this identity's app. */
|
|
203
|
-
listAuthenticatorAccounts(): Promise<AuthenticatorAccount[]>;
|
|
204
|
-
/**
|
|
205
|
-
* Get a single authenticator account by ID.
|
|
206
|
-
*
|
|
207
|
-
* @param accountId - UUID of the authenticator account.
|
|
208
|
-
*/
|
|
209
|
-
getAuthenticatorAccount(accountId: string): Promise<AuthenticatorAccount>;
|
|
210
|
-
/**
|
|
211
|
-
* Update user-managed metadata on an authenticator account.
|
|
212
|
-
*
|
|
213
|
-
* @param accountId - UUID of the authenticator account to update.
|
|
214
|
-
* @param options.displayName - New label (max 255 characters).
|
|
215
|
-
* @param options.description - New notes.
|
|
216
|
-
*/
|
|
217
|
-
updateAuthenticatorAccount(accountId: string, options: {
|
|
218
|
-
displayName?: string | null;
|
|
219
|
-
description?: string | null;
|
|
220
|
-
}): Promise<AuthenticatorAccount>;
|
|
221
|
-
/**
|
|
222
|
-
* Soft-delete an authenticator account.
|
|
223
|
-
*
|
|
224
|
-
* @param accountId - UUID of the authenticator account to delete.
|
|
225
|
-
*/
|
|
226
|
-
deleteAuthenticatorAccount(accountId: string): Promise<void>;
|
|
227
|
-
/**
|
|
228
|
-
* Generate the current OTP code for an authenticator account.
|
|
229
|
-
*
|
|
230
|
-
* @param accountId - UUID of the authenticator account.
|
|
231
|
-
* @returns The generated OTP code with metadata.
|
|
232
|
-
*/
|
|
233
|
-
generateOtp(accountId: string): Promise<OTPCode>;
|
|
234
248
|
/**
|
|
235
249
|
* Update this identity's handle or status.
|
|
236
250
|
*
|
|
@@ -244,13 +258,17 @@ export declare class AgentIdentity {
|
|
|
244
258
|
/**
|
|
245
259
|
* Re-fetch this identity from the API and update cached channels.
|
|
246
260
|
*
|
|
261
|
+
* Also clears the credentials filter cache so the next call to
|
|
262
|
+
* {@link getCredentials} re-evaluates access rules. (The cache is
|
|
263
|
+
* also automatically invalidated when the vault is re-unlocked.)
|
|
264
|
+
*
|
|
247
265
|
* @returns `this` for chaining.
|
|
248
266
|
*/
|
|
249
267
|
refresh(): Promise<AgentIdentity>;
|
|
250
|
-
/**
|
|
268
|
+
/** Delete this identity (unlinks channels without deleting them). */
|
|
251
269
|
delete(): Promise<void>;
|
|
270
|
+
private _requireVaultUnlocked;
|
|
252
271
|
private _requireMailbox;
|
|
253
272
|
private _requirePhone;
|
|
254
|
-
private _requireAuthenticatorApp;
|
|
255
273
|
}
|
|
256
274
|
//# 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,
|
|
1
|
+
{"version":3,"file":"agent_identity.d.ts","sourceRoot":"","sources":["../src/agent_identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO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