@lit-protocol/vincent-app-sdk 0.0.7-mma → 0.0.9-mma
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 -1
- package/dist/README.md +1 -1
- package/dist/package.json +1 -2
- package/dist/src/expressMiddleware/express.js +10 -1
- package/dist/src/expressMiddleware/express.js.map +1 -1
- package/dist/src/expressMiddleware/types.d.ts +2 -2
- package/dist/src/expressMiddleware/types.d.ts.map +1 -1
- package/dist/src/jwt/accessors.d.ts +36 -3
- package/dist/src/jwt/accessors.d.ts.map +1 -1
- package/dist/src/jwt/accessors.js +60 -2
- package/dist/src/jwt/accessors.js.map +1 -1
- package/dist/src/jwt/constants.d.ts +33 -0
- package/dist/src/jwt/constants.d.ts.map +1 -0
- package/dist/src/jwt/constants.js +36 -0
- package/dist/src/jwt/constants.js.map +1 -0
- package/dist/src/jwt/core/create.d.ts +14 -19
- package/dist/src/jwt/core/create.d.ts.map +1 -1
- package/dist/src/jwt/core/create.js +78 -78
- package/dist/src/jwt/core/create.js.map +1 -1
- package/dist/src/jwt/core/decode.d.ts +3 -0
- package/dist/src/jwt/core/decode.d.ts.map +1 -0
- package/dist/src/jwt/core/decode.js +27 -0
- package/dist/src/jwt/core/decode.js.map +1 -0
- package/dist/src/jwt/core/isExpired.d.ts +3 -3
- package/dist/src/jwt/core/isExpired.d.ts.map +1 -1
- package/dist/src/jwt/core/isExpired.js +1 -1
- package/dist/src/jwt/core/isExpired.js.map +1 -1
- package/dist/src/jwt/core/utils/base64.d.ts +1 -0
- package/dist/src/jwt/core/utils/base64.d.ts.map +1 -1
- package/dist/src/jwt/core/utils/base64.js +1 -0
- package/dist/src/jwt/core/utils/base64.js.map +1 -1
- package/dist/src/jwt/core/utils/decodeJWTStr.d.ts +3 -0
- package/dist/src/jwt/core/utils/decodeJWTStr.d.ts.map +1 -0
- package/dist/src/jwt/core/utils/decodeJWTStr.js +21 -0
- package/dist/src/jwt/core/utils/decodeJWTStr.js.map +1 -0
- package/dist/src/jwt/core/utils/index.d.ts +2 -2
- package/dist/src/jwt/core/utils/index.d.ts.map +1 -1
- package/dist/src/jwt/core/utils/index.js +6 -5
- package/dist/src/jwt/core/utils/index.js.map +1 -1
- package/dist/src/jwt/core/utils/validateJWTTime.js +3 -3
- package/dist/src/jwt/core/utils/validateJWTTime.js.map +1 -1
- package/dist/src/jwt/core/utils/verifyES256KSignature.d.ts +5 -0
- package/dist/src/jwt/core/utils/verifyES256KSignature.d.ts.map +1 -0
- package/dist/src/jwt/core/utils/verifyES256KSignature.js +33 -0
- package/dist/src/jwt/core/utils/verifyES256KSignature.js.map +1 -0
- package/dist/src/jwt/core/verify.d.ts +27 -0
- package/dist/src/jwt/core/verify.d.ts.map +1 -0
- package/dist/src/jwt/core/verify.js +84 -0
- package/dist/src/jwt/core/verify.js.map +1 -0
- package/dist/src/jwt/index.d.ts +7 -7
- package/dist/src/jwt/index.d.ts.map +1 -1
- package/dist/src/jwt/index.js +20 -10
- package/dist/src/jwt/index.js.map +1 -1
- package/dist/src/jwt/typeGuards.d.ts +28 -11
- package/dist/src/jwt/typeGuards.d.ts.map +1 -1
- package/dist/src/jwt/typeGuards.js +51 -20
- package/dist/src/jwt/typeGuards.js.map +1 -1
- package/dist/src/jwt/types.d.ts +123 -49
- package/dist/src/jwt/types.d.ts.map +1 -1
- package/dist/src/utils/delegation.js +2 -2
- package/dist/src/utils/delegation.js.map +1 -1
- package/dist/src/utils/types.d.ts +1 -4
- package/dist/src/utils/types.d.ts.map +1 -1
- package/dist/src/webAuthClient/app.js +1 -1
- package/dist/src/webAuthClient/app.js.map +1 -1
- package/dist/src/webAuthClient/internal/uriHelpers.d.ts +3 -3
- package/dist/src/webAuthClient/internal/uriHelpers.d.ts.map +1 -1
- package/dist/src/webAuthClient/internal/uriHelpers.js +6 -4
- package/dist/src/webAuthClient/internal/uriHelpers.js.map +1 -1
- package/dist/src/webAuthClient/types.d.ts +8 -8
- package/dist/src/webAuthClient/types.d.ts.map +1 -1
- package/package.json +3 -4
- package/dist/src/jwt/core/utils/processJWTSignature.d.ts +0 -8
- package/dist/src/jwt/core/utils/processJWTSignature.d.ts.map +0 -1
- package/dist/src/jwt/core/utils/processJWTSignature.js +0 -14
- package/dist/src/jwt/core/utils/processJWTSignature.js.map +0 -1
- package/dist/src/jwt/core/utils/splitJWT.d.ts +0 -11
- package/dist/src/jwt/core/utils/splitJWT.d.ts.map +0 -1
- package/dist/src/jwt/core/utils/splitJWT.js +0 -21
- package/dist/src/jwt/core/utils/splitJWT.js.map +0 -1
- package/dist/src/jwt/core/validate.d.ts +0 -29
- package/dist/src/jwt/core/validate.d.ts.map +0 -1
- package/dist/src/jwt/core/validate.js +0 -143
- package/dist/src/jwt/core/validate.js.map +0 -1
package/dist/src/jwt/types.d.ts
CHANGED
|
@@ -1,82 +1,156 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Wallet } from 'ethers';
|
|
2
2
|
import type { PKPEthersWallet } from '@lit-protocol/pkp-ethers';
|
|
3
3
|
import type { IRelayPKP } from '@lit-protocol/types';
|
|
4
|
-
export
|
|
5
|
-
|
|
4
|
+
export type JWTWalletSigner = Omit<Wallet, '_signingKey' | '_mnemonic'>;
|
|
5
|
+
/** Property keys that are set by internal logic during Vincent JWT creation, so should not be in your `payload`
|
|
6
|
+
*
|
|
7
|
+
* @category Interfaces
|
|
8
|
+
*/
|
|
9
|
+
export type InternallySetPayloadKeys = 'iss' | 'sub' | 'aud' | 'iat' | 'exp' | 'publicKey' | 'role' | '__vincentJWTApiVersion';
|
|
10
|
+
type DisallowKeys<T, K extends keyof any> = {
|
|
11
|
+
[P in Exclude<keyof T, K>]: T[P];
|
|
12
|
+
} & {
|
|
13
|
+
[P in K]?: never;
|
|
14
|
+
};
|
|
15
|
+
/** Many standard payload properties are set automatically on Vincent JWTs, and will be overridden if you try to pass them
|
|
16
|
+
* in the raw `payload` when creating a new JWT.
|
|
17
|
+
*
|
|
18
|
+
* This interface identifies the keys that should not be provided in your `payload`, as they are internally managed.
|
|
19
|
+
*
|
|
20
|
+
* See {@link InternallySetPayloadKeys} for the list.
|
|
21
|
+
*
|
|
22
|
+
* @category Interfaces
|
|
23
|
+
*/
|
|
24
|
+
export type PayloadWithoutInternallySetKeys = DisallowKeys<Record<string, any>, InternallySetPayloadKeys>;
|
|
25
|
+
export interface CreateJWSConfig {
|
|
26
|
+
payload: PayloadWithoutInternallySetKeys;
|
|
27
|
+
wallet: JWTWalletSigner;
|
|
28
|
+
config: {
|
|
29
|
+
audience: string | string[];
|
|
30
|
+
expiresInMinutes: number;
|
|
31
|
+
subjectAddress?: `0x${string}`;
|
|
32
|
+
role: VincentJWTRole;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/** JWT payload properties that are shared by all Vincent JWTs
|
|
36
|
+
*
|
|
37
|
+
* @category Interfaces
|
|
38
|
+
*/
|
|
39
|
+
export interface JWTPayload {
|
|
40
|
+
iat: number;
|
|
41
|
+
exp: number;
|
|
42
|
+
iss: `0x${string}`;
|
|
43
|
+
aud: string | string[];
|
|
44
|
+
sub?: `0x${string}`;
|
|
45
|
+
nbf?: number;
|
|
46
|
+
publicKey: `0x${string}`;
|
|
47
|
+
__vincentJWTApiVersion: number;
|
|
48
|
+
[x: string]: any;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
*
|
|
52
|
+
* @category Interfaces
|
|
53
|
+
*/
|
|
54
|
+
export interface DecodedJWT {
|
|
55
|
+
header: {
|
|
56
|
+
typ: 'JWT';
|
|
57
|
+
alg: 'ES256K';
|
|
58
|
+
[x: string]: any;
|
|
59
|
+
};
|
|
6
60
|
payload: JWTPayload;
|
|
7
61
|
signature: string;
|
|
8
62
|
data: string;
|
|
9
63
|
}
|
|
10
64
|
/**
|
|
11
|
-
* Configuration interface for creating a JWT (JSON Web Token) signed by a PKP wallet.
|
|
12
|
-
* Vincent App developers will likely never need this function, as the provider of the JWT is the Vincent Connect page frontend
|
|
13
65
|
*
|
|
14
|
-
* @
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
* @property audience - The domain(s) this token is intended for (aud claim)
|
|
22
|
-
* @property authentication - The authentication method used to generate the JWT.
|
|
66
|
+
* @category Interfaces
|
|
67
|
+
*/
|
|
68
|
+
export interface PKPAuthenticationMethod {
|
|
69
|
+
type: string;
|
|
70
|
+
value?: string;
|
|
71
|
+
}
|
|
72
|
+
/** All valid Vincent JWT roles
|
|
23
73
|
*
|
|
74
|
+
* @category Interfaces
|
|
75
|
+
* */
|
|
76
|
+
export type VincentJWTRole = 'platform-user' | 'app-user' | 'app-delegatee';
|
|
77
|
+
/**
|
|
78
|
+
* @inline
|
|
79
|
+
* @category Interfaces
|
|
24
80
|
*/
|
|
25
|
-
export interface
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
payload: Record<string, unknown>;
|
|
29
|
-
expiresInMinutes: number;
|
|
30
|
-
audience: string | string[];
|
|
31
|
-
app?: {
|
|
32
|
-
id: number;
|
|
33
|
-
version: number;
|
|
34
|
-
};
|
|
35
|
-
authentication: {
|
|
36
|
-
type: string;
|
|
37
|
-
value?: string;
|
|
38
|
-
};
|
|
81
|
+
export interface VincentPKPPayload extends JWTPayload {
|
|
82
|
+
pkpInfo: IRelayPKP;
|
|
83
|
+
authentication: PKPAuthenticationMethod;
|
|
39
84
|
}
|
|
40
85
|
/**
|
|
41
|
-
* Extended payload interface for Vincent-specific JWTs.
|
|
42
|
-
*
|
|
43
|
-
* @interface BaseVincentJWTPayload
|
|
44
|
-
* @extends {JWTPayload} Extends the JWTPayload type from `did-jwt` with Vincent-specific properties
|
|
45
86
|
*
|
|
46
|
-
* @
|
|
47
|
-
|
|
87
|
+
* @category Interfaces
|
|
88
|
+
*/
|
|
89
|
+
export interface VincentJWTPlatformUser extends DecodedJWT {
|
|
90
|
+
payload: VincentPKPPayload & {
|
|
91
|
+
role: 'platform-user';
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
48
95
|
*
|
|
49
96
|
* @category Interfaces
|
|
50
97
|
*/
|
|
51
|
-
export interface
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
98
|
+
export interface VincentJWTAppUser extends DecodedJWT {
|
|
99
|
+
payload: VincentPKPPayload & {
|
|
100
|
+
role: 'app-user';
|
|
101
|
+
app: {
|
|
102
|
+
id: number;
|
|
103
|
+
version: number;
|
|
104
|
+
};
|
|
56
105
|
};
|
|
57
106
|
}
|
|
58
107
|
/**
|
|
59
|
-
* Interface representing a decoded Vincent JWT
|
|
60
108
|
*
|
|
61
|
-
* @
|
|
62
|
-
|
|
109
|
+
* @category Interfaces
|
|
110
|
+
*/
|
|
111
|
+
export interface VincentJWTDelegatee extends DecodedJWT {
|
|
112
|
+
payload: JWTPayload & {
|
|
113
|
+
role: 'app-delegatee';
|
|
114
|
+
sub?: `0x${string}`;
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
63
118
|
*
|
|
64
119
|
* @category Interfaces
|
|
65
120
|
*/
|
|
66
|
-
export
|
|
67
|
-
|
|
121
|
+
export type AnyVincentJWT = VincentJWTPlatformUser | VincentJWTAppUser | VincentJWTDelegatee;
|
|
122
|
+
interface BaseJWTParams {
|
|
123
|
+
payload?: PayloadWithoutInternallySetKeys;
|
|
124
|
+
audience: string | string[];
|
|
125
|
+
expiresInMinutes: number;
|
|
126
|
+
}
|
|
127
|
+
interface VincentPKPJWTParams extends BaseJWTParams {
|
|
128
|
+
pkpWallet: PKPEthersWallet;
|
|
129
|
+
pkpInfo: IRelayPKP;
|
|
130
|
+
authentication: PKPAuthenticationMethod;
|
|
68
131
|
}
|
|
69
|
-
/**
|
|
70
|
-
|
|
132
|
+
/**
|
|
133
|
+
*
|
|
134
|
+
* @category Interfaces
|
|
135
|
+
*/
|
|
136
|
+
export type CreatePlatformUserJWTParams = VincentPKPJWTParams;
|
|
137
|
+
/**
|
|
138
|
+
*
|
|
139
|
+
* @category Interfaces
|
|
140
|
+
*/
|
|
141
|
+
export interface CreateAppUserJWTParams extends VincentPKPJWTParams {
|
|
71
142
|
app: {
|
|
72
143
|
id: number;
|
|
73
144
|
version: number;
|
|
74
145
|
};
|
|
75
146
|
}
|
|
76
|
-
/**
|
|
147
|
+
/**
|
|
148
|
+
*
|
|
149
|
+
* @category Interfaces
|
|
77
150
|
*/
|
|
78
|
-
export interface
|
|
79
|
-
|
|
151
|
+
export interface CreateDelegateeJWTParams extends BaseJWTParams {
|
|
152
|
+
ethersWallet: Wallet;
|
|
153
|
+
subjectAddress: `0x${string}`;
|
|
80
154
|
}
|
|
81
155
|
export {};
|
|
82
156
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/jwt/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/jwt/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAErD,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,MAAM,EAAE,aAAa,GAAG,WAAW,CAAC,CAAC;AAExE;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAChC,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,WAAW,GACX,MAAM,GACN,wBAAwB,CAAC;AAE7B,KAAK,YAAY,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,GAAG,IAAI;KACzC,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACjC,GAAG;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GAAG,EAAE;QACH,EAAE,EAAE,MAAM,CAAC;QACX,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH;AAED;;;GAGG;AACH,MAAM,WAAW,wBAAyB,SAAQ,aAAa;IAC7D,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,KAAK,MAAM,EAAE,CAAC;CAC/B"}
|
|
@@ -7,12 +7,12 @@ const vincent_contracts_sdk_1 = require("@lit-protocol/vincent-contracts-sdk");
|
|
|
7
7
|
* See documentation at {@link vincent-contracts-sdk!getDelegatedPkpEthAddresses | vincent-contracts-sdk/getDelegatedPkpEthAddresses}
|
|
8
8
|
*/
|
|
9
9
|
async function getDelegatorsAgentPkpAddresses(params) {
|
|
10
|
-
const { appId, appVersion, signer,
|
|
10
|
+
const { appId, appVersion, signer, offset } = params;
|
|
11
11
|
const contractClient = (0, vincent_contracts_sdk_1.getClient)({ signer });
|
|
12
12
|
return await contractClient.getDelegatedPkpEthAddresses({
|
|
13
13
|
appId,
|
|
14
14
|
version: appVersion,
|
|
15
|
-
|
|
15
|
+
offset,
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
18
|
//# sourceMappingURL=delegation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delegation.js","sourceRoot":"","sources":["../../../src/utils/delegation.ts"],"names":[],"mappings":";;AAQA,wEASC;AAjBD,+EAAgE;AAIhE;;;GAGG;AACI,KAAK,UAAU,8BAA8B,CAAC,MAAoC;IACvF,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"delegation.js","sourceRoot":"","sources":["../../../src/utils/delegation.ts"],"names":[],"mappings":";;AAQA,wEASC;AAjBD,+EAAgE;AAIhE;;;GAGG;AACI,KAAK,UAAU,8BAA8B,CAAC,MAAoC;IACvF,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IAErD,MAAM,cAAc,GAAG,IAAA,iCAAS,EAAC,EAAE,MAAM,EAAE,CAAC,CAAC;IAC7C,OAAO,MAAM,cAAc,CAAC,2BAA2B,CAAC;QACtD,KAAK;QACL,OAAO,EAAE,UAAU;QACnB,MAAM;KACP,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/utils/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC;;;GAGG;AACH,MAAM,WAAW,4BAA4B;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/utils/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC;;;GAGG;AACH,MAAM,WAAW,4BAA4B;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -21,7 +21,7 @@ const getWebAuthClient = (appClientConfig) => {
|
|
|
21
21
|
});
|
|
22
22
|
},
|
|
23
23
|
uriContainsVincentJWT: () => uriContainsVincentJWT(window.location.href),
|
|
24
|
-
|
|
24
|
+
decodeVincentJWTFromUri: (expectedAudience) => decodeVincentJWTFromUri({
|
|
25
25
|
uri: window.location.href,
|
|
26
26
|
expectedAudience: expectedAudience,
|
|
27
27
|
requiredAppId: appId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../src/webAuthClient/app.ts"],"names":[],"mappings":";;;AAMA,2CAA0C;AAC1C,yCAAwC;AAExC,MAAM,EAAE,qBAAqB,EAAE,iBAAiB,EA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qBAAqB,EAAE,CAAC,yBAAgE,EAAE,EAAE;YAC1F,MAAM,EAAE,cAAc,EAAE,WAAW,EAAE,GAAG,yBAAyB,CAAC;YAClE,qBAAqB,CAAC;gBACpB,KAAK;gBACL,cAAc;gBACd,WAAW;aACZ,CAAC,CAAC;QACL,CAAC;QACD,qBAAqB,EAAE,GAAG,EAAE,CAAC,qBAAqB,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;QACxE,uBAAuB,EAAE,CAAC,gBAAwB,EAAE,EAAE,CACpD,uBAAuB,CAAC;YACtB,GAAG,EAAE,MAAM,CAAC,QAAQ,CAAC,IAAI;YACzB,gBAAgB,EAAE,gBAAgB;YAClC,aAAa,EAAE,KAAK;SACrB,CAAC;QACJ,uBAAuB,EAAE,GAAG,EAAE;YAC5B,MAAM,wBAAwB,GAAG,iBAAiB,CAAC;gBACjD,SAAS,EAAE,uBAAW;gBACtB,GAAG,EAAE,MAAM,CAAC,QAAQ,CAAC,IAAI;aAC1B,CAAC,CAAC;YACH,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,EAAE,QAAQ,CAAC,KAAK,EAAE,wBAAwB,CAAC,CAAC;QAC5E,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AA3BW,QAAA,gBAAgB,oBA2B3B"}
|
|
@@ -2,10 +2,10 @@ export declare const decodeVincentJWTFromUri: ({ uri, expectedAudience, required
|
|
|
2
2
|
uri: string;
|
|
3
3
|
expectedAudience: string;
|
|
4
4
|
requiredAppId: number;
|
|
5
|
-
}) => {
|
|
6
|
-
decodedJWT: import("../../jwt").
|
|
5
|
+
}) => Promise<{
|
|
6
|
+
decodedJWT: import("../../jwt").VincentJWTAppUser;
|
|
7
7
|
jwtStr: string;
|
|
8
|
-
} | null
|
|
8
|
+
} | null>;
|
|
9
9
|
export declare const uriContainsVincentJWT: (uri: string) => boolean;
|
|
10
10
|
export declare function composeConnectUrl(appId: number, redirectUri: string, connectPageUrl?: string): URL;
|
|
11
11
|
export declare const removeSearchParam: ({ paramName, uri, }: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uriHelpers.d.ts","sourceRoot":"","sources":["../../../../src/webAuthClient/internal/uriHelpers.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,uBAAuB,
|
|
1
|
+
{"version":3,"file":"uriHelpers.d.ts","sourceRoot":"","sources":["../../../../src/webAuthClient/internal/uriHelpers.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,uBAAuB,GAAU,2CAI3C;IACD,GAAG,EAAE,MAAM,CAAC;IACZ,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;CACvB;;;SAiBA,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,KAAK,MAAM,YAKhD,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM,OAK5F;AAED,eAAO,MAAM,iBAAiB,GAAI,qBAG/B;IACD,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;CACb,KAAG,MAKH,CAAC"}
|
|
@@ -2,16 +2,19 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.removeSearchParam = exports.uriContainsVincentJWT = exports.decodeVincentJWTFromUri = void 0;
|
|
4
4
|
exports.composeConnectUrl = composeConnectUrl;
|
|
5
|
-
const
|
|
5
|
+
const verify_1 = require("../../jwt/core/verify");
|
|
6
6
|
const constants_1 = require("../constants");
|
|
7
|
-
const decodeVincentJWTFromUri = ({ uri, expectedAudience, requiredAppId, }) => {
|
|
7
|
+
const decodeVincentJWTFromUri = async ({ uri, expectedAudience, requiredAppId, }) => {
|
|
8
8
|
const url = new URL(uri);
|
|
9
9
|
const jwt = url.searchParams.get(constants_1.JWT_URL_KEY);
|
|
10
10
|
if (!jwt) {
|
|
11
11
|
return null;
|
|
12
12
|
}
|
|
13
13
|
try {
|
|
14
|
-
return {
|
|
14
|
+
return {
|
|
15
|
+
decodedJWT: await (0, verify_1.verifyVincentAppUserJWT)({ jwt, expectedAudience, requiredAppId }),
|
|
16
|
+
jwtStr: jwt,
|
|
17
|
+
};
|
|
15
18
|
}
|
|
16
19
|
catch (error) {
|
|
17
20
|
// Explicitly throw if the JWT doesn't contain the required appId
|
|
@@ -31,7 +34,6 @@ function composeConnectUrl(appId, redirectUri, connectPageUrl) {
|
|
|
31
34
|
const removeSearchParam = ({ paramName, uri, }) => {
|
|
32
35
|
const url = new URL(uri);
|
|
33
36
|
url.searchParams.delete(paramName);
|
|
34
|
-
// Update the browser's history without reloading the page
|
|
35
37
|
return url.toString();
|
|
36
38
|
};
|
|
37
39
|
exports.removeSearchParam = removeSearchParam;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uriHelpers.js","sourceRoot":"","sources":["../../../../src/webAuthClient/internal/uriHelpers.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"uriHelpers.js","sourceRoot":"","sources":["../../../../src/webAuthClient/internal/uriHelpers.ts"],"names":[],"mappings":";;;AAqCA,8CAKC;AA1CD,kDAAgE;AAChE,4CAA6E;AAEtE,MAAM,uBAAuB,GAAG,KAAK,EAAE,EAC5C,GAAG,EACH,gBAAgB,EAChB,aAAa,GAKd,EAAE,EAAE;IACH,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;IACzB,MAAM,GAAG,GAAG,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,uBAAW,CAAC,CAAC;IAE9C,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,CAAC;QACH,OAAO;YACL,UAAU,EAAE,MAAM,IAAA,gCAAuB,EAAC,EAAE,GAAG,EAAE,gBAAgB,EAAE,aAAa,EAAE,CAAC;YACnF,MAAM,EAAE,GAAG;SACZ,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,iEAAiE;QACjE,MAAM,IAAI,KAAK,CAAC,yBAA0B,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC;IACvE,CAAC;AACH,CAAC,CAAC;AAzBW,QAAA,uBAAuB,2BAyBlC;AAEK,MAAM,qBAAqB,GAAG,CAAC,GAAW,EAAE,EAAE;IACnD,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;IACzB,MAAM,UAAU,GAAG,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,uBAAW,CAAC,CAAC;IAErD,OAAO,CAAC,CAAC,UAAU,CAAC;AACtB,CAAC,CAAC;AALW,QAAA,qBAAqB,yBAKhC;AAEF,SAAgB,iBAAiB,CAAC,KAAa,EAAE,WAAmB,EAAE,cAAuB;IAC3F,OAAO,IAAI,GAAG,CACZ,eAAe,MAAM,CAAC,KAAK,CAAC,wBAAwB,WAAW,EAAE,EACjE,cAAc,IAAI,4CAAgC,CACnD,CAAC;AACJ,CAAC;AAEM,MAAM,iBAAiB,GAAG,CAAC,EAChC,SAAS,EACT,GAAG,GAIJ,EAAU,EAAE;IACX,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;IACzB,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAEnC,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;AACxB,CAAC,CAAC;AAXW,QAAA,iBAAiB,qBAW5B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { VincentJWTAppUser } from '../jwt/types';
|
|
2
2
|
export interface WebAuthClientConfig {
|
|
3
3
|
appId: number;
|
|
4
4
|
}
|
|
@@ -13,7 +13,7 @@ export interface RedirectToVincentDelegationPageParams {
|
|
|
13
13
|
* The Vincent Web Application Client is used in web apps to handle interactions with the Vincent app portal.
|
|
14
14
|
*
|
|
15
15
|
* - Connect page redirection
|
|
16
|
-
* - Authentication helpers that are browser
|
|
16
|
+
* - Authentication helpers that are browser-specific
|
|
17
17
|
*
|
|
18
18
|
*/
|
|
19
19
|
export interface WebAuthClient {
|
|
@@ -24,7 +24,7 @@ export interface WebAuthClient {
|
|
|
24
24
|
*
|
|
25
25
|
* Use {@link WebAuthClient.uriContainsVincentJWT} to detect if a user has just opened your app via the Connect page
|
|
26
26
|
*
|
|
27
|
-
* Use {@link WebAuthClient.
|
|
27
|
+
* Use {@link WebAuthClient.decodeVincentJWTFromUri} to decode and verify the {@link VincentJWTAppUser} from the page URI, and store it for later usage
|
|
28
28
|
*
|
|
29
29
|
* NOTE: You must register the `redirectUri` on your Vincent app for it to be considered a valid redirect target
|
|
30
30
|
*
|
|
@@ -36,7 +36,7 @@ export interface WebAuthClient {
|
|
|
36
36
|
* // ... In your app logic:
|
|
37
37
|
* if(vincentAppClient.uriContainsVincentJWT()) {
|
|
38
38
|
* // Handle app logic for the user has just logged in
|
|
39
|
-
* const { decoded, jwtStr } = vincentAppClient.
|
|
39
|
+
* const { decoded, jwtStr } = vincentAppClient.decodeVincentJWTFromUri(EXPECTED_AUDIENCE);
|
|
40
40
|
* // Store `jwtStr` for later usage; the user is now logged in.
|
|
41
41
|
* } else {
|
|
42
42
|
* // Handle app logic for the user is already logged in (check for stored & unexpired JWT)
|
|
@@ -75,10 +75,10 @@ export interface WebAuthClient {
|
|
|
75
75
|
* @returns {decodedJWT: VincentJWTAppSpecific; jwtStr: string | null} `null` if no JWT is found, otherwise both the decoded jwt and the original JWT string is returned
|
|
76
76
|
* @throws {Error} If there was a JWT in the page URL, but it was invalid / could not be verified
|
|
77
77
|
*/
|
|
78
|
-
|
|
79
|
-
decodedJWT:
|
|
78
|
+
decodeVincentJWTFromUri: (expectedAudience: string) => Promise<{
|
|
79
|
+
decodedJWT: VincentJWTAppUser;
|
|
80
80
|
jwtStr: string;
|
|
81
|
-
} | null
|
|
81
|
+
} | null>;
|
|
82
82
|
/**
|
|
83
83
|
* Removes the Vincent connect JWT from the current window URI.
|
|
84
84
|
*
|
|
@@ -93,7 +93,7 @@ export interface WebAuthClient {
|
|
|
93
93
|
* const vincentAppClient = getWebAuthClient({ appId: MY_APP_ID });
|
|
94
94
|
*
|
|
95
95
|
* if (vincentAppClient.uriContainsVincentJWT()) {
|
|
96
|
-
* const { decodedJWT, jwtStr } = vincentAppClient.
|
|
96
|
+
* const { decodedJWT, jwtStr } = vincentAppClient.decodeVincentJWTFromUri(EXPECTED_AUDIENCE);
|
|
97
97
|
* // Store the JWT and use it for authentication
|
|
98
98
|
*
|
|
99
99
|
* // Now we can remove the JWT from the URL searchParams
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/webAuthClient/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/webAuthClient/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEtD,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,qCAAqC;IACpD,WAAW,EAAE,MAAM,CAAC;IACpB;;SAEK;IACL,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,qBAAqB,EAAE,CAAC,cAAc,EAAE,qCAAqC,KAAK,IAAI,CAAC;IAEvF;;;;;;;;;;;OAWG;IACH,qBAAqB,EAAE,MAAM,OAAO,CAAC;IAErC;;;;;;;;;;;;OAYG;IACH,uBAAuB,EAAE,CACvB,gBAAgB,EAAE,MAAM,KACrB,OAAO,CAAC;QAAE,UAAU,EAAE,iBAAiB,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC,CAAC;IAEvE;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,uBAAuB,EAAE,MAAM,IAAI,CAAC;CACrC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lit-protocol/vincent-app-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9-mma",
|
|
4
4
|
"description": "Vincent SDK for browser and backend",
|
|
5
5
|
"author": "Lit Protocol",
|
|
6
6
|
"license": "ISC",
|
|
@@ -50,12 +50,11 @@
|
|
|
50
50
|
"@lit-protocol/constants": "^7.0.8",
|
|
51
51
|
"@lit-protocol/lit-node-client": "^7.0.8",
|
|
52
52
|
"@noble/secp256k1": "^2.2.3",
|
|
53
|
-
"did-jwt": "^8.0.8",
|
|
54
53
|
"ethers": "5.8.0",
|
|
55
54
|
"tslib": "^2.8.1",
|
|
56
55
|
"zod": "3.25.64",
|
|
57
|
-
"@lit-protocol/vincent-
|
|
58
|
-
"@lit-protocol/vincent-
|
|
56
|
+
"@lit-protocol/vincent-ability-sdk": "0.0.9-mma",
|
|
57
|
+
"@lit-protocol/vincent-contracts-sdk": "0.0.9-mma"
|
|
59
58
|
},
|
|
60
59
|
"sideEffects": false,
|
|
61
60
|
"files": [
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/** Processes a JWT signature from base64url to binary
|
|
2
|
-
* @ignore
|
|
3
|
-
*
|
|
4
|
-
* @param signature - The base64url encoded signature string
|
|
5
|
-
* @returns A Uint8Array of the binary signature
|
|
6
|
-
*/
|
|
7
|
-
export declare function processJWTSignature(signature: string): Uint8Array;
|
|
8
|
-
//# sourceMappingURL=processJWTSignature.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"processJWTSignature.d.ts","sourceRoot":"","sources":["../../../../../src/jwt/core/utils/processJWTSignature.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,UAAU,CAEjE"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.processJWTSignature = processJWTSignature;
|
|
4
|
-
const base64_1 = require("./base64");
|
|
5
|
-
/** Processes a JWT signature from base64url to binary
|
|
6
|
-
* @ignore
|
|
7
|
-
*
|
|
8
|
-
* @param signature - The base64url encoded signature string
|
|
9
|
-
* @returns A Uint8Array of the binary signature
|
|
10
|
-
*/
|
|
11
|
-
function processJWTSignature(signature) {
|
|
12
|
-
return (0, base64_1.fromBase64)(signature);
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=processJWTSignature.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"processJWTSignature.js","sourceRoot":"","sources":["../../../../../src/jwt/core/utils/processJWTSignature.ts"],"names":[],"mappings":";;AAQA,kDAEC;AAVD,qCAAsC;AAEtC;;;;;GAKG;AACH,SAAgB,mBAAmB,CAAC,SAAiB;IACnD,OAAO,IAAA,mBAAU,EAAC,SAAS,CAAC,CAAC;AAC/B,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/** Splits a JWT into its signed data portion and signature
|
|
2
|
-
* @ignore
|
|
3
|
-
*
|
|
4
|
-
* @param jwt - The JWT string
|
|
5
|
-
* @returns An object with signedData and signature
|
|
6
|
-
*/
|
|
7
|
-
export declare function splitJWT(jwt: string): {
|
|
8
|
-
signedData: string;
|
|
9
|
-
signature: string;
|
|
10
|
-
};
|
|
11
|
-
//# sourceMappingURL=splitJWT.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"splitJWT.d.ts","sourceRoot":"","sources":["../../../../../src/jwt/core/utils/splitJWT.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAU/E"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.splitJWT = splitJWT;
|
|
4
|
-
const did_jwt_1 = require("did-jwt");
|
|
5
|
-
/** Splits a JWT into its signed data portion and signature
|
|
6
|
-
* @ignore
|
|
7
|
-
*
|
|
8
|
-
* @param jwt - The JWT string
|
|
9
|
-
* @returns An object with signedData and signature
|
|
10
|
-
*/
|
|
11
|
-
function splitJWT(jwt) {
|
|
12
|
-
const parts = jwt.split('.');
|
|
13
|
-
if (parts.length !== 3) {
|
|
14
|
-
throw new Error(`${did_jwt_1.JWT_ERROR.INVALID_JWT}: JWT format: must contain 3 parts separated by "."`);
|
|
15
|
-
}
|
|
16
|
-
return {
|
|
17
|
-
signedData: `${parts[0]}.${parts[1]}`,
|
|
18
|
-
signature: parts[2],
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=splitJWT.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"splitJWT.js","sourceRoot":"","sources":["../../../../../src/jwt/core/utils/splitJWT.ts"],"names":[],"mappings":";;AAQA,4BAUC;AAlBD,qCAAoC;AAEpC;;;;;GAKG;AACH,SAAgB,QAAQ,CAAC,GAAW;IAClC,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC7B,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,GAAG,mBAAS,CAAC,WAAW,qDAAqD,CAAC,CAAC;IACjG,CAAC;IAED,OAAO;QACL,UAAU,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE;QACrC,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC;KACpB,CAAC;AACJ,CAAC"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { VincentJWT, VincentJWTAppSpecific } from '../types';
|
|
2
|
-
export declare function verify({ jwt, expectedAudience, }: {
|
|
3
|
-
jwt: string;
|
|
4
|
-
expectedAudience: string;
|
|
5
|
-
requiredAppId: undefined;
|
|
6
|
-
}): VincentJWT;
|
|
7
|
-
export declare function verify({ jwt, expectedAudience, requiredAppId, }: {
|
|
8
|
-
jwt: string;
|
|
9
|
-
expectedAudience: string;
|
|
10
|
-
requiredAppId: number;
|
|
11
|
-
}): VincentJWTAppSpecific;
|
|
12
|
-
export declare function verify({ jwt, expectedAudience, requiredAppId, }: {
|
|
13
|
-
jwt: string;
|
|
14
|
-
expectedAudience: string;
|
|
15
|
-
requiredAppId: number | undefined;
|
|
16
|
-
}): VincentJWT | VincentJWTAppSpecific;
|
|
17
|
-
export declare function decode({ jwt, requiredAppId, }: {
|
|
18
|
-
jwt: string;
|
|
19
|
-
requiredAppId: undefined;
|
|
20
|
-
}): VincentJWT;
|
|
21
|
-
export declare function decode({ jwt, requiredAppId, }: {
|
|
22
|
-
jwt: string;
|
|
23
|
-
requiredAppId: number;
|
|
24
|
-
}): VincentJWTAppSpecific;
|
|
25
|
-
export declare function decode({ jwt, requiredAppId, }: {
|
|
26
|
-
jwt: string;
|
|
27
|
-
requiredAppId: number | undefined;
|
|
28
|
-
}): VincentJWT | VincentJWTAppSpecific;
|
|
29
|
-
//# sourceMappingURL=validate.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../../src/jwt/core/validate.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAMlE,wBAAgB,MAAM,CAAC,EACrB,GAAG,EACH,gBAAgB,GACjB,EAAE;IACD,GAAG,EAAE,MAAM,CAAC;IACZ,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,SA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