Skip to content

Commit

Permalink
Merge branch 'main' into feat/geolocation
Browse files Browse the repository at this point in the history
  • Loading branch information
ghopper-bloom authored Mar 4, 2025
2 parents 487b09e + 1cf2255 commit 0ac5b1c
Show file tree
Hide file tree
Showing 24 changed files with 330 additions and 106 deletions.
2 changes: 1 addition & 1 deletion packages/credential-manifest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"lint": "eslint src --format table --ext .ts,.tsx,.js,.jsx",
"lint:fix": "npm run lint -- --fix",
"prepare": "npm run build",
"prepublishOnly": "npm run size && npm run lint && npm run test"
"prepublishOnly": "npm run lint && npm run test"
},
"dependencies": {
"@bloomprotocol/presentation-exchange": "^0.1.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/ecdsa-secp256k1-signature-2019/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"lint": "eslint src --format table --ext .ts,.tsx,.js,.jsx",
"lint:fix": "npm run lint -- --fix",
"prepare": "npm run build",
"prepublishOnly": "npm run size && npm run lint && npm run test"
"prepublishOnly": "npm run lint && npm run test"
},
"dependencies": {
"@bloomprotocol/ecdsa-secp256k1-verification-key-2019": "^0.1.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"lint": "eslint src --format table --ext .ts,.tsx,.js,.jsx",
"lint:fix": "npm run lint -- --fix",
"prepare": "npm run build",
"prepublishOnly": "npm run size && npm run lint && npm run test"
"prepublishOnly": "npm run lint && npm run test"
},
"dependencies": {
"@trust/keyto": "^1.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/elem-did-legacy-non-anchored/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"lint": "eslint src --format table --ext .ts,.tsx,.js,.jsx",
"lint:fix": "npm run lint -- --fix",
"prepare": "npm run build",
"prepublishOnly": "npm run size && npm run lint && npm run test"
"prepublishOnly": "npm run lint && npm run test"
},
"dependencies": {
"@types/create-hash": "^1.2.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/presentation-exchange/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"lint": "eslint src --format table --ext .ts,.tsx,.js,.jsx",
"lint:fix": "npm run lint -- --fix",
"prepare": "npm run build",
"prepublishOnly": "npm run size && npm run lint && npm run test"
"prepublishOnly": "npm run lint && npm run test"
},
"dependencies": {
"jest": "^29.1.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/presentation-exchange/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from './presentationDefiniton'
export * from './presentationDefinition'
export * from './presentationSubmission'
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.54",
"version": "0.1.61",
"author": "Bloom Team <team@bloom.co>",
"license": "Apache-2.0",
"repository": "https://github.com/hellobloom/ssi-sdk/tree/main/packages/vc-data",
Expand Down
6 changes: 6 additions & 0 deletions packages/vc-data/src/__tests__/identity/v2.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ describe('VCIdentityPersonV2', () => {
additionalName: 'foobar',
birthDate: 'foobar',
email: 'foobar',
phone: 'foobar',
familyName: 'foobar',
gender: 'foobar',
givenName: 'foobar',
Expand Down Expand Up @@ -138,6 +139,11 @@ describe('VCIdentityPersonV2', () => {
"@value": "foobar",
},
],
"https://schema.org/phone": Array [
Object {
"@value": "foobar",
},
],
},
],
},
Expand Down
2 changes: 1 addition & 1 deletion packages/vc-data/src/accreditation/v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const getHelperContextEntries = () => {

export type AccreditationPersonV2 = {
'@type': 'AccreditationPerson'
identifier?: OneOrMore<PropertyValueV2>
identifier?: string | OneOrMore<PropertyValueV2>
nationality?: string
hasAccreditation: OneOrMore<AccreditationV2>

Expand Down
2 changes: 1 addition & 1 deletion packages/vc-data/src/address/v2.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CreateVCType, createSubjectContext, createContextConfig, createContext } from '../util/v2'
import { PostalAddressV2, postalAddressV2Context, GeoCoordinates as GeoCoordinates, geoCoordinatesContext } from '../base/v2'
import { PostalAddressV2, postalAddressV2Context, GeoCoordinates, geoCoordinatesContext } from '../base/v2'

export type AddressPersonV2 = {
'@type': 'AddressPerson'
Expand Down
58 changes: 58 additions & 0 deletions packages/vc-data/src/base/v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,64 @@ export type GovernmentOrgV2 =
| GovernmentOrganizationV2
| AdministrativeAreaV2

export type PossibleMatchVals = 'match' | 'partial_match' | 'no_match' | 'no_data' | 'no_input'
export type PossibleCheckVals = 'success' | 'failure' | 'not_checked'

export type AddressCheckV2 = {
'@type': 'AddressCheck'
status: PossibleMatchVals
postOfficeBox?: 'yes' | 'no' | 'no_data'
type?: 'residential' | 'commercial' | 'no_data'
}

export type IdentityCheckV2 = {
'@type': 'IdentityCheck'
status?: PossibleCheckVals
createdAt?: string
completedAt?: string

// General checks
riskCheck?: PossibleCheckVals
selfieCheck?: PossibleCheckVals

// Individually validated attributes
addressCheck?: AddressCheckV2
nameCheck?: PossibleMatchVals
birthDateCheck?: PossibleMatchVals
identifierCheck?: PossibleMatchVals
phoneCheck?: PossibleMatchVals

// Active SMS verification, as opposed to passive database lookup
smsCheck?: PossibleCheckVals
}
export const identityCheckV2Context = createSubjectContext<IdentityCheckV2>({
type: 'IdentityCheck',
base: 'bloomSchema',
properties: {
status: 'bloomSchema',
createdAt: 'bloomSchema',
completedAt: 'bloomSchema',
riskCheck: 'bloomSchema',
selfieCheck: 'bloomSchema',
addressCheck: 'bloomSchema',
nameCheck: 'bloomSchema',
birthDateCheck: 'bloomSchema',
identifierCheck: 'bloomSchema',
phoneCheck: 'bloomSchema',
smsCheck: 'bloomSchema',
},
})

export const addressCheckV2Context = createSubjectContext<AddressCheckV2>({
type: 'AddressCheck',
base: 'bloomSchema',
properties: {
status: 'bloomSchema',
postOfficeBox: 'bloomSchema',
type: 'bloomSchema',
},
})

export const genericOrgContext = <T extends GenericOrgType>(typeName: T['@type']) =>
createSubjectContext<{ '@type': T['@type'] } & Omit<GenericOrgType, '@type'>>({
type: typeName,
Expand Down
2 changes: 1 addition & 1 deletion packages/vc-data/src/iddocument/v1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
createVCContextEntry,
} from '../util/v1'

import { PossibleCheckVals, PossibleMatchVals } from '../identity/v2'
import { PossibleCheckVals, PossibleMatchVals } from '../base/v2'

// Helper Types

Expand Down
32 changes: 29 additions & 3 deletions packages/vc-data/src/iddocument/v2.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { PostalAddressV2, postalAddressV2Context, IdentityCheckV2, identityCheckV2Context, addressCheckV2Context } from '../base/v2'
import { CreateVCType, createSubjectContext, createContextConfig, createContext, OneOrMore } from '../util/v2'

export type IDDocumentClassV2 =
Expand Down Expand Up @@ -67,7 +68,15 @@ export type IDDocumentRoleV2 = {

export type IDDocumentPersonV2 = {
'@type': 'IDDocumentPerson'
hasIDDocument: OneOrMore<IDDocumentRoleV2>
hasIDDocument?: OneOrMore<IDDocumentRoleV2>
address?: OneOrMore<PostalAddressV2>
hasIdentityCheck?: OneOrMore<IdentityCheckV2>
gender?: string
birthDate?: string
name?: OneOrMore<string>
givenName?: OneOrMore<string>
additionalName?: OneOrMore<string>
familyName?: OneOrMore<string>
}

export type VCIDDocumentPersonV2Type = 'IDDocumentCredentialPersonV2'
Expand All @@ -77,7 +86,15 @@ export const getVCIDDocumentPersonV2ContextConfig = () => {
type: 'IDDocumentPerson',
base: 'bloomSchema',
properties: {
address: 'schema',
hasIDDocument: 'bloomSchema',
hasIdentityCheck: 'bloomSchema',
birthDate: 'schema',
gender: 'schema',
name: 'schema',
givenName: 'schema',
additionalName: 'schema',
familyName: 'schema',
},
})

Expand Down Expand Up @@ -129,7 +146,7 @@ export const getVCIDDocumentPersonV2ContextConfig = () => {
},
})

const idDocumentIssuer = createSubjectContext<IDDocumentIssuerV2>({
const idDocumentIssuerContext = createSubjectContext<IDDocumentIssuerV2>({
type: 'IDDocumentIssuer',
base: 'bloomSchema',
properties: {
Expand All @@ -140,7 +157,16 @@ export const getVCIDDocumentPersonV2ContextConfig = () => {

return createContextConfig<VCIDDocumentPersonV2Type>({
type: 'IDDocumentCredentialPersonV2',
subjects: [idDocPersonContext, idDocRoleContext, idDocMatchContext, idDocContext, idDocumentIssuer],
subjects: [
idDocPersonContext,
idDocRoleContext,
idDocMatchContext,
idDocContext,
idDocumentIssuerContext,
identityCheckV2Context,
addressCheckV2Context,
postalAddressV2Context,
],
})
}

Expand Down
75 changes: 12 additions & 63 deletions packages/vc-data/src/identity/v2.ts
Original file line number Diff line number Diff line change
@@ -1,69 +1,16 @@
import { CreateVCType, createSubjectContext, createContextConfig, createContext, OneOrMore } from '../util/v2'
import { PostalAddressV2, postalAddressV2Context, PropertyValueV2, propertyValueV2Context } from '../base/v2'

export type PossibleMatchVals = 'match' | 'partial_match' | 'no_match' | 'no_data' | 'no_input'
export type PossibleCheckVals = 'success' | 'failure' | 'not_checked'

export type AddressCheckV2 = {
'@type': 'AddressCheck'
status: PossibleMatchVals
postOfficeBox?: 'yes' | 'no' | 'no_data'
type?: 'residential' | 'commercial' | 'no_data'
}

export type IdentityCheckV2 = {
'@type': 'IdentityCheck'
status?: PossibleCheckVals
createdAt?: string
completedAt?: string

// General checks
riskCheck?: PossibleCheckVals
selfieCheck?: PossibleCheckVals

// Individually validated attributes
addressCheck?: AddressCheckV2
nameCheck?: PossibleMatchVals
birthDateCheck?: PossibleMatchVals
identifierCheck?: PossibleMatchVals
phoneCheck?: PossibleMatchVals

// Active SMS verification, as opposed to passive database lookup
smsCheck?: PossibleCheckVals
}
import {
PostalAddressV2,
postalAddressV2Context,
PropertyValueV2,
propertyValueV2Context,
addressCheckV2Context, // i believe required with identityCheckV2Context
IdentityCheckV2,
identityCheckV2Context,
} from '../base/v2'

const getHelperContextEntries = () => {
return [
// IdentityCheck
createSubjectContext<IdentityCheckV2>({
type: 'IdentityCheck',
base: 'bloomSchema',
properties: {
status: 'bloomSchema',
createdAt: 'bloomSchema',
completedAt: 'bloomSchema',
riskCheck: 'bloomSchema',
selfieCheck: 'bloomSchema',
addressCheck: 'bloomSchema',
nameCheck: 'bloomSchema',
birthDateCheck: 'bloomSchema',
identifierCheck: 'bloomSchema',
phoneCheck: 'bloomSchema',
smsCheck: 'bloomSchema',
},
}),

// AddressCheck
createSubjectContext<AddressCheckV2>({
type: 'AddressCheck',
base: 'bloomSchema',
properties: {
status: 'bloomSchema',
postOfficeBox: 'bloomSchema',
type: 'bloomSchema',
},
}),
]
return [identityCheckV2Context, addressCheckV2Context]
}

// Person-related
Expand All @@ -73,6 +20,7 @@ export type IdentityPersonV2 = {
additionalName?: string
birthDate?: string
email?: string
phone?: string
familyName?: string
gender?: string
givenName?: string
Expand All @@ -94,6 +42,7 @@ export const getVCIdentityPersonV2ContextConfig = () => {
additionalName: 'schema',
birthDate: 'schema',
email: 'schema',
phone: 'schema',
familyName: 'schema',
gender: 'schema',
givenName: 'schema',
Expand Down
4 changes: 2 additions & 2 deletions packages/vc-data/src/wallet/v2.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CreateVCType, createSubjectContext, createContextConfig, createContext } from '../util/v2'
import { OneOrMore, CreateVCType, createSubjectContext, createContextConfig, createContext } from '../util/v2'

export type CryptographicWallet = {
'@type': 'CryptographicWallet'
Expand All @@ -10,7 +10,7 @@ export type CryptographicWallet = {

export type WalletPersonV2 = {
'@type': 'WalletPerson'
hasCryptographicWallet: CryptographicWallet
hasCryptographicWallet: OneOrMore<CryptographicWallet>
}

export type VCWalletPersonV2Type = 'WalletCredentialPersonV2'
Expand Down
4 changes: 2 additions & 2 deletions packages/vc/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@bloomprotocol/vc",
"description": "TypeScript types, JSON schemas, and signing and verifying functions for Verifiable Credentials and Presentations.",
"version": "0.1.4",
"version": "0.1.5",
"author": "Bloom Team <team@bloom.co>",
"license": "Apache-2.0",
"repository": "https://github.com/hellobloom/ssi-sdk/tree/main/packages/vc",
Expand All @@ -23,7 +23,7 @@
"lint": "eslint src --format table --ext .ts,.tsx,.js,.jsx",
"lint:fix": "npm run lint -- --fix",
"prepare": "npm run build",
"prepublishOnly": "npm run size && npm run lint && npm run test"
"prepublishOnly": "npm run lint && npm run test"
},
"dependencies": {
"ajv": "^8.2.0",
Expand Down
1 change: 1 addition & 0 deletions packages/vc/src/core/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './shared'
export * from './vc'
export * from './sdvc'
export * from './vp'
Loading

0 comments on commit 0ac5b1c

Please sign in to comment.