@0xsequence/guard 1.8.5 → 1.8.6

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.
@@ -36,31 +36,22 @@ export declare enum AuthMethod {
36
36
  PIN = "PIN",
37
37
  TOTP = "TOTP"
38
38
  }
39
- export type OwnershipProof = {
40
- jwt: string;
41
- } | {
39
+ export type SignedOwnershipProof = {
42
40
  walletAddress: string;
43
41
  timestamp: Date;
44
42
  signerAddress: string;
45
43
  signature: string;
44
+ };
45
+ export type OwnershipProof = SignedOwnershipProof | {
46
+ jwt: string;
46
47
  } | {
47
48
  walletAddress: string;
48
49
  signer: ethers.Signer | signers.SapientSigner;
49
50
  };
50
- export declare function isSignedOwnershipProof(proof: OwnershipProof): proof is {
51
- walletAddress: string;
52
- timestamp: Date;
53
- signerAddress: string;
54
- signature: string;
55
- };
51
+ export declare function isSignedOwnershipProof(proof: OwnershipProof): proof is SignedOwnershipProof;
56
52
  export declare function signOwnershipProof(proof: Exclude<OwnershipProof, {
57
53
  jwt: string;
58
- }>): Promise<{
59
- walletAddress: string;
60
- timestamp: Date;
61
- signerAddress: string;
62
- signature: string;
63
- }>;
54
+ }>): Promise<SignedOwnershipProof>;
64
55
  export type AuthUpdateProof = {
65
56
  jwt: string;
66
57
  } & ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xsequence/guard",
3
- "version": "1.8.5",
3
+ "version": "1.8.6",
4
4
  "description": "guard sub-package for Sequence",
5
5
  "repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/guard",
6
6
  "source": "src/index.ts",
@@ -10,10 +10,10 @@
10
10
  "license": "Apache-2.0",
11
11
  "dependencies": {
12
12
  "ethers": "^5.7.2",
13
- "@0xsequence/account": "1.8.5",
14
- "@0xsequence/core": "1.8.5",
15
- "@0xsequence/signhub": "1.8.5",
16
- "@0xsequence/utils": "1.8.5"
13
+ "@0xsequence/account": "1.8.6",
14
+ "@0xsequence/core": "1.8.6",
15
+ "@0xsequence/signhub": "1.8.6",
16
+ "@0xsequence/utils": "1.8.6"
17
17
  },
18
18
  "files": [
19
19
  "src",
package/src/signer.ts CHANGED
@@ -196,28 +196,26 @@ function parseAuthMethod(method: string): AuthMethod {
196
196
  }
197
197
  }
198
198
 
199
+ export type SignedOwnershipProof = {
200
+ walletAddress: string
201
+ timestamp: Date
202
+ signerAddress: string
203
+ signature: string
204
+ }
205
+
199
206
  export type OwnershipProof =
207
+ | SignedOwnershipProof
200
208
  | { jwt: string }
201
- | {
202
- walletAddress: string
203
- timestamp: Date
204
- signerAddress: string
205
- signature: string
206
- }
207
209
  | {
208
210
  walletAddress: string
209
211
  signer: ethers.Signer | signers.SapientSigner
210
212
  }
211
213
 
212
- export function isSignedOwnershipProof(
213
- proof: OwnershipProof
214
- ): proof is { walletAddress: string; timestamp: Date; signerAddress: string; signature: string } {
214
+ export function isSignedOwnershipProof(proof: OwnershipProof): proof is SignedOwnershipProof {
215
215
  return 'signerAddress' in proof && typeof proof.signerAddress === 'string'
216
216
  }
217
217
 
218
- export async function signOwnershipProof(
219
- proof: Exclude<OwnershipProof, { jwt: string }>
220
- ): Promise<{ walletAddress: string; timestamp: Date; signerAddress: string; signature: string }> {
218
+ export async function signOwnershipProof(proof: Exclude<OwnershipProof, { jwt: string }>): Promise<SignedOwnershipProof> {
221
219
  if (isSignedOwnershipProof(proof)) {
222
220
  return proof
223
221
  } else {