@monerium/sdk 2.0.9 → 2.0.12
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 +22 -0
- package/README.md +16 -6
- package/dist/index.d.ts +21 -4
- package/dist/index.es.js +396 -447
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +413 -461
- package/dist/index.umd.js.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.0.12](https://github.com/monerium/sdk/compare/v2.0.11...v2.0.12) (2023-02-25)
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
- replace encodeBase64Url, not available in the downgraded version of crypto-js ([c883b64](https://github.com/monerium/sdk/commit/c883b6422b1d068752a420abce2ce3a14d8a4092))
|
|
8
|
+
|
|
9
|
+
## [2.0.11](https://github.com/monerium/sdk/compare/v2.0.10...v2.0.11) (2023-02-25)
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
- crypto-js to 3.1.9-1 because of https://github.com/brix/crypto-js/issues/256 ([00bffd9](https://github.com/monerium/sdk/commit/00bffd9e7e90315f09cee4a8ade60121d1e1b75a))
|
|
14
|
+
|
|
15
|
+
### Miscellaneous
|
|
16
|
+
|
|
17
|
+
- remove unnecessary comment ([c8d64ad](https://github.com/monerium/sdk/commit/c8d64adad6157eecd1e2a3faf0bec0a86da74f07))
|
|
18
|
+
|
|
19
|
+
## [2.0.10](https://github.com/monerium/sdk/compare/v2.0.9...v2.0.10) (2023-02-16)
|
|
20
|
+
|
|
21
|
+
### Miscellaneous
|
|
22
|
+
|
|
23
|
+
- define properties for automatic wallet link on auth flow ([#19](https://github.com/monerium/sdk/issues/19)) ([3bf845c](https://github.com/monerium/sdk/commit/3bf845cac60bb8a2d5ee7a9dbfa56c76f6996178))
|
|
24
|
+
|
|
3
25
|
## [2.0.9](https://github.com/monerium/sdk/compare/v2.0.8...v2.0.9) (2023-02-06)
|
|
4
26
|
|
|
5
27
|
### Bug Fixes
|
package/README.md
CHANGED
|
@@ -22,17 +22,21 @@ yarn add @monerium/sdk
|
|
|
22
22
|
- `watch`: Run Vite in watch mode to detect changes to files during development
|
|
23
23
|
- `build`: Run Vite to build a production release distributable
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
## Getting started
|
|
26
26
|
|
|
27
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
28
|
|
|
29
|
+
### Import the SDK and initialize a client
|
|
30
|
+
|
|
29
31
|
```ts
|
|
30
|
-
import { MoneriumClient } from
|
|
32
|
+
import { MoneriumClient } from "@monerium/sdk";
|
|
31
33
|
|
|
32
34
|
const client = new MoneriumClient();
|
|
35
|
+
```
|
|
33
36
|
|
|
34
|
-
|
|
37
|
+
### Authenticate using client credentials
|
|
35
38
|
|
|
39
|
+
```ts
|
|
36
40
|
await client.auth({
|
|
37
41
|
client_id: "your_client_credentials_uuid"
|
|
38
42
|
client_secret: "your_client_secret"
|
|
@@ -40,14 +44,20 @@ await client.auth({
|
|
|
40
44
|
|
|
41
45
|
// User is now authenticated, get authentication data
|
|
42
46
|
await client.getAuthContext()
|
|
47
|
+
```
|
|
43
48
|
|
|
44
|
-
|
|
45
|
-
/** Or, authenticate using auth flow */
|
|
49
|
+
### Authenticate using auth flow
|
|
46
50
|
|
|
51
|
+
```ts
|
|
47
52
|
// Construct the authFlowUrl for your application and redirect your customer.
|
|
48
53
|
let authFlowUrl = client.getAuthFlowURI({
|
|
49
54
|
client_id: "your_client_authflow_uuid"
|
|
50
|
-
|
|
55
|
+
// optional automatic wallet selection:
|
|
56
|
+
network: "mumbai",
|
|
57
|
+
chain: "polygon",
|
|
58
|
+
address: "0xValidAddress72413Fa92980B889A1eCE84dD",
|
|
59
|
+
signature: "0xValidSignature0df2b6c9e0fc067ab29bdbf322bec30aad7c46dcd97f62498a91ef7795957397e0f49426e000b0f500c347219ddd98dc5080982563055e918031c"
|
|
60
|
+
|
|
51
61
|
})
|
|
52
62
|
// Redirecting to the Monerium onboarding / Authentication flow.
|
|
53
63
|
window.location.replace(authFlowUrl)
|
package/dist/index.d.ts
CHANGED
|
@@ -48,19 +48,36 @@ export interface ClientCredentials {
|
|
|
48
48
|
client_secret: string;
|
|
49
49
|
scope?: string;
|
|
50
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* @returns A {@link PKCERequest} object with properties omitted that are automatically computed in by the SDK.
|
|
53
|
+
*/
|
|
51
54
|
export type PKCERequestArgs = Omit<
|
|
52
55
|
PKCERequest,
|
|
53
56
|
"code_challenge" | "code_challenge_method" | "response_type"
|
|
54
57
|
>;
|
|
55
58
|
export type PKCERequest = {
|
|
59
|
+
/** the authentication flow client id of the application */
|
|
56
60
|
client_id: string;
|
|
61
|
+
/** the code challenge automatically generated by the SDK */
|
|
57
62
|
code_challenge: string;
|
|
58
|
-
|
|
59
|
-
|
|
63
|
+
/** the code challenge method for the authentication flow , handled by the SDK */
|
|
64
|
+
code_challenge_method: "S256";
|
|
65
|
+
/** the response type of the authentication flow, handled by the SDK */
|
|
66
|
+
response_type: "code";
|
|
67
|
+
/** the state of the application */
|
|
60
68
|
state?: string;
|
|
69
|
+
/** the redirect uri of the application */
|
|
61
70
|
redirect_uri?: string;
|
|
71
|
+
/** the scope of the application */
|
|
62
72
|
scope?: string;
|
|
73
|
+
/** the address of the wallet to automatically link */
|
|
63
74
|
address?: string;
|
|
75
|
+
/** the signature of the wallet to automatically link */
|
|
76
|
+
signature?: string;
|
|
77
|
+
/** the network of the wallet to automatically link */
|
|
78
|
+
network?: Network;
|
|
79
|
+
/** the chain of the wallet to automatically link */
|
|
80
|
+
chain?: Chain;
|
|
64
81
|
};
|
|
65
82
|
declare enum Method {
|
|
66
83
|
password = "password",
|
|
@@ -276,17 +293,17 @@ export declare class MoneriumClient {
|
|
|
276
293
|
/** The PKCE code verifier */
|
|
277
294
|
codeVerifier?: string;
|
|
278
295
|
bearerProfile?: BearerProfile;
|
|
279
|
-
clientId?: string;
|
|
280
296
|
constructor(env?: "production" | "sandbox");
|
|
281
297
|
auth(args: AuthArgs): Promise<void>;
|
|
282
298
|
/**
|
|
283
299
|
* Construct the url to the authorization code flow,
|
|
284
300
|
* the code verifier is needed afterwards to obtain an access token and is therefore stored in `this.codeVerifier`
|
|
301
|
+
* For automatic wallet link, add the following properties: `address`, `signature`, `chain` & `network`
|
|
285
302
|
* @returns string
|
|
286
303
|
*/
|
|
287
304
|
getAuthFlowURI(args: PKCERequestArgs): string;
|
|
288
305
|
/**
|
|
289
|
-
* @deprecated since v2.0.7, use getAuthFlowURI instead.
|
|
306
|
+
* @deprecated since v2.0.7, use {@link getAuthFlowURI} instead.
|
|
290
307
|
*/
|
|
291
308
|
pkceRequest: (args: PKCERequestArgs) => string;
|
|
292
309
|
getAuthContext(): Promise<AuthContext>;
|