passkey-kit 0.5.6 → 0.6.1
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/cheatsheet +3 -3
- package/package.json +3 -3
- package/src/server.ts +2 -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/cheatsheet
CHANGED
|
@@ -7,9 +7,9 @@ pnpm publish --no-git-checks
|
|
|
7
7
|
# Mercury commands
|
|
8
8
|
# https://test.mercurydata.app/
|
|
9
9
|
|
|
10
|
-
export
|
|
11
|
-
mercury-cli --jwt $
|
|
12
|
-
mercury-cli --jwt $
|
|
10
|
+
export JWT=???
|
|
11
|
+
mercury-cli --jwt $JWT --local false --mainnet false deploy
|
|
12
|
+
mercury-cli --jwt $JWT --local false --mainnet false catchup --contracts "CDOWBLFYFIWXVUW46QILLAIYIWWCZ63CIRQBG3DK5PDBUVVJ4QVJX2IX" # don't forget to subscribe to the contract first
|
|
13
13
|
curl -X GET https://api.mercurydata.app/catchups/4
|
|
14
14
|
curl -X POST https://api.mercurydata.app/zephyr/execute -H "Authorization: Bearer $MERCURY_JWT" -H 'Content-Type: application/json' -d '{"mode":{"Function": {"fname": "get_signers_by_address", "arguments": "{\"address\": \"CCXIUFR243N7QWKXY44LZO3DVUXHAVBEEJWFGNGNVVB44VJXIYWVGNTR\"}"}}}'
|
|
15
15
|
curl -X POST https://api.mercurydata.app/zephyr/execute -H "Authorization: Bearer $MERCURY_JWT" -H 'Content-Type: application/json' -d '{"mode":{"Function": {"fname": "get_address_by_signer", "arguments": "{\"id\": [78,127,30,69,248,174,95,168,47,59,161,168,51,120,117,135,112,133,232,92]}"}}}'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "passkey-kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
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",
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"base64url": "^3.0.1",
|
|
15
15
|
"buffer": "^6.0.3",
|
|
16
16
|
"passkey-kit-sdk": "0.2.1",
|
|
17
|
-
"
|
|
18
|
-
"
|
|
17
|
+
"passkey-factory-sdk": "0.2.1",
|
|
18
|
+
"sac-sdk": "0.1.0"
|
|
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
|
|
|
@@ -95,6 +49,7 @@ export class PasskeyServer extends PasskeyBase {
|
|
|
95
49
|
Authorization: `Bearer ${this.mercuryJwt}`
|
|
96
50
|
},
|
|
97
51
|
body: JSON.stringify({
|
|
52
|
+
project_name: 'smart-wallets-data',
|
|
98
53
|
mode: {
|
|
99
54
|
Function: {
|
|
100
55
|
fname: "get_signers_by_address",
|
|
@@ -129,9 +84,6 @@ export class PasskeyServer extends PasskeyBase {
|
|
|
129
84
|
}
|
|
130
85
|
|
|
131
86
|
public async getContractId(keyId: string) {
|
|
132
|
-
if (this.mercuryUrl && !this.mercuryJwt)
|
|
133
|
-
await this.setMercuryJwt()
|
|
134
|
-
|
|
135
87
|
if (!this.mercuryUrl || !this.mercuryJwt)
|
|
136
88
|
return
|
|
137
89
|
|
|
@@ -142,6 +94,7 @@ export class PasskeyServer extends PasskeyBase {
|
|
|
142
94
|
Authorization: `Bearer ${this.mercuryJwt}`
|
|
143
95
|
},
|
|
144
96
|
body: JSON.stringify({
|
|
97
|
+
project_name: 'smart-wallets-data',
|
|
145
98
|
mode: {
|
|
146
99
|
Function: {
|
|
147
100
|
fname: "get_address_by_signer",
|
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;
|