Skip to content

Returned passkey object is frozen #55

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
yagopv opened this issue Dec 3, 2024 · 2 comments
Open

Returned passkey object is frozen #55

yagopv opened this issue Dec 3, 2024 · 2 comments
Assignees
Labels
bug Something isn't working question Further information is requested Stale

Comments

@yagopv
Copy link

yagopv commented Dec 3, 2024

Hi,

I'm trying to extract the x and y coordinates from the returned public key. The passkey is created correctly and returns the following JSON objects.

iOS

{
  "rawId": "M5fINeW8ZFTKRK8kIHOJZ5m8sqs",
  "response": {
    "clientDataJSON": "eyJ0eXBlIjoid2ViYXV0aG4uY3JlYXRlIiwiY2hhbGxlbmdlIjoiZEdobExXTm9ZV3hzWlc1blpRIiwib3JpZ2luIjoiaHR0cHM6Ly80Zjc1LTQ3LTYxLTE3LTYwLm5ncm9rLWZyZWUuYXBwIn0",
    "attestationObject": "o2NmbXRkbm9uZWdhdHRTdG10oGhhdXRoRGF0YViYlwwb48synmusVipXli9VGAxImFj0brfAv4MncHreUahdAAAAAPv8MAcVTk7MjAtuAgVX170AFDOXyDXlvGRUykSvJCBziWeZvLKrpQECAyYgASFYIDyL0JBN857tDsHjkp9dYGYwLHccrv5bUJ7QSczCDhgIIlggpeJv_9J1pacuJvYI0h0NZ82ZndfrMj2FrESJvaUF1WQ"
  },
  "id": "M5fINeW8ZFTKRK8kIHOJZ5m8sqs",
  "type": "public-key"
}

Android

{
  "rawId": "GHwZvyv1sL8FWyvg2cHrMw",
  "authenticatorAttachment": "platform",
  "type": "public-key",
  "id": "GHwZvyv1sL8FWyvg2cHrMw",
  "response": {
    "clientDataJSON": "eyJ0eXBlIjoid2ViYXV0aG4uY3JlYXRlIiwiY2hhbGxlbmdlIjoiZEdobExXTm9ZV3hzWlc1blpRIiwib3JpZ2luIjoiYW5kcm9pZDphcGsta2V5LWhhc2g6LXNZWFJkd0pBM2h2dWUzbUtwWXJPWjl6U1BDN2I0bWJnekptZFpFRE81dyIsImFuZHJvaWRQYWNrYWdlTmFtZSI6ImNvbS55YWdvcHYucmVhY3RuYXRpdmVzYWZlY29yZXNkayJ9",
    "attestationObject": "o2NmbXRkbm9uZWdhdHRTdG10oGhhdXRoRGF0YViUlwwb48synmusVipXli9VGAxImFj0brfAv4MncHreUahdAAAAAOqbjWZNAR0hPOS2tIy1ddQAEBh8Gb8r9bC_BVsr4NnB6zOlAQIDJiABIVgghDdNMMOcQUbbfuaHCGPG27cpWRNJFHSCQZH6ONkrelgiWCB-buYxBfQqUobeNkN5MJKu8-mOj4MxZ4fv_J300EKEZg",
    "transports": [
      "internal",
      "hybrid"
    ],
    "authenticatorData": "lwwb48synmusVipXli9VGAxImFj0brfAv4MncHreUahdAAAAAOqbjWZNAR0hPOS2tIy1ddQAEBh8Gb8r9bC_BVsr4NnB6zOlAQIDJiABIVgghDdNMMOcQUbbfuaHCGPG27cpWRNJFHSCQZH6ONkrelgiWCB-buYxBfQqUobeNkN5MJKu8-mOj4MxZ4fv_J300EKEZg",
    "publicKeyAlgorithm": -7,
    "publicKey": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEhDdNMMOcQUbbfuaHCGPG27cpWRNJFHSCQZH6ONkrelh-buYxBfQqUobeNkN5MJKu8-mOj4MxZ4fv_J300EKEZg"
  },
  "clientExtensionResults": {}
}

The issue arises when I try to access any property, as it returns undefined.

Using this snippet:

  const passkey =  await Passkey.create(credentialRequestJson)

  console.log("Check Prototype:", Object.getPrototypeOf(passkey));
  console.log("Access Properties Directly:", passkey["rawId"]);
  const isFrozen = Object.isFrozen(passkey);
  console.log("Is Frozen:", isFrozen);
  const isSealed = Object.isSealed(passkey);
  console.log("Is Sealed:", isSealed);
  const isExtensible = Object.isExtensible(passkey);
  console.log("Is Extensible:", isExtensible);
  const clonedObject = JSON.parse(JSON.stringify(passkey));
  console.log(clonedObject.rawId);

It logs the following:

 LOG  Check Prototype: {}
 LOG  Access Properties Directly: undefined
 LOG  Is Frozen: true
 LOG  Is Sealed: true
 LOG  Is Extensible: false
 LOG  undefined

Are there any way to extract the publicKey?

Thanks!!

@f-23
Copy link
Owner

f-23 commented Jan 14, 2025

@yagopv Could you try again with v3.1.0? I'm not sure where this is coming from, the properties on the returned object should be accessible.

@f-23 f-23 self-assigned this Jan 14, 2025
@f-23 f-23 added bug Something isn't working question Further information is requested labels Jan 14, 2025
Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale label Apr 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested Stale
Projects
None yet
Development

No branches or pull requests

2 participants