jfrog-workers 0.16.0 → 0.18.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 (2) hide show
  1. package/dist/index.d.ts +27 -0
  2. package/package.json +3 -3
package/dist/index.d.ts CHANGED
@@ -132,6 +132,29 @@ export interface PlatformHttpClientError {
132
132
  */
133
133
  status: number;
134
134
  }
135
+ export interface PlatformCrypto {
136
+ /**
137
+ * Computes a cryptographic hash of the given data
138
+ * @param {string} algorithm - The hash algorithm to use. Supported: 'sha256', 'sha512'
139
+ * @param {string} data - The data to hash
140
+ * @param {string} encoding - The output encoding. Defaults to 'hex'
141
+ */
142
+ hash(algorithm: 'sha256' | 'sha512', data: string, encoding?: 'hex' | 'base64'): string;
143
+ /**
144
+ * Computes an HMAC of the given data using the given key
145
+ * @param {string} algorithm - The hash algorithm to use. Supported: 'sha256', 'sha512'
146
+ * @param {string} key - The HMAC key
147
+ * @param {string} data - The data to authenticate
148
+ * @param {string} encoding - The output encoding. Defaults to 'hex'
149
+ */
150
+ hmac(algorithm: 'sha256' | 'sha512', key: string, data: string, encoding?: 'hex' | 'base64'): string;
151
+ /**
152
+ * Generates cryptographically secure random bytes
153
+ * @param {number} size - The number of random bytes to generate
154
+ * @param {string} encoding - The output encoding. Defaults to 'hex'
155
+ */
156
+ randomBytes(size: number, encoding?: 'hex' | 'base64'): string;
157
+ }
135
158
  export interface PlatformContext {
136
159
  /**
137
160
  * HTTP clients to perform requests to your JFrog platform or to the outside
@@ -160,6 +183,10 @@ export interface PlatformContext {
160
183
  * NOTE: The state is limited in size and number of items. Check the Worker documentation for more details.
161
184
  */
162
185
  state: StateManager;
186
+ /**
187
+ * Utility to compute cryptographic hashes, HMACs, and generate random bytes
188
+ */
189
+ crypto: PlatformCrypto;
163
190
  /**
164
191
  * Will wait for the number of millisecond.
165
192
  * The waiting time is limited by the execution time of the function.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jfrog-workers",
3
- "version": "0.16.0",
3
+ "version": "0.18.0",
4
4
  "description": "JFrog workers interfaces",
5
5
  "homepage": "https://github.com/jfrog/workers-sample",
6
6
  "contributors": [
@@ -33,9 +33,9 @@
33
33
  "url": "git+https://github.com/jfrog/workers-sample.git"
34
34
  },
35
35
  "dependencies": {
36
- "axios": "1.15.2"
36
+ "axios": "1.19.0"
37
37
  },
38
38
  "devDependencies": {
39
- "typescript": "^6.0.3"
39
+ "typescript": "^7.0.2"
40
40
  }
41
41
  }