@plainkey/vue 0.16.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.
@@ -0,0 +1,23 @@
1
+ import * as _plainkey_types0 from "@plainkey/types";
2
+ import { UserIdentifier } from "@plainkey/types";
3
+
4
+ //#region src/usePlainkey/index.d.ts
5
+
6
+ /**
7
+ *
8
+ * @param projectId - Your PlainKey project ID. You can find it in the PlainKey admin dashboard.
9
+ * @param baseUrl - Set by default to https://api.plainkey.io/browser. Change only for development purposes.
10
+ *
11
+ * Docs: https://plainkey.io/docs
12
+ *
13
+ * @example
14
+ * const { login, createUserWithPasskey, addPasskey } = usePlainKey("projectId")
15
+ */
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: (authenticationToken: string, userName?: string) => Promise<_plainkey_types0.AddPasskeyResult>;
20
+ };
21
+ //#endregion
22
+ export { usePlainKey };
23
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/usePlainkey/index.ts"],"sourcesContent":[],"mappings":";;;;;;;;AAaA;;;;;;;AA+BoE,iBA/BpD,WAAA,CA+BoD,SAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EAAA,MAAA,CAAA,EAAA;EAAA,YAAA,EAAA,CAAA,cAAA,CAAA,EAtB3B,cAsB2B,EAAA,GAtBb,OAsBa,CAtBb,gBAAA,CAAA,kBAAA,CAsBa;gDAZlB,QAVK,gBAAA,CAUL,2BAAA;kEAYkB,QAZlB,gBAAA,CAYkB,gBAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,54 @@
1
+ import { PlainKey } from "@plainkey/browser";
2
+
3
+ //#region src/usePlainkey/index.ts
4
+ /**
5
+ *
6
+ * @param projectId - Your PlainKey project ID. You can find it in the PlainKey admin dashboard.
7
+ * @param baseUrl - Set by default to https://api.plainkey.io/browser. Change only for development purposes.
8
+ *
9
+ * Docs: https://plainkey.io/docs
10
+ *
11
+ * @example
12
+ * const { login, createUserWithPasskey, addPasskey } = usePlainKey("projectId")
13
+ */
14
+ function usePlainKey(projectId, baseUrl) {
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 authenticationToken - The user authentication token, is returned from .authenticate() or createUserWithPasskey().
38
+ * Do NOT store it in local storage, database, etc. Always keep it in memory.
39
+ * @param userName - A stable unique identifier for the user, like an email address or username.
40
+ * If not provided, the user's stored userName will be used.
41
+ */
42
+ function addPasskey(authenticationToken, userName) {
43
+ return plainKey.addPasskey(authenticationToken, userName);
44
+ }
45
+ return {
46
+ authenticate,
47
+ createUserWithPasskey,
48
+ addPasskey
49
+ };
50
+ }
51
+
52
+ //#endregion
53
+ export { usePlainKey };
54
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/usePlainkey/index.ts"],"sourcesContent":["import { PlainKey } from \"@plainkey/browser\"\nimport type { 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/browser. 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 authenticationToken - The user authentication token, is returned from .authenticate() or createUserWithPasskey().\n * Do NOT store it in local storage, database, etc. Always keep it in memory.\n * @param userName - A stable unique identifier for the user, like an email address or username.\n * If not provided, the user's stored userName will be used.\n */\n function addPasskey(authenticationToken: string, userName?: string) {\n return plainKey.addPasskey(authenticationToken, userName)\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,qBAA6B,UAAmB;AAClE,SAAO,SAAS,WAAW,qBAAqB,SAAS;;AAG3D,QAAO;EACL;EACA;EACA;EACD"}
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@plainkey/vue",
3
+ "version": "0.16.0",
4
+ "description": "PlainKey Vue SDK. Experimental!",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "sideEffects": false,
10
+ "files": [
11
+ "dist"
12
+ ],
13
+ "exports": {
14
+ ".": "./dist/index.js",
15
+ "./package.json": "./package.json"
16
+ },
17
+ "peerDependencies": {
18
+ "vue": "^3.4.0"
19
+ },
20
+ "dependencies": {
21
+ "@plainkey/browser": "0.16.0",
22
+ "@plainkey/types": "0.16.0"
23
+ },
24
+ "scripts": {
25
+ "build": "tsdown --clean --config tsdown.config.ts",
26
+ "prepare": "npm run build",
27
+ "prepublishOnly": "npm run build"
28
+ },
29
+ "devDependencies": {
30
+ "tsdown": "^0.15.5"
31
+ },
32
+ "publishConfig": {
33
+ "access": "public"
34
+ }
35
+ }