oro-sdk-apis 1.11.1 → 1.13.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.
@@ -97,4 +97,18 @@ export declare class GuardService {
97
97
  * @return void
98
98
  */
99
99
  identitySendConfirmEmail(req: IdentityResendConfirmEmailRequest): Promise<void>;
100
+ /**
101
+ * Get an identity using a customer email (format: customer+[b64Hash]@orohealth.me)
102
+ *
103
+ * @param email the customer email
104
+ * @returns IdentityResponse
105
+ */
106
+ identityGetByCustomerEmail(email: string): Promise<IdentityResponse>;
107
+ /**
108
+ * Get an identity using a base64 hash
109
+ *
110
+ * @param b64Hash base64 hash of the identity
111
+ * @returns IdentityResponse
112
+ */
113
+ identityGetByHash(b64Hash: string): Promise<IdentityResponse>;
100
114
  }
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.11.1",
2
+ "version": "1.13.0",
3
3
  "main": "dist/index.js",
4
4
  "typings": "dist/index.d.ts",
5
5
  "files": [
@@ -19,12 +19,8 @@
19
19
  "prepare": "tsdx build",
20
20
  "size": "size-limit",
21
21
  "analyze": "size-limit --why",
22
- "package": "tsdx build && npm publish"
23
- },
24
- "husky": {
25
- "hooks": {
26
- "pre-commit": "tsdx lint"
27
- }
22
+ "package": "tsdx build && npm publish",
23
+ "pretty": "prettier --config ../../.prettierrc.yaml --write './src/**/*.{ts,js,json,md}' && prettier --write './*.md'"
28
24
  },
29
25
  "name": "oro-sdk-apis",
30
26
  "author": "Antoine Jaouën <antoine@orohealth.me>",
@@ -45,8 +41,7 @@
45
41
  "@types/jest": "^27.4.1",
46
42
  "@types/sha.js": "^2.4.0",
47
43
  "@types/uuid": "^8.3.0",
48
- "husky": "^6.0.0",
49
- "prettier": "^2.5.1",
44
+ "prettier": "^2.6.1",
50
45
  "prettier-plugin-svelte": "^2.3.0",
51
46
  "size-limit": "^4.10.2",
52
47
  "tsdx": "^0.14.1",
@@ -6,4 +6,5 @@ export * from './practice'
6
6
  export * from './shared'
7
7
  export * from './vault'
8
8
  export * from './workflow'
9
- export * from './external'
9
+ export * from './external'
10
+ export * from './user'
@@ -0,0 +1,13 @@
1
+ export interface User {
2
+ aud: string
3
+ exp: number
4
+ jti: string
5
+ iat: number
6
+ iss: string
7
+ nbf?: number
8
+ sub: string
9
+ email: string
10
+ practice: string
11
+ scope: string
12
+ data?: { [val: string]: any }
13
+ }
@@ -157,7 +157,7 @@ export class GuardService {
157
157
  }
158
158
  return resp
159
159
  }
160
-
160
+
161
161
  /**
162
162
  * Retrieve an identity. Will return public fields only when requested
163
163
  * without authentication
@@ -229,4 +229,32 @@ export class GuardService {
229
229
  public async identitySendConfirmEmail(req: IdentityResendConfirmEmailRequest): Promise<void> {
230
230
  return this.api.post<void>(`${this.baseURL}/v1/identity/confirm`, req)
231
231
  }
232
+
233
+ /**
234
+ * Get an identity using a customer email (format: customer+[b64Hash]@orohealth.me)
235
+ *
236
+ * @param email the customer email
237
+ * @returns IdentityResponse
238
+ */
239
+ public async identityGetByCustomerEmail(email: string): Promise<IdentityResponse> {
240
+ return this.identityGetByHash(email.substring(email.indexOf('+')+1, email.indexOf('@')))
241
+ }
242
+
243
+ /**
244
+ * Get an identity using a base64 hash
245
+ *
246
+ * @param b64Hash base64 hash of the identity
247
+ * @returns IdentityResponse
248
+ */
249
+ public async identityGetByHash(b64Hash: string): Promise<IdentityResponse> {
250
+ //TODO: Right now this maps directly to the IdentityGet call.
251
+ //Eventually, with the mapping table method, this would lead to another
252
+ //call (ie: /v1/mapping/[b64Hash]) which would return a blob to decrypt
253
+ //which would contain the real identityID to call IdentityGet with.
254
+
255
+
256
+ //The hash comes in base64 format but it isn't URL safe soe we have to convert
257
+ //to base64URL (see https://en.wikipedia.org/wiki/Base64#The_URL_applications)
258
+ return this.identityGet(b64Hash.replace('+','-').replace('/','_'))
259
+ }
232
260
  }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2021 ORO Health Inc.
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.