Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add geolocation to address VC data type #68

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/vc-data/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/vc-data/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@bloomprotocol/vc-data",
"description": "Data types for verifiable credentials (forked from @affinidi/vc-data)",
"version": "0.1.53",
"version": "0.1.54",
"author": "Bloom Team <team@bloom.co>",
"license": "Apache-2.0",
"repository": "https://github.com/hellobloom/ssi-sdk/tree/main/packages/vc-data",
Expand Down
2 changes: 2 additions & 0 deletions packages/vc-data/src/accreditation/v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export type AccreditationPersonV2 = {

email?: string
birthDate?: string
identifier?: string
name?: string
givenName?: string
additionalName?: string
Expand All @@ -72,6 +73,7 @@ export const getVCAccreditationPersonV2ContextConfig = () => {

address: 'schema',
birthDate: 'schema',
identifier: 'schema',
email: 'schema',
name: 'schema',
givenName: 'schema',
Expand Down
12 changes: 8 additions & 4 deletions packages/vc-data/src/address/v2.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
import { CreateVCType, createSubjectContext, createContextConfig, createContext } from '../util/v2'
import { PostalAddressV2, postalAddressV2Context } from '../base/v2'
import { PostalAddressV2, postalAddressV2Context, GeoCoordinates as GeoCoordinates, geoCoordinatesContext } from '../base/v2'

export type AddressPersonV2 = {
'@type': 'AddressPerson'
address: string | PostalAddressV2
geo?: GeoCoordinates
}

export type VCAddressPersonV2Type = 'AddressCredentialPersonV2'

export const getVCAddressPersonV2ContextConfig = () => {
const phonePersonContext = createSubjectContext<AddressPersonV2>({
const addressPersonContext = createSubjectContext<AddressPersonV2>({
type: 'AddressPerson',
base: 'bloomSchema',
properties: { address: 'schema' },
properties: {
address: 'schema',
geo: 'schema',
},
})

return createContextConfig<VCAddressPersonV2Type>({
type: 'AddressCredentialPersonV2',
subjects: [phonePersonContext, postalAddressV2Context],
subjects: [addressPersonContext, postalAddressV2Context, geoCoordinatesContext],
})
}

Expand Down
15 changes: 15 additions & 0 deletions packages/vc-data/src/base/v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,21 @@ export const postalAddressV2Context = createSubjectContext<PostalAddressV2>({
},
})

export type GeoCoordinates = {
'@type': 'GeoCoordinates'
latitude?: number
longitude?: number
}

export const geoCoordinatesContext = createSubjectContext<GeoCoordinates>({
type: 'GeoCoordinates',
base: 'schema',
properties: {
latitude: 'schema',
longitude: 'schema',
},
})

export type GenericOrgType = { '@type': string; name?: string; address?: OneOrMore<string | PostalAddressV2> }

export type OrganizationV2 = {
Expand Down