@infinitetoken/lumber-kit 0.4.22 → 0.4.23

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 CHANGED
@@ -53,6 +53,15 @@ import { LogLevel, LogRecord, LogEncrypted, LogPayload, LogsQuery } from '@infin
53
53
  | `TeamRecord` | interface | API response shape for a team |
54
54
  | `TeamMemberRecord` | interface | Team membership record |
55
55
 
56
+ ### API keys
57
+
58
+ | Export | Kind | Purpose |
59
+ |--------|------|---------|
60
+ | `joinApiKey` | function | Joins an app's API token and its encryption key as `<token>.<encryptionKey>`, the one secret a plugin is configured with |
61
+ | `splitApiKey` | function | Splits an API key into `{ token, encryptionKey? }`; a bare token, as keys were before they were joined, has no encryption key |
62
+
63
+ A plugin sends only the token to the API (`Authorization: Bearer <token>`) and encrypts with the rest, so the encryption key never leaves it.
64
+
56
65
  ## Wire format
57
66
 
58
67
  All log content is E2E encrypted before leaving the client. `LogRecord` contains only:
package/dist/index.d.mts CHANGED
@@ -355,5 +355,16 @@ declare const isValidDeviceLinkStatus: (value: unknown) => value is DeviceLinkSt
355
355
  declare const isValidTeamMemberRole: (value: unknown) => value is TeamMemberRecord["role"];
356
356
  /** Accepts any valid absolute URL (https://..., http://..., etc.). */
357
357
  declare const isValidImageUrl: (value: unknown) => value is string;
358
+ /**
359
+ * The API key the Lumber app hands out: an app's API token and its encryption key, joined as `<token>.<encryptionKey>`,
360
+ * so a plugin is configured with one secret. A plugin sends only the token to the API (`Authorization: Bearer <token>`)
361
+ * and encrypts with the rest, so the encryption key never leaves it. Neither half can contain a `.` (hex and base64).
362
+ */
363
+ declare const joinApiKey: (token: string, encryptionKey: string) => string;
364
+ /** Splits an API key into its token and encryption key. A bare token, as keys were before they were joined, has no encryption key. */
365
+ declare const splitApiKey: (apiKey: string) => {
366
+ token: string;
367
+ encryptionKey?: string;
368
+ };
358
369
 
359
- export { type ApiKeyRecord, type ApiResponse, type AppCreatedRecord, type AppEncryptedKey, type AppRecord, type Appearance, type AppsQuery, type DeviceLinkCreatedRecord, type DeviceLinkRecord, type DeviceLinkStatus, type FlagRecord, type FlagsQuery, type GuestRecord, type LogContext, type LogEncrypted, LogLevel, type LogLevelName, type LogPayload, type LogRecord, type LogTimeseriesQuery, type LogsQuery, type NoteEncrypted, type NoteRecord, type NotesQuery, type NotificationPreference, type NotificationPreferences, type PushToken, type ResponseMetadata, SubscriptionLevel, type SubscriptionLevelName, type SubscriptionLimits, type TeamMemberRecord, type TeamRecord, type TeamsQuery, type TimeseriesBucket, type TimeseriesResponse, type UserRecord, isValidAppearance, isValidColor, isValidDeviceLinkStatus, isValidImageUrl, isValidLogLevel, isValidSubscriptionLevel, isValidTeamMemberRole, logLevelNameToLevel, logLevelToName, logLevels, subscriptionLevelToName, subscriptionLevels, subscriptionLimits };
370
+ export { type ApiKeyRecord, type ApiResponse, type AppCreatedRecord, type AppEncryptedKey, type AppRecord, type Appearance, type AppsQuery, type DeviceLinkCreatedRecord, type DeviceLinkRecord, type DeviceLinkStatus, type FlagRecord, type FlagsQuery, type GuestRecord, type LogContext, type LogEncrypted, LogLevel, type LogLevelName, type LogPayload, type LogRecord, type LogTimeseriesQuery, type LogsQuery, type NoteEncrypted, type NoteRecord, type NotesQuery, type NotificationPreference, type NotificationPreferences, type PushToken, type ResponseMetadata, SubscriptionLevel, type SubscriptionLevelName, type SubscriptionLimits, type TeamMemberRecord, type TeamRecord, type TeamsQuery, type TimeseriesBucket, type TimeseriesResponse, type UserRecord, isValidAppearance, isValidColor, isValidDeviceLinkStatus, isValidImageUrl, isValidLogLevel, isValidSubscriptionLevel, isValidTeamMemberRole, joinApiKey, logLevelNameToLevel, logLevelToName, logLevels, splitApiKey, subscriptionLevelToName, subscriptionLevels, subscriptionLimits };
package/dist/index.d.ts CHANGED
@@ -355,5 +355,16 @@ declare const isValidDeviceLinkStatus: (value: unknown) => value is DeviceLinkSt
355
355
  declare const isValidTeamMemberRole: (value: unknown) => value is TeamMemberRecord["role"];
356
356
  /** Accepts any valid absolute URL (https://..., http://..., etc.). */
357
357
  declare const isValidImageUrl: (value: unknown) => value is string;
358
+ /**
359
+ * The API key the Lumber app hands out: an app's API token and its encryption key, joined as `<token>.<encryptionKey>`,
360
+ * so a plugin is configured with one secret. A plugin sends only the token to the API (`Authorization: Bearer <token>`)
361
+ * and encrypts with the rest, so the encryption key never leaves it. Neither half can contain a `.` (hex and base64).
362
+ */
363
+ declare const joinApiKey: (token: string, encryptionKey: string) => string;
364
+ /** Splits an API key into its token and encryption key. A bare token, as keys were before they were joined, has no encryption key. */
365
+ declare const splitApiKey: (apiKey: string) => {
366
+ token: string;
367
+ encryptionKey?: string;
368
+ };
358
369
 
359
- export { type ApiKeyRecord, type ApiResponse, type AppCreatedRecord, type AppEncryptedKey, type AppRecord, type Appearance, type AppsQuery, type DeviceLinkCreatedRecord, type DeviceLinkRecord, type DeviceLinkStatus, type FlagRecord, type FlagsQuery, type GuestRecord, type LogContext, type LogEncrypted, LogLevel, type LogLevelName, type LogPayload, type LogRecord, type LogTimeseriesQuery, type LogsQuery, type NoteEncrypted, type NoteRecord, type NotesQuery, type NotificationPreference, type NotificationPreferences, type PushToken, type ResponseMetadata, SubscriptionLevel, type SubscriptionLevelName, type SubscriptionLimits, type TeamMemberRecord, type TeamRecord, type TeamsQuery, type TimeseriesBucket, type TimeseriesResponse, type UserRecord, isValidAppearance, isValidColor, isValidDeviceLinkStatus, isValidImageUrl, isValidLogLevel, isValidSubscriptionLevel, isValidTeamMemberRole, logLevelNameToLevel, logLevelToName, logLevels, subscriptionLevelToName, subscriptionLevels, subscriptionLimits };
370
+ export { type ApiKeyRecord, type ApiResponse, type AppCreatedRecord, type AppEncryptedKey, type AppRecord, type Appearance, type AppsQuery, type DeviceLinkCreatedRecord, type DeviceLinkRecord, type DeviceLinkStatus, type FlagRecord, type FlagsQuery, type GuestRecord, type LogContext, type LogEncrypted, LogLevel, type LogLevelName, type LogPayload, type LogRecord, type LogTimeseriesQuery, type LogsQuery, type NoteEncrypted, type NoteRecord, type NotesQuery, type NotificationPreference, type NotificationPreferences, type PushToken, type ResponseMetadata, SubscriptionLevel, type SubscriptionLevelName, type SubscriptionLimits, type TeamMemberRecord, type TeamRecord, type TeamsQuery, type TimeseriesBucket, type TimeseriesResponse, type UserRecord, isValidAppearance, isValidColor, isValidDeviceLinkStatus, isValidImageUrl, isValidLogLevel, isValidSubscriptionLevel, isValidTeamMemberRole, joinApiKey, logLevelNameToLevel, logLevelToName, logLevels, splitApiKey, subscriptionLevelToName, subscriptionLevels, subscriptionLimits };
package/dist/index.js CHANGED
@@ -29,9 +29,11 @@ __export(index_exports, {
29
29
  isValidLogLevel: () => isValidLogLevel,
30
30
  isValidSubscriptionLevel: () => isValidSubscriptionLevel,
31
31
  isValidTeamMemberRole: () => isValidTeamMemberRole,
32
+ joinApiKey: () => joinApiKey,
32
33
  logLevelNameToLevel: () => logLevelNameToLevel,
33
34
  logLevelToName: () => logLevelToName,
34
35
  logLevels: () => logLevels,
36
+ splitApiKey: () => splitApiKey,
35
37
  subscriptionLevelToName: () => subscriptionLevelToName,
36
38
  subscriptionLevels: () => subscriptionLevels,
37
39
  subscriptionLimits: () => subscriptionLimits
@@ -104,6 +106,13 @@ var isValidImageUrl = (value) => {
104
106
  return false;
105
107
  }
106
108
  };
109
+ var joinApiKey = (token, encryptionKey) => `${token}.${encryptionKey}`;
110
+ var splitApiKey = (apiKey) => {
111
+ const value = apiKey.trim();
112
+ const dot = value.indexOf(".");
113
+ if (dot === -1) return { token: value };
114
+ return { token: value.slice(0, dot), encryptionKey: value.slice(dot + 1) };
115
+ };
107
116
  // Annotate the CommonJS export names for ESM import in node:
108
117
  0 && (module.exports = {
109
118
  LogLevel,
@@ -115,9 +124,11 @@ var isValidImageUrl = (value) => {
115
124
  isValidLogLevel,
116
125
  isValidSubscriptionLevel,
117
126
  isValidTeamMemberRole,
127
+ joinApiKey,
118
128
  logLevelNameToLevel,
119
129
  logLevelToName,
120
130
  logLevels,
131
+ splitApiKey,
121
132
  subscriptionLevelToName,
122
133
  subscriptionLevels,
123
134
  subscriptionLimits
package/dist/index.mjs CHANGED
@@ -64,6 +64,13 @@ var isValidImageUrl = (value) => {
64
64
  return false;
65
65
  }
66
66
  };
67
+ var joinApiKey = (token, encryptionKey) => `${token}.${encryptionKey}`;
68
+ var splitApiKey = (apiKey) => {
69
+ const value = apiKey.trim();
70
+ const dot = value.indexOf(".");
71
+ if (dot === -1) return { token: value };
72
+ return { token: value.slice(0, dot), encryptionKey: value.slice(dot + 1) };
73
+ };
67
74
  export {
68
75
  LogLevel,
69
76
  SubscriptionLevel,
@@ -74,9 +81,11 @@ export {
74
81
  isValidLogLevel,
75
82
  isValidSubscriptionLevel,
76
83
  isValidTeamMemberRole,
84
+ joinApiKey,
77
85
  logLevelNameToLevel,
78
86
  logLevelToName,
79
87
  logLevels,
88
+ splitApiKey,
80
89
  subscriptionLevelToName,
81
90
  subscriptionLevels,
82
91
  subscriptionLimits
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infinitetoken/lumber-kit",
3
- "version": "0.4.22",
3
+ "version": "0.4.23",
4
4
  "description": "Shared TypeScript types and wire format contracts for the Lumber cloud logging suite",
5
5
  "keywords": [
6
6
  "lumber",
@@ -56,9 +56,9 @@
56
56
  },
57
57
  "prettier": "@infinitetoken/eslint-config/prettier",
58
58
  "devDependencies": {
59
- "@infinitetoken/eslint-config": "^0.1.6",
60
- "@infinitetoken/jest-config": "^0.1.3",
61
- "@infinitetoken/tsconfig": "^0.3.0",
59
+ "@infinitetoken/eslint-config": "^0.2.1",
60
+ "@infinitetoken/jest-config": "^0.5.2",
61
+ "@infinitetoken/tsconfig": "^0.6.0",
62
62
  "@types/jest": "^30.0.0",
63
63
  "@types/node": "^25.0.0",
64
64
  "eslint": "^10.2.1",