@pear-protocol/core-sdk 1.7.0 → 1.8.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.
- package/dist/auth/index.d.ts +33 -2
- package/dist/auth/index.js +40 -0
- package/package.json +2 -2
package/dist/auth/index.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ declare class Auth {
|
|
|
15
15
|
id: string;
|
|
16
16
|
role: "basic" | "pro" | "admin";
|
|
17
17
|
providerId: string | null;
|
|
18
|
-
loginMethod: "email" | "evm_wallet";
|
|
18
|
+
loginMethod: "email" | "evm_wallet" | "oauth";
|
|
19
19
|
};
|
|
20
20
|
}>;
|
|
21
21
|
requestNonce(body: HttpTypes.RequestNonceRequest, headers?: ClientHeaders): Promise<{
|
|
@@ -29,7 +29,7 @@ declare class Auth {
|
|
|
29
29
|
id: string;
|
|
30
30
|
role: "basic" | "pro" | "admin";
|
|
31
31
|
providerId: string | null;
|
|
32
|
-
loginMethod: "email" | "evm_wallet";
|
|
32
|
+
loginMethod: "email" | "evm_wallet" | "oauth";
|
|
33
33
|
}>;
|
|
34
34
|
apiKeyMe(headers?: ClientHeaders): Promise<{
|
|
35
35
|
id: string;
|
|
@@ -50,6 +50,37 @@ declare class Auth {
|
|
|
50
50
|
changePassword(body: HttpTypes.ChangePasswordRequest, headers?: ClientHeaders): Promise<void>;
|
|
51
51
|
forgotPassword(body: HttpTypes.ForgotPasswordRequest, headers?: ClientHeaders): Promise<void>;
|
|
52
52
|
resetPassword(body: HttpTypes.ResetPasswordRequest, headers?: ClientHeaders): Promise<void>;
|
|
53
|
+
getInteractionDetails(uid: string, headers?: ClientHeaders): Promise<{
|
|
54
|
+
uid: string;
|
|
55
|
+
prompt: {
|
|
56
|
+
name: string;
|
|
57
|
+
details: Record<string, unknown>;
|
|
58
|
+
};
|
|
59
|
+
params: Record<string, unknown>;
|
|
60
|
+
client: {
|
|
61
|
+
clientId: string;
|
|
62
|
+
redirectUris: string[];
|
|
63
|
+
clientName?: string | undefined;
|
|
64
|
+
};
|
|
65
|
+
}>;
|
|
66
|
+
submitInteractionLogin(uid: string, body: HttpTypes.LoginRequest, headers?: ClientHeaders): Promise<{
|
|
67
|
+
returnTo: string;
|
|
68
|
+
}>;
|
|
69
|
+
confirmInteraction(uid: string, body: HttpTypes.OauthInteractionConfirmRequest, headers?: ClientHeaders): Promise<{
|
|
70
|
+
returnTo: string;
|
|
71
|
+
}>;
|
|
72
|
+
abortInteraction(uid: string, headers?: ClientHeaders): Promise<{
|
|
73
|
+
returnTo: string;
|
|
74
|
+
}>;
|
|
75
|
+
listOauthGrants(headers?: ClientHeaders): Promise<{
|
|
76
|
+
grants: {
|
|
77
|
+
id: string;
|
|
78
|
+
name: string;
|
|
79
|
+
scopes: string[];
|
|
80
|
+
connectedAt: string;
|
|
81
|
+
}[];
|
|
82
|
+
}>;
|
|
83
|
+
revokeOauthGrant(id: string, headers?: ClientHeaders): Promise<void>;
|
|
53
84
|
}
|
|
54
85
|
|
|
55
86
|
export { Auth };
|
package/dist/auth/index.js
CHANGED
|
@@ -111,6 +111,46 @@ class Auth {
|
|
|
111
111
|
body
|
|
112
112
|
});
|
|
113
113
|
}
|
|
114
|
+
// --- OAuth interaction (login + consent), keyed by uid in the URL, served by apps/auth ---
|
|
115
|
+
async getInteractionDetails(uid, headers) {
|
|
116
|
+
return await this.client.fetch(`/interaction/${uid}`, {
|
|
117
|
+
method: "GET",
|
|
118
|
+
headers
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
async submitInteractionLogin(uid, body, headers) {
|
|
122
|
+
return await this.client.fetch(`/interaction/${uid}/login`, {
|
|
123
|
+
method: "POST",
|
|
124
|
+
headers,
|
|
125
|
+
body
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
async confirmInteraction(uid, body, headers) {
|
|
129
|
+
return await this.client.fetch(`/interaction/${uid}/confirm`, {
|
|
130
|
+
method: "POST",
|
|
131
|
+
headers,
|
|
132
|
+
body
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
async abortInteraction(uid, headers) {
|
|
136
|
+
return await this.client.fetch(`/interaction/${uid}/abort`, {
|
|
137
|
+
method: "POST",
|
|
138
|
+
headers
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
// --- OAuth grants (the user's active authorizations), served by apps/auth ---
|
|
142
|
+
async listOauthGrants(headers) {
|
|
143
|
+
return await this.client.fetch(`/oauth2/grants`, {
|
|
144
|
+
method: "GET",
|
|
145
|
+
headers
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
async revokeOauthGrant(id, headers) {
|
|
149
|
+
return await this.client.fetch(`/oauth2/grants/${id}`, {
|
|
150
|
+
method: "DELETE",
|
|
151
|
+
headers
|
|
152
|
+
});
|
|
153
|
+
}
|
|
114
154
|
}
|
|
115
155
|
|
|
116
156
|
export { Auth };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pear-protocol/core-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"description": "Pear Protocol Core SDK",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"typecheck": "tsc --noEmit"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@pear-protocol/types": "^1.
|
|
30
|
+
"@pear-protocol/types": "^1.11.0",
|
|
31
31
|
"@pear-protocol/utils": "^0.2.0",
|
|
32
32
|
"qs": "^6.14.0"
|
|
33
33
|
},
|