Skip to content

Commit 6980eb7

Browse files
committed
Update changelog to new format.
1 parent b432427 commit 6980eb7

File tree

2 files changed

+84
-10
lines changed

2 files changed

+84
-10
lines changed

CHANGELOG.md

+69-8
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,75 @@
1-
# v2.0.0 (Wed May 03 2023)
1+
# v2.0.0 (July 03, 2023)
22

3-
#### 🚀 Enhancement
3+
## Summary
4+
- 🚀 **Added:** Magic Connect developers can now use the Admin SDK to validate DID tokens. [#111](https://github.com/magiclabs/magic-admin-js/pull/111) ([@magic-ravi](https://github.com/magic-ravi))
5+
- ⚠️ **Changed:** After creating the Magic instance, it is now necessary to call a new initialize method for Magic Connect developers that want to utilize the Admin SDK. [#111](https://github.com/magiclabs/magic-admin-js/pull/111) ([@magic-ravi](https://github.com/magic-ravi))
6+
- 🛡️ **Security:** Additional validation of `aud` (client ID) is now being done during initialization of the SDK. [#111](https://github.com/magiclabs/magic-admin-js/pull/111) ([@magic-ravi](https://github.com/magic-ravi))
47

5-
- Add Magic Connect Admin SDK support for Token Resource [#111](https://github.com/magiclabs/magic-admin-js/pull/111) ([@magic-ravi](https://github.com/magic-ravi))
6-
- [Security Enhancement]: Validate `aud` using Magic client ID.
7-
- Add new `init` async method to create Magic instance and pull client ID from Magic servers if not provided.
8-
- Deprecate regular constructor.
9-
- Skip validation of attachment if 'none' is passed in `validate`.
8+
## Developer Notes
109

11-
#### Authors: 1
10+
### 🚀 Added
11+
12+
#### Admin SDK for MC
13+
Magic Connect developers can now use the Admin SDK to validate DID tokens.
14+
15+
**Details**
16+
There is full support for all `TokenResource` SDK methods for MC. This is intended to be used with client side [`magic-js`](#) SDK which will now emit an `id-token-created` event with a DID token upon login via the [`connectWithUI`](#) method.
17+
18+
This functionality is replicated on our other SDKs on Python and Ruby.
19+
20+
### ⚠️ Changed
21+
22+
#### Constructor initialization
23+
24+
The existing constructor has been deprecated in place of a new async `initialize` method.
25+
The `initialize` method will pull clientId from Magic servers if one is not provided in the `options` parameter.
26+
27+
**Previous Version**
28+
```javascript
29+
const magic = new Magic(secretKey);
30+
try {
31+
magic.token.validate(DIDT);
32+
} catch (e) {
33+
console.log(e);
34+
}
35+
try {
36+
await magic.users.getMetadataByToken(DIDT);
37+
} catch (e) {
38+
console.log(e);
39+
}
40+
```
41+
42+
**Current Version**
43+
```javascript
44+
const magic = await Magic.init(mcSecretKey);
45+
try {
46+
magic.token.validate(DIDT);
47+
} catch (e) {
48+
console.log(e);
49+
}
50+
try {
51+
await magic.users.getMetadataByToken(DIDT);
52+
} catch (e) {
53+
console.log(e);
54+
}
55+
```
56+
57+
#### Attachment Validation
58+
59+
- Skip validation of attachment if 'none' is passed in `validate`.
60+
61+
### 🛡️ Security
62+
63+
#### Client ID Validation
64+
65+
Additional validation of `aud` (client ID) is now being done during initialization of the SDK. This is for both Magic Connect and Magic Auth developers.
66+
67+
68+
### 🚨 Breaking
69+
70+
None, all changes are fully backwards compatiable.
71+
72+
### Authors: 1
1273

1374
- Ravi Bhankharia ([@magic-ravi](https://github.com/magic-ravi))
1475

README.md

+15-2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,19 @@ const { Magic } = require('@magic-sdk/admin');
3535
// In async function:
3636
const magic = await Magic.init('YOUR_SECRET_API_KEY');
3737
// OR
38-
Magic.init('YOUR_SECRET_API_KEY').then((magic) => magic);
39-
// Read the docs to learn about next steps! 🚀
38+
Magic.init('YOUR_SECRET_API_KEY').then((magic) => {
39+
magic
40+
});
41+
// Validate a token
42+
try {
43+
magic.token.validate("DIDToken");
44+
} catch (e) {
45+
console.log(e);
46+
}
47+
// Magic Auth - Get User Email
48+
try {
49+
await magic.users.getMetadataByToken("DIDToken");
50+
} catch (e) {
51+
console.log(e);
52+
}
4053
```

0 commit comments

Comments
 (0)