@monerium/sdk 2.0.6 → 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 +25 -0
- package/README.md +50 -4
- package/dist/index.d.ts +12 -17
- package/dist/index.es.js +136 -132
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +142 -138
- package/dist/index.umd.js.map +1 -1
- package/package.json +6 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
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
|
+
|
|
20
|
+
## [2.0.7](https://github.com/monerium/sdk/compare/v2.0.6...v2.0.7) (2023-01-11)
|
|
21
|
+
|
|
22
|
+
### Miscellaneous
|
|
23
|
+
|
|
24
|
+
- add commitlint ([bdae6d8](https://github.com/monerium/sdk/commit/bdae6d83ed386d80be0f27e362e6622ad6ca0ffd))
|
|
25
|
+
- add theme for typedoc to expand and make the sidebar more useful ([355f0f8](https://github.com/monerium/sdk/commit/355f0f839b27bdaeaead2463c0afc48409080041))
|
|
26
|
+
- fix and document pckeRequest ([3905283](https://github.com/monerium/sdk/commit/390528378206149862795ee7a46b54649927e384))
|
|
27
|
+
|
|
3
28
|
## [2.0.6](https://github.com/monerium/sdk/compare/v2.0.0...v2.0.6) (2023-01-05)
|
|
4
29
|
|
|
5
30
|
### Bug Fixes
|
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,14 +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
19
|
## Usage
|
|
22
20
|
|
|
23
21
|
- `start`: Run Vite in host mode for a local development environment (not included in production build)
|
|
24
22
|
- `watch`: Run Vite in watch mode to detect changes to files during development
|
|
25
23
|
- `build`: Run Vite to build a production release distributable
|
|
26
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
|
+
|
|
27
73
|
## Publishing
|
|
28
74
|
|
|
29
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
|
@@ -57,7 +57,7 @@ export type PKCERequest = {
|
|
|
57
57
|
code_challenge: string;
|
|
58
58
|
code_challenge_method: string;
|
|
59
59
|
response_type: string;
|
|
60
|
-
state
|
|
60
|
+
state?: string;
|
|
61
61
|
redirect_uri?: string;
|
|
62
62
|
scope?: string;
|
|
63
63
|
address?: string;
|
|
@@ -271,29 +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:
|
|
285
|
-
* 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
|
+
/**
|
|
283
|
+
* Construct the url to the authorization code flow,
|
|
284
|
+
* the code verifier is needed afterwards to obtain an access token and is therefore stored in `this.codeVerifier`
|
|
285
|
+
* @returns string
|
|
286
|
+
*/
|
|
287
|
+
getAuthFlowURI(args: PKCERequestArgs): string;
|
|
288
|
+
/**
|
|
289
|
+
* @deprecated since v2.0.7, use getAuthFlowURI instead.
|
|
290
|
+
*/
|
|
291
|
+
pkceRequest: (args: PKCERequestArgs) => string;
|
|
297
292
|
getAuthContext(): Promise<AuthContext>;
|
|
298
293
|
/**
|
|
299
294
|
* @param {string} profileId - the id of the profile to fetch.
|