Skip to content
This repository was archived by the owner on Aug 11, 2025. It is now read-only.
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 20 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,56 +92,46 @@ EncryptionParamaters = {


### API

One idea a new `CredentialRequest` (et al)
Add an Identity Managment API, which mirrors the Credential Managment API and add a `DocumentCredential` type to that extends Credential.
```
dictionary CredentialElement {
partial interface Navigator {
[SecureContext, SameObject] readonly attribute CredentialsContainer identity;
};

dictionary DocumentCredentialElement {
required DOMString namespace; // As defined in ISO 18013-5 clause 8.
required DOMString name;
};

dictionary CredentialStorageDuration {
dictionary DocumentCredentialStorageDuration {
// At least one of these is required.

boolean forever; // Cannot be used with any other properties.

long days; // Cannot (currently) be used with any other properties.
};

dictionary CredentialDocumentDescriptor {
dictionary DocumentCredentialOptions {
required DOMString documentType; // As defined in ISO 18013-5 clause 8.

required sequence<CredentialElement> requestedElements;
required sequence<DocumentCredentialElement> requestedElements;

CredentialStorageDuration desiredStorageDuration; // Not providing this is equivalent to not asking to store.
DocumentCredentialStorageDuration desiredStorageDuration; // Not providing this is equivalent to not asking to store.
};

dictionary CredentialDocument {
[Exposed=Window, SecureContext]
interface DocumentCredential : Credential {
object data; // The CBOR encoded `CredentialDocument` defined above.
};

dictionary RequestConfiguration {
required DOMString nonce;
};

[
SecureContext,
Exposed=Window,
] interface CredentialRequest {
constructor(DOMString requesterIdentity, CredentialDocumentDescriptor documentDescriptor); // This throws if anything in the `documentDescriptor` is not recognized (e.g. an invalid `documentType`).

Promise<CredentialDocument> requestDocument(RequestConfiguration configuration);

Promise<undefined> abort();
};
```


## Examples

```js
// Driver's License
let mDLCredentialRequest = new CredentialRequest(certificate, {
let options = {
documentType: "org.iso.18013.5.1.mDL",
requestedElements: [
{ namespace: "org.iso.18013.5.1", name: "document_number" },
Expand All @@ -153,20 +143,22 @@ let mDLCredentialRequest = new CredentialRequest(certificate, {
desiredStorageDuration: {
days: 7,
},
});
mDLCredentialRequest.request({ nonce }).then((credentialDocument) => { ... });
nonce,
};
navigator.identity.get({mdoc: options}).then((credentialDocument) => { ... });
```

```js
// Vaccination Card
let micovCredentialRequest = new CredentialRequest(certificate, {
let options = {
documentType: "org.micov.1",
requestedElements: [
{ namespace: "org.micov.attestation.1", name: "PersonId_dl" },
{ namespace: "org.micov.attestation.1", name: "portrait" },
],
});
micovCredentialRequest.request({ nonce }).then((credentialDocument) => { ... });
nonce,
};
navigator.identity.get({mdoc: options}).then((credentialDocument) => { ... });
```


Expand Down