diff options
author | Paul Frazee <pfrazee@gmail.com> | 2022-06-15 22:33:16 -0500 |
---|---|---|
committer | Paul Frazee <pfrazee@gmail.com> | 2022-06-15 22:33:16 -0500 |
commit | de87ec17d1673855fdfe2ccd125d734591969dd4 (patch) | |
tree | cc2380d8fd4bb6c97f034ed460638536c735a144 /src/platform/auth-flow.ts | |
parent | 172ed1e2cd00ace0ace07f5782daa264f7a2764f (diff) | |
download | voidsky-de87ec17d1673855fdfe2ccd125d734591969dd4.tar.zst |
Fix web build
Diffstat (limited to 'src/platform/auth-flow.ts')
-rw-r--r-- | src/platform/auth-flow.ts | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/platform/auth-flow.ts b/src/platform/auth-flow.ts new file mode 100644 index 000000000..b96fc58e9 --- /dev/null +++ b/src/platform/auth-flow.ts @@ -0,0 +1,19 @@ +import * as auth from '@adxp/auth' +import * as ucan from 'ucans' +import {makeAppUrl} from '../platform/urls' +import {ReactNativeStore} from '../state/auth' +import * as env from '../env' + +export async function requestAppUcan( + authStore: ReactNativeStore, + scope: ucan.Capability, +) { + const did = await authStore.getDid() + const returnUrl = makeAppUrl() + const fragment = auth.requestAppUcanHashFragment(did, scope, returnUrl) + const url = `${env.AUTH_LOBBY}#${fragment}` + + // @ts-ignore window is defined -prf + window.location.href = url + return false +} |