Socket
Socket
Sign inDemoInstall

@dfinity/identity

Package Overview
Dependencies
Maintainers
11
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dfinity/identity - npm Package Compare versions

Comparing version 0.15.4 to 0.15.5

12

lib/cjs/identity/webauthn.d.ts

@@ -15,2 +15,3 @@ import { DerEncodedPublicKey, PublicKey, Signature, SignIdentity } from '@dfinity/agent';

readonly rawId: ArrayBuffer;
protected authenticatorAttachment: AuthenticatorAttachment | undefined;
/**

@@ -27,4 +28,13 @@ * Create an identity from a JSON serialization.

protected _publicKey: CosePublicKey;
protected constructor(rawId: ArrayBuffer, cose: ArrayBuffer);
constructor(rawId: ArrayBuffer, cose: ArrayBuffer, authenticatorAttachment: AuthenticatorAttachment | undefined);
getPublicKey(): PublicKey;
/**
* WebAuthn level 3 spec introduces a new attribute on successful WebAuthn interactions,
* see https://w3c.github.io/webauthn/#dom-publickeycredential-authenticatorattachment.
* This attribute is already implemented for Chrome, Safari and Edge.
*
* Given the attribute is only available after a successful interaction, the information is
* provided opportunistically and might also be `undefined`.
*/
getAuthenticatorAttachment(): AuthenticatorAttachment | undefined;
sign(blob: ArrayBuffer): Promise<Signature>;

@@ -31,0 +41,0 @@ /**

@@ -132,5 +132,6 @@ "use strict";

class WebAuthnIdentity extends agent_1.SignIdentity {
constructor(rawId, cose) {
constructor(rawId, cose, authenticatorAttachment) {
super();
this.rawId = rawId;
this.authenticatorAttachment = authenticatorAttachment;
this._publicKey = new CosePublicKey(cose);

@@ -147,3 +148,3 @@ }

}
return new this((0, buffer_1.fromHexString)(rawId), (0, buffer_1.fromHexString)(publicKey));
return new this((0, buffer_1.fromHexString)(rawId), (0, buffer_1.fromHexString)(publicKey), undefined);
}

@@ -155,2 +156,3 @@ /**

static async create(credentialCreationOptions) {
var _a;
const creds = await _createCredential(credentialCreationOptions);

@@ -166,3 +168,3 @@ if (!creds || creds.type !== 'public-key') {

const attObject = borc_1.default.decodeFirst(new Uint8Array(response.attestationObject));
return new this(creds.rawId, _authDataToCose(attObject.authData));
return new this(creds.rawId, _authDataToCose(attObject.authData), (_a = creds.authenticatorAttachment) !== null && _a !== void 0 ? _a : undefined);
}

@@ -172,2 +174,13 @@ getPublicKey() {

}
/**
* WebAuthn level 3 spec introduces a new attribute on successful WebAuthn interactions,
* see https://w3c.github.io/webauthn/#dom-publickeycredential-authenticatorattachment.
* This attribute is already implemented for Chrome, Safari and Edge.
*
* Given the attribute is only available after a successful interaction, the information is
* provided opportunistically and might also be `undefined`.
*/
getAuthenticatorAttachment() {
return this.authenticatorAttachment;
}
async sign(blob) {

@@ -186,2 +199,5 @@ const result = (await navigator.credentials.get({

}));
if (result.authenticatorAttachment !== null) {
this.authenticatorAttachment = result.authenticatorAttachment;
}
const response = result.response;

@@ -188,0 +204,0 @@ if (response.signature instanceof ArrayBuffer &&

@@ -15,2 +15,3 @@ import { DerEncodedPublicKey, PublicKey, Signature, SignIdentity } from '@dfinity/agent';

readonly rawId: ArrayBuffer;
protected authenticatorAttachment: AuthenticatorAttachment | undefined;
/**

@@ -27,4 +28,13 @@ * Create an identity from a JSON serialization.

protected _publicKey: CosePublicKey;
protected constructor(rawId: ArrayBuffer, cose: ArrayBuffer);
constructor(rawId: ArrayBuffer, cose: ArrayBuffer, authenticatorAttachment: AuthenticatorAttachment | undefined);
getPublicKey(): PublicKey;
/**
* WebAuthn level 3 spec introduces a new attribute on successful WebAuthn interactions,
* see https://w3c.github.io/webauthn/#dom-publickeycredential-authenticatorattachment.
* This attribute is already implemented for Chrome, Safari and Edge.
*
* Given the attribute is only available after a successful interaction, the information is
* provided opportunistically and might also be `undefined`.
*/
getAuthenticatorAttachment(): AuthenticatorAttachment | undefined;
sign(blob: ArrayBuffer): Promise<Signature>;

@@ -31,0 +41,0 @@ /**

@@ -102,5 +102,6 @@ import { SignIdentity } from '@dfinity/agent';

export class WebAuthnIdentity extends SignIdentity {
constructor(rawId, cose) {
constructor(rawId, cose, authenticatorAttachment) {
super();
this.rawId = rawId;
this.authenticatorAttachment = authenticatorAttachment;
this._publicKey = new CosePublicKey(cose);

@@ -117,3 +118,3 @@ }

}
return new this(fromHexString(rawId), fromHexString(publicKey));
return new this(fromHexString(rawId), fromHexString(publicKey), undefined);
}

@@ -125,2 +126,3 @@ /**

static async create(credentialCreationOptions) {
var _a;
const creds = await _createCredential(credentialCreationOptions);

@@ -136,3 +138,3 @@ if (!creds || creds.type !== 'public-key') {

const attObject = borc.decodeFirst(new Uint8Array(response.attestationObject));
return new this(creds.rawId, _authDataToCose(attObject.authData));
return new this(creds.rawId, _authDataToCose(attObject.authData), (_a = creds.authenticatorAttachment) !== null && _a !== void 0 ? _a : undefined);
}

@@ -142,2 +144,13 @@ getPublicKey() {

}
/**
* WebAuthn level 3 spec introduces a new attribute on successful WebAuthn interactions,
* see https://w3c.github.io/webauthn/#dom-publickeycredential-authenticatorattachment.
* This attribute is already implemented for Chrome, Safari and Edge.
*
* Given the attribute is only available after a successful interaction, the information is
* provided opportunistically and might also be `undefined`.
*/
getAuthenticatorAttachment() {
return this.authenticatorAttachment;
}
async sign(blob) {

@@ -156,2 +169,5 @@ const result = (await navigator.credentials.get({

}));
if (result.authenticatorAttachment !== null) {
this.authenticatorAttachment = result.authenticatorAttachment;
}
const response = result.response;

@@ -158,0 +174,0 @@ if (response.signature instanceof ArrayBuffer &&

6

package.json
{
"name": "@dfinity/identity",
"version": "0.15.4",
"version": "0.15.5",
"author": "DFINITY Stiftung <sdk@dfinity.org>",

@@ -49,4 +49,4 @@ "license": "Apache-2.0",

"peerDependencies": {
"@dfinity/agent": "^0.15.4",
"@dfinity/principal": "^0.15.4",
"@dfinity/agent": "^0.15.5",
"@dfinity/principal": "^0.15.5",
"@peculiar/webcrypto": "^1.4.0"

@@ -53,0 +53,0 @@ },

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc