From 1d14d8d9680cb3024067512598fb73b805c6c2f2 Mon Sep 17 00:00:00 2001 From: Yordan Kinkov <yordan.kinkov@vereign.com> Date: Tue, 26 Jul 2022 09:54:28 +0300 Subject: [PATCH] Passwordless login extension functions documentation --- doc/policy_development.md | 68 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/doc/policy_development.md b/doc/policy_development.md index 72ce50e6..b78189ae 100644 --- a/doc/policy_development.md +++ b/doc/policy_development.md @@ -310,3 +310,71 @@ Result: "valid": true } ``` + +#### ocm.getLoginProofInvitation + +Get a Proof Invitation URL from OCM's "out-of-band" endpoint. +This function accepts two arguments. The first argument is an array of scopes used to identify +credential types in OCM. The second argument is a map between scopes and credential types +which is statically defined in a `data.json` file. + +Example request body: +```json +{ + "scope": ["openid", "email"] +} +``` + +Example `data.json` file containing "scope-to-credential-type" map: +```json +{ + "scopes": { + "openid": "principalMemberCredential", + "email": "universityCert" + } +} +``` + +Example policy: + +```rego +package example.GetLoginProofInvitation + +_ = ocm.getLoginProofInvitation(input.scope, data.scopes) +``` + +Result: + +```json +{ + "link": "https://ocm:443/didcomm/?d_m=eyJAdHlwZSI6Imh0dHBzOi8vZGlkY29tbS5vc9tbSJ9fQ", + "requestId": "851076fa-da78-444a-9127-e636c5102f40" +} +``` + +#### ocm.GetLoginProofResult + +Get a Proof Invitation result from OCM containing a flattened list of claims. +This function accepts one argument which is the `resuestId` from the +`ocm.getLoginProofInvitation` result. + +Example policy: + +```rego +package example.GetLoginProofResult + +_ = ocm.getLoginProofResult(input.requestId) +``` + +Result: +```json +{ + "name": "John Doe", + "given_name": "John", + "family_name": "Doe", + "email": "example@example.com", + "email_verified": true, + "preferred_username": "john", + "gender": "NA" +} +``` -- GitLab