oro-sdk 7.5.0 → 8.0.0

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "7.5.0",
2
+ "version": "8.0.0",
3
3
  "main": "dist/index.js",
4
4
  "typings": "dist/index.d.ts",
5
5
  "files": [
@@ -55,8 +55,8 @@
55
55
  "form-data": "^4.0.0",
56
56
  "formdata-node": "^4.3.1",
57
57
  "idb-keyval": "^5.0.6",
58
- "oro-sdk-apis": "~7.5.0",
58
+ "oro-sdk-apis": "~8.0.0",
59
59
  "oro-toolbox": "0.0.6",
60
60
  "uuid": "^8.3.2"
61
61
  }
62
- }
62
+ }
package/src/client.ts CHANGED
@@ -203,6 +203,26 @@ export class OroClient {
203
203
  return await this.guardClient.identityGet(userUuid)
204
204
  }
205
205
 
206
+ /**
207
+ * Creates a lockbox and decrypts the created grant for that lockbox
208
+ * @returns the grant to the created lockbox
209
+ */
210
+ public async lockboxCreate(): Promise<Grant> {
211
+ if (!this.rsa) {
212
+ if (this.authenticationCallback) {
213
+ this.authenticationCallback(new IncompleteAuthentication())
214
+ }
215
+ throw new IncompleteAuthentication()
216
+ }
217
+ return this.vaultClient
218
+ .lockboxCreate()
219
+ .then((grant) => decryptGrants([grant], this.rsa!))
220
+ .then((grants) => {
221
+ if (grants.length <= 0 || !grants[0].lockboxUuid) throw new MissingGrant()
222
+ return grants[0]
223
+ })
224
+ }
225
+
206
226
  /**
207
227
  * Will attempt to recover an existing login session and set back
208
228
  * the private key in scope
@@ -306,7 +306,7 @@ async function getOrCreatePatientLockbox(oroClient: OroClient): Promise<Uuid> {
306
306
  await oroClient.guardClient.setTokens({ accessToken: tokens.accessToken, refreshToken: tokens.refreshToken })
307
307
  await oroClient.guardClient.whoAmI(true)
308
308
 
309
- return lockboxResponse.lockboxUuid
309
+ return lockboxResponse.lockboxUuid!
310
310
  }
311
311
  }
312
312