diff --git a/packages/client/README.md b/packages/client/README.md index b1da2a32..43b9ffd2 100644 --- a/packages/client/README.md +++ b/packages/client/README.md @@ -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(); ``` @@ -111,6 +109,8 @@ 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'; + const { privateKey, publicKey } = await jose.generateKeyPair('ES256'); // Must be JWS @@ -121,7 +121,7 @@ async function signCallback(args: Jwt, kid: string): Promise { .setIssuer(kid) .setAudience(args.payload.aud) .setExpirationTime('2h') - .sign(keypair.privateKey); + .sign(privateKey); } const callbacks: ProofOfPossessionCallbacks = { @@ -133,14 +133,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 ```