Skip to content

Commit

Permalink
Merge pull request #79 from rkreutzer/patch-1
Browse files Browse the repository at this point in the history
Update README.md for code discrepancies
  • Loading branch information
nklomp authored Nov 29, 2023
2 parents 651c110 + 3213b38 commit 1595df2
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions packages/client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,10 @@ console.log(client.getAccessTokenEndpoint()); // https://auth.research.identipro

The OID4VCI Server metadata contains information about token endpoints, credential endpoints, as well as additional
information about supported Credentials, and their cryptographic suites and formats.
The code above already retrieved the metadata, so it will not be fetched again. If you however not used
The code above already retrieved the metadata, so it will not be fetched again, and this method places the data in another variable. If you however have not used
the `retrieveServerMetadata` option, you can use this method to fetch it from the Issuer:

```typescript
import { OpenID4VCIClient } from '@sphereon/oid4vci-client';

const metadata = await client.retrieveServerMetadata();
```

Expand Down Expand Up @@ -111,6 +109,9 @@ the [Proof of Posession](#proof-of-possession) chapter for more information.
The Proof of Possession using a signature callback function. The example uses the `jose` library.

```typescript
import * as jose from 'jose';
import { DIDDocument } from 'did-resolver';

const { privateKey, publicKey } = await jose.generateKeyPair('ES256');

// Must be JWS
Expand All @@ -121,10 +122,10 @@ async function signCallback(args: Jwt, kid: string): Promise<string> {
.setIssuer(kid)
.setAudience(args.payload.aud)
.setExpirationTime('2h')
.sign(keypair.privateKey);
.sign(privateKey);
}

const callbacks: ProofOfPossessionCallbacks = {
const callbacks: ProofOfPossessionCallbacks<DIDDocument> = {
signCallback,
};
```
Expand All @@ -133,14 +134,14 @@ Now it is time to get the actual credential

```typescript
const credentialResponse = await client.acquireCredentials({
credentialType: 'OpenBadgeCredential',
credentialTypes: 'OpenBadgeCredential',
proofCallbacks: callbacks,
format: 'jwt_vc',
format: 'jwt_vc_json',
alg: Alg.ES256K,
kid: 'did:example:ebfeb1f712ebc6f1c276e12ec21#keys-1',
});
console.log(credentialResponse.credential);
// JWT format. (LDP/JSON-LD is also supported by the client)
// JWT format. (LDP / JSON-LD ('ldp_vc' / 'jwt_vc_json-ld') is also supported by the client)
// eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSIsImh0dHBzOi8vd3d3LnczLm9yZy8yMDE4L2NyZWRlbnRpYWxzL2V4YW1wbGVzL3YxIl0sImlkIjoiaHR0cDovL2V4YW1wbGUuZWR1L2NyZWRlbnRpYWxzLzM3MzIiLCJ0eXBlIjpbIlZlcmlmaWFibGVDcmVkZW50aWFsIiwiVW5pdmVyc2l0eURlZ3JlZUNyZWRlbnRpYWwiXSwiaXNzdWVyIjoiaHR0cHM6Ly9leGFtcGxlLmVkdS9pc3N1ZXJzLzU2NTA0OSIsImlzc3VhbmNlRGF0ZSI6IjIwMTAtMDEtMDFUMDA6MDA6MDBaIiwiY3JlZGVudGlhbFN1YmplY3QiOnsiaWQiOiJkaWQ6ZXhhbXBsZTplYmZlYjFmNzEyZWJjNmYxYzI3NmUxMmVjMjEiLCJkZWdyZWUiOnsidHlwZSI6IkJhY2hlbG9yRGVncmVlIiwibmFtZSI6IkJhY2hlbG9yIG9mIFNjaWVuY2UgYW5kIEFydHMifX19LCJpc3MiOiJodHRwczovL2V4YW1wbGUuZWR1L2lzc3VlcnMvNTY1MDQ5IiwibmJmIjoxMjYyMzA0MDAwLCJqdGkiOiJodHRwOi8vZXhhbXBsZS5lZHUvY3JlZGVudGlhbHMvMzczMiIsInN1YiI6ImRpZDpleGFtcGxlOmViZmViMWY3MTJlYmM2ZjFjMjc2ZTEyZWMyMSJ9.z5vgMTK1nfizNCg5N-niCOL3WUIAL7nXy-nGhDZYO_-PNGeE-0djCpWAMH8fD8eWSID5PfkPBYkx_dfLJnQ7NA
```

Expand Down

0 comments on commit 1595df2

Please sign in to comment.