@redzone/taunt-logins 0.0.2 → 0.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redzone/taunt-logins",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "index.ts",
package/src/magic.ts CHANGED
@@ -7,24 +7,34 @@ const customNodeOptions = {
7
7
  chainId: 137
8
8
  }
9
9
 
10
- export function withMagic(magicKey: string, email: string) {
10
+ export function emailOTPWithMagic(magicKey: string, email: string) {
11
11
  const magic = new Magic(magicKey, {
12
12
  network: customNodeOptions
13
13
  })
14
14
  return magic.auth.loginWithEmailOTP({ email })
15
15
  }
16
16
 
17
- export async function loginWithMagic(
17
+ export async function tauntMagicEmailOTPLogin(
18
18
  tauntServiceEndpoint: string,
19
19
  magicKey: string,
20
20
  email: string
21
21
  ) {
22
22
  const taunt = new TauntApi(tauntServiceEndpoint)
23
23
  try {
24
- const did = await withMagic(magicKey, email)
25
- return taunt.loginWithMagicDid(did!)
24
+ const did = await emailOTPWithMagic(magicKey, email)
25
+ if (!did) throw new Error("No DID returned")
26
+ console.log("Magic email OTP login", { did })
27
+ return taunt.loginWithMagicDid(did)
26
28
  } catch (err) {
27
29
  console.error("Magic login error:", err)
28
30
  throw err
29
31
  }
30
32
  }
33
+
34
+ export async function tauntMagicDidLogin(
35
+ tauntServiceEndpoint: string,
36
+ did: string
37
+ ) {
38
+ const taunt = new TauntApi(tauntServiceEndpoint)
39
+ return taunt.loginWithMagicDid(did)
40
+ }
package/src/metamask.ts CHANGED
@@ -8,7 +8,7 @@ declare global {
8
8
  }
9
9
  }
10
10
 
11
- export async function withMetamask(
11
+ export async function tauntSignWithMetamask(
12
12
  tauntServiceEndpoint: string,
13
13
  provider?: BaseProvider
14
14
  ) {
@@ -49,12 +49,12 @@ export async function withMetamask(
49
49
  return { walletAddress, message, signature }
50
50
  }
51
51
 
52
- export async function loginWithMetamask(
52
+ export async function tauntMetamaskLogin(
53
53
  tauntServiceEndpoint: string,
54
54
  providerParam?: BaseProvider
55
55
  ) {
56
56
  const taunt = new TauntApi(tauntServiceEndpoint)
57
- const { walletAddress, message, signature } = await withMetamask(
57
+ const { walletAddress, message, signature } = await tauntSignWithMetamask(
58
58
  tauntServiceEndpoint,
59
59
  providerParam
60
60
  )