Skip to content

Commit 1f3e5f1

Browse files
committed
created VCI Issuer module for Group Registry
1 parent 11202b2 commit 1f3e5f1

File tree

9 files changed

+287
-0
lines changed

9 files changed

+287
-0
lines changed

spp_openid_vci_group/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import models
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Part of OpenSPP. See LICENSE file for full copyright and licensing details.
2+
3+
4+
{
5+
"name": "SPP Registry OpenID VCI: Group",
6+
"category": "OpenSPP",
7+
"version": "17.0.1.0.0",
8+
"sequence": 1,
9+
"author": "OpenSPP.org",
10+
"website": "https://github.com/OpenSPP/openspp-modules",
11+
"license": "LGPL-3",
12+
"development_status": "Beta",
13+
"maintainers": ["jeremi", "gonzalesedwin1123"],
14+
"depends": [
15+
"spp_openid_vci",
16+
"g2p_registry_group",
17+
],
18+
"external_dependencies": {"python": ["qrcode"]},
19+
"data": [
20+
"views/group_view.xml",
21+
],
22+
"assets": {},
23+
"demo": [],
24+
"images": [],
25+
"application": True,
26+
"installable": True,
27+
"auto_install": False,
28+
}
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
{
2+
"@context": {
3+
"OpenG2PRegistryVerifiableCredential": {
4+
"@id": "https://openg2p.org/credential#OpenG2PRegistryVerifiableCredential",
5+
"@context": [
6+
"https://www.w3.org/2018/credentials/v1",
7+
{
8+
"@vocab": "https://openg2p.org/credential#OpenG2PRegistryVerifiableCredential#",
9+
"credentialSubject": {
10+
"@id": "credentialSubject",
11+
"@type": "@id",
12+
"@context": {
13+
"@vocab": "https://openg2p.org/credential#OpenG2PRegistryVerifiableCredential#credentialSubject#",
14+
"name": {
15+
"@id": "name",
16+
"@type": "@id",
17+
"@context": {
18+
"value": "@value",
19+
"language": "@language"
20+
}
21+
},
22+
"fullName": {
23+
"@id": "fullName",
24+
"@type": "@id",
25+
"@context": {
26+
"value": "@value",
27+
"language": "@language"
28+
}
29+
},
30+
"gender": {
31+
"@id": "gender",
32+
"@type": "@id",
33+
"@context": {
34+
"value": "@value",
35+
"language": "@language"
36+
}
37+
},
38+
"dateOfBirth": "dateOfBirth",
39+
"email": "email",
40+
"phone": "phone",
41+
"addressLine1": {
42+
"@id": "addressLine1",
43+
"@type": "@id",
44+
"@context": {
45+
"value": "@value",
46+
"language": "@language"
47+
}
48+
},
49+
"addressLine2": {
50+
"@id": "addressLine2",
51+
"@type": "@id",
52+
"@context": {
53+
"value": "@value",
54+
"language": "@language"
55+
}
56+
},
57+
"addressLine3": {
58+
"@id": "addressLine3",
59+
"@type": "@id",
60+
"@context": {
61+
"value": "@value",
62+
"language": "@language"
63+
}
64+
},
65+
"province": {
66+
"@id": "province",
67+
"@type": "@id",
68+
"@context": {
69+
"value": "@value",
70+
"language": "@language"
71+
}
72+
},
73+
"region": {
74+
"@id": "region",
75+
"@type": "@id",
76+
"@context": {
77+
"value": "@value",
78+
"language": "@language"
79+
}
80+
},
81+
"postalCode": "postalCode",
82+
"face": "face",
83+
"vcVer": "vcVer",
84+
"UIN": "UIN"
85+
}
86+
}
87+
}
88+
]
89+
}
90+
}
91+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"@context": [
3+
"https://www.w3.org/2018/credentials/v1",
4+
(.web_base_url + "/api/v1/vci/.well-known/contexts.json")
5+
],
6+
"id": .vc_id,
7+
"type": ["VerifiableCredential", .issuer.credential_type],
8+
"issuer": .issuer.unique_issuer_id,
9+
"issuanceDate": .curr_datetime,
10+
"credentialSubject": {
11+
"vcVer": "VC-V1",
12+
"id": (.partner.id | tostring),
13+
"name": (.partner.name // null),
14+
"email": (.partner.email // null),
15+
"phone": (.partner.phone // null),
16+
"addressLine1": .partner_address.street_address,
17+
"province": .partner_address.locality,
18+
"region": .partner_address.region,
19+
"postalCode": .partner_address.postal_code,
20+
}
21+
}
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
[
2+
{
3+
"id": .credential_type,
4+
"format": .supported_format,
5+
"scope": .scope,
6+
"cryptographic_binding_methods_supported": [
7+
"did:jwk"
8+
],
9+
"credential_signing_alg_values_supported": [
10+
"RS256"
11+
],
12+
"proof_types_supported": [
13+
"jwt"
14+
],
15+
"credential_definition": {
16+
"type": [
17+
"VerifiableCredential",
18+
.credential_type
19+
],
20+
"credentialSubject": {
21+
"fullName": {
22+
"display": [
23+
{
24+
"name": "Name",
25+
"locale": "en"
26+
}
27+
]
28+
},
29+
"gender": {
30+
"display": [
31+
{
32+
"name": "Gender",
33+
"locale": "en"
34+
}
35+
]
36+
},
37+
"dateOfBirth": {
38+
"display": [
39+
{
40+
"name": "Date of Birth",
41+
"locale": "en"
42+
}
43+
]
44+
},
45+
"address": {
46+
"display": [
47+
{
48+
"name": "Address",
49+
"locale": "en"
50+
}
51+
]
52+
},
53+
"UIN": {
54+
"display": [
55+
{
56+
"name": "Beneficiary ID",
57+
"locale": "en"
58+
}
59+
]
60+
},
61+
"nationalID": {
62+
"display": [
63+
{
64+
"name": "National ID",
65+
"locale": "en"
66+
}
67+
]
68+
}
69+
}
70+
},
71+
"display": [
72+
{
73+
"name": "OpenG2P Registry Credential",
74+
"locale": "en",
75+
"logo": {
76+
"url": (.web_base_url + "/g2p_openid_vci/static/description/icon.png"),
77+
"alt_text": "a square logo of a OpenG2P"
78+
},
79+
"background_color": "#12107c",
80+
"text_color": "#FFFFFF"
81+
}
82+
],
83+
"order": [
84+
"fullName",
85+
"gender",
86+
"dateOfBirth"
87+
]
88+
}
89+
]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import vci_issuer
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
from odoo import fields, models
2+
3+
4+
class CustomOpenIDVCIssuer(models.Model):
5+
_inherit = "g2p.openid.vci.issuers"
6+
7+
issuer_type = fields.Selection(
8+
selection_add=[
9+
(
10+
"GroupRegistry",
11+
"GroupRegistry",
12+
)
13+
],
14+
ondelete={"GroupRegistry": "cascade"},
15+
)
16+
17+
def set_from_static_file_GroupRegistry(
18+
self, module_name="spp_openid_vci_group", file_name="", field_name="", **kwargs
19+
):
20+
return self.set_from_static_file_Registry(
21+
module_name=module_name, file_name=file_name, field_name=field_name, **kwargs
22+
)
23+
24+
def set_default_credential_type_GroupRegistry(self):
25+
self.credential_type = "GroupRegistry"
26+
27+
def issue_vc_GroupRegistry(self, auth_claims, credential_request):
28+
return self.issue_vc_Registry(auth_claims, credential_request)
29+
30+
def set_default_auth_allowed_issuers_GroupRegistry(self):
31+
web_base_url = self.env["ir.config_parameter"].sudo().get_param("web.base.url").rstrip("/")
32+
endpoint = "/api/v1/security"
33+
self.auth_allowed_issuers = f"{web_base_url}{endpoint}"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["whool"]
3+
build-backend = "whool.buildapi"
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<odoo>
3+
<record id="view_group_form" model="ir.ui.view">
4+
<field name="name">view_group_form</field>
5+
<field name="model">res.partner</field>
6+
<field name="inherit_id" ref="g2p_registry_group.view_groups_form" />
7+
<field name="arch" type="xml">
8+
<xpath
9+
expr="//div[@name='button_box']/button[@name='%(g2p_registry_base.action_disable_registrant_wizard)d']"
10+
position="before"
11+
>
12+
<button type="object" class="oe_stat_button" icon="fa-indent" name="registry_issue_card">
13+
<div class="o_form_field o_stat_info">
14+
<span class="o_stat_text">Issue Card</span>
15+
</div>
16+
</button>
17+
</xpath>
18+
</field>
19+
</record>
20+
</odoo>

0 commit comments

Comments
 (0)