-
Notifications
You must be signed in to change notification settings - Fork 2
/
2_credential.ts
43 lines (38 loc) · 1.17 KB
/
2_credential.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import { JolocomLib, claimsMetadata } from 'jolocom-lib'
import {claimsMetadata as demoClaimsMetadata} from 'cred-types-jolocom-demo'
import { data } from './data'
const registry = JolocomLib.registries.jolocom.create()
const vaultedKeyProvider = new JolocomLib.KeyProvider(data.seed, data.secret)
registry
.authenticate(vaultedKeyProvider, {
derivationPath: JolocomLib.KeyTypes.jolocomIdentityKey,
encryptionPass: data.secret
})
.then(async iw => {
const mobilePhoneNrCredential = await iw.create.signedCredential(
{
metadata: claimsMetadata.mobilePhoneNumber,
claim: {
telephone: '000111222'
},
subject: iw.did
},
data.secret
)
console.log(mobilePhoneNrCredential.toJSON())
const driverLicenseCredential = await iw.create.signedCredential(
{
metadata: demoClaimsMetadata.demoDriversLicence,
claim: {
familyName: 'Test Name',
givenName: 'Test Given Name',
identifier: 'DOC0123',
postalCode: '12351',
residence: 'Berlin'
},
subject: iw.did
},
data.secret
)
console.log(driverLicenseCredential)
})