passkey-kit 0.5.6 → 0.6.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/README.md +1 -2
- package/package.json +3 -3
- package/src/server.ts +0 -49
- package/types/server.d.ts +0 -5
package/README.md
CHANGED
|
@@ -25,8 +25,7 @@ const account = new PasskeyServer({
|
|
|
25
25
|
launchtubeUrl: env.PUBLIC_launchtubeUrl,
|
|
26
26
|
launchtubeJwt: env.PRIVATE_launchtubeJwt,
|
|
27
27
|
mercuryUrl: env.PUBLIC_mercuryUrl,
|
|
28
|
-
|
|
29
|
-
mercuryPassword: env.PRIVATE_mercuryPassword,
|
|
28
|
+
mercuryJwt: env.PRIVATE_mercuryJwt,
|
|
30
29
|
});
|
|
31
30
|
```
|
|
32
31
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "passkey-kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "A helper library for creating and using passkey accounts on the Stellar blockchain.",
|
|
5
5
|
"author": "Tyler van der Hoeven",
|
|
6
6
|
"license": "MIT",
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
"@stellar/stellar-sdk": "12.1.0",
|
|
14
14
|
"base64url": "^3.0.1",
|
|
15
15
|
"buffer": "^6.0.3",
|
|
16
|
-
"passkey-
|
|
16
|
+
"passkey-factory-sdk": "0.2.1",
|
|
17
17
|
"sac-sdk": "0.1.0",
|
|
18
|
-
"passkey-
|
|
18
|
+
"passkey-kit-sdk": "0.2.1"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@simplewebauthn/types": "^10.0.0",
|
package/src/server.ts
CHANGED
|
@@ -7,8 +7,6 @@ export class PasskeyServer extends PasskeyBase {
|
|
|
7
7
|
public launchtubeJwt: string | undefined
|
|
8
8
|
public mercuryUrl: string | undefined
|
|
9
9
|
public mercuryJwt: string | undefined
|
|
10
|
-
public mercuryEmail: string | undefined
|
|
11
|
-
public mercuryPassword: string | undefined
|
|
12
10
|
|
|
13
11
|
constructor(options: {
|
|
14
12
|
rpcUrl?: string,
|
|
@@ -16,8 +14,6 @@ export class PasskeyServer extends PasskeyBase {
|
|
|
16
14
|
launchtubeJwt?: string,
|
|
17
15
|
mercuryUrl?: string,
|
|
18
16
|
mercuryJwt?: string,
|
|
19
|
-
mercuryEmail?: string,
|
|
20
|
-
mercuryPassword?: string
|
|
21
17
|
}) {
|
|
22
18
|
const {
|
|
23
19
|
rpcUrl,
|
|
@@ -25,8 +21,6 @@ export class PasskeyServer extends PasskeyBase {
|
|
|
25
21
|
launchtubeJwt,
|
|
26
22
|
mercuryUrl,
|
|
27
23
|
mercuryJwt,
|
|
28
|
-
mercuryEmail,
|
|
29
|
-
mercuryPassword
|
|
30
24
|
} = options
|
|
31
25
|
|
|
32
26
|
super(rpcUrl)
|
|
@@ -42,49 +36,9 @@ export class PasskeyServer extends PasskeyBase {
|
|
|
42
36
|
|
|
43
37
|
if (mercuryJwt)
|
|
44
38
|
this.mercuryJwt = mercuryJwt
|
|
45
|
-
|
|
46
|
-
if (mercuryEmail)
|
|
47
|
-
this.mercuryEmail = mercuryEmail
|
|
48
|
-
|
|
49
|
-
if (mercuryPassword)
|
|
50
|
-
this.mercuryPassword = mercuryPassword
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
public async setMercuryJwt() {
|
|
54
|
-
if (!this.mercuryUrl || !this.mercuryEmail || !this.mercuryPassword)
|
|
55
|
-
throw new Error('Mercury service not configured')
|
|
56
|
-
|
|
57
|
-
const { data: { authenticate: { jwtToken } } } = await fetch(`${this.mercuryUrl}/graphql`, {
|
|
58
|
-
method: 'POST',
|
|
59
|
-
headers: {
|
|
60
|
-
'Content-Type': 'application/json',
|
|
61
|
-
},
|
|
62
|
-
body: JSON.stringify({
|
|
63
|
-
query: `mutation {
|
|
64
|
-
authenticate(input: {
|
|
65
|
-
email: "${this.mercuryEmail}"
|
|
66
|
-
password: "${this.mercuryPassword}"
|
|
67
|
-
}) {
|
|
68
|
-
jwtToken
|
|
69
|
-
}
|
|
70
|
-
}`
|
|
71
|
-
})
|
|
72
|
-
})
|
|
73
|
-
.then(async (res) => {
|
|
74
|
-
if (res.ok)
|
|
75
|
-
return res.json()
|
|
76
|
-
|
|
77
|
-
throw await res.json()
|
|
78
|
-
})
|
|
79
|
-
|
|
80
|
-
this.mercuryJwt = jwtToken
|
|
81
|
-
return jwtToken
|
|
82
39
|
}
|
|
83
40
|
|
|
84
41
|
public async getSigners(contractId: string) {
|
|
85
|
-
if (this.rpc && this.mercuryUrl && !this.mercuryJwt)
|
|
86
|
-
await this.setMercuryJwt()
|
|
87
|
-
|
|
88
42
|
if (!this.rpc || !this.mercuryUrl || !this.mercuryJwt)
|
|
89
43
|
throw new Error('Mercury service not configured')
|
|
90
44
|
|
|
@@ -129,9 +83,6 @@ export class PasskeyServer extends PasskeyBase {
|
|
|
129
83
|
}
|
|
130
84
|
|
|
131
85
|
public async getContractId(keyId: string) {
|
|
132
|
-
if (this.mercuryUrl && !this.mercuryJwt)
|
|
133
|
-
await this.setMercuryJwt()
|
|
134
|
-
|
|
135
86
|
if (!this.mercuryUrl || !this.mercuryJwt)
|
|
136
87
|
return
|
|
137
88
|
|
package/types/server.d.ts
CHANGED
|
@@ -4,18 +4,13 @@ export declare class PasskeyServer extends PasskeyBase {
|
|
|
4
4
|
launchtubeJwt: string | undefined;
|
|
5
5
|
mercuryUrl: string | undefined;
|
|
6
6
|
mercuryJwt: string | undefined;
|
|
7
|
-
mercuryEmail: string | undefined;
|
|
8
|
-
mercuryPassword: string | undefined;
|
|
9
7
|
constructor(options: {
|
|
10
8
|
rpcUrl?: string;
|
|
11
9
|
launchtubeUrl?: string;
|
|
12
10
|
launchtubeJwt?: string;
|
|
13
11
|
mercuryUrl?: string;
|
|
14
12
|
mercuryJwt?: string;
|
|
15
|
-
mercuryEmail?: string;
|
|
16
|
-
mercuryPassword?: string;
|
|
17
13
|
});
|
|
18
|
-
setMercuryJwt(): Promise<any>;
|
|
19
14
|
getSigners(contractId: string): Promise<{
|
|
20
15
|
id: string;
|
|
21
16
|
pk: string;
|