# SDK - Design and Implementation ## Services ### Wallet Service `CreateChallenge(email|phone)` - optional step - Input = email | phone - Response = token/device_code `Create()` *Inputs* - Optional challenge = token/device_code *Implementation* - Generate new Key and DID Document using `DIDKey.Generate(Type=Ed25519)` - Retrieve provider configuration using grpc `Wallet.GetProviderConfiguration()` - Initialize new `CreateWalletRequest { Description: "my wallet" }` - Encrypt the message using `DIDComm.Pack` by sending the provider key as receiver, and generated key as sender - Send the encrypted message using grpc `Wallet.CreateWallet(request)` - Unpack the response using `DIDComm.Unpack` - Deserialize the payload into `CreateWalletResponse` - Generate new `CapabilityInvocation` using `????` by setting the `Invoker` to the DIDKey controller and Target to the WalletId from the WalletResponse - Initialize new `WalletProfile` - Set DidDocument to the generated document above - Set Provider configuration to the response - Set Capability to CapabilityInvocation - Set WalletId to WalletId - Return the profile serialized to binary `ListRecords()` *Inputs* `query: string` - a SQL query ex. `select * from c` *Implementation* ### Issuer Service Should be initialized using the profile binary data `new IssuerService(profile.bin)` **Workflow Credential Issuance** - as issuer, call IssueCredential - let cred = new verifiableCred {...} - userDest = email | phone | didcomm | siop - on the server, check if wallet with email exists - if not, provision new wallet - if yes, retrieve walletId - sign the credential - store a copy in issuer wallet, and tag/mark as issued/sent/outgoing - store credential in user wallet inbox - generate some kind of claim token - send email to user with link (token) - as the user, click email link - redirected to browser or mobile app launches (sdk clients) - checks for authentication - connect(token) - create local did - create local profile - if successful, show the credential to the user - getCredential() **Workflow: Prepare for Public Presentation** - user can generate a presentation as - generatePresentation(credId) - on the server, check the defined presentation definition for this credential manifest/schema - create verifiablePresentation from that credential - create public sharable link | apple wallet enabled link, etc **Workflow: View Verifiable Presential Link** *Inputs* *Implementation* ### Provider Service #### Fields List Fields Create Field #### Credential Template #### Presentation Template #### Organizations