-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
057a930
commit 657d142
Showing
5 changed files
with
89 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
function isURL(str) { | ||
try { | ||
// eslint-disable-next-line no-new | ||
new URL(str); | ||
return true; | ||
} catch (err) { | ||
return false; | ||
} | ||
} | ||
|
||
export function getJSONOrUrl(data) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import {IWallet} from './types'; | ||
import {createVerificationProvider} from './verification-provider'; | ||
import {createWallet} from './wallet'; | ||
|
||
describe('Verification provider', () => { | ||
let verificationProvider; | ||
let wallet: IWallet; | ||
|
||
beforeAll(async () => { | ||
wallet = await createWallet({ | ||
databasePath: ':memory:', | ||
}); | ||
verificationProvider = createVerificationProvider({ | ||
wallet, | ||
}); | ||
}); | ||
|
||
it('expect to create verification controller', () => { | ||
const controller = verificationProvider.start({ | ||
template: 'https://creds-testnet.dock.io/proof/6de279ba-caf3-4979-a067-553284b40767', | ||
}); | ||
|
||
console.log(controller); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
export function createVerificationController({wallet}) { | ||
let templateJSON = null; | ||
let credentials = []; | ||
let selectedCredentials = []; | ||
let selectedAttributes = []; | ||
let didKeyPair = null; | ||
|
||
function setTemplate(template) { | ||
// TODO: fetch URL data | ||
templateJSON = template; | ||
} | ||
|
||
function loadCredentials() { | ||
// get wallet credentials and apply pex filter | ||
} | ||
|
||
function selectCredential(credentialId: string) { | ||
|
||
} | ||
|
||
function selectCredentialAttribute(credentialId: string, attributePath: string) { | ||
|
||
} | ||
|
||
function createPresentation() { | ||
// for the given credential selection | ||
// it will create a presentation | ||
} | ||
|
||
return { | ||
setTemplate, | ||
loadCredentials, | ||
selectCredential, | ||
selectCredentialAttribute, | ||
createPresentation, | ||
}; | ||
} | ||
|
||
export function createVerificationProvider({wallet}) { | ||
return { | ||
start: ({template}) => { | ||
const controller = createVerificationController({ | ||
wallet, | ||
}); | ||
|
||
controller.setTemplate(template); | ||
|
||
return controller; | ||
}, | ||
}; | ||
} |