@webex/plugin-encryption 3.8.0-next.9 → 3.8.1-next.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 +21 -6
- package/babel.config.js +10 -8
- package/developer-quickstart.md +8 -12
- package/dist/config.js.map +1 -1
- package/dist/cypher/constants.js.map +1 -1
- package/dist/cypher/index.js.map +1 -1
- package/dist/cypher/types.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/types/webex-config.d.ts +14 -0
- package/dist/types/webex.d.ts +2 -0
- package/dist/types.js.map +1 -1
- package/dist/webex-config.js +21 -0
- package/dist/webex-config.js.map +1 -0
- package/dist/webex.js +32 -0
- package/dist/webex.js.map +1 -0
- package/jest.config.js +3 -1
- package/package.json +19 -8
- package/src/webex-config.ts +15 -0
- package/src/webex.js +35 -0
package/README.md
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://github.com/RichardLitt/standard-readme)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
# Encryption plugin for the Cisco Webex JS SDK
|
|
6
6
|
|
|
7
7
|
- [Install](#install)
|
|
8
8
|
- [Usage](#usage)
|
|
9
|
-
- [
|
|
9
|
+
- [API Docs and Sample App](#api-docs-and-sample-app)
|
|
10
10
|
- [Sample Code](#sample-code)
|
|
11
11
|
- [Contribute](#contribute)
|
|
12
12
|
- [Maintainers](#maintainers)
|
|
@@ -18,9 +18,24 @@
|
|
|
18
18
|
npm install --save @webex/plugin-encryption
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
+
In addition to the module consumption via NPMJS, this module can also be consumed via our CDN. See the below examples of how to consume this via CDN:
|
|
22
|
+
|
|
23
|
+
```html
|
|
24
|
+
<html>
|
|
25
|
+
<head>
|
|
26
|
+
<!-- via unpkg -->
|
|
27
|
+
<script crossorigin src="https://unpkg.com/webex@latest/umd/encryption.min.js"></script>
|
|
28
|
+
|
|
29
|
+
<!-- via jsdelivr -->
|
|
30
|
+
<script crossorigin src="https://cdn.jsdelivr.net/npm/webex/umd/encryption.min.js"></script>
|
|
31
|
+
</head>
|
|
32
|
+
<!-- ...application html... -->
|
|
33
|
+
</html>
|
|
34
|
+
```
|
|
35
|
+
|
|
21
36
|
## Usage
|
|
22
37
|
|
|
23
|
-
This is a plugin for the Cisco Webex JS SDK
|
|
38
|
+
This is a plugin for the Cisco Webex JS SDK. Please see our [developer portal](https://developer.webex.com/) and the [API reference](https://webex.github.io/webex-js-sdk/plugin-encryption/) for full details.
|
|
24
39
|
|
|
25
40
|
## API Docs and Sample App
|
|
26
41
|
|
|
@@ -31,7 +46,7 @@ This is a plugin for the Cisco Webex JS SDK . Please see our [developer portal](
|
|
|
31
46
|
## Sample Code
|
|
32
47
|
|
|
33
48
|
```typescript
|
|
34
|
-
import Webex from 'webex/plugin-encryption';
|
|
49
|
+
import Webex from '@webex/plugin-encryption';
|
|
35
50
|
|
|
36
51
|
const webex = Webex.init({
|
|
37
52
|
credentials: {
|
|
@@ -40,7 +55,7 @@ const webex = Webex.init({
|
|
|
40
55
|
});
|
|
41
56
|
|
|
42
57
|
webex.once('ready', () => {
|
|
43
|
-
webex.cypher.register().then(() => {
|
|
58
|
+
webex.cypher.register().then(async () => {
|
|
44
59
|
try {
|
|
45
60
|
const attachmentURL = 'https:/myfileurl.xyz/zzz/fileid?keyUri=somekeyuri&JWE=somejwe';
|
|
46
61
|
const options = {
|
|
@@ -63,7 +78,7 @@ webex.cypher.deregister().then(() => {
|
|
|
63
78
|
});
|
|
64
79
|
```
|
|
65
80
|
|
|
66
|
-
|
|
81
|
+
## Development
|
|
67
82
|
|
|
68
83
|
To use `webpack-dev-server` to load this package, run `yarn run samples:serve`.
|
|
69
84
|
|
package/babel.config.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
|
|
2
|
+
plugins: ['@webex/babel-config-legacy/inject-package-version'],
|
|
3
|
+
presets: [
|
|
3
4
|
[
|
|
4
|
-
|
|
5
|
+
'@babel/preset-env',
|
|
5
6
|
{
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
}
|
|
7
|
+
targets: {
|
|
8
|
+
node: 'current',
|
|
9
|
+
},
|
|
10
|
+
},
|
|
10
11
|
],
|
|
11
|
-
|
|
12
|
+
'@babel/preset-typescript',
|
|
12
13
|
],
|
|
13
|
-
|
|
14
|
+
sourceMaps: true,
|
|
15
|
+
};
|
package/developer-quickstart.md
CHANGED
|
@@ -71,27 +71,23 @@ async function decryptFile(webex, encryptedFileUrl, options, decryptedFileName,
|
|
|
71
71
|
console.error('Error decrypting file:', error);
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
-
|
|
75
|
-
const attachmentURL = 'https:/myfileurl.xyz/zzz/fileid?keyUri=somekeyuri&JWE=somejwe';
|
|
76
|
-
const options = {
|
|
77
|
-
useFileService: false,
|
|
78
|
-
jwe: somejwe, // Provide the JWE here if not already present in the attachmentURL
|
|
79
|
-
keyUri: someKeyUri // Provide the keyURI here if not already present in the attachmentURL
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
await decryptFile(webex, attachmentURL, options, 'MyFile.png', 'image/png');
|
|
83
74
|
```
|
|
84
75
|
|
|
85
76
|
### Example Usage
|
|
86
77
|
|
|
87
78
|
```typescript
|
|
88
79
|
const accessToken = 'YOUR_ACCESS_TOKEN';
|
|
89
|
-
const
|
|
80
|
+
const attachmentURL = 'https://myfileurl.xyz/zzz/fileid?keyUri=somekeyuri&JWE=somejwe';
|
|
90
81
|
const decryptedFileName = 'my-decrypted-file.jpeg';
|
|
91
82
|
const mimeType = 'image/jpeg';
|
|
83
|
+
const options = {
|
|
84
|
+
useFileService: false,
|
|
85
|
+
jwe: somejwe, // Provide the JWE here if not already present in the attachmentURL
|
|
86
|
+
keyUri: someKeyUri // Provide the keyURI here if not already present in the attachmentURL
|
|
87
|
+
};
|
|
92
88
|
|
|
93
|
-
initializeWebex(accessToken).then((webex) => {
|
|
94
|
-
decryptFile(webex,
|
|
89
|
+
initializeWebex(accessToken).then(async (webex) => {
|
|
90
|
+
await decryptFile(webex, attachmentURL, options, decryptedFileName, mimeType);
|
|
95
91
|
});
|
|
96
92
|
```
|
|
97
93
|
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
{"version":3,"names":["cypher"],"sources":["config.ts"],"sourcesContent":["export default {\n cypher: {},\n};\n"],"mappings":";;;;;;iCAAe;EACbA,MAAM,EAAE,CAAC;AACX,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
{"version":3,"names":["CYPHER","exports","DECRYPTION","DECRYPTION_FAILED","DECRYPTION_IN_PROGRESS","DECRYPTION_SUCCESS"],"sources":["constants.ts"],"sourcesContent":["export const CYPHER = 'cypher';\nexport const DECRYPTION = 'decryption';\nexport const DECRYPTION_FAILED = 'decryptionFailed';\nexport const DECRYPTION_IN_PROGRESS = 'decryptionInProgress';\nexport const DECRYPTION_SUCCESS = 'decryptionSuccess';\n"],"mappings":";;;;;;AAAO,MAAMA,MAAM,GAAAC,OAAA,CAAAD,MAAA,GAAG,QAAQ;AACvB,MAAME,UAAU,GAAAD,OAAA,CAAAC,UAAA,GAAG,YAAY;AAC/B,MAAMC,iBAAiB,GAAAF,OAAA,CAAAE,iBAAA,GAAG,kBAAkB;AAC5C,MAAMC,sBAAsB,GAAAH,OAAA,CAAAG,sBAAA,GAAG,sBAAsB;AACrD,MAAMC,kBAAkB,GAAAJ,OAAA,CAAAI,kBAAA,GAAG,mBAAmB"}
|
package/dist/cypher/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
{"version":3,"names":["_webexCore","require","_constants","Cypher","WebexPlugin","namespace","CYPHER","registered","constructor","args","$webex","webex","register","logger","info","Promise","resolve","internal","device","then","catch","error","deregister","unregister","downloadAndDecryptFile","fileUri","useFileService","options","keyUri","JWE","url","URL","searchParams","get","undefined","message","Error","stack","jwe","scr","encryption","decryptScr","download","enhancedError","cause","_default","exports","default"],"sources":["index.ts"],"sourcesContent":["import {WebexPlugin} from '@webex/webex-core';\n\nimport {FileDownloadOptions, IEncryption} from './types';\nimport {CYPHER} from './constants';\nimport {WebexSDK} from '../types';\n\n/**\n * @description Encryption APIs for KMS\n * @class\n */\nclass Cypher extends WebexPlugin implements IEncryption {\n readonly namespace = CYPHER;\n private readonly $webex: WebexSDK;\n registered = false;\n\n /**\n * Constructs an instance of the class.\n *\n * @param {...any[]} args - The arguments to pass to the superclass constructor.\n *\n * @remarks\n * This constructor calls the superclass constructor with the provided arguments.\n * It also assigns the `webex` property to the `$webex` property, ignoring TypeScript errors.\n */\n constructor(...args: any[]) {\n super(...args);\n this.$webex = (this as WebexPlugin).webex as WebexSDK;\n }\n\n /**\n * Registers the device to WDM. This is required for metrics and other services.\n * @returns {Promise<void>}\n */\n async register() {\n if (this.registered) {\n this.$webex.logger.info('Cypher: webex.internal.device.register already done');\n\n return Promise.resolve();\n }\n\n return this.$webex.internal.device\n .register()\n .then(() => {\n this.$webex.logger.info('Cypher: webex.internal.device.register successful');\n this.registered = true;\n })\n .catch((error) => {\n this.$webex.logger.error(`Error occurred during device.register() ${error}`);\n\n throw error;\n });\n }\n\n /**\n * Deregisters the device.\n * @returns {Promise<void>}\n */\n async deregister() {\n if (!this.registered) {\n this.$webex.logger.info('Cypher: webex.internal.device.deregister already done');\n\n return Promise.resolve();\n }\n\n return this.$webex.internal.device\n .unregister()\n .then(() => {\n this.$webex.logger.info('Cypher: webex.internal.device.deregister successful');\n this.registered = false;\n })\n .catch((error) => {\n this.$webex.logger.error(`Error occurred during device.deregister() ${error}`);\n\n throw error;\n });\n }\n\n /**\n * Downloads and decrypts a file from the given URI.\n *\n * @param {string} fileUri - The URI of the file to be decrypted.\n * @param {FileDownloadOptions} options - The options for file download.\n * @returns {Promise<ArrayBuffer>} A promise that resolves to the decrypted ArrayBuffer.\n * @throws {Error} If the file download or decryption fails.\n *\n * @example\n * ```typescript\n * const attachmentURL = 'https:/myfileurl.xyz/zzz/fileid?keyUri=somekeyuri&JWE=somejwe';\n * const options: FileDownloadOptions = {\n * useFileService: false,\n * jwe: somejwe, // Provide the JWE here if not already present in the attachmentURL\n * keyUri: someKeyUri, // Provide the keyURI here if not already present in the attachmentURL\n * };\n * const decryptedBuf = await webex.cypher.downloadAndDecryptFile(attachmentURL, options);\n * const file = new File([decryptedBuf], \"myFileName.jpeg\", {type: 'image/jpeg'});\n * ```\n */\n public async downloadAndDecryptFile(\n fileUri: string,\n {useFileService = false, ...options}: FileDownloadOptions = {}\n ): Promise<ArrayBuffer> {\n // Sample fileUri: https://someserver.com/3cc29537-7f39-4cce-b204-a529960997fcab9375d8-4fd4-4788-bb12-18426674e95b.jpg?keyUri=kms://kms.wbx2.com/keys/79be16-a4dd-4195-93ef-a72604509aca&JWE=eyJlbmMiOiJBMjU2R0NNIiwiYWxnIjoiZGlyIn0..EHYI5SmnFisaOJgv.6Ie3Zui7LFtAr4eWMSnxXAzfi8Cgixcy2b9jy9cImDWvBjjvJQfwik7qvZewCaq-u8lhtTbjEzsJLeVtOKhW_9RoZt3U0RQ-cKaSh2RaK3N_mvuH7_BsoXCMf5zxaqP1HD-3jXUtVSnqFYvEGdGRWxTCWK-PK9BoIUjX6v5t22CUNYbBQBuHizLWvrGAM0UkSvFNRX5n07Xd3WVJ7OnIhYi0JvOb50lbZIrBn27AQL-_CIKoOQxQLkW9zmVACsVpHxLZx9wIo9XYsBYADRTZaw_l_uTiosAd2P1QAGHgLr_Q_qf1wGUn3eGhmptpPx-YCSJikvs2DttwWOg_-vg4jI3EiIXlc0gGsDnleeNRguCLtrks0PMz5hOp5_w9Z5EW05Cx2UAztnp1hE9_nCvPP9wTzdHsG3flkK82HMbPpeVStWvWmAlzp24vTw2KzYrCemdS2AkrShWsNt6_G7_G8nB4RhUnZ11MKaduE5jYpCXNcTx84RBYwA.vqYHCx8uIn-IMQAsPvrw\n // KeyUri: An attachment level unique ID generated by Webex KMS post encryption of an attachment. In order to\n // decrypt an attachment, KeyUri is a required parameter.\n // JWE: JWE can be decrypted using KMS key to obtain the SCR key.\n // Decrypting an attachment requires the SCR key parameter.\n // We need to download the encrypted file from the given URI and then decrypt it using the SCR key.\n // The decrypted file is then returned.\n\n // step 1: parse the fileUri to get the keyUri and JWE\n // step 2: if keyUri and JWE are not present in the fileUri, use the options\n // step 3: use the keyUri to decrypt the JWE to get the SCR\n // step 4: download the file from the fileUri and decrypt it using the SCR\n\n let keyUri: string | undefined;\n let JWE: string | undefined;\n try {\n const url = new URL(fileUri);\n keyUri = url.searchParams.get('keyUri') ?? undefined;\n JWE = url.searchParams.get('JWE') ?? undefined;\n } catch (error) {\n this.$webex.logger.error(`Cypher: Invalid fileUri: ${(error as Error).message}`);\n throw new Error(\n `Failed to decrypt the JWE: ${(error as Error).message}\\nStack: ${(error as Error).stack}`\n );\n }\n\n // Check if the keyUri and JWE are present, else take it from options\n if (!keyUri || !JWE) {\n keyUri = options.keyUri;\n JWE = options.jwe;\n }\n\n // Check if the keyUri and JWE are present, else throw an error\n if (!keyUri || !JWE) {\n throw new Error(\n 'KeyUri and JWE are required to decrypt the file. Either provide them in the fileUri or in the options.'\n );\n }\n\n try {\n // Decrypt the JWE to get the SCR\n const scr = await this.$webex.internal.encryption.decryptScr(keyUri, JWE);\n\n // Start the download and decryption process, returning a promise\n return this.$webex.internal.encryption.download(fileUri, scr, {useFileService});\n } catch (error) {\n const enhancedError = new Error(\n `Failed to decrypt or download the file: ${(error as Error).message}\\nStack: ${\n (error as Error).stack\n }`\n );\n enhancedError.cause = error;\n throw enhancedError;\n }\n }\n}\n\nexport default Cypher;\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAGA,IAAAC,UAAA,GAAAD,OAAA;AAGA;AACA;AACA;AACA;AACA,MAAME,MAAM,SAASC,sBAAW,CAAwB;EAC7CC,SAAS,GAAGC,iBAAM;EAE3BC,UAAU,GAAG,KAA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B,MAAM,CAACO,QAAQ,CAACuB,UAAU,CAACC,UAAU,CAACb,MAAM,EAAEC,GAAG,CAAC;;MAEzE;MACA,OAAO,IAAI,CAACnB,MAAM,CAACO,QAAQ,CAACuB,UAAU,CAACE,QAAQ,CAACjB,OAAO,EAAEc,GAAG,EAAE;QAACb;MAAc,CAAC,CAAC;IACjF,CAAC,CAAC,OAAOL,KAAK,EAAE;MACd,MAAMsB,aAAa,GAAG,IAAIP,KAAK,CAC5B,2CAA2Cf,KAAK,CAAWc,OAAQ,YACjEd,KAAK,CAAWgB,KAClB,EACH,CAAC;MACDM,aAAa,CAACC,KAAK,GAAGvB,KAAK;MAC3B,MAAMsB,aAAa;IACrB;EACF;AACF;AAAC,IAAAE,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc5C,MAAM"}
|
package/dist/cypher/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["/**\n * Options for downloading a file with encryption.\n */\ninterface FileDownloadOptions {\n /**\n * Indicates whether to use the file service for downloading.\n * If true, the webex files service will be used.\n * If false or undefined, the file will be downloaded directly from the URL.\n */\n useFileService?: boolean;\n\n /**\n * The JSON Web Encryption (JWE) string used for decrypting the file.\n * This is a required parameter if the url does not contain the JWE.\n */\n jwe?: string;\n\n /**\n * The URI of the key used for decrypting the file.\n * This is a required parameter if the url does not contain the keyUri.\n */\n keyUri?: string;\n}\ninterface IEncryption {\n downloadAndDecryptFile(fileUri: string, options: FileDownloadOptions): Promise<ArrayBuffer>;\n}\n\nexport type {IEncryption, FileDownloadOptions};\n"],"mappings":""}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
{"version":3,"names":["_webexCore","require","_cypher","_interopRequireDefault","_config","obj","__esModule","default","registerPlugin","Cypher","config","_default","exports"],"sources":["index.ts"],"sourcesContent":["/* eslint-env browser */\nimport {registerPlugin} from '@webex/webex-core';\n\nimport Cypher from './cypher';\nimport config from './config';\nimport {FileDownloadOptions, IEncryption} from './cypher/types';\n\nregisterPlugin('cypher', Cypher, {\n config,\n});\n\nexport default Cypher;\nexport type {FileDownloadOptions, IEncryption};\n"],"mappings":";;;;;;AACA,IAAAA,UAAA,GAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAD,sBAAA,CAAAF,OAAA;AAA8B,SAAAE,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAJ9B;;AAOA,IAAAG,yBAAc,EAAC,QAAQ,EAAEC,eAAM,EAAE;EAC/BC,MAAM,EAANA;AACF,CAAC,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAL,OAAA,GAEYE,eAAM"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
hydra: string;
|
|
3
|
+
hydraServiceUrl: string;
|
|
4
|
+
credentials: {};
|
|
5
|
+
device: {
|
|
6
|
+
validateDomains: boolean;
|
|
7
|
+
ephemeral: boolean;
|
|
8
|
+
};
|
|
9
|
+
storage: {
|
|
10
|
+
boundedAdapter: any;
|
|
11
|
+
unboundedAdapter: any;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export default _default;
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["/**\n * Logging related types\n */\nexport type Logger = {\n log: (payload: string) => void;\n error: (payload: string) => void;\n warn: (payload: string) => void;\n info: (payload: string) => void;\n trace: (payload: string) => void;\n debug: (payload: string) => void;\n};\n\ninterface IWebexInternal {\n mercury: {\n connect: () => Promise<void>;\n disconnect: () => Promise<void>;\n };\n device: {\n register: () => Promise<void>;\n unregister: () => Promise<void>;\n };\n encryption: {\n decryptScr: (keyUri: string, jwe: string) => Promise<string>;\n download: (\n fileUri: string,\n scr: string,\n options: {useFileService: boolean}\n ) => Promise<ArrayBuffer>;\n };\n}\n\nexport interface WebexSDK {\n version: string;\n canAuthorize: boolean;\n credentials: {\n getUserToken: () => Promise<string>;\n getOrgId: () => string;\n };\n ready: boolean;\n once: (event: string, callBack: () => void) => void;\n // internal plugins\n internal: IWebexInternal;\n // public plugins\n logger: Logger;\n}\n"],"mappings":""}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _webexCore = require("@webex/webex-core");
|
|
8
|
+
var _default = exports.default = {
|
|
9
|
+
hydra: process.env.HYDRA_SERVICE_URL || 'https://api.ciscospark.com/v1',
|
|
10
|
+
hydraServiceUrl: process.env.HYDRA_SERVICE_URL || 'https://api.ciscospark.com/v1',
|
|
11
|
+
credentials: {},
|
|
12
|
+
device: {
|
|
13
|
+
validateDomains: true,
|
|
14
|
+
ephemeral: true
|
|
15
|
+
},
|
|
16
|
+
storage: {
|
|
17
|
+
boundedAdapter: _webexCore.MemoryStoreAdapter,
|
|
18
|
+
unboundedAdapter: _webexCore.MemoryStoreAdapter
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=webex-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_webexCore","require","_default","exports","default","hydra","process","env","HYDRA_SERVICE_URL","hydraServiceUrl","credentials","device","validateDomains","ephemeral","storage","boundedAdapter","MemoryStoreAdapter","unboundedAdapter"],"sources":["webex-config.ts"],"sourcesContent":["import {MemoryStoreAdapter} from '@webex/webex-core';\n\nexport default {\n hydra: process.env.HYDRA_SERVICE_URL || 'https://api.ciscospark.com/v1',\n hydraServiceUrl: process.env.HYDRA_SERVICE_URL || 'https://api.ciscospark.com/v1',\n credentials: {},\n device: {\n validateDomains: true,\n ephemeral: true,\n },\n storage: {\n boundedAdapter: MemoryStoreAdapter,\n unboundedAdapter: MemoryStoreAdapter,\n },\n};\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAAqD,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEtC;EACbC,KAAK,EAAEC,OAAO,CAACC,GAAG,CAACC,iBAAiB,IAAI,+BAA+B;EACvEC,eAAe,EAAEH,OAAO,CAACC,GAAG,CAACC,iBAAiB,IAAI,+BAA+B;EACjFE,WAAW,EAAE,CAAC,CAAC;EACfC,MAAM,EAAE;IACNC,eAAe,EAAE,IAAI;IACrBC,SAAS,EAAE;EACb,CAAC;EACDC,OAAO,EAAE;IACPC,cAAc,EAAEC,6BAAkB;IAClCC,gBAAgB,EAAED;EACpB;AACF,CAAC"}
|
package/dist/webex.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/*!
|
|
4
|
+
* Copyright (c) 2015-2025 Cisco Systems, Inc. See the LICENSE file.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
// Note: this file is written using commonjs instead of import/export to
|
|
8
|
+
// simplify consumption by those less familiar with the current state of
|
|
9
|
+
// JavaScript modularization
|
|
10
|
+
|
|
11
|
+
/* istanbul ignore else */
|
|
12
|
+
if (!global._babelPolyfill) {
|
|
13
|
+
/* eslint global-require: [0] */
|
|
14
|
+
require('@babel/polyfill');
|
|
15
|
+
}
|
|
16
|
+
require('@webex/plugin-authorization');
|
|
17
|
+
require('@webex/internal-plugin-encryption'); // required
|
|
18
|
+
require('./index');
|
|
19
|
+
const merge = require('lodash/merge');
|
|
20
|
+
const WebexCore = require('@webex/webex-core').default;
|
|
21
|
+
const config = require('./webex-config');
|
|
22
|
+
const Webex = WebexCore.extend({
|
|
23
|
+
webex: true,
|
|
24
|
+
version: `3.8.1-next.1`
|
|
25
|
+
});
|
|
26
|
+
Webex.init = function init(attrs = {}) {
|
|
27
|
+
attrs.config = merge({}, config, attrs.config); // eslint-disable-line no-param-reassign
|
|
28
|
+
|
|
29
|
+
return new Webex(attrs);
|
|
30
|
+
};
|
|
31
|
+
module.exports = Webex;
|
|
32
|
+
//# sourceMappingURL=webex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["global","_babelPolyfill","require","merge","WebexCore","default","config","Webex","extend","webex","version","init","attrs","module","exports"],"sources":["webex.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2025 Cisco Systems, Inc. See the LICENSE file.\n */\n\n// Note: this file is written using commonjs instead of import/export to\n// simplify consumption by those less familiar with the current state of\n// JavaScript modularization\n\n/* istanbul ignore else */\nif (!global._babelPolyfill) {\n /* eslint global-require: [0] */\n require('@babel/polyfill');\n}\n\nrequire('@webex/plugin-authorization');\nrequire('@webex/internal-plugin-encryption'); // required\nrequire('./index');\n\nconst merge = require('lodash/merge');\nconst WebexCore = require('@webex/webex-core').default;\n\nconst config = require('./webex-config');\n\nconst Webex = WebexCore.extend({\n webex: true,\n version: PACKAGE_VERSION,\n});\n\nWebex.init = function init(attrs = {}) {\n attrs.config = merge({}, config, attrs.config); // eslint-disable-line no-param-reassign\n\n return new Webex(attrs);\n};\n\nmodule.exports = Webex;\n"],"mappings":";;AAAA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,IAAI,CAACA,MAAM,CAACC,cAAc,EAAE;EAC1B;EACAC,OAAO,CAAC,iBAAiB,CAAC;AAC5B;AAEAA,OAAO,CAAC,6BAA6B,CAAC;AACtCA,OAAO,CAAC,mCAAmC,CAAC,CAAC,CAAC;AAC9CA,OAAO,CAAC,SAAS,CAAC;AAElB,MAAMC,KAAK,GAAGD,OAAO,CAAC,cAAc,CAAC;AACrC,MAAME,SAAS,GAAGF,OAAO,CAAC,mBAAmB,CAAC,CAACG,OAAO;AAEtD,MAAMC,MAAM,GAAGJ,OAAO,CAAC,gBAAgB,CAAC;AAExC,MAAMK,KAAK,GAAGH,SAAS,CAACI,MAAM,CAAC;EAC7BC,KAAK,EAAE,IAAI;EACXC,OAAO;AACT,CAAC,CAAC;AAEFH,KAAK,CAACI,IAAI,GAAG,SAASA,IAAIA,CAACC,KAAK,GAAG,CAAC,CAAC,EAAE;EACrCA,KAAK,CAACN,MAAM,GAAGH,KAAK,CAAC,CAAC,CAAC,EAAEG,MAAM,EAAEM,KAAK,CAACN,MAAM,CAAC,CAAC,CAAC;;EAEhD,OAAO,IAAIC,KAAK,CAACK,KAAK,CAAC;AACzB,CAAC;AAEDC,MAAM,CAACC,OAAO,GAAGP,KAAK"}
|
package/jest.config.js
CHANGED
|
@@ -2,7 +2,9 @@ const config = require('@webex/jest-config-legacy');
|
|
|
2
2
|
|
|
3
3
|
const jestConfig = {
|
|
4
4
|
rootDir: './',
|
|
5
|
-
transformIgnorePatterns: [
|
|
5
|
+
transformIgnorePatterns: [
|
|
6
|
+
'/node_modules/(?!(uuid)/)', // Transform `uuid` using Babel
|
|
7
|
+
],
|
|
6
8
|
testPathIgnorePatterns: ['/node_modules/', '/dist/'],
|
|
7
9
|
testResultsProcessor: 'jest-junit',
|
|
8
10
|
// Clear mocks in between tests by default
|
package/package.json
CHANGED
|
@@ -8,13 +8,25 @@
|
|
|
8
8
|
},
|
|
9
9
|
"license": "https://github.com/webex/webex-js-sdk/blob/next/LICENSE.md",
|
|
10
10
|
"contributors": [
|
|
11
|
-
"
|
|
11
|
+
"Adhwaith Menon <adhmenon@cisco.com>",
|
|
12
|
+
"Bharath Balan <bhabalan@cisco.com>",
|
|
13
|
+
"Kesava Krishnan Madavan <kmadavan@cisco.com>",
|
|
14
|
+
"Priya Kesari <pkesari@cisco.com>",
|
|
15
|
+
"Rajesh Kumar <rarajes2@cisco.com>",
|
|
16
|
+
"Ravi Chandra Sekhar Sarika <rsarika@cisco.com>",
|
|
17
|
+
"Shreyas Sharma <shreysh2@cisco.com>",
|
|
18
|
+
"Sreekanth Narayanan <sreenara@cisco.com>"
|
|
12
19
|
],
|
|
13
|
-
"main": "dist/
|
|
20
|
+
"main": "dist/webex.js",
|
|
21
|
+
"devMain": "src/index.ts",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": "./dist/webex.js",
|
|
24
|
+
"./package": "./package.json"
|
|
25
|
+
},
|
|
14
26
|
"types": "dist/types/index.d.ts",
|
|
15
27
|
"scripts": {
|
|
16
28
|
"build": "yarn run -T tsc --declaration true --declarationDir ./dist/types",
|
|
17
|
-
"build:docs": "typedoc --out ../../../docs/plugin-
|
|
29
|
+
"build:docs": "typedoc --out ../../../docs/plugin-encryption",
|
|
18
30
|
"build:src": "webex-legacy-tools build -dest \"./dist\" -src \"./src\" -js -ts -maps && yarn build",
|
|
19
31
|
"deploy:npm": "yarn npm publish",
|
|
20
32
|
"test:browser": "webex-legacy-tools test --integration --runner karma",
|
|
@@ -28,8 +40,8 @@
|
|
|
28
40
|
]
|
|
29
41
|
},
|
|
30
42
|
"dependencies": {
|
|
31
|
-
"@webex/internal-plugin-encryption": "3.8.
|
|
32
|
-
"@webex/webex-core": "3.8.
|
|
43
|
+
"@webex/internal-plugin-encryption": "3.8.1-next.1",
|
|
44
|
+
"@webex/webex-core": "3.8.1-next.1"
|
|
33
45
|
},
|
|
34
46
|
"devDependencies": {
|
|
35
47
|
"@babel/preset-typescript": "7.22.11",
|
|
@@ -38,7 +50,7 @@
|
|
|
38
50
|
"@webex/eslint-config-legacy": "0.0.0",
|
|
39
51
|
"@webex/jest-config-legacy": "0.0.0",
|
|
40
52
|
"@webex/legacy-tools": "0.0.0",
|
|
41
|
-
"@webex/test-helper-mock-webex": "3.8.
|
|
53
|
+
"@webex/test-helper-mock-webex": "3.8.1-next.1",
|
|
42
54
|
"eslint": "^8.24.0",
|
|
43
55
|
"jest-html-reporters": "3.0.11",
|
|
44
56
|
"jest-junit": "13.0.0",
|
|
@@ -52,6 +64,5 @@
|
|
|
52
64
|
"engines": {
|
|
53
65
|
"node": ">=16"
|
|
54
66
|
},
|
|
55
|
-
"
|
|
56
|
-
"version": "3.8.0-next.9"
|
|
67
|
+
"version": "3.8.1-next.1"
|
|
57
68
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {MemoryStoreAdapter} from '@webex/webex-core';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
hydra: process.env.HYDRA_SERVICE_URL || 'https://api.ciscospark.com/v1',
|
|
5
|
+
hydraServiceUrl: process.env.HYDRA_SERVICE_URL || 'https://api.ciscospark.com/v1',
|
|
6
|
+
credentials: {},
|
|
7
|
+
device: {
|
|
8
|
+
validateDomains: true,
|
|
9
|
+
ephemeral: true,
|
|
10
|
+
},
|
|
11
|
+
storage: {
|
|
12
|
+
boundedAdapter: MemoryStoreAdapter,
|
|
13
|
+
unboundedAdapter: MemoryStoreAdapter,
|
|
14
|
+
},
|
|
15
|
+
};
|
package/src/webex.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2025 Cisco Systems, Inc. See the LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
// Note: this file is written using commonjs instead of import/export to
|
|
6
|
+
// simplify consumption by those less familiar with the current state of
|
|
7
|
+
// JavaScript modularization
|
|
8
|
+
|
|
9
|
+
/* istanbul ignore else */
|
|
10
|
+
if (!global._babelPolyfill) {
|
|
11
|
+
/* eslint global-require: [0] */
|
|
12
|
+
require('@babel/polyfill');
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
require('@webex/plugin-authorization');
|
|
16
|
+
require('@webex/internal-plugin-encryption'); // required
|
|
17
|
+
require('./index');
|
|
18
|
+
|
|
19
|
+
const merge = require('lodash/merge');
|
|
20
|
+
const WebexCore = require('@webex/webex-core').default;
|
|
21
|
+
|
|
22
|
+
const config = require('./webex-config');
|
|
23
|
+
|
|
24
|
+
const Webex = WebexCore.extend({
|
|
25
|
+
webex: true,
|
|
26
|
+
version: PACKAGE_VERSION,
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
Webex.init = function init(attrs = {}) {
|
|
30
|
+
attrs.config = merge({}, config, attrs.config); // eslint-disable-line no-param-reassign
|
|
31
|
+
|
|
32
|
+
return new Webex(attrs);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
module.exports = Webex;
|