@renown/sdk 6.2.1-dev.0 → 6.2.1

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.
@@ -1,182 +0,0 @@
1
- import { $ as User, A as ISigner, B as PKHDid, G as RenownEvents, H as ProfileFetcher, J as RenownStorageMap, M as InternalUser, N as Issuer, V as PowerhouseVerifiableCredential, W as RenownEventEmitter, f as IRenownCrypto, g as AuthVerifiedCredential, k as IRenown, nt as VerifiedCredential, ot as MemoryStorage, p as JsonWebKeyPairStorage, q as RenownStorage, v as CreateBearerTokenOptions, z as LoginStatus } from "./signer-DYKGoYHB.js";
2
- import { Resolver } from "did-resolver";
3
-
4
- //#region src/common.d.ts
5
- declare class RenownMemoryStorage extends MemoryStorage<RenownStorageMap> {}
6
- declare class Renown implements IRenown {
7
- #private;
8
- constructor(store: RenownStorage, eventEmitter: RenownEventEmitter, crypto: IRenownCrypto, appName: string, baseUrl?: string, profileFetcher?: ProfileFetcher);
9
- get baseUrl(): string;
10
- get user(): InternalUser | undefined;
11
- get status(): LoginStatus;
12
- get signer(): ISigner;
13
- get crypto(): IRenownCrypto;
14
- get did(): `did:${string}`;
15
- get profileFetcher(): ProfileFetcher | undefined;
16
- login(userDid: string): Promise<User>;
17
- logout(): Promise<void>;
18
- on<K extends keyof RenownEvents>(event: K, listener: (data: RenownEvents[K]) => void): () => void;
19
- verifyBearerToken(token: string): Promise<false | AuthVerifiedCredential>;
20
- getBearerToken(options: CreateBearerTokenOptions): Promise<string>;
21
- }
22
- //#endregion
23
- //#region src/credential.d.ts
24
- type Hex = `0x${string}`;
25
- type TypedDataDomain = {
26
- name?: string;
27
- version?: string;
28
- chainId?: number;
29
- verifyingContract?: Hex;
30
- salt?: Hex;
31
- };
32
- type TypedDataParameter = {
33
- name: string;
34
- type: string;
35
- };
36
- /** EIP-712 domain as signed by the credential issuer. */
37
- type CredentialDomain = {
38
- version: string;
39
- chainId: number;
40
- };
41
- /** The credential body that is EIP-712 signed (everything except `proof`). */
42
- type CredentialMessage = {
43
- "@context": string[];
44
- type: string[];
45
- id: string;
46
- issuer: {
47
- id: string;
48
- ethereumAddress: Hex;
49
- };
50
- credentialSubject: {
51
- id: string;
52
- app: string;
53
- };
54
- credentialSchema: {
55
- id: string;
56
- type: string;
57
- };
58
- issuanceDate: string;
59
- expirationDate: string;
60
- };
61
- /** Typed-data signer; matches the loose shape used by wallet adapters. */
62
- type SignCredentialTypedData = (args: {
63
- domain: TypedDataDomain;
64
- types: Record<string, readonly TypedDataParameter[]>;
65
- primaryType: string;
66
- message: Record<string, unknown>;
67
- }) => Promise<Hex>;
68
- interface BuildCredentialParams {
69
- signTypedData: SignCredentialTypedData;
70
- address: Hex;
71
- chainId: number;
72
- app: string;
73
- /** Credential subject id: the app/client DID the credential delegates to. */
74
- appId: string;
75
- expiresInDays?: number;
76
- }
77
- /** Assemble a Renown delegation VC and sign it with the provided signer. */
78
- declare function buildAndSignCredential(params: BuildCredentialParams): Promise<PowerhouseVerifiableCredential>;
79
- /** Recover the address that signed a credential's EIP-712 proof. */
80
- declare function recoverCredentialSigner(credential: PowerhouseVerifiableCredential): Promise<Hex>;
81
- /** True when the proof was signed by the credential's declared issuer address. */
82
- declare function verifyCredentialSignature(credential: PowerhouseVerifiableCredential): Promise<boolean>;
83
- //#endregion
84
- //#region src/renown-builder.d.ts
85
- interface RenownBuilderOptions {
86
- appName: string;
87
- storage?: RenownStorage;
88
- eventEmitter?: RenownEventEmitter;
89
- crypto?: IRenownCrypto;
90
- keyPairStorage?: JsonWebKeyPairStorage;
91
- baseUrl?: string;
92
- profileFetcher?: ProfileFetcher;
93
- }
94
- /**
95
- * Base builder for creating Renown instances.
96
- * Use platform-specific builders (RenownBuilder from init.browser.js or init.node.js)
97
- * for pre-configured defaults.
98
- */
99
- declare class BaseRenownBuilder {
100
- #private;
101
- /**
102
- * @param appName - Application name used for signing context
103
- */
104
- constructor(appName: string);
105
- /**
106
- * Set custom storage for user data persistence.
107
- * Defaults to in-memory storage if not set.
108
- */
109
- withStorage(storage: RenownStorage): this;
110
- /**
111
- * Set custom event emitter for user state changes.
112
- * Defaults to in-memory event emitter if not set.
113
- */
114
- withEventEmitter(eventEmitter: RenownEventEmitter): this;
115
- /**
116
- * Set a pre-built crypto instance.
117
- * Either crypto or keyPairStorage must be provided.
118
- */
119
- withCrypto(crypto: IRenownCrypto): this;
120
- /**
121
- * Set key pair storage for cryptographic keys.
122
- * A crypto instance will be built from this storage.
123
- * Either crypto or keyPairStorage must be provided.
124
- */
125
- withKeyPairStorage(keyPairStorage: JsonWebKeyPairStorage): this;
126
- /**
127
- * Set the Renown server URL for credential verification.
128
- * Defaults to https://www.renown.id
129
- */
130
- withBaseUrl(baseUrl: string): this;
131
- /**
132
- * Set a profile fetcher strategy for enriching user data after login.
133
- * The fetcher receives the authenticated user and the base URL,
134
- * and returns a RenownProfile. Called in the background after each login.
135
- * Defaults to fetchRenownProfile which calls the Renown API.
136
- */
137
- withProfileFetcher(profileFetcher: ProfileFetcher): this;
138
- /**
139
- * Build and initialize the Renown instance.
140
- * If a user is stored, attempts to re-authenticate them.
141
- * @throws Error if neither crypto nor keyPairStorage is provided
142
- */
143
- build(): Promise<Renown>;
144
- /**
145
- * Create a BaseRenownBuilder from options object for a more concise API
146
- */
147
- static from(options: RenownBuilderOptions): BaseRenownBuilder;
148
- }
149
- //#endregion
150
- //#region src/profile.d.ts
151
- declare const fetchRenownProfile: ProfileFetcher;
152
- //#endregion
153
- //#region src/utils.d.ts
154
- type ILogger = {
155
- level: "verbose" | "debug" | "info" | "warn" | "error";
156
- verbose: (message: string, ...replacements: any[]) => void;
157
- debug: (message: string, ...replacements: any[]) => void;
158
- info: (message: string, ...replacements: any[]) => void;
159
- warn: (message: string, ...replacements: any[]) => void;
160
- error: (message: string, ...replacements: any[]) => void;
161
- };
162
- /**
163
- * Parse a DID:pkh string to extract network, chain ID, and address information
164
- * @param did - The DID string in format "did:pkh:networkId:chainId:address"
165
- * @returns Parsed DID information
166
- * @throws Error if the DID format is invalid
167
- */
168
- declare function parsePkhDid(did: string): PKHDid;
169
- interface VerifyAuthBearerTokenOptions {
170
- /** Expected `aud` claim. Required when verifying tokens that include an
171
- * audience claim — did-jwt rejects them otherwise with
172
- * `invalid_config: JWT audience is required but your app address has not
173
- * been configured`. Tokens minted without `aud` are unaffected. */
174
- audience?: string;
175
- }
176
- declare function verifyAuthBearerToken(jwt: string, options?: VerifyAuthBearerTokenOptions): Promise<false | AuthVerifiedCredential>;
177
- declare function assertIsAuthCredential(credential: VerifiedCredential): asserts credential is AuthVerifiedCredential;
178
- declare function createAuthBearerToken(chainId: number, networkId: string, address: string, issuer: Issuer, options?: CreateBearerTokenOptions): Promise<string>;
179
- declare const getResolver: () => Resolver;
180
- //#endregion
181
- export { verifyCredentialSignature as _, getResolver as a, fetchRenownProfile as c, BuildCredentialParams as d, CredentialDomain as f, recoverCredentialSigner as g, buildAndSignCredential as h, createAuthBearerToken as i, BaseRenownBuilder as l, SignCredentialTypedData as m, VerifyAuthBearerTokenOptions as n, parsePkhDid as o, CredentialMessage as p, assertIsAuthCredential as r, verifyAuthBearerToken as s, ILogger as t, RenownBuilderOptions as u, Renown as v, RenownMemoryStorage as y };
182
- //# sourceMappingURL=utils-D8C7f9Qs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils-D8C7f9Qs.d.ts","names":[],"sources":["../src/common.ts","../src/credential.ts","../src/renown-builder.ts","../src/profile.ts","../src/utils.ts"],"mappings":";;;;cAqBa,mBAAA,SAA4B,aAAA,CAAc,gBAAA;AAAA,cAE1C,MAAA,YAAkB,OAAA;EAAA;cAW3B,KAAA,EAAO,aAAA,EACP,YAAA,EAAc,kBAAA,EACd,MAAA,EAAQ,aAAA,EACR,OAAA,UACA,OAAA,WACA,cAAA,GAAiB,cAAA;EAAA,IAef,OAAA,CAAA;EAAA,IAIA,IAAA,CAAA,GAnB6B,YAAA;EAAA,IAuB7B,MAAA,CAAA,GAAM,WAAA;EAAA,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