@enbox/auth 0.5.0 → 0.6.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/dist/esm/auth-manager.js +94 -167
- package/dist/esm/auth-manager.js.map +1 -1
- package/dist/esm/connect/import.js +131 -0
- package/dist/esm/connect/import.js.map +1 -0
- package/dist/esm/connect/lifecycle.js +235 -0
- package/dist/esm/connect/lifecycle.js.map +1 -0
- package/dist/esm/connect/local.js +91 -0
- package/dist/esm/connect/local.js.map +1 -0
- package/dist/esm/{flows/session-restore.js → connect/restore.js} +34 -56
- package/dist/esm/connect/restore.js.map +1 -0
- package/dist/esm/{flows/wallet-connect.js → connect/wallet.js} +28 -35
- package/dist/esm/connect/wallet.js.map +1 -0
- package/dist/esm/{flows/dwn-discovery.js → discovery.js} +2 -2
- package/dist/esm/discovery.js.map +1 -0
- package/dist/esm/index.js +4 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/{flows/dwn-registration.js → registration.js} +2 -2
- package/dist/esm/registration.js.map +1 -0
- package/dist/esm/types.js +2 -0
- package/dist/esm/types.js.map +1 -1
- package/dist/esm/wallet-connect-client.js +188 -0
- package/dist/esm/wallet-connect-client.js.map +1 -0
- package/dist/types/auth-manager.d.ts +20 -6
- package/dist/types/auth-manager.d.ts.map +1 -1
- package/dist/types/connect/import.d.ts +25 -0
- package/dist/types/connect/import.d.ts.map +1 -0
- package/dist/types/connect/lifecycle.d.ts +152 -0
- package/dist/types/connect/lifecycle.d.ts.map +1 -0
- package/dist/types/connect/local.d.ts +18 -0
- package/dist/types/connect/local.d.ts.map +1 -0
- package/dist/types/connect/restore.d.ts +18 -0
- package/dist/types/connect/restore.d.ts.map +1 -0
- package/dist/types/{flows/wallet-connect.d.ts → connect/wallet.d.ts} +5 -14
- package/dist/types/connect/wallet.d.ts.map +1 -0
- package/dist/types/{flows/dwn-discovery.d.ts → discovery.d.ts} +3 -3
- package/dist/types/discovery.d.ts.map +1 -0
- package/dist/types/index.d.ts +5 -4
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/{flows/dwn-registration.d.ts → registration.d.ts} +2 -2
- package/dist/types/registration.d.ts.map +1 -0
- package/dist/types/types.d.ts +6 -3
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/wallet-connect-client.d.ts +89 -0
- package/dist/types/wallet-connect-client.d.ts.map +1 -0
- package/package.json +9 -5
- package/src/auth-manager.ts +94 -188
- package/src/connect/import.ts +148 -0
- package/src/connect/lifecycle.ts +321 -0
- package/src/connect/local.ts +101 -0
- package/src/connect/restore.ts +117 -0
- package/src/{flows/wallet-connect.ts → connect/wallet.ts} +37 -54
- package/src/{flows/dwn-discovery.ts → discovery.ts} +4 -3
- package/src/index.ts +5 -4
- package/src/{flows/dwn-registration.ts → registration.ts} +2 -2
- package/src/types.ts +7 -3
- package/src/wallet-connect-client.ts +278 -0
- package/dist/esm/flows/dwn-discovery.js.map +0 -1
- package/dist/esm/flows/dwn-registration.js.map +0 -1
- package/dist/esm/flows/import-identity.js +0 -177
- package/dist/esm/flows/import-identity.js.map +0 -1
- package/dist/esm/flows/local-connect.js +0 -158
- package/dist/esm/flows/local-connect.js.map +0 -1
- package/dist/esm/flows/session-restore.js.map +0 -1
- package/dist/esm/flows/wallet-connect.js.map +0 -1
- package/dist/esm/vault/vault-manager.js +0 -95
- package/dist/esm/vault/vault-manager.js.map +0 -1
- package/dist/types/flows/dwn-discovery.d.ts.map +0 -1
- package/dist/types/flows/dwn-registration.d.ts.map +0 -1
- package/dist/types/flows/import-identity.d.ts +0 -35
- package/dist/types/flows/import-identity.d.ts.map +0 -1
- package/dist/types/flows/local-connect.d.ts +0 -31
- package/dist/types/flows/local-connect.d.ts.map +0 -1
- package/dist/types/flows/session-restore.d.ts +0 -29
- package/dist/types/flows/session-restore.d.ts.map +0 -1
- package/dist/types/flows/wallet-connect.d.ts.map +0 -1
- package/dist/types/vault/vault-manager.d.ts +0 -57
- package/dist/types/vault/vault-manager.d.ts.map +0 -1
- package/src/flows/import-identity.ts +0 -219
- package/src/flows/local-connect.ts +0 -192
- package/src/flows/session-restore.ts +0 -155
- package/src/vault/vault-manager.ts +0 -89
|
@@ -7,26 +7,18 @@
|
|
|
7
7
|
* @module
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import { Convert } from '@enbox/common';
|
|
11
|
-
import { WalletConnect } from '@enbox/agent';
|
|
12
10
|
import type { DwnDataEncodedRecordsWriteMessage, DwnMessagesPermissionScope, DwnRecordsPermissionScope, EnboxUserAgent } from '@enbox/agent';
|
|
13
|
-
import { DwnInterface, DwnPermissionGrant } from '@enbox/agent';
|
|
14
11
|
|
|
15
|
-
import type {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
|
|
19
|
-
import
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
storage: StorageAdapter;
|
|
26
|
-
defaultSync?: SyncOption;
|
|
27
|
-
defaultDwnEndpoints?: string[];
|
|
28
|
-
registration?: RegistrationOptions;
|
|
29
|
-
}
|
|
12
|
+
import type { AuthSession } from '../identity-session.js';
|
|
13
|
+
import type { FlowContext } from './lifecycle.js';
|
|
14
|
+
import type { WalletConnectOptions } from '../types.js';
|
|
15
|
+
|
|
16
|
+
import { Convert } from '@enbox/common';
|
|
17
|
+
import { registerWithDwnEndpoints } from '../registration.js';
|
|
18
|
+
import { WalletConnect } from '../wallet-connect-client.js';
|
|
19
|
+
import { DEFAULT_DWN_ENDPOINTS, STORAGE_KEYS } from '../types.js';
|
|
20
|
+
import { DwnInterface, DwnPermissionGrant } from '@enbox/agent';
|
|
21
|
+
import { ensureVaultReady, finalizeSession, resolvePassword, startSyncIfEnabled } from './lifecycle.js';
|
|
30
22
|
|
|
31
23
|
/**
|
|
32
24
|
* Process connected grants by storing them in the local DWN as the owner.
|
|
@@ -86,7 +78,7 @@ export async function processConnectedGrants(params: {
|
|
|
86
78
|
* 3. Sets up sync and returns an AuthSession.
|
|
87
79
|
*/
|
|
88
80
|
export async function walletConnect(
|
|
89
|
-
ctx:
|
|
81
|
+
ctx: FlowContext,
|
|
90
82
|
options: WalletConnectOptions,
|
|
91
83
|
): Promise<AuthSession> {
|
|
92
84
|
const { userAgent, emitter, storage } = ctx;
|
|
@@ -99,6 +91,17 @@ export async function walletConnect(
|
|
|
99
91
|
);
|
|
100
92
|
}
|
|
101
93
|
|
|
94
|
+
// Ensure the agent is initialized and started before the relay flow.
|
|
95
|
+
const isFirstLaunch = await userAgent.firstLaunch();
|
|
96
|
+
const password = await resolvePassword(ctx, undefined, isFirstLaunch);
|
|
97
|
+
|
|
98
|
+
await ensureVaultReady({
|
|
99
|
+
userAgent,
|
|
100
|
+
emitter,
|
|
101
|
+
password,
|
|
102
|
+
isFirstLaunch,
|
|
103
|
+
});
|
|
104
|
+
|
|
102
105
|
// Run the Enbox Connect relay flow.
|
|
103
106
|
// permissionRequests are already agent-level ConnectPermissionRequest objects.
|
|
104
107
|
const result = await WalletConnect.initClient({
|
|
@@ -140,7 +143,7 @@ export async function walletConnect(
|
|
|
140
143
|
|
|
141
144
|
// Register with DWN endpoints (if registration options are provided).
|
|
142
145
|
if (ctx.registration) {
|
|
143
|
-
const dwnEndpoints = ctx.defaultDwnEndpoints ??
|
|
146
|
+
const dwnEndpoints = ctx.defaultDwnEndpoints ?? DEFAULT_DWN_ENDPOINTS;
|
|
144
147
|
await registerWithDwnEndpoints(
|
|
145
148
|
{
|
|
146
149
|
userAgent : userAgent,
|
|
@@ -184,43 +187,23 @@ export async function walletConnect(
|
|
|
184
187
|
throw new Error(`[@enbox/auth] Wallet connect failed: ${message}`);
|
|
185
188
|
}
|
|
186
189
|
|
|
187
|
-
// Start sync.
|
|
188
|
-
const syncMode = sync === undefined ? 'live' : 'poll';
|
|
189
|
-
const syncInterval = sync ?? (syncMode === 'live' ? '5m' : '2m');
|
|
190
|
-
userAgent.sync.startSync({ mode: syncMode, interval: syncInterval })
|
|
191
|
-
.catch((err: unknown) => {
|
|
192
|
-
console.error('[@enbox/auth] Sync failed:', err);
|
|
193
|
-
});
|
|
194
|
-
|
|
195
190
|
const delegateDid = delegatePortableDid.uri;
|
|
196
191
|
|
|
197
|
-
//
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
connectedDid : identity.metadata.connectedDid,
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
const session = new AuthSession({
|
|
210
|
-
agent : userAgent,
|
|
211
|
-
did : connectedDid,
|
|
192
|
+
// Start sync.
|
|
193
|
+
startSyncIfEnabled(userAgent, sync);
|
|
194
|
+
|
|
195
|
+
// Persist session info, build AuthSession, and emit lifecycle events.
|
|
196
|
+
return finalizeSession({
|
|
197
|
+
userAgent,
|
|
198
|
+
emitter,
|
|
199
|
+
storage,
|
|
200
|
+
connectedDid,
|
|
212
201
|
delegateDid,
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
session: {
|
|
219
|
-
did : session.did,
|
|
220
|
-
delegateDid,
|
|
221
|
-
identity : identityInfo,
|
|
202
|
+
identityName : identity.metadata.name,
|
|
203
|
+
identityConnectedDid : identity.metadata.connectedDid,
|
|
204
|
+
extraStorageKeys : {
|
|
205
|
+
[STORAGE_KEYS.DELEGATE_DID] : delegateDid,
|
|
206
|
+
[STORAGE_KEYS.CONNECTED_DID] : connectedDid,
|
|
222
207
|
},
|
|
223
208
|
});
|
|
224
|
-
|
|
225
|
-
return session;
|
|
226
209
|
}
|
|
@@ -30,9 +30,10 @@ import type { EnboxUserAgent } from '@enbox/agent';
|
|
|
30
30
|
import { EnboxRpcClient } from '@enbox/dwn-clients';
|
|
31
31
|
import { buildDwnConnectUrl, localDwnServerName, normalizeBaseUrl, readDwnDiscoveryPayloadFromUrl } from '@enbox/agent';
|
|
32
32
|
|
|
33
|
-
import type { AuthEventEmitter } from '
|
|
34
|
-
import {
|
|
35
|
-
|
|
33
|
+
import type { AuthEventEmitter } from './events.js';
|
|
34
|
+
import type { StorageAdapter } from './types.js';
|
|
35
|
+
|
|
36
|
+
import { STORAGE_KEYS } from './types.js';
|
|
36
37
|
|
|
37
38
|
/**
|
|
38
39
|
* Check the current page URL for a `DwnDiscoveryPayload` in the fragment.
|
package/src/index.ts
CHANGED
|
@@ -37,7 +37,6 @@
|
|
|
37
37
|
// Core classes
|
|
38
38
|
export { AuthManager } from './auth-manager.js';
|
|
39
39
|
export { AuthSession } from './identity-session.js';
|
|
40
|
-
export { VaultManager } from './vault/vault-manager.js';
|
|
41
40
|
export { AuthEventEmitter } from './events.js';
|
|
42
41
|
|
|
43
42
|
// Password providers
|
|
@@ -49,10 +48,12 @@ export type { PasswordContext } from './password-provider.js';
|
|
|
49
48
|
export { EnboxUserAgent, HdIdentityVault } from '@enbox/agent';
|
|
50
49
|
|
|
51
50
|
// Wallet-connect helpers
|
|
52
|
-
export { processConnectedGrants } from './
|
|
51
|
+
export { processConnectedGrants } from './connect/wallet.js';
|
|
52
|
+
export { WalletConnect } from './wallet-connect-client.js';
|
|
53
|
+
export type { Permission, ProtocolPermissionOptions, WalletConnectClientOptions } from './wallet-connect-client.js';
|
|
53
54
|
|
|
54
55
|
// Registration token storage helpers
|
|
55
|
-
export { loadTokensFromStorage, saveTokensToStorage } from './
|
|
56
|
+
export { loadTokensFromStorage, saveTokensToStorage } from './registration.js';
|
|
56
57
|
|
|
57
58
|
// Local DWN discovery (browser dwn:// protocol integration)
|
|
58
59
|
export {
|
|
@@ -63,7 +64,7 @@ export {
|
|
|
63
64
|
persistLocalDwnEndpoint,
|
|
64
65
|
requestLocalDwnDiscovery,
|
|
65
66
|
restoreLocalDwnEndpoint,
|
|
66
|
-
} from './
|
|
67
|
+
} from './discovery.js';
|
|
67
68
|
|
|
68
69
|
// Storage adapters
|
|
69
70
|
export { BrowserStorage, LevelStorage, MemoryStorage, createDefaultStorage } from './storage/storage.js';
|
|
@@ -15,13 +15,13 @@ import type { EnboxUserAgent } from '@enbox/agent';
|
|
|
15
15
|
|
|
16
16
|
import { DwnRegistrar } from '@enbox/dwn-clients';
|
|
17
17
|
|
|
18
|
-
import { STORAGE_KEYS } from '
|
|
18
|
+
import { STORAGE_KEYS } from './types.js';
|
|
19
19
|
|
|
20
20
|
import type {
|
|
21
21
|
RegistrationOptions,
|
|
22
22
|
RegistrationTokenData,
|
|
23
23
|
StorageAdapter,
|
|
24
|
-
} from '
|
|
24
|
+
} from './types.js';
|
|
25
25
|
|
|
26
26
|
/** @internal */
|
|
27
27
|
export interface RegistrationContext {
|
package/src/types.ts
CHANGED
|
@@ -332,9 +332,10 @@ export interface WalletConnectOptions {
|
|
|
332
332
|
/**
|
|
333
333
|
* Protocol permission requests for the wallet connect flow.
|
|
334
334
|
*
|
|
335
|
-
* Each entry is a `ConnectPermissionRequest`
|
|
336
|
-
*
|
|
337
|
-
* `WalletConnect.createPermissionRequestForProtocol()`
|
|
335
|
+
* Each entry is a `ConnectPermissionRequest` containing a
|
|
336
|
+
* `protocolDefinition` and `permissionScopes`. Use
|
|
337
|
+
* `WalletConnect.createPermissionRequestForProtocol()` from `@enbox/auth`
|
|
338
|
+
* to build these.
|
|
338
339
|
*/
|
|
339
340
|
permissionRequests: ConnectPermissionRequest[];
|
|
340
341
|
|
|
@@ -464,6 +465,9 @@ export interface StorageAdapter {
|
|
|
464
465
|
/** The insecure default password used when none is provided. */
|
|
465
466
|
export const INSECURE_DEFAULT_PASSWORD = 'insecure-static-phrase';
|
|
466
467
|
|
|
468
|
+
/** Default DWN endpoints for new identities when none are configured. */
|
|
469
|
+
export const DEFAULT_DWN_ENDPOINTS = ['https://enbox-dwn.fly.dev'];
|
|
470
|
+
|
|
467
471
|
/**
|
|
468
472
|
* Storage keys used by the auth manager for session persistence.
|
|
469
473
|
* @internal
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WalletConnect client — initiates the relay-mediated connect flow.
|
|
3
|
+
*
|
|
4
|
+
* Moved from `@enbox/agent/src/connect.ts` because `initClient` has zero
|
|
5
|
+
* coupling to agent internals (no vault, no key store, no DWN processing,
|
|
6
|
+
* no sync). Its only consumer is `auth/src/connect/wallet.ts`.
|
|
7
|
+
*
|
|
8
|
+
* The server-side counterpart (`EnboxConnectProtocol`) correctly stays in
|
|
9
|
+
* `@enbox/agent` because it uses `agent.processDwnRequest()`,
|
|
10
|
+
* `agent.sendDwnRequest()`, and `AgentPermissionsApi`.
|
|
11
|
+
*
|
|
12
|
+
* @module
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import type { ConnectPermissionRequest, DwnPermissionScope, DwnProtocolDefinition } from '@enbox/agent';
|
|
16
|
+
import type { ConnectPushedResponse, EnboxConnectResponse } from '@enbox/agent';
|
|
17
|
+
|
|
18
|
+
import { CryptoUtils } from '@enbox/crypto';
|
|
19
|
+
import { DidJwk } from '@enbox/dids';
|
|
20
|
+
import { Convert, logger } from '@enbox/common';
|
|
21
|
+
import { DwnInterfaceName, DwnMethodName } from '@enbox/dwn-sdk-js';
|
|
22
|
+
import { EnboxConnectProtocol, pollWithTtl } from '@enbox/agent';
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Options for initiating a wallet connect flow (remote, relay-mediated).
|
|
26
|
+
*
|
|
27
|
+
* This is the agent-level options type used by `initClient()`. The auth-level
|
|
28
|
+
* `WalletConnectOptions` (in `types.ts`) wraps this with additional fields
|
|
29
|
+
* like `sync`.
|
|
30
|
+
*/
|
|
31
|
+
export type WalletConnectClientOptions = {
|
|
32
|
+
/** The user-friendly name of the app, displayed in the wallet consent UI. */
|
|
33
|
+
displayName: string;
|
|
34
|
+
|
|
35
|
+
/** The URL of the connect server which relays messages between the app and wallet. */
|
|
36
|
+
connectServerUrl: string;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* The URI of the wallet app. Query params (`request_uri`, `encryption_key`)
|
|
40
|
+
* are appended and passed to `onWalletUriReady`.
|
|
41
|
+
* @example `enbox://connect` or `http://localhost:3000/`
|
|
42
|
+
*/
|
|
43
|
+
walletUri: string;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* The protocols of permissions requested, along with the definition and
|
|
47
|
+
* permission scopes for each protocol. The key is the protocol URL and
|
|
48
|
+
* the value is an object with the protocol definition and the permission scopes.
|
|
49
|
+
*/
|
|
50
|
+
permissionRequests: ConnectPermissionRequest[];
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Called with the wallet URI including query params (`request_uri`, `encryption_key`).
|
|
54
|
+
* The app should render this as a QR code or use it as a deep link.
|
|
55
|
+
*
|
|
56
|
+
* @param uri - The wallet URI with connect payload.
|
|
57
|
+
*/
|
|
58
|
+
onWalletUriReady: (uri: string) => void;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Called to collect the PIN from the user. The PIN is used as AAD
|
|
62
|
+
* when decrypting the connect response from the relay.
|
|
63
|
+
*
|
|
64
|
+
* @returns A promise that resolves to the PIN as a string.
|
|
65
|
+
*/
|
|
66
|
+
validatePin: () => Promise<string>;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Shorthand for the types of permissions that can be requested.
|
|
71
|
+
*/
|
|
72
|
+
export type Permission = 'write' | 'read' | 'delete' | 'query' | 'subscribe' | 'configure';
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* The options for creating a permission request for a given protocol.
|
|
76
|
+
*/
|
|
77
|
+
export type ProtocolPermissionOptions = {
|
|
78
|
+
/** The protocol definition for the protocol being requested */
|
|
79
|
+
definition: DwnProtocolDefinition;
|
|
80
|
+
|
|
81
|
+
/** The permissions being requested for the protocol */
|
|
82
|
+
permissions: Permission[];
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Initiates the wallet connect process. Used when a client wants to obtain
|
|
87
|
+
* a did from a provider.
|
|
88
|
+
*/
|
|
89
|
+
async function initClient({
|
|
90
|
+
displayName,
|
|
91
|
+
connectServerUrl,
|
|
92
|
+
walletUri,
|
|
93
|
+
permissionRequests,
|
|
94
|
+
onWalletUriReady,
|
|
95
|
+
validatePin,
|
|
96
|
+
}: WalletConnectClientOptions): Promise<{
|
|
97
|
+
delegateGrants: EnboxConnectResponse['delegateGrants'];
|
|
98
|
+
delegatePortableDid: EnboxConnectResponse['delegatePortableDid'];
|
|
99
|
+
connectedDid: string;
|
|
100
|
+
} | undefined> {
|
|
101
|
+
// ephemeral client did for ECDH, signing, verification
|
|
102
|
+
const clientDid = await DidJwk.create();
|
|
103
|
+
|
|
104
|
+
// TODO: properly implement PKCE. this implementation is lacking server side validations and more.
|
|
105
|
+
// https://github.com/enboxorg/enbox/issues/829
|
|
106
|
+
// Derive the code challenge based on the code verifier
|
|
107
|
+
// const { codeChallengeBytes, codeChallengeBase64Url } =
|
|
108
|
+
// await Oidc.generateCodeChallenge();
|
|
109
|
+
const encryptionKey = CryptoUtils.randomBytes(32);
|
|
110
|
+
|
|
111
|
+
// Build callback URL for the connect request.
|
|
112
|
+
const callbackEndpoint = EnboxConnectProtocol.buildConnectUrl({
|
|
113
|
+
baseURL : connectServerUrl,
|
|
114
|
+
endpoint : 'callback',
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
// Build the connect request.
|
|
118
|
+
const request = await EnboxConnectProtocol.createConnectRequest({
|
|
119
|
+
clientDid : clientDid.uri,
|
|
120
|
+
callbackUrl : callbackEndpoint,
|
|
121
|
+
permissionRequests : permissionRequests,
|
|
122
|
+
appName : displayName,
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
// Sign the request as a JWT.
|
|
126
|
+
const requestJwt = await EnboxConnectProtocol.signJwt({
|
|
127
|
+
did : clientDid,
|
|
128
|
+
data : request as unknown as Record<string, unknown>,
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
if (!requestJwt) {
|
|
132
|
+
throw new Error('Unable to sign requestObject');
|
|
133
|
+
}
|
|
134
|
+
// Encrypt the request JWT with the symmetric key.
|
|
135
|
+
const requestObjectJwe = await EnboxConnectProtocol.encryptRequest({
|
|
136
|
+
jwt: requestJwt,
|
|
137
|
+
encryptionKey,
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
const pushedAuthorizationRequestEndpoint = EnboxConnectProtocol.buildConnectUrl({
|
|
141
|
+
baseURL : connectServerUrl,
|
|
142
|
+
endpoint : 'pushedAuthorizationRequest',
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
const parResponse = await fetch(pushedAuthorizationRequestEndpoint, {
|
|
146
|
+
body : JSON.stringify({ request: requestObjectJwe }),
|
|
147
|
+
method : 'POST',
|
|
148
|
+
headers : {
|
|
149
|
+
'Content-Type': 'application/json',
|
|
150
|
+
},
|
|
151
|
+
signal: AbortSignal.timeout(30_000),
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
if (!parResponse.ok) {
|
|
155
|
+
throw new Error(`${parResponse.status}: ${parResponse.statusText}`);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const parData: ConnectPushedResponse = await parResponse.json();
|
|
159
|
+
|
|
160
|
+
// a deeplink to a compatible wallet. if the wallet scans this link it should receive
|
|
161
|
+
// a route to its Connect provider flow and the params of where to fetch the auth request.
|
|
162
|
+
logger.log(`Wallet URI: ${walletUri}`);
|
|
163
|
+
const generatedWalletUri = new URL(walletUri);
|
|
164
|
+
generatedWalletUri.searchParams.set('request_uri', parData.request_uri);
|
|
165
|
+
generatedWalletUri.searchParams.set(
|
|
166
|
+
'encryption_key',
|
|
167
|
+
Convert.uint8Array(encryptionKey).toBase64Url()
|
|
168
|
+
);
|
|
169
|
+
|
|
170
|
+
// call user's callback so they can send the URI to the wallet as they see fit
|
|
171
|
+
onWalletUriReady(generatedWalletUri.toString());
|
|
172
|
+
|
|
173
|
+
const tokenUrl = EnboxConnectProtocol.buildConnectUrl({
|
|
174
|
+
baseURL : connectServerUrl,
|
|
175
|
+
endpoint : 'token',
|
|
176
|
+
tokenParam : request.state,
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
// subscribe to receiving a response from the wallet with default TTL. receive ciphertext of {@link EnboxConnectResponse}
|
|
180
|
+
const authResponse = await pollWithTtl(() => fetch(tokenUrl, { signal: AbortSignal.timeout(30_000) }));
|
|
181
|
+
|
|
182
|
+
if (authResponse) {
|
|
183
|
+
const jwe = await authResponse?.text();
|
|
184
|
+
|
|
185
|
+
// Get the PIN from the user and use it as AAD to decrypt.
|
|
186
|
+
const pin = await validatePin();
|
|
187
|
+
const jwt = await EnboxConnectProtocol.decryptResponse(clientDid, jwe, pin);
|
|
188
|
+
const verifiedResponse = (await EnboxConnectProtocol.verifyJwt({
|
|
189
|
+
jwt,
|
|
190
|
+
})) as unknown as EnboxConnectResponse;
|
|
191
|
+
|
|
192
|
+
return {
|
|
193
|
+
delegateGrants : verifiedResponse.delegateGrants,
|
|
194
|
+
delegatePortableDid : verifiedResponse.delegatePortableDid,
|
|
195
|
+
connectedDid : verifiedResponse.providerDid,
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Creates a set of Dwn Permission Scopes to request for a given protocol.
|
|
202
|
+
*
|
|
203
|
+
* If no permissions are provided, the default is to request all relevant record permissions (write, read, delete, query, subscribe).
|
|
204
|
+
* 'configure' is not included by default, as this gives the application a lot of control over the protocol.
|
|
205
|
+
*/
|
|
206
|
+
function createPermissionRequestForProtocol({ definition, permissions }: ProtocolPermissionOptions): ConnectPermissionRequest {
|
|
207
|
+
const requests: DwnPermissionScope[] = [];
|
|
208
|
+
|
|
209
|
+
// Add the ability to query for the specific protocol
|
|
210
|
+
requests.push({
|
|
211
|
+
protocol : definition.protocol,
|
|
212
|
+
interface : DwnInterfaceName.Protocols,
|
|
213
|
+
method : DwnMethodName.Query,
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
// A Messages.Read grant is a unified scope that covers MessagesRead, MessagesSync, and MessagesSubscribe.
|
|
217
|
+
// This single grant enables sync and real-time subscriptions for the protocol.
|
|
218
|
+
requests.push({
|
|
219
|
+
protocol : definition.protocol,
|
|
220
|
+
interface : DwnInterfaceName.Messages,
|
|
221
|
+
method : DwnMethodName.Read,
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
// We also request any additional permissions the user has requested for this protocol
|
|
225
|
+
for (const permission of permissions) {
|
|
226
|
+
switch (permission) {
|
|
227
|
+
case 'write':
|
|
228
|
+
requests.push({
|
|
229
|
+
protocol : definition.protocol,
|
|
230
|
+
interface : DwnInterfaceName.Records,
|
|
231
|
+
method : DwnMethodName.Write,
|
|
232
|
+
});
|
|
233
|
+
break;
|
|
234
|
+
case 'read':
|
|
235
|
+
requests.push({
|
|
236
|
+
protocol : definition.protocol,
|
|
237
|
+
interface : DwnInterfaceName.Records,
|
|
238
|
+
method : DwnMethodName.Read,
|
|
239
|
+
});
|
|
240
|
+
break;
|
|
241
|
+
case 'delete':
|
|
242
|
+
requests.push({
|
|
243
|
+
protocol : definition.protocol,
|
|
244
|
+
interface : DwnInterfaceName.Records,
|
|
245
|
+
method : DwnMethodName.Delete,
|
|
246
|
+
});
|
|
247
|
+
break;
|
|
248
|
+
case 'query':
|
|
249
|
+
requests.push({
|
|
250
|
+
protocol : definition.protocol,
|
|
251
|
+
interface : DwnInterfaceName.Records,
|
|
252
|
+
method : DwnMethodName.Query,
|
|
253
|
+
});
|
|
254
|
+
break;
|
|
255
|
+
case 'subscribe':
|
|
256
|
+
requests.push({
|
|
257
|
+
protocol : definition.protocol,
|
|
258
|
+
interface : DwnInterfaceName.Records,
|
|
259
|
+
method : DwnMethodName.Subscribe,
|
|
260
|
+
});
|
|
261
|
+
break;
|
|
262
|
+
case 'configure':
|
|
263
|
+
requests.push({
|
|
264
|
+
protocol : definition.protocol,
|
|
265
|
+
interface : DwnInterfaceName.Protocols,
|
|
266
|
+
method : DwnMethodName.Configure,
|
|
267
|
+
});
|
|
268
|
+
break;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
return {
|
|
273
|
+
protocolDefinition : definition,
|
|
274
|
+
permissionScopes : requests,
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
export const WalletConnect = { initClient, createPermissionRequestForProtocol };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dwn-discovery.js","sourceRoot":"","sources":["../../../src/flows/dwn-discovery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;;;;;;;;;;AAIH,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,8BAA8B,EAAE,MAAM,cAAc,CAAC;AAGxH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C;;;;;;;;;;GAUG;AACH,MAAM,UAAU,8BAA8B;IAC5C,IAAI,OAAO,UAAU,CAAC,QAAQ,KAAK,WAAW,EAAE,CAAC;QAC/C,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,OAAO,GAAG,8BAA8B,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACzE,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,kEAAkE;IAClE,qDAAqD;IACrD,IAAI,OAAO,UAAU,CAAC,OAAO,KAAK,WAAW,IAAI,UAAU,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;QACjF,MAAM,QAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACxD,UAAU,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,EAAE,EAAE,EAAE,QAAQ,CAAC,CAAC;IACtD,CAAC;IAED,OAAO,OAAO,CAAC,QAAQ,CAAC;AAC1B,CAAC;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