@plainkey/vue 0.6.0 → 0.6.3
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/index.d.ts +7 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +35 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as _plainkey_types0 from "@plainkey/types";
|
|
2
|
+
import { UserIdentifier } from "@plainkey/types";
|
|
2
3
|
|
|
3
4
|
//#region src/usePlainkey/index.d.ts
|
|
4
5
|
|
|
@@ -12,7 +13,11 @@ import { PlainKey } from "@plainkey/browser";
|
|
|
12
13
|
* @example
|
|
13
14
|
* const { login, createUserWithPasskey, addPasskey } = usePlainKey("projectId")
|
|
14
15
|
*/
|
|
15
|
-
declare function usePlainKey(projectId: string, baseUrl?: string):
|
|
16
|
+
declare function usePlainKey(projectId: string, baseUrl?: string): {
|
|
17
|
+
authenticate: (userIdentifier?: UserIdentifier) => Promise<_plainkey_types0.AuthenticateResult>;
|
|
18
|
+
createUserWithPasskey: (userName?: string) => Promise<_plainkey_types0.CreateUserWithPasskeyResult>;
|
|
19
|
+
addPasskey: (userToken: string, userIdentifier: UserIdentifier) => Promise<_plainkey_types0.AddPasskeyResult>;
|
|
20
|
+
};
|
|
16
21
|
//#endregion
|
|
17
22
|
export { usePlainKey };
|
|
18
23
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/usePlainkey/index.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/usePlainkey/index.ts"],"sourcesContent":[],"mappings":";;;;;;;;AAaA;;;;;;;AA+BuE,iBA/BvD,WAAA,CA+BuD,SAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EAAA,MAAA,CAAA,EAAA;EAAA,YAAA,EAAA,CAAA,cAAA,CAAA,EAtB9B,cAsB8B,EAAA,GAtBhB,OAsBgB,CAtBhB,gBAAA,CAAA,kBAAA,CAsBgB;EAAA,qBAAA,EAAA,CAAA,QAAA,CAAA,EAAA,MAAA,EAAA,GAZrB,OAYqB,CAtBhB,gBAAA,CAUL,2BAAA,CAYqB;kDAAd,mBAAc,QAAA,gBAAA,CAAA,gBAAA"}
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,41 @@ import { PlainKey } from "@plainkey/browser";
|
|
|
12
12
|
* const { login, createUserWithPasskey, addPasskey } = usePlainKey("projectId")
|
|
13
13
|
*/
|
|
14
14
|
function usePlainKey(projectId, baseUrl) {
|
|
15
|
-
|
|
15
|
+
const plainKey = new PlainKey(projectId, baseUrl);
|
|
16
|
+
/**
|
|
17
|
+
* Authenticates a user. Can be used for login, verification, 2FA, etc.
|
|
18
|
+
* Will require user interaction to authenticate.
|
|
19
|
+
*
|
|
20
|
+
* @param userIdentifier - An object with either the user's PlainKey User ID or their userName.
|
|
21
|
+
*/
|
|
22
|
+
function authenticate(userIdentifier) {
|
|
23
|
+
return plainKey.authenticate(userIdentifier);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Registration of a new user with a passkey. Will require user interaction to create a passkey.
|
|
27
|
+
*
|
|
28
|
+
* @param userName - A stable unique identifier for the user, like an email address or username.
|
|
29
|
+
* Can be empty for usernameless login.
|
|
30
|
+
*/
|
|
31
|
+
function createUserWithPasskey(userName) {
|
|
32
|
+
return plainKey.createUserWithPasskey(userName);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Adds a passkey to an existing user. Will require user interaction to create a passkey.
|
|
36
|
+
*
|
|
37
|
+
* @param userToken - The user authentication token, obtained from login.
|
|
38
|
+
* Do NOT store it in local storage, database, etc. Always keep it in memory.
|
|
39
|
+
*
|
|
40
|
+
* @param userIdentifier - An object with either the user's PlainKey User ID or their userName.
|
|
41
|
+
*/
|
|
42
|
+
function addPasskey(userToken, userIdentifier) {
|
|
43
|
+
return plainKey.addPasskey(userToken, userIdentifier);
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
authenticate,
|
|
47
|
+
createUserWithPasskey,
|
|
48
|
+
addPasskey
|
|
49
|
+
};
|
|
16
50
|
}
|
|
17
51
|
|
|
18
52
|
//#endregion
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/usePlainkey/index.ts"],"sourcesContent":["import { PlainKey } from \"@plainkey/browser\"\n\n/**\n *\n * @param projectId - Your PlainKey project ID. You can find it in the PlainKey admin dashboard.\n * @param baseUrl - Set by default to https://api.plainkey.io/api. Change only for development purposes.\n *\n * Docs: https://plainkey.io/docs\n *\n * @example\n * const { login, createUserWithPasskey, addPasskey } = usePlainKey(\"projectId\")\n */\nexport function usePlainKey(projectId: string, baseUrl?: string) {\n
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/usePlainkey/index.ts"],"sourcesContent":["import { PlainKey } from \"@plainkey/browser\"\nimport { UserIdentifier } from \"@plainkey/types\"\n\n/**\n *\n * @param projectId - Your PlainKey project ID. You can find it in the PlainKey admin dashboard.\n * @param baseUrl - Set by default to https://api.plainkey.io/api. Change only for development purposes.\n *\n * Docs: https://plainkey.io/docs\n *\n * @example\n * const { login, createUserWithPasskey, addPasskey } = usePlainKey(\"projectId\")\n */\nexport function usePlainKey(projectId: string, baseUrl?: string) {\n const plainKey = new PlainKey(projectId, baseUrl)\n\n /**\n * Authenticates a user. Can be used for login, verification, 2FA, etc.\n * Will require user interaction to authenticate.\n *\n * @param userIdentifier - An object with either the user's PlainKey User ID or their userName.\n */\n function authenticate(userIdentifier?: UserIdentifier) {\n return plainKey.authenticate(userIdentifier)\n }\n\n /**\n * Registration of a new user with a passkey. Will require user interaction to create a passkey.\n *\n * @param userName - A stable unique identifier for the user, like an email address or username.\n * Can be empty for usernameless login.\n */\n function createUserWithPasskey(userName?: string) {\n return plainKey.createUserWithPasskey(userName)\n }\n\n /**\n * Adds a passkey to an existing user. Will require user interaction to create a passkey.\n *\n * @param userToken - The user authentication token, obtained from login.\n * Do NOT store it in local storage, database, etc. Always keep it in memory.\n *\n * @param userIdentifier - An object with either the user's PlainKey User ID or their userName.\n */\n function addPasskey(userToken: string, userIdentifier: UserIdentifier) {\n return plainKey.addPasskey(userToken, userIdentifier)\n }\n\n return {\n authenticate,\n createUserWithPasskey,\n addPasskey\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAaA,SAAgB,YAAY,WAAmB,SAAkB;CAC/D,MAAM,WAAW,IAAI,SAAS,WAAW,QAAQ;;;;;;;CAQjD,SAAS,aAAa,gBAAiC;AACrD,SAAO,SAAS,aAAa,eAAe;;;;;;;;CAS9C,SAAS,sBAAsB,UAAmB;AAChD,SAAO,SAAS,sBAAsB,SAAS;;;;;;;;;;CAWjD,SAAS,WAAW,WAAmB,gBAAgC;AACrE,SAAO,SAAS,WAAW,WAAW,eAAe;;AAGvD,QAAO;EACL;EACA;EACA;EACD"}
|