@dfinity/identity
Advanced tools
Comparing version 0.8.4 to 0.8.5
@@ -22,5 +22,5 @@ import { BinaryBlob, DerEncodedBlob, PublicKey, SignIdentity } from '@dfinity/agent'; | ||
* Create an identity. | ||
* @param challenge an optional PublicKeyCredentialCreationOptions Challenge | ||
* @param credentialCreationOptions an optional CredentialCreationOptions Challenge | ||
*/ | ||
static create(challenge?: PublicKeyCredentialCreationOptions['challenge']): Promise<WebAuthnIdentity>; | ||
static create(credentialCreationOptions: CredentialCreationOptions): Promise<WebAuthnIdentity>; | ||
protected _publicKey: CosePublicKey; | ||
@@ -27,0 +27,0 @@ protected constructor(rawId: BinaryBlob, cose: BinaryBlob); |
@@ -99,6 +99,6 @@ "use strict"; | ||
* it, so we don't. | ||
* @param challenge an optional PublicKeyCredentialCreationOptions Challenge | ||
* @param credentialCreationOptions an optional CredentialCreationOptions object | ||
*/ | ||
async function _createCredential(challenge) { | ||
const creds = (await navigator.credentials.create({ | ||
async function _createCredential(credentialCreationOptions) { | ||
const creds = (await navigator.credentials.create(credentialCreationOptions !== null && credentialCreationOptions !== void 0 ? credentialCreationOptions : { | ||
publicKey: { | ||
@@ -109,11 +109,11 @@ authenticatorSelection: { | ||
attestation: 'direct', | ||
challenge: challenge !== null && challenge !== void 0 ? challenge : _createChallengeBuffer(), | ||
challenge: _createChallengeBuffer(), | ||
pubKeyCredParams: [{ type: 'public-key', alg: PubKeyCoseAlgo.ECDSA_WITH_SHA256 }], | ||
rp: { | ||
name: 'ic0.app', | ||
name: 'Internet Identity Service', | ||
}, | ||
user: { | ||
id: tweetnacl.randomBytes(16), | ||
name: 'ic0 user', | ||
displayName: 'ic0 user', | ||
name: 'Internet Identity', | ||
displayName: 'Internet Identity', | ||
}, | ||
@@ -160,6 +160,6 @@ }, | ||
* Create an identity. | ||
* @param challenge an optional PublicKeyCredentialCreationOptions Challenge | ||
* @param credentialCreationOptions an optional CredentialCreationOptions Challenge | ||
*/ | ||
static async create(challenge) { | ||
const creds = await _createCredential(challenge); | ||
static async create(credentialCreationOptions) { | ||
const creds = await _createCredential(credentialCreationOptions); | ||
if (!creds || creds.type !== 'public-key') { | ||
@@ -166,0 +166,0 @@ throw new Error('Could not create credentials.'); |
@@ -22,5 +22,5 @@ import { BinaryBlob, DerEncodedBlob, PublicKey, SignIdentity } from '@dfinity/agent'; | ||
* Create an identity. | ||
* @param challenge an optional PublicKeyCredentialCreationOptions Challenge | ||
* @param credentialCreationOptions an optional CredentialCreationOptions Challenge | ||
*/ | ||
static create(challenge?: PublicKeyCredentialCreationOptions['challenge']): Promise<WebAuthnIdentity>; | ||
static create(credentialCreationOptions: CredentialCreationOptions): Promise<WebAuthnIdentity>; | ||
protected _publicKey: CosePublicKey; | ||
@@ -27,0 +27,0 @@ protected constructor(rawId: BinaryBlob, cose: BinaryBlob); |
@@ -73,6 +73,6 @@ import { blobFromHex, blobFromUint8Array, derBlobFromBlob, SignIdentity, } from '@dfinity/agent'; | ||
* it, so we don't. | ||
* @param challenge an optional PublicKeyCredentialCreationOptions Challenge | ||
* @param credentialCreationOptions an optional CredentialCreationOptions object | ||
*/ | ||
async function _createCredential(challenge) { | ||
const creds = (await navigator.credentials.create({ | ||
async function _createCredential(credentialCreationOptions) { | ||
const creds = (await navigator.credentials.create(credentialCreationOptions !== null && credentialCreationOptions !== void 0 ? credentialCreationOptions : { | ||
publicKey: { | ||
@@ -83,11 +83,11 @@ authenticatorSelection: { | ||
attestation: 'direct', | ||
challenge: challenge !== null && challenge !== void 0 ? challenge : _createChallengeBuffer(), | ||
challenge: _createChallengeBuffer(), | ||
pubKeyCredParams: [{ type: 'public-key', alg: PubKeyCoseAlgo.ECDSA_WITH_SHA256 }], | ||
rp: { | ||
name: 'ic0.app', | ||
name: 'Internet Identity Service', | ||
}, | ||
user: { | ||
id: tweetnacl.randomBytes(16), | ||
name: 'ic0 user', | ||
displayName: 'ic0 user', | ||
name: 'Internet Identity', | ||
displayName: 'Internet Identity', | ||
}, | ||
@@ -134,6 +134,6 @@ }, | ||
* Create an identity. | ||
* @param challenge an optional PublicKeyCredentialCreationOptions Challenge | ||
* @param credentialCreationOptions an optional CredentialCreationOptions Challenge | ||
*/ | ||
static async create(challenge) { | ||
const creds = await _createCredential(challenge); | ||
static async create(credentialCreationOptions) { | ||
const creds = await _createCredential(credentialCreationOptions); | ||
if (!creds || creds.type !== 'public-key') { | ||
@@ -140,0 +140,0 @@ throw new Error('Could not create credentials.'); |
{ | ||
"name": "@dfinity/identity", | ||
"version": "0.8.4", | ||
"version": "0.8.5", | ||
"author": "DFINITY Stiftung <sdk@dfinity.org>", | ||
@@ -42,3 +42,3 @@ "license": "Apache-2.0", | ||
"dependencies": { | ||
"@dfinity/agent": "^0.8.4", | ||
"@dfinity/agent": "^0.8.5", | ||
"borc": "^2.1.1", | ||
@@ -45,0 +45,0 @@ "buffer": "^5.4.3", |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
293688
Updated@dfinity/agent@^0.8.5