@renown/sdk 5.1.0-dev.9 → 5.1.0
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 -487
- package/dist/src/common.d.ts +1 -1
- package/dist/src/common.d.ts.map +1 -1
- package/dist/src/components/RenownLoginAvatar.d.ts +44 -0
- package/dist/src/components/RenownLoginAvatar.d.ts.map +1 -0
- package/dist/src/components/RenownLoginAvatar.js +50 -0
- package/dist/src/components/RenownLoginAvatar.js.map +1 -0
- package/dist/src/components/index.d.ts +3 -7
- package/dist/src/components/index.d.ts.map +1 -1
- package/dist/src/components/index.js +1 -4
- package/dist/src/components/index.js.map +1 -1
- package/dist/src/components/types.d.ts +12 -0
- package/dist/src/components/types.d.ts.map +1 -0
- package/dist/src/components/types.js +2 -0
- package/dist/src/components/types.js.map +1 -0
- package/dist/src/constants.d.ts +1 -1
- package/dist/src/constants.d.ts.map +1 -1
- package/dist/src/constants.js +1 -1
- package/dist/src/constants.js.map +1 -1
- package/dist/src/index.d.ts +1 -8
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -8
- package/dist/src/index.js.map +1 -1
- package/dist/src/types.d.ts +2 -3
- package/dist/src/types.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -26
- package/dist/e2e/fixtures/main.d.ts +0 -2
- package/dist/e2e/fixtures/main.d.ts.map +0 -1
- package/dist/e2e/fixtures/main.js +0 -97
- package/dist/e2e/fixtures/main.js.map +0 -1
- package/dist/e2e/fixtures/vite.config.d.ts +0 -3
- package/dist/e2e/fixtures/vite.config.d.ts.map +0 -1
- package/dist/e2e/fixtures/vite.config.js +0 -10
- package/dist/e2e/fixtures/vite.config.js.map +0 -1
- package/dist/e2e/renown-components.spec.d.ts +0 -2
- package/dist/e2e/renown-components.spec.d.ts.map +0 -1
- package/dist/e2e/renown-components.spec.js +0 -155
- package/dist/e2e/renown-components.spec.js.map +0 -1
- package/dist/playwright.config.d.ts +0 -3
- package/dist/playwright.config.d.ts.map +0 -1
- package/dist/playwright.config.js +0 -25
- package/dist/playwright.config.js.map +0 -1
- package/dist/src/assets/assets.d.ts +0 -19
- package/dist/src/assets/renown-hover.svg +0 -17
- package/dist/src/assets/renown-light.svg +0 -15
- package/dist/src/assets/renown-short-hover.png +0 -0
- package/dist/src/assets/renown-short.png +0 -0
- package/dist/src/assets/renown.svg +0 -16
- package/dist/src/components/RenownAuthButton.d.ts +0 -62
- package/dist/src/components/RenownAuthButton.d.ts.map +0 -1
- package/dist/src/components/RenownAuthButton.js +0 -82
- package/dist/src/components/RenownAuthButton.js.map +0 -1
- package/dist/src/components/RenownLoginButton.d.ts +0 -48
- package/dist/src/components/RenownLoginButton.d.ts.map +0 -1
- package/dist/src/components/RenownLoginButton.js +0 -175
- package/dist/src/components/RenownLoginButton.js.map +0 -1
- package/dist/src/components/RenownUserButton.d.ts +0 -66
- package/dist/src/components/RenownUserButton.d.ts.map +0 -1
- package/dist/src/components/RenownUserButton.js +0 -216
- package/dist/src/components/RenownUserButton.js.map +0 -1
- package/dist/src/components/icons.d.ts +0 -25
- package/dist/src/components/icons.d.ts.map +0 -1
- package/dist/src/components/icons.js +0 -24
- package/dist/src/components/icons.js.map +0 -1
- package/dist/src/components/image-data.d.ts +0 -3
- package/dist/src/components/image-data.d.ts.map +0 -1
- package/dist/src/components/image-data.js +0 -4
- package/dist/src/components/image-data.js.map +0 -1
- package/dist/src/hooks/index.d.ts +0 -2
- package/dist/src/hooks/index.d.ts.map +0 -1
- package/dist/src/hooks/index.js +0 -2
- package/dist/src/hooks/index.js.map +0 -1
- package/dist/src/hooks/use-user.d.ts +0 -21
- package/dist/src/hooks/use-user.d.ts.map +0 -1
- package/dist/src/hooks/use-user.js +0 -30
- package/dist/src/hooks/use-user.js.map +0 -1
- package/dist/src/lib/crypto/browser.d.ts +0 -8
- package/dist/src/lib/crypto/browser.d.ts.map +0 -1
- package/dist/src/lib/crypto/browser.js +0 -73
- package/dist/src/lib/crypto/browser.js.map +0 -1
- package/dist/src/lib/crypto/index.d.ts +0 -36
- package/dist/src/lib/crypto/index.d.ts.map +0 -1
- package/dist/src/lib/crypto/index.js +0 -150
- package/dist/src/lib/crypto/index.js.map +0 -1
- package/dist/src/lib/crypto/node.d.ts +0 -8
- package/dist/src/lib/crypto/node.d.ts.map +0 -1
- package/dist/src/lib/crypto/node.js +0 -67
- package/dist/src/lib/crypto/node.js.map +0 -1
- package/dist/src/lib/renown/constants.d.ts +0 -130
- package/dist/src/lib/renown/constants.d.ts.map +0 -1
- package/dist/src/lib/renown/constants.js +0 -40
- package/dist/src/lib/renown/constants.js.map +0 -1
- package/dist/src/lib/renown/did-parser.d.ts +0 -28
- package/dist/src/lib/renown/did-parser.d.ts.map +0 -1
- package/dist/src/lib/renown/did-parser.js +0 -57
- package/dist/src/lib/renown/did-parser.js.map +0 -1
- package/dist/src/lib/renown/index.d.ts +0 -4
- package/dist/src/lib/renown/index.d.ts.map +0 -1
- package/dist/src/lib/renown/index.js +0 -4
- package/dist/src/lib/renown/index.js.map +0 -1
- package/dist/src/lib/renown/utils.d.ts +0 -33
- package/dist/src/lib/renown/utils.d.ts.map +0 -1
- package/dist/src/lib/renown/utils.js +0 -207
- package/dist/src/lib/renown/utils.js.map +0 -1
- package/dist/src/lib/session-storage.d.ts +0 -40
- package/dist/src/lib/session-storage.d.ts.map +0 -1
- package/dist/src/lib/session-storage.js +0 -107
- package/dist/src/lib/session-storage.js.map +0 -1
- package/dist/src/providers/index.d.ts +0 -3
- package/dist/src/providers/index.d.ts.map +0 -1
- package/dist/src/providers/index.js +0 -2
- package/dist/src/providers/index.js.map +0 -1
- package/dist/src/providers/renown-user-provider.d.ts +0 -72
- package/dist/src/providers/renown-user-provider.d.ts.map +0 -1
- package/dist/src/providers/renown-user-provider.js +0 -171
- package/dist/src/providers/renown-user-provider.js.map +0 -1
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
export declare const RENOWN_URL = "https://www.renown.id";
|
|
2
|
-
export declare const RENOWN_NETWORK_ID = "eip155";
|
|
3
|
-
export declare const RENOWN_CHAIN_ID = "1";
|
|
4
|
-
export declare const DOMAIN_TYPE: readonly [{
|
|
5
|
-
readonly name: "name";
|
|
6
|
-
readonly type: "string";
|
|
7
|
-
}, {
|
|
8
|
-
readonly name: "version";
|
|
9
|
-
readonly type: "string";
|
|
10
|
-
}, {
|
|
11
|
-
readonly name: "chainId";
|
|
12
|
-
readonly type: "uint256";
|
|
13
|
-
}, {
|
|
14
|
-
readonly name: "verifyingContract";
|
|
15
|
-
readonly type: "address";
|
|
16
|
-
}];
|
|
17
|
-
export declare const VERIFIABLE_CREDENTIAL_EIP712_TYPE: readonly [{
|
|
18
|
-
readonly name: "@context";
|
|
19
|
-
readonly type: "string[]";
|
|
20
|
-
}, {
|
|
21
|
-
readonly name: "type";
|
|
22
|
-
readonly type: "string[]";
|
|
23
|
-
}, {
|
|
24
|
-
readonly name: "id";
|
|
25
|
-
readonly type: "string";
|
|
26
|
-
}, {
|
|
27
|
-
readonly name: "issuer";
|
|
28
|
-
readonly type: "Issuer";
|
|
29
|
-
}, {
|
|
30
|
-
readonly name: "credentialSubject";
|
|
31
|
-
readonly type: "CredentialSubject";
|
|
32
|
-
}, {
|
|
33
|
-
readonly name: "credentialSchema";
|
|
34
|
-
readonly type: "CredentialSchema";
|
|
35
|
-
}, {
|
|
36
|
-
readonly name: "issuanceDate";
|
|
37
|
-
readonly type: "string";
|
|
38
|
-
}, {
|
|
39
|
-
readonly name: "expirationDate";
|
|
40
|
-
readonly type: "string";
|
|
41
|
-
}];
|
|
42
|
-
export declare const CREDENTIAL_SCHEMA_EIP712_TYPE: readonly [{
|
|
43
|
-
readonly name: "id";
|
|
44
|
-
readonly type: "string";
|
|
45
|
-
}, {
|
|
46
|
-
readonly name: "type";
|
|
47
|
-
readonly type: "string";
|
|
48
|
-
}];
|
|
49
|
-
export declare const CREDENTIAL_SUBJECT_TYPE: readonly [{
|
|
50
|
-
readonly name: "app";
|
|
51
|
-
readonly type: "string";
|
|
52
|
-
}, {
|
|
53
|
-
readonly name: "id";
|
|
54
|
-
readonly type: "string";
|
|
55
|
-
}, {
|
|
56
|
-
readonly name: "name";
|
|
57
|
-
readonly type: "string";
|
|
58
|
-
}];
|
|
59
|
-
export declare const ISSUER_TYPE: readonly [{
|
|
60
|
-
readonly name: "id";
|
|
61
|
-
readonly type: "string";
|
|
62
|
-
}, {
|
|
63
|
-
readonly name: "ethereumAddress";
|
|
64
|
-
readonly type: "string";
|
|
65
|
-
}];
|
|
66
|
-
export declare const CREDENTIAL_TYPES: {
|
|
67
|
-
readonly EIP712Domain: readonly [{
|
|
68
|
-
readonly name: "name";
|
|
69
|
-
readonly type: "string";
|
|
70
|
-
}, {
|
|
71
|
-
readonly name: "version";
|
|
72
|
-
readonly type: "string";
|
|
73
|
-
}, {
|
|
74
|
-
readonly name: "chainId";
|
|
75
|
-
readonly type: "uint256";
|
|
76
|
-
}, {
|
|
77
|
-
readonly name: "verifyingContract";
|
|
78
|
-
readonly type: "address";
|
|
79
|
-
}];
|
|
80
|
-
readonly VerifiableCredential: readonly [{
|
|
81
|
-
readonly name: "@context";
|
|
82
|
-
readonly type: "string[]";
|
|
83
|
-
}, {
|
|
84
|
-
readonly name: "type";
|
|
85
|
-
readonly type: "string[]";
|
|
86
|
-
}, {
|
|
87
|
-
readonly name: "id";
|
|
88
|
-
readonly type: "string";
|
|
89
|
-
}, {
|
|
90
|
-
readonly name: "issuer";
|
|
91
|
-
readonly type: "Issuer";
|
|
92
|
-
}, {
|
|
93
|
-
readonly name: "credentialSubject";
|
|
94
|
-
readonly type: "CredentialSubject";
|
|
95
|
-
}, {
|
|
96
|
-
readonly name: "credentialSchema";
|
|
97
|
-
readonly type: "CredentialSchema";
|
|
98
|
-
}, {
|
|
99
|
-
readonly name: "issuanceDate";
|
|
100
|
-
readonly type: "string";
|
|
101
|
-
}, {
|
|
102
|
-
readonly name: "expirationDate";
|
|
103
|
-
readonly type: "string";
|
|
104
|
-
}];
|
|
105
|
-
readonly CredentialSchema: readonly [{
|
|
106
|
-
readonly name: "id";
|
|
107
|
-
readonly type: "string";
|
|
108
|
-
}, {
|
|
109
|
-
readonly name: "type";
|
|
110
|
-
readonly type: "string";
|
|
111
|
-
}];
|
|
112
|
-
readonly CredentialSubject: readonly [{
|
|
113
|
-
readonly name: "app";
|
|
114
|
-
readonly type: "string";
|
|
115
|
-
}, {
|
|
116
|
-
readonly name: "id";
|
|
117
|
-
readonly type: "string";
|
|
118
|
-
}, {
|
|
119
|
-
readonly name: "name";
|
|
120
|
-
readonly type: "string";
|
|
121
|
-
}];
|
|
122
|
-
readonly Issuer: readonly [{
|
|
123
|
-
readonly name: "id";
|
|
124
|
-
readonly type: "string";
|
|
125
|
-
}, {
|
|
126
|
-
readonly name: "ethereumAddress";
|
|
127
|
-
readonly type: "string";
|
|
128
|
-
}];
|
|
129
|
-
};
|
|
130
|
-
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/lib/renown/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,0BAA0B,CAAC;AAClD,eAAO,MAAM,iBAAiB,WAAW,CAAC;AAC1C,eAAO,MAAM,eAAe,MAAM,CAAC;AAEnC,eAAO,MAAM,WAAW;;;;;;;;;;;;EAKd,CAAC;AAEX,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;;;;;;;EASpC,CAAC;AAEX,eAAO,MAAM,6BAA6B;;;;;;EAGhC,CAAC;AAEX,eAAO,MAAM,uBAAuB;;;;;;;;;EAI1B,CAAC;AAEX,eAAO,MAAM,WAAW;;;;;;EAGd,CAAC;AAEX,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAMnB,CAAC"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
export const RENOWN_URL = "https://www.renown.id";
|
|
2
|
-
export const RENOWN_NETWORK_ID = "eip155";
|
|
3
|
-
export const RENOWN_CHAIN_ID = "1";
|
|
4
|
-
export const DOMAIN_TYPE = [
|
|
5
|
-
{ name: "name", type: "string" },
|
|
6
|
-
{ name: "version", type: "string" },
|
|
7
|
-
{ name: "chainId", type: "uint256" },
|
|
8
|
-
{ name: "verifyingContract", type: "address" },
|
|
9
|
-
];
|
|
10
|
-
export const VERIFIABLE_CREDENTIAL_EIP712_TYPE = [
|
|
11
|
-
{ name: "@context", type: "string[]" },
|
|
12
|
-
{ name: "type", type: "string[]" },
|
|
13
|
-
{ name: "id", type: "string" },
|
|
14
|
-
{ name: "issuer", type: "Issuer" },
|
|
15
|
-
{ name: "credentialSubject", type: "CredentialSubject" },
|
|
16
|
-
{ name: "credentialSchema", type: "CredentialSchema" },
|
|
17
|
-
{ name: "issuanceDate", type: "string" },
|
|
18
|
-
{ name: "expirationDate", type: "string" },
|
|
19
|
-
];
|
|
20
|
-
export const CREDENTIAL_SCHEMA_EIP712_TYPE = [
|
|
21
|
-
{ name: "id", type: "string" },
|
|
22
|
-
{ name: "type", type: "string" },
|
|
23
|
-
];
|
|
24
|
-
export const CREDENTIAL_SUBJECT_TYPE = [
|
|
25
|
-
{ name: "app", type: "string" },
|
|
26
|
-
{ name: "id", type: "string" },
|
|
27
|
-
{ name: "name", type: "string" },
|
|
28
|
-
];
|
|
29
|
-
export const ISSUER_TYPE = [
|
|
30
|
-
{ name: "id", type: "string" },
|
|
31
|
-
{ name: "ethereumAddress", type: "string" },
|
|
32
|
-
];
|
|
33
|
-
export const CREDENTIAL_TYPES = {
|
|
34
|
-
EIP712Domain: DOMAIN_TYPE,
|
|
35
|
-
VerifiableCredential: VERIFIABLE_CREDENTIAL_EIP712_TYPE,
|
|
36
|
-
CredentialSchema: CREDENTIAL_SCHEMA_EIP712_TYPE,
|
|
37
|
-
CredentialSubject: CREDENTIAL_SUBJECT_TYPE,
|
|
38
|
-
Issuer: ISSUER_TYPE,
|
|
39
|
-
};
|
|
40
|
-
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../src/lib/renown/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,UAAU,GAAG,uBAAuB,CAAC;AAClD,MAAM,CAAC,MAAM,iBAAiB,GAAG,QAAQ,CAAC;AAC1C,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,CAAC;AAEnC,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE;IAChC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE;IACnC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;IACpC,EAAE,IAAI,EAAE,mBAAmB,EAAE,IAAI,EAAE,SAAS,EAAE;CACtC,CAAC;AAEX,MAAM,CAAC,MAAM,iCAAiC,GAAG;IAC/C,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,EAAE;IACtC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE;IAClC,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE;IAC9B,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE;IAClC,EAAE,IAAI,EAAE,mBAAmB,EAAE,IAAI,EAAE,mBAAmB,EAAE;IACxD,EAAE,IAAI,EAAE,kBAAkB,EAAE,IAAI,EAAE,kBAAkB,EAAE;IACtD,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,QAAQ,EAAE;IACxC,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,QAAQ,EAAE;CAClC,CAAC;AAEX,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC3C,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE;IAC9B,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE;CACxB,CAAC;AAEX,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE;IAC/B,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE;IAC9B,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE;CACxB,CAAC;AAEX,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE;IAC9B,EAAE,IAAI,EAAE,iBAAiB,EAAE,IAAI,EAAE,QAAQ,EAAE;CACnC,CAAC;AAEX,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,YAAY,EAAE,WAAW;IACzB,oBAAoB,EAAE,iCAAiC;IACvD,gBAAgB,EAAE,6BAA6B;IAC/C,iBAAiB,EAAE,uBAAuB;IAC1C,MAAM,EAAE,WAAW;CACX,CAAC"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* DID parsing utilities for extracting information from DID strings
|
|
3
|
-
*/
|
|
4
|
-
export type PKHDid = {
|
|
5
|
-
networkId: string;
|
|
6
|
-
chainId: number;
|
|
7
|
-
address: `0x${string}`;
|
|
8
|
-
};
|
|
9
|
-
/**
|
|
10
|
-
* Parse a DID:pkh string to extract network, chain ID, and address information
|
|
11
|
-
* @param did - The DID string in format "did:pkh:networkId:chainId:address"
|
|
12
|
-
* @returns Parsed DID information
|
|
13
|
-
* @throws Error if the DID format is invalid
|
|
14
|
-
*/
|
|
15
|
-
export declare function parsePkhDid(did: string): PKHDid;
|
|
16
|
-
/**
|
|
17
|
-
* Extract Ethereum address from a DID:pkh string
|
|
18
|
-
* @param did - The DID string
|
|
19
|
-
* @returns Ethereum address or null if invalid
|
|
20
|
-
*/
|
|
21
|
-
export declare function extractEthAddressFromDid(did: string): `0x${string}` | null;
|
|
22
|
-
/**
|
|
23
|
-
* Extract chain ID from a DID:pkh string
|
|
24
|
-
* @param did - The DID string
|
|
25
|
-
* @returns Chain ID or null if invalid
|
|
26
|
-
*/
|
|
27
|
-
export declare function extractChainIdFromDid(did: string): number | null;
|
|
28
|
-
//# sourceMappingURL=did-parser.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"did-parser.d.ts","sourceRoot":"","sources":["../../../../src/lib/renown/did-parser.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,MAAM,MAAM,GAAG;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,KAAK,MAAM,EAAE,CAAC;CACxB,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAqB/C;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,MAAM,EAAE,GAAG,IAAI,CAO1E;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAOhE"}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* DID parsing utilities for extracting information from DID strings
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Parse a DID:pkh string to extract network, chain ID, and address information
|
|
6
|
-
* @param did - The DID string in format "did:pkh:networkId:chainId:address"
|
|
7
|
-
* @returns Parsed DID information
|
|
8
|
-
* @throws Error if the DID format is invalid
|
|
9
|
-
*/
|
|
10
|
-
export function parsePkhDid(did) {
|
|
11
|
-
const parts = did.split(":");
|
|
12
|
-
if (!did.startsWith("did:pkh:") || parts.length !== 5) {
|
|
13
|
-
throw new Error("Invalid pkh did");
|
|
14
|
-
}
|
|
15
|
-
const [, , networkId, chainIdStr, address] = parts;
|
|
16
|
-
if (!address.startsWith("0x")) {
|
|
17
|
-
throw new Error(`Invalid address: ${address}`);
|
|
18
|
-
}
|
|
19
|
-
const chainId = Number(chainIdStr);
|
|
20
|
-
if (isNaN(chainId)) {
|
|
21
|
-
throw new Error(`Invalid chain id: ${chainIdStr}`);
|
|
22
|
-
}
|
|
23
|
-
return {
|
|
24
|
-
chainId,
|
|
25
|
-
networkId,
|
|
26
|
-
address: address,
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Extract Ethereum address from a DID:pkh string
|
|
31
|
-
* @param did - The DID string
|
|
32
|
-
* @returns Ethereum address or null if invalid
|
|
33
|
-
*/
|
|
34
|
-
export function extractEthAddressFromDid(did) {
|
|
35
|
-
try {
|
|
36
|
-
const parsed = parsePkhDid(did);
|
|
37
|
-
return parsed.address;
|
|
38
|
-
}
|
|
39
|
-
catch {
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Extract chain ID from a DID:pkh string
|
|
45
|
-
* @param did - The DID string
|
|
46
|
-
* @returns Chain ID or null if invalid
|
|
47
|
-
*/
|
|
48
|
-
export function extractChainIdFromDid(did) {
|
|
49
|
-
try {
|
|
50
|
-
const parsed = parsePkhDid(did);
|
|
51
|
-
return parsed.chainId;
|
|
52
|
-
}
|
|
53
|
-
catch {
|
|
54
|
-
return null;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
//# sourceMappingURL=did-parser.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"did-parser.js","sourceRoot":"","sources":["../../../../src/lib/renown/did-parser.ts"],"names":[],"mappings":"AAAA;;GAEG;AAQH;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,GAAW;IACrC,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,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ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/renown/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { IRenown } from "@renown/sdk";
|
|
2
|
-
import type { IConnectCrypto } from "../../crypto/index.js";
|
|
3
|
-
export type LoginStatus = "initial" | "checking" | "authorized" | "not-authorized";
|
|
4
|
-
export interface User {
|
|
5
|
-
did: string;
|
|
6
|
-
address: string;
|
|
7
|
-
name?: string;
|
|
8
|
-
email?: string;
|
|
9
|
-
avatar?: string;
|
|
10
|
-
ethAddress?: string;
|
|
11
|
-
documentId?: string;
|
|
12
|
-
}
|
|
13
|
-
export declare function fetchProfileDataForUser(user: User): Promise<User>;
|
|
14
|
-
declare global {
|
|
15
|
-
interface Window {
|
|
16
|
-
renown?: IRenown;
|
|
17
|
-
reactor?: {
|
|
18
|
-
setGenerateJwtHandler: (handler: (driveUrl: string) => Promise<string>) => void;
|
|
19
|
-
removeJwtHandler: () => void;
|
|
20
|
-
};
|
|
21
|
-
connectCrypto?: IConnectCrypto;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
export declare function openRenown(documentId?: string): Promise<void>;
|
|
25
|
-
export declare function handleRenownReturn(): Promise<void>;
|
|
26
|
-
export declare function login(userDid: string | undefined, renown: IRenown | undefined, connectCrypto: IConnectCrypto | undefined): Promise<User | undefined>;
|
|
27
|
-
export declare function logout(): Promise<void>;
|
|
28
|
-
/**
|
|
29
|
-
* Re-authenticate using stored session data
|
|
30
|
-
* This allows calling renown.login without needing to go through the full auth flow again
|
|
31
|
-
*/
|
|
32
|
-
export declare function reauthenticateFromSession(): Promise<User | null>;
|
|
33
|
-
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/lib/renown/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAe5D,MAAM,MAAM,WAAW,GACnB,SAAS,GACT,UAAU,GACV,YAAY,GACZ,gBAAgB,CAAC;AAErB,MAAM,WAAW,IAAI;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAqDD,wBAAsB,uBAAuB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CA+BvE;AAGD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,MAAM,CAAC,EAAE,OAAO,CAAC;QACjB,OAAO,CAAC,EAAE;YACR,qBAAqB,EAAE,CACrB,OAAO,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,KAC3C,IAAI,CAAC;YACV,gBAAgB,EAAE,MAAM,IAAI,CAAC;SAC9B,CAAC;QACF,aAAa,CAAC,EAAE,cAAc,CAAC;KAChC;CACF;AAED,wBAAsB,UAAU,CAAC,UAAU,CAAC,EAAE,MAAM,iBAgCnD;AAGD,wBAAsB,kBAAkB,kBAkBvC;AAED,wBAAsB,KAAK,CACzB,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,MAAM,EAAE,OAAO,GAAG,SAAS,EAC3B,aAAa,EAAE,cAAc,GAAG,SAAS,6BA8D1C;AAED,wBAAsB,MAAM,kBAS3B;AAED;;;GAGG;AACH,wBAAsB,yBAAyB,IAAI,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,CAoCtE"}
|
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
import { SessionStorageManager } from "../session-storage.js";
|
|
2
|
-
import { RENOWN_CHAIN_ID, RENOWN_NETWORK_ID, RENOWN_URL } from "./constants.js";
|
|
3
|
-
import { extractEthAddressFromDid } from "./did-parser.js";
|
|
4
|
-
// Helper function to fetch user profile from renown API
|
|
5
|
-
async function fetchUserProfileFromRenown(ethAddress) {
|
|
6
|
-
try {
|
|
7
|
-
const response = await fetch(`${RENOWN_URL}/api/profile`, {
|
|
8
|
-
method: "POST",
|
|
9
|
-
headers: {
|
|
10
|
-
"Content-Type": "application/json",
|
|
11
|
-
},
|
|
12
|
-
body: JSON.stringify({
|
|
13
|
-
ethAddress,
|
|
14
|
-
}),
|
|
15
|
-
});
|
|
16
|
-
if (!response.ok) {
|
|
17
|
-
throw new Error(`HTTP error! status: ${response.status}`);
|
|
18
|
-
}
|
|
19
|
-
const result = (await response.json());
|
|
20
|
-
const profile = result.profile;
|
|
21
|
-
if (profile) {
|
|
22
|
-
return {
|
|
23
|
-
documentId: profile.documentId,
|
|
24
|
-
username: profile.username,
|
|
25
|
-
ethAddress: profile.ethAddress,
|
|
26
|
-
userImage: profile.userImage,
|
|
27
|
-
createdAt: profile.createdAt,
|
|
28
|
-
updatedAt: profile.updatedAt,
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
catch (error) {
|
|
34
|
-
console.error("Error fetching user profile from renown:", error);
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
// Helper function to fetch profile data for a user
|
|
39
|
-
export async function fetchProfileDataForUser(user) {
|
|
40
|
-
try {
|
|
41
|
-
const ethAddress = extractEthAddressFromDid(user.did);
|
|
42
|
-
if (!ethAddress) {
|
|
43
|
-
console.warn("Could not extract ETH address from DID:", user.did);
|
|
44
|
-
return user;
|
|
45
|
-
}
|
|
46
|
-
// Get profile data from renown API
|
|
47
|
-
const profile = await fetchUserProfileFromRenown(ethAddress);
|
|
48
|
-
if (profile) {
|
|
49
|
-
return {
|
|
50
|
-
...user,
|
|
51
|
-
name: profile.username || undefined,
|
|
52
|
-
avatar: profile.userImage || undefined,
|
|
53
|
-
ethAddress: profile.ethAddress || undefined,
|
|
54
|
-
documentId: profile.documentId,
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
// If no profile found, return user with ethAddress
|
|
58
|
-
return {
|
|
59
|
-
...user,
|
|
60
|
-
ethAddress,
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
catch (error) {
|
|
64
|
-
console.error("Failed to fetch profile data for user:", error);
|
|
65
|
-
return user;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
export async function openRenown(documentId) {
|
|
69
|
-
// If documentId is provided, open the profile page directly
|
|
70
|
-
if (documentId) {
|
|
71
|
-
const profileUrl = `${RENOWN_URL}/profile/${documentId}`;
|
|
72
|
-
window.open(profileUrl, "_blank")?.focus();
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
// Otherwise, open the auth flow
|
|
76
|
-
const url = new URL(RENOWN_URL);
|
|
77
|
-
// Get DID from connectCrypto if available
|
|
78
|
-
let connectDid = "";
|
|
79
|
-
if (window.connectCrypto) {
|
|
80
|
-
try {
|
|
81
|
-
connectDid = await window.connectCrypto.did();
|
|
82
|
-
}
|
|
83
|
-
catch (error) {
|
|
84
|
-
console.error("Failed to get DID from connectCrypto:", error);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
console.warn("connectCrypto not available - authentication may not be properly initialized");
|
|
89
|
-
}
|
|
90
|
-
url.searchParams.set("connect", connectDid);
|
|
91
|
-
url.searchParams.set("network", RENOWN_NETWORK_ID);
|
|
92
|
-
url.searchParams.set("chain", RENOWN_CHAIN_ID);
|
|
93
|
-
const returnUrl = new URL(window.location.pathname, window.location.origin);
|
|
94
|
-
url.searchParams.set("returnUrl", returnUrl.toJSON());
|
|
95
|
-
window.open(url, "_self")?.focus();
|
|
96
|
-
}
|
|
97
|
-
// Check for return from Renown authentication and handle login
|
|
98
|
-
export async function handleRenownReturn() {
|
|
99
|
-
if (typeof window === "undefined")
|
|
100
|
-
return;
|
|
101
|
-
const urlParams = new URLSearchParams(window.location.search);
|
|
102
|
-
const userDid = decodeURIComponent(urlParams.get("user") ?? "");
|
|
103
|
-
// If we have authentication parameters, attempt login
|
|
104
|
-
if (userDid && window.renown && window.connectCrypto) {
|
|
105
|
-
try {
|
|
106
|
-
await login(userDid, window.renown, window.connectCrypto);
|
|
107
|
-
// Clean up URL parameters
|
|
108
|
-
const cleanUrl = new URL(window.location.href);
|
|
109
|
-
cleanUrl.searchParams.delete("user");
|
|
110
|
-
window.history.replaceState({}, "", cleanUrl.toString());
|
|
111
|
-
}
|
|
112
|
-
catch (error) {
|
|
113
|
-
console.error("Failed to handle Renown return:", error);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
export async function login(userDid, renown, connectCrypto) {
|
|
118
|
-
if (!renown || !connectCrypto) {
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
// Validate that userDid is a valid pkh DID format
|
|
122
|
-
if (userDid && !userDid.startsWith("did:pkh:")) {
|
|
123
|
-
console.warn("Invalid DID format for login:", userDid, "- expected did:pkh: format");
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
try {
|
|
127
|
-
let user = renown.user instanceof Function ? renown.user() : renown.user;
|
|
128
|
-
user = user instanceof Promise ? await user : user;
|
|
129
|
-
if (user?.did && (user.did === userDid || !userDid)) {
|
|
130
|
-
// Fetch profile data for the user
|
|
131
|
-
const userWithProfile = await fetchProfileDataForUser(user);
|
|
132
|
-
// Set up JWT handler if reactor is available
|
|
133
|
-
// Store user data in sessionStorage for persistence
|
|
134
|
-
SessionStorageManager.setUserData({
|
|
135
|
-
user: userWithProfile,
|
|
136
|
-
userDid: userWithProfile.did,
|
|
137
|
-
loginStatus: "authorized",
|
|
138
|
-
timestamp: Date.now(),
|
|
139
|
-
});
|
|
140
|
-
return userWithProfile;
|
|
141
|
-
}
|
|
142
|
-
if (!userDid) {
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
145
|
-
const newUser = await renown.login(userDid ?? "");
|
|
146
|
-
if (newUser) {
|
|
147
|
-
// Fetch profile data for the user
|
|
148
|
-
const userWithProfile = await fetchProfileDataForUser(newUser);
|
|
149
|
-
// Set up JWT handler if reactor is available
|
|
150
|
-
// Store user data in sessionStorage for persistence
|
|
151
|
-
SessionStorageManager.setUserData({
|
|
152
|
-
user: userWithProfile,
|
|
153
|
-
userDid: userWithProfile.did,
|
|
154
|
-
loginStatus: "authorized",
|
|
155
|
-
timestamp: Date.now(),
|
|
156
|
-
});
|
|
157
|
-
return userWithProfile;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
catch (error) {
|
|
161
|
-
console.error("Renown login error:", error);
|
|
162
|
-
throw error;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
export async function logout() {
|
|
166
|
-
const renown = window.renown;
|
|
167
|
-
const reactor = window.reactor;
|
|
168
|
-
// Clear sessionStorage data
|
|
169
|
-
SessionStorageManager.clearUserData();
|
|
170
|
-
await renown?.logout();
|
|
171
|
-
reactor?.removeJwtHandler();
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* Re-authenticate using stored session data
|
|
175
|
-
* This allows calling renown.login without needing to go through the full auth flow again
|
|
176
|
-
*/
|
|
177
|
-
export async function reauthenticateFromSession() {
|
|
178
|
-
if (typeof window === "undefined" ||
|
|
179
|
-
!window.renown ||
|
|
180
|
-
!window.connectCrypto) {
|
|
181
|
-
return null;
|
|
182
|
-
}
|
|
183
|
-
const storedUserDid = SessionStorageManager.getStoredUserDid();
|
|
184
|
-
if (!storedUserDid) {
|
|
185
|
-
return null;
|
|
186
|
-
}
|
|
187
|
-
try {
|
|
188
|
-
await login(storedUserDid, window.renown, window.connectCrypto);
|
|
189
|
-
// Get the current user after login
|
|
190
|
-
let currentUser = window.renown.user instanceof Function
|
|
191
|
-
? window.renown.user()
|
|
192
|
-
: window.renown.user;
|
|
193
|
-
currentUser =
|
|
194
|
-
currentUser instanceof Promise ? await currentUser : currentUser;
|
|
195
|
-
if (currentUser) {
|
|
196
|
-
// Fetch profile data for the restored user
|
|
197
|
-
const userWithProfile = await fetchProfileDataForUser(currentUser);
|
|
198
|
-
return userWithProfile;
|
|
199
|
-
}
|
|
200
|
-
return null;
|
|
201
|
-
}
|
|
202
|
-
catch (error) {
|
|
203
|
-
console.error("Failed to re-authenticate from session:", error);
|
|
204
|
-
return null;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/lib/renown/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAChF,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AA4B3D,wDAAwD;AACxD,KAAK,UAAU,0BAA0B,CACvC,UAAkB;IAElB,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,UAAU,cAAc,EAAE;YACxD,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;aACnC;YACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;gBACnB,UAAU;aACX,CAAC;SACH,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,I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CAAC,MAAM,CAAC,IAAI,EAAE;YACtB,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;QACzB,WAAW;YACT,WAAW,YAAY,OAAO,CAAC,CAAC,CAAC,MAAM,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC;QAEnE,IAAI,WAAW,EAAE,CAAC;YAChB,2CAA2C;YAC3C,MAAM,eAAe,GAAG,MAAM,uBAAuB,CAAC,WAAW,CAAC,CAAC;YACnE,OAAO,eAAe,CAAC;QACzB,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,yCAAyC,EAAE,KAAK,CAAC,CAAC;QAChE,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type { User } from "./renown/utils.js";
|
|
2
|
-
export interface SessionUserData {
|
|
3
|
-
user: User;
|
|
4
|
-
userDid: string;
|
|
5
|
-
loginStatus: "authorized";
|
|
6
|
-
timestamp: number;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Session storage utilities for Renown authentication
|
|
10
|
-
* Stores user data in sessionStorage to persist across page reloads
|
|
11
|
-
* but clears when the browser session ends
|
|
12
|
-
*/
|
|
13
|
-
export declare class SessionStorageManager {
|
|
14
|
-
/**
|
|
15
|
-
* Store user authentication data in sessionStorage
|
|
16
|
-
*/
|
|
17
|
-
static setUserData(userData: SessionUserData): void;
|
|
18
|
-
/**
|
|
19
|
-
* Retrieve user authentication data from sessionStorage
|
|
20
|
-
*/
|
|
21
|
-
static getUserData(): SessionUserData | null;
|
|
22
|
-
/**
|
|
23
|
-
* Check if user data exists in sessionStorage
|
|
24
|
-
*/
|
|
25
|
-
static hasUserData(): boolean;
|
|
26
|
-
/**
|
|
27
|
-
* Clear all user authentication data from sessionStorage
|
|
28
|
-
*/
|
|
29
|
-
static clearUserData(): void;
|
|
30
|
-
/**
|
|
31
|
-
* Check if stored user data is still valid (not expired)
|
|
32
|
-
* You can implement expiration logic here if needed
|
|
33
|
-
*/
|
|
34
|
-
static isUserDataValid(userData: SessionUserData): boolean;
|
|
35
|
-
/**
|
|
36
|
-
* Get the stored user DID for easy re-authentication
|
|
37
|
-
*/
|
|
38
|
-
static getStoredUserDid(): string | null;
|
|
39
|
-
}
|
|
40
|
-
//# sourceMappingURL=session-storage.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"session-storage.d.ts","sourceRoot":"","sources":["../../../src/lib/session-storage.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAQ9C,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,IAAI,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,YAAY,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;GAIG;AACH,qBAAa,qBAAqB;IAChC;;OAEG;IACH,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI;IAmBnD;;OAEG;IACH,MAAM,CAAC,WAAW,IAAI,eAAe,GAAG,IAAI;IA8B5C;;OAEG;IACH,MAAM,CAAC,WAAW,IAAI,OAAO;IAU7B;;OAEG;IACH,MAAM,CAAC,aAAa,IAAI,IAAI;IAa5B;;;OAGG;IACH,MAAM,CAAC,eAAe,CAAC,QAAQ,EAAE,eAAe,GAAG,OAAO;IAM1D;;OAEG;IACH,MAAM,CAAC,gBAAgB,IAAI,MAAM,GAAG,IAAI;CAUzC"}
|