@0xsequence/guard 1.8.4 → 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.
|
@@ -464,3 +464,5 @@ exports.AuthMethod = AuthMethod;
|
|
|
464
464
|
exports.GuardSigner = GuardSigner;
|
|
465
465
|
exports.getAuthUpdateProofTypedData = getAuthUpdateProofTypedData;
|
|
466
466
|
exports.getOwnershipProofTypedData = getOwnershipProofTypedData;
|
|
467
|
+
exports.isSignedOwnershipProof = isSignedOwnershipProof;
|
|
468
|
+
exports.signOwnershipProof = signOwnershipProof;
|
|
@@ -464,3 +464,5 @@ exports.AuthMethod = AuthMethod;
|
|
|
464
464
|
exports.GuardSigner = GuardSigner;
|
|
465
465
|
exports.getAuthUpdateProofTypedData = getAuthUpdateProofTypedData;
|
|
466
466
|
exports.getOwnershipProofTypedData = getOwnershipProofTypedData;
|
|
467
|
+
exports.isSignedOwnershipProof = isSignedOwnershipProof;
|
|
468
|
+
exports.signOwnershipProof = signOwnershipProof;
|
|
@@ -456,4 +456,4 @@ function toUTCString(date) {
|
|
|
456
456
|
return date.toUTCString().replace('GMT', 'UTC');
|
|
457
457
|
}
|
|
458
458
|
|
|
459
|
-
export { AuthMethod, GuardSigner, getAuthUpdateProofTypedData, getOwnershipProofTypedData };
|
|
459
|
+
export { AuthMethod, GuardSigner, getAuthUpdateProofTypedData, getOwnershipProofTypedData, isSignedOwnershipProof, signOwnershipProof };
|
|
@@ -36,17 +36,22 @@ export declare enum AuthMethod {
|
|
|
36
36
|
PIN = "PIN",
|
|
37
37
|
TOTP = "TOTP"
|
|
38
38
|
}
|
|
39
|
-
export type
|
|
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
|
};
|
|
51
|
+
export declare function isSignedOwnershipProof(proof: OwnershipProof): proof is SignedOwnershipProof;
|
|
52
|
+
export declare function signOwnershipProof(proof: Exclude<OwnershipProof, {
|
|
53
|
+
jwt: string;
|
|
54
|
+
}>): Promise<SignedOwnershipProof>;
|
|
50
55
|
export type AuthUpdateProof = {
|
|
51
56
|
jwt: string;
|
|
52
57
|
} & ({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xsequence/guard",
|
|
3
|
-
"version": "1.8.
|
|
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.
|
|
14
|
-
"@0xsequence/core": "1.8.
|
|
15
|
-
"@0xsequence/signhub": "1.8.
|
|
16
|
-
"@0xsequence/utils": "1.8.
|
|
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
|
-
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
|
-
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 {
|