@monerium/sdk 2.0.7 → 2.0.9

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/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.0.9](https://github.com/monerium/sdk/compare/v2.0.8...v2.0.9) (2023-02-06)
4
+
5
+ ### Bug Fixes
6
+
7
+ - build files ([1b0f99f](https://github.com/monerium/sdk/commit/1b0f99fcc6635de69b62de72198f22daa2d36b10))
8
+
9
+ ## [2.0.8](https://github.com/monerium/sdk/compare/v2.0.7...v2.0.8) (2023-02-06)
10
+
11
+ ### Bug Fixes
12
+
13
+ - move dts-bundle config to configs and update paths ([2de558f](https://github.com/monerium/sdk/commit/2de558f6c69b5c72d77ee1065e326d05072ad16c))
14
+
15
+ ### Miscellaneous
16
+
17
+ - add getting started to README and document pckeRequest ([8cf68dd](https://github.com/monerium/sdk/commit/8cf68dd7fcf28b098192ca0da8dfdb3878a3e449))
18
+ - deprecate pkceRequest for getAuthFlowURI ([4f33174](https://github.com/monerium/sdk/commit/4f33174abbdbc0758b61efc4161e4fc234524ca5))
19
+
3
20
  ## [2.0.7](https://github.com/monerium/sdk/compare/v2.0.6...v2.0.7) (2023-01-11)
4
21
 
5
22
  ### Miscellaneous
package/README.md CHANGED
@@ -1,11 +1,11 @@
1
1
  # @monerium/sdk
2
2
 
3
- Everything you need to interact with the Monerium API - an electronic money issuer.
3
+ Everything you need to interact with the [Monerium API](https://monerium.dev/api-docs) - an electronic money issuer.
4
4
 
5
5
  _This package is in development. Please make sure to check if any future updates contain commits
6
6
  that may change the behavior of your application before you upgrade._
7
7
 
8
- [Documentation](https://monerium.github.io/sdk/)
8
+ [SDK Documentation](https://monerium.github.io/sdk/)
9
9
 
10
10
  [Code coverage](https://monerium.github.io/sdk/coverage)
11
11
 
@@ -16,16 +16,60 @@ that may change the behavior of your application before you upgrade._
16
16
  yarn add @monerium/sdk
17
17
  ```
18
18
 
19
- ## Developing
20
-
21
- We are using [commitlint](https://github.com/conventional-changelog/commitlint/tree/master/@commitlint/config-conventional) to enforce that developers format the commit messages according to the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) guidelines.
22
-
23
19
  ## Usage
24
20
 
25
21
  - `start`: Run Vite in host mode for a local development environment (not included in production build)
26
22
  - `watch`: Run Vite in watch mode to detect changes to files during development
27
23
  - `build`: Run Vite to build a production release distributable
28
24
 
25
+ ### Getting started
26
+
27
+ If you are new here, we recommend starting in the [Developer Portal](https://monerium.dev/docs/welcome). There you will more about `client_id`'s and ways of authenticating.
28
+
29
+ ```ts
30
+ import { MoneriumClient } from '@monerium/sdk'
31
+
32
+ const client = new MoneriumClient();
33
+
34
+ /** Authenticate using client credentials */
35
+
36
+ await client.auth({
37
+ client_id: "your_client_credentials_uuid"
38
+ client_secret: "your_client_secret"
39
+ })
40
+
41
+ // User is now authenticated, get authentication data
42
+ await client.getAuthContext()
43
+
44
+ /*************************************/
45
+ /** Or, authenticate using auth flow */
46
+
47
+ // Construct the authFlowUrl for your application and redirect your customer.
48
+ let authFlowUrl = client.getAuthFlowURI({
49
+ client_id: "your_client_authflow_uuid"
50
+ redirect_uri: "http://your-webpage.com/monerium-integration"
51
+ })
52
+ // Redirecting to the Monerium onboarding / Authentication flow.
53
+ window.location.replace(authFlowUrl)
54
+
55
+ // As the final step of the flow, the customer will be routed back to the `redirect_uri` with a `code` parameter attached to it.
56
+ // i.e. http://your-webpage.com/monerium-integration?code=1234abcd
57
+
58
+ await client.auth({
59
+ client_id: "your_client_authflow_uuid",
60
+ code: new URLSearchParams(window.location.search).get('code'),
61
+ code_verifier: client.code_verifier,
62
+ redirect_url: "http://your-webpage.com/monerium-integration"
63
+ })
64
+
65
+ // User is now authenticated, get authentication data
66
+ await client.getAuthContext()
67
+ ```
68
+
69
+ ## Developing
70
+
71
+ We are using [commitlint](https://github.com/conventional-changelog/commitlint/tree/master/@commitlint/config-conventional) to enforce that developers format the commit messages according to the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) guidelines.
72
+
29
73
  ## Publishing
30
74
 
31
75
  When changes are merged to the `main` branch that follows the [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) standard, [release-please](https://github.com/googleapis/release-please) workflow creates a pull request, preparing for the next release. If kept open, the following commits will also be added to the PR. Merging that PR will create a new release, a workflow will publish it on NPM and tag it on Github.
package/dist/index.d.ts CHANGED
@@ -271,41 +271,24 @@ export interface LinkAddress {
271
271
  signature: string;
272
272
  accounts: CurrencyAccounts[];
273
273
  }
274
- /**
275
- * How to authenticate
276
- * ```ts
277
- *
278
- * import { MoneriumClient } from '@monerium/sdk'
279
- *
280
- * const client = new MoneriumClient();
281
- *
282
- * // Start by authenticating
283
- * await client.auth({
284
- * client_id: "your_client_id"
285
- * client_secret: "your_client_secret"
286
- * })
287
- * ```
288
- * */
289
274
  export declare class MoneriumClient {
290
275
  #private;
291
276
  /** The PKCE code verifier */
292
277
  codeVerifier?: string;
293
278
  bearerProfile?: BearerProfile;
279
+ clientId?: string;
294
280
  constructor(env?: "production" | "sandbox");
295
281
  auth(args: AuthArgs): Promise<void>;
296
282
  /**
297
283
  * Construct the url to the authorization code flow,
298
- * the code verifier is needed afterwards to obtain an access token and is therefore stored in this.codeVerifier
299
- *
300
- * ```
301
- * let authFlowUrl = client.pkceRequest({
302
- * client_id:
303
- * redirect_uri:
304
- * })
305
- * ```
284
+ * the code verifier is needed afterwards to obtain an access token and is therefore stored in `this.codeVerifier`
306
285
  * @returns string
307
286
  */
308
- pkceRequest(args: PKCERequestArgs): string;
287
+ getAuthFlowURI(args: PKCERequestArgs): string;
288
+ /**
289
+ * @deprecated since v2.0.7, use getAuthFlowURI instead.
290
+ */
291
+ pkceRequest: (args: PKCERequestArgs) => string;
309
292
  getAuthContext(): Promise<AuthContext>;
310
293
  /**
311
294
  * @param {string} profileId - the id of the profile to fetch.