Start an OIDC Credential Provider flow 

Discover OIDC credential offer 

typescript
Copy to clipboard.
1const discoverResult = await wallet.oidc.discover("openid://discovery?issuer=https://issuer.example.com");
2
3if (discoverResult.isErr()) {
4    // Handle error from discoverResult.error 
5    return;
6}
7
8const { offer } = discoverResult.value; 

Create a local subject DID for the credential 

typescript
Copy to clipboard.
1const createDidResult = await wallet.did.createDid();
2
3if (createDidResult.isErr()) {
4    // Handle error from createDidResult.error 
5    return;
6}
7
8const { did } = createDidResult.value; 

Generate an OpenID authorization url to request the credential 

typescript
Copy to clipboard.
1import { Linking } from "react-native";
2const genUrlResult = await wallet.oidc.generateAuthorizeUrl({ offer, did });
3
4if (genUrlResult.isErr()) {
5    // Handle error from genUrlResult.error 
6    return;
7}
8
9const { url, codeVerifier, nonce } = genUrlResult.value;
10await Linking.openURL(url);

Retrieve the credential on authorization success callback 

typescript
Copy to clipboard.
1const retrieveResult = (retrieveCredential = await wallet.oidc.retrieveCredential({
2    offer,
3    codeVerifier,
4    nonce,
5    code: route.params.code, // code comes from part of the callback url 
6}));
7
8if (retrieveResult.isErr()) {
9    // Handle error from retrieveResult.error 
10    return;
11}
12
13const { credential } = retrieveResult.value; 

Verify a credential 

typescript
Copy to clipboard.
1const verifyResult = await wallet.credential.webSemantic.verifyCredential({ credential });
2
3if (verifyResult.isErr()) {
4    // Handle error from verifyResult.error 
5    return;
6}
7
8const { credentialVerified, status } = verifyResult.value; 

Find the comprehensive SDK interfaces for these examples and others in the documentation https://github.com/mattrglobal/docs-wallet-sdk.

Get in touch if you wish to find out more about using the Wallet SDK in production.