@dfinity/authentication
Advanced tools
Comparing version 0.9.3 to 0.10.0-beta.1
import { PublicKey } from '@dfinity/agent'; | ||
import { DelegationChain } from '@dfinity/identity'; | ||
import { Principal } from '@dfinity/principal'; | ||
import { DelegationChain } from '@dfinity/identity'; | ||
/** | ||
@@ -5,0 +5,0 @@ * Options for {@link createAuthenticationRequestUrl}. All these options may be limited |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isDelegationValid = exports.createDelegationChainFromAccessToken = exports.getAccessTokenFromURL = exports.getAccessTokenFromWindow = exports.createAuthenticationRequestUrl = void 0; | ||
const identity_1 = require("@dfinity/identity"); | ||
const principal_1 = require("@dfinity/principal"); | ||
const identity_1 = require("@dfinity/identity"); | ||
const DEFAULT_IDENTITY_PROVIDER_URL = 'https://auth.ic0.app/authorize'; | ||
function toHexString(bytes) { | ||
return new Uint8Array(bytes).reduce((str, byte) => str + byte.toString(16).padStart(2, '0'), ''); | ||
} | ||
function _getDefaultLocation() { | ||
@@ -22,3 +25,3 @@ if (typeof window === 'undefined') { | ||
url.searchParams.set('response_type', 'token'); | ||
url.searchParams.set('login_hint', options.publicKey.toDer().toString('hex')); | ||
url.searchParams.set('login_hint', toHexString(options.publicKey.toDer())); | ||
url.searchParams.set('redirect_uri', (_c = options.redirectUri) !== null && _c !== void 0 ? _c : _getDefaultLocation()); | ||
@@ -25,0 +28,0 @@ url.searchParams.set('scope', options.scope |
import { PublicKey } from '@dfinity/agent'; | ||
import { DelegationChain } from '@dfinity/identity'; | ||
import { Principal } from '@dfinity/principal'; | ||
import { DelegationChain } from '@dfinity/identity'; | ||
/** | ||
@@ -5,0 +5,0 @@ * Options for {@link createAuthenticationRequestUrl}. All these options may be limited |
@@ -0,4 +1,7 @@ | ||
import { DelegationChain } from '@dfinity/identity'; | ||
import { Principal } from '@dfinity/principal'; | ||
import { DelegationChain } from '@dfinity/identity'; | ||
const DEFAULT_IDENTITY_PROVIDER_URL = 'https://auth.ic0.app/authorize'; | ||
function toHexString(bytes) { | ||
return new Uint8Array(bytes).reduce((str, byte) => str + byte.toString(16).padStart(2, '0'), ''); | ||
} | ||
function _getDefaultLocation() { | ||
@@ -19,3 +22,3 @@ if (typeof window === 'undefined') { | ||
url.searchParams.set('response_type', 'token'); | ||
url.searchParams.set('login_hint', options.publicKey.toDer().toString('hex')); | ||
url.searchParams.set('login_hint', toHexString(options.publicKey.toDer())); | ||
url.searchParams.set('redirect_uri', (_c = options.redirectUri) !== null && _c !== void 0 ? _c : _getDefaultLocation()); | ||
@@ -22,0 +25,0 @@ url.searchParams.set('scope', options.scope |
{ | ||
"name": "@dfinity/authentication", | ||
"version": "0.9.3", | ||
"version": "0.10.0-beta.1", | ||
"author": "DFINITY Stiftung <sdk@dfinity.org>", | ||
@@ -40,5 +40,5 @@ "license": "Apache-2.0", | ||
"peerDependencies": { | ||
"@dfinity/agent": "^0.9.3", | ||
"@dfinity/identity": "^0.9.3", | ||
"@dfinity/principal": "^0.9.3" | ||
"@dfinity/agent": "^0.10.0-beta.1", | ||
"@dfinity/identity": "^0.10.0-beta.1", | ||
"@dfinity/principal": "^0.10.0-beta.1" | ||
}, | ||
@@ -45,0 +45,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
213330
12
414