Skip to content

Commit

Permalink
fix: Updates and fixes for latest SDK versions
Browse files Browse the repository at this point in the history
  • Loading branch information
nklomp committed Jul 25, 2024
1 parent 19ee3e6 commit 66df325
Show file tree
Hide file tree
Showing 10 changed files with 265 additions and 252 deletions.
70 changes: 35 additions & 35 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,36 +40,36 @@
"@reduxjs/toolkit": "^1.9.7",
"@scure/base": "^1.1.6",
"@sphereon/did-auth-siop": "0.6.4",
"@sphereon/did-provider-oyd": "0.22.1-next.12",
"@sphereon/did-provider-oyd": "0.23.1-next.3",
"@sphereon/isomorphic-webcrypto": "2.4.1-unstable.0",
"@sphereon/oid4vci-client": "0.15.0",
"@sphereon/oid4vci-common": "0.15.0",
"@sphereon/pex": "3.3.4-unstable.0",
"@sphereon/oid4vci-client": "0.15.1",
"@sphereon/oid4vci-common": "0.15.1",
"@sphereon/pex": "4.0.1",
"@sphereon/pex-models": "^2.2.4",
"@sphereon/react-native-argon2": "2.0.9",
"@sphereon/ssi-sdk-ext.did-provider-jwk": "0.22.1-next.12",
"@sphereon/ssi-sdk-ext.did-provider-key": "0.22.1-next.12",
"@sphereon/ssi-sdk-ext.did-resolver-ebsi": "0.22.1-next.12",
"@sphereon/ssi-sdk-ext.did-resolver-jwk": "0.22.1-next.12",
"@sphereon/ssi-sdk-ext.did-resolver-key": "0.22.1-next.12",
"@sphereon/ssi-sdk-ext.did-utils": "0.22.1-next.12",
"@sphereon/ssi-sdk-ext.key-manager": "0.22.1-next.12",
"@sphereon/ssi-sdk-ext.key-utils": "0.22.1-next.12",
"@sphereon/ssi-sdk-ext.kms-local": "0.22.1-next.12",
"@sphereon/ssi-sdk.contact-manager": "0.27.1-next.31",
"@sphereon/ssi-sdk.core": "0.27.1-next.31",
"@sphereon/ssi-sdk.data-store": "0.27.1-next.31",
"@sphereon/ssi-sdk.event-logger": "0.27.1-next.31",
"@sphereon/ssi-sdk.issuance-branding": "0.27.1-next.31",
"@sphereon/ssi-sdk.oid4vci-holder": "0.27.1-next.31",
"@sphereon/ssi-sdk.sd-jwt": "0.27.1-next.31",
"@sphereon/ssi-sdk.siopv2-oid4vp-op-auth": "0.27.1-next.31",
"@sphereon/ssi-sdk.vc-handler-ld-local": "0.27.1-next.31",
"@sphereon/ssi-sdk.xstate-machine-persistence": "0.27.1-next.31",
"@sphereon/ssi-types": "0.27.1-next.31",
"@sphereon/ui-components.core": "0.2.1-next.72",
"@sphereon/ui-components.ssi-react-native": "0.2.1-next.72",
"@sphereon/ui-components.credential-branding": "0.2.1-next.72",
"@sphereon/ssi-sdk-ext.did-provider-jwk": "0.23.1-next.3",
"@sphereon/ssi-sdk-ext.did-provider-key": "0.23.1-next.3",
"@sphereon/ssi-sdk-ext.did-resolver-ebsi": "0.23.1-next.3",
"@sphereon/ssi-sdk-ext.did-resolver-jwk": "0.23.1-next.3",
"@sphereon/ssi-sdk-ext.did-resolver-key": "0.23.1-next.3",
"@sphereon/ssi-sdk-ext.did-utils": "0.23.1-next.3",
"@sphereon/ssi-sdk-ext.key-manager": "0.23.1-next.3",
"@sphereon/ssi-sdk-ext.key-utils": "0.23.1-next.3",
"@sphereon/ssi-sdk-ext.kms-local": "0.23.1-next.3",
"@sphereon/ssi-sdk.contact-manager": "0.28.1-next.11",
"@sphereon/ssi-sdk.core": "0.28.1-next.11",
"@sphereon/ssi-sdk.data-store": "0.28.1-next.11",
"@sphereon/ssi-sdk.event-logger": "0.28.1-next.11",
"@sphereon/ssi-sdk.issuance-branding": "0.28.1-next.11",
"@sphereon/ssi-sdk.oid4vci-holder": "0.28.1-next.11",
"@sphereon/ssi-sdk.sd-jwt": "0.28.1-next.11",
"@sphereon/ssi-sdk.siopv2-oid4vp-op-auth": "0.28.1-next.11",
"@sphereon/ssi-sdk.vc-handler-ld-local": "0.28.1-next.11",
"@sphereon/ssi-sdk.xstate-machine-persistence": "0.28.1-next.11",
"@sphereon/ssi-types": "0.28.1-next.11",
"@sphereon/ui-components.core": "0.2.1-next.85",
"@sphereon/ui-components.ssi-react-native": "0.2.1-next.85",
"@sphereon/ui-components.credential-branding": "0.2.1-next.85",
"@veramo/core": "4.2.0",
"@veramo/credential-w3c": "4.2.0",
"@veramo/data-store": "4.2.0",
Expand Down Expand Up @@ -248,14 +248,14 @@
"ajv": "^8.12.0",
"@sphereon/isomorphic-argon2": "1.0.1",
"@sphereon/did-auth-siop": "0.6.4",
"@sphereon/ssi-sdk-ext.key-utils": "0.22.1-next.12",
"@sphereon/ssi-sdk-ext.did-utils": "0.22.1-next.12",
"@sphereon/ssi-types": "0.27.1-next.31",
"@sphereon/ssi-sdk.core": "0.27.1-next.31",
"@sphereon/ssi-sdk.data-store": "0.27.1-next.31",
"@sphereon/oid4vci-client": "0.15.0",
"@sphereon/oid4vci-common": "0.15.0",
"@sphereon/pex": "3.3.4-unstable.0",
"@sphereon/ssi-sdk-ext.key-utils": "0.23.1-next.3",
"@sphereon/ssi-sdk-ext.did-utils": "0.23.1-next.3",
"@sphereon/ssi-types": "0.28.1-next.11",
"@sphereon/ssi-sdk.core": "0.28.1-next.11",
"@sphereon/ssi-sdk.data-store": "0.28.1-next.11",
"@sphereon/oid4vci-client": "0.15.1",
"@sphereon/oid4vci-common": "0.15.1",
"@sphereon/pex": "4.0.1",
"@sphereon/pex-models": "2.2.4",
"@mattrglobal/bbs-signatures": "npm:empty-npm-package",
"@veramo/core": "4.2.0",
Expand Down
2 changes: 1 addition & 1 deletion src/components/views/SSICredentialViewItem/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
SSICredentialViewItemTitleCaptionStyled as TitleCaption,
} from '../../../styles/components';
import {CredentialSummary} from '@sphereon/ui-components.credential-branding';
import {toLocalDateString, toLocalDateTimeString} from '../../../utils/DateUtils';
import {toLocalDateString, toLocalDateTimeString} from '../../../utils';
import {View} from 'react-native';

// TODO fix to many properties
Expand Down
8 changes: 5 additions & 3 deletions src/providers/authentication/SIOPv2Provider.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {CheckLinkedDomain, SupportedVersion, VerifiedAuthorizationRequest} from '@sphereon/did-auth-siop';
import {getIdentifier, getKey} from '@sphereon/ssi-sdk-ext.did-utils';
import {getIdentifier, getKey, determineKid} from '@sphereon/ssi-sdk-ext.did-utils';
import {ConnectionType, DidAuthConfig} from '@sphereon/ssi-sdk.data-store';
import {OID4VP, OpSession, VerifiableCredentialsWithDefinition, VerifiablePresentationWithDefinition} from '@sphereon/ssi-sdk.siopv2-oid4vp-op-auth';
import {CredentialMapper, PresentationSubmission} from '@sphereon/ssi-types'; // FIXME we should fix the export of these objects
Expand Down Expand Up @@ -127,14 +127,16 @@ export const siopSendAuthorizationResponse = async (
identifier = await getIdentifier(presentationsAndDefs[0].identifierOpts, agentContext);
presentationSubmission = presentationsAndDefs[0].presentationSubmission;
}
const kid: string = (await getKey(identifier, 'authentication', session.context)).kid;
const key = await getKey({identifier, vmRelationship: 'authentication'}, session.context);
const kmsKeyRef = key.kid;
const kid = await determineKid({key, idOpts: {identifier, kmsKeyRef, verificationMethodSection: 'authentication'}}, session.context);

debug(`Definitions and locations:`, JSON.stringify(presentationsAndDefs?.[0]?.verifiablePresentation, null, 2));
debug(`Presentation Submission:`, JSON.stringify(presentationSubmission, null, 2));
const response = session.sendAuthorizationResponse({
...(presentationsAndDefs && {verifiablePresentations: presentationsAndDefs?.map(pd => pd.verifiablePresentation)}),
...(presentationSubmission && {presentationSubmission}),
responseSignerOpts: {identifier, kid},
responseSignerOpts: {identifier, kmsKeyRef, kid},
});
debug(`Response: `, response);

Expand Down
Empty file.
2 changes: 1 addition & 1 deletion src/screens/SSICredentialsOverviewScreen/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
SSIStatusBarDarkModeStyled as StatusBar,
} from '../../styles/components';
import {IUser, IUserIdentifier, MainRoutesEnum, RootState, ScreenRoutesEnum, StackParamList} from '../../types';
import {getOriginalVerifiableCredential} from '../../utils/CredentialUtils';
import {getOriginalVerifiableCredential} from '../../utils';
import {backgroundColors, borderColors} from '@sphereon/ui-components.core';
import {CredentialSummary} from '@sphereon/ui-components.credential-branding';

Expand Down
2 changes: 1 addition & 1 deletion src/services/machines/onboardingMachineService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const createUserAndIdentity = async (

const cred: Partial<CredentialPayload> | undefined = credentialData.credential;
const ctx = {...agent?.context, agent};
const key: _ExtendedIKey | undefined = await getFirstKeyWithRelation(identifier, ctx, 'authentication');
const key: _ExtendedIKey | undefined = await getFirstKeyWithRelation({identifier, vmRelationship: 'authentication'}, ctx);
const verifiableCredential: VerifiableCredential = await createVerifiableCredential({
credential: {
...cred,
Expand Down
9 changes: 7 additions & 2 deletions src/services/machines/siopV2MachineService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,19 @@ import {SiopV2AuthorizationRequestData, SiopV2MachineContext} from '../../types/
import {translateCorrelationIdToName} from '../../utils';
import {getContacts} from '../contactService';

export const createConfig = async (context: Pick<SiopV2MachineContext, 'url'>): Promise<Omit<DidAuthConfig, 'stateId' | 'identifier'>> => {
const {url} = context;
export const createConfig = async (
context: Pick<SiopV2MachineContext, 'url' | 'identifier'>,
): Promise<Omit<DidAuthConfig, 'stateId' | 'identifier'>> => {
const {url, identifier} = context;

if (!url) {
return Promise.reject(Error('Missing request uri in context'));
}

return {
idOpts: {
identifier,
},
id: uuidv4(),
// FIXME: Update these values in SSI-SDK. Only the URI (not a redirectURI) would be available at this point
sessionId: uuidv4(),
Expand Down
4 changes: 3 additions & 1 deletion src/services/qrService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ const connectDidAuth = async (args: IQrDataArgs): Promise<void> => {
const connection: NonPersistedConnection = {
type: ConnectionType.SIOPv2,
config: {
identifier,
idOpts: {
identifier,
},
stateId: (args.qrData as IQrDidSiopAuthenticationRequest).state,
redirectUrl: (args.qrData as IQrDidSiopAuthenticationRequest).redirectUrl,
sessionId: (args.qrData as IQrDidSiopAuthenticationRequest).redirectUrl + identifier.did,
Expand Down
6 changes: 5 additions & 1 deletion src/store/actions/credential.actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ export const getVerifiableCredentials = (): ThunkAction<Promise<void>, RootState
const credentialBranding: ICredentialBranding | undefined = credentialsBranding.find(
(branding: ICredentialBranding): boolean => branding.vcHash === uniqueVC.hash,
);
return await toCredentialSummary(uniqueVC, credentialBranding?.localeBranding, getCredentialIssuerContact(uniqueVC.verifiableCredential));
return await toCredentialSummary(
uniqueVC,
credentialBranding?.localeBranding,
await getCredentialIssuerContact(uniqueVC.verifiableCredential),
);
}),
);
dispatch({type: GET_CREDENTIALS_SUCCESS, payload: [...credentialSummaries]});
Expand Down
Loading

0 comments on commit 66df325

Please sign in to comment.