Skip to content

Commit 0685f04

Browse files
committed
chore(client): migrate from deprecated @privacybydesign/irma-* to yivi-* packages
Replaces irma-client/core/css/web 0.3.3 with the successor yivi-client/core/css/web 1.0.x packages. The API is identical (use(), start(), abort()), only the import names changed: IrmaCore → YiviCore, Web → YiviWeb, Client → YiviClient. Also mocks @privacybydesign/yivi-css in jest (same as the old irma-css needed) to prevent jest from trying to parse the raw CSS file as JavaScript.
1 parent 8ec69ce commit 0685f04

7 files changed

Lines changed: 55 additions & 121 deletions

File tree

client/jest.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ module.exports = {
66
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
77
'<rootDir>/src/test/fileMock.ts',
88
'\\.(css)$': '<rootDir>/src/test/styleMock.ts',
9+
'@privacybydesign/yivi-css': '<rootDir>/src/test/styleMock.ts',
910
'^@config/(.*)$': '<rootDir>/src/config/$1',
1011
'^@app/(.*)$': '<rootDir>/src/app/$1',
1112
'^@components/(.*)$': '<rootDir>/src/components/$1',

client/package-lock.json

Lines changed: 31 additions & 98 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818
"@amsterdam/asc-assets": "^0.35.0",
1919
"@amsterdam/asc-ui": "^0.35.2",
2020
"@amsterdam/react-maps": "^0.12.0",
21-
"@privacybydesign/irma-client": "^0.3.3",
22-
"@privacybydesign/irma-core": "^0.3.3",
23-
"@privacybydesign/irma-css": "^0.3.3",
24-
"@privacybydesign/irma-web": "^0.3.3",
21+
"@privacybydesign/yivi-client": "^1.0.0",
22+
"@privacybydesign/yivi-core": "^1.0.0",
23+
"@privacybydesign/yivi-css": "^1.0.1",
24+
"@privacybydesign/yivi-web": "^1.0.2",
2525
"axios": "^1.12.0",
2626
"core-js": "3",
2727
"leaflet": "^1.6.0",

client/src/services/createIrmaSession.spec.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import IrmaCore from '@privacybydesign/irma-core';
2+
import YiviCore from '@privacybydesign/yivi-core';
33
import { setupMocks, wrappedRender } from '@test/utils';
44
import { act } from 'react-dom/test-utils';
55
import createIrmaSession, { getConfig } from './createIrmaSession';
@@ -79,7 +79,7 @@ xdescribe('createIrmaSession', () => {
7979
it('createIrmaSession()', async () => {
8080
await act(async (): Promise<any> => await wrappedRender(<div id="test-elementID"></div>));
8181

82-
IrmaCore.prototype.start = jest.fn().mockReturnValue({
82+
YiviCore.prototype.start = jest.fn().mockReturnValue({
8383
token: '1234567890abcdefg',
8484
status: 'DONE',
8585
type: 'disclosing',

client/src/services/createIrmaSession.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import axios from 'axios';
2-
import '@privacybydesign/irma-css';
3-
import IrmaCore from '@privacybydesign/irma-core';
4-
import Web from '@privacybydesign/irma-web';
5-
import Client from '@privacybydesign/irma-client';
2+
import '@privacybydesign/yivi-css';
3+
import YiviCore from '@privacybydesign/yivi-core';
4+
import YiviWeb from '@privacybydesign/yivi-web';
5+
import YiviClient from '@privacybydesign/yivi-client';
66
import userAgent from './userAgent';
77

88
// Types
@@ -99,12 +99,12 @@ const createIrmaSession = (
9999
callBackMapping?: IStateChangeCallbackMapping,
100100
alwaysShowQRCode = false,
101101
language = 'nl'
102-
): typeof IrmaCore => {
102+
): typeof YiviCore => {
103103
const queryString = Object.keys(query)
104104
.map((key, index) => `${index === 0 ? '?' : ''}${key}=${(query as any)[key]}`)
105105
.join('&');
106106

107-
const irma = new IrmaCore({
107+
const irma = new YiviCore({
108108
debugging: process.env.NODE_ENV !== 'production',
109109
element: `#${holderElementId}`,
110110
callBackMapping,
@@ -136,8 +136,8 @@ const createIrmaSession = (
136136
}
137137
});
138138

139-
irma.use(Client);
140-
irma.use(Web);
139+
irma.use(YiviClient);
140+
irma.use(YiviWeb);
141141

142142
if (isMobile()) {
143143
irma.use(IrmaSkipMobileChoice);

client/src/services/createIrmaVoteSession.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import IrmaCore from '@privacybydesign/irma-core';
2-
import Web from '@privacybydesign/irma-web';
3-
import Client from '@privacybydesign/irma-client';
1+
import YiviCore from '@privacybydesign/yivi-core';
2+
import YiviWeb from '@privacybydesign/yivi-web';
3+
import YiviClient from '@privacybydesign/yivi-client';
44
import { IrmaAbortOnCancel, isMobile, IStateChangeCallbackMapping, IStateMachine } from '@services/createIrmaSession';
55
import { HOLDER_ELEMENT_ID } from '../pages/Vote';
66

@@ -75,7 +75,7 @@ const createIrmaVoteSession = async (
7575
objectToSign: IQueryObj,
7676
callBackMapping?: IStateChangeCallbackMapping
7777
): Promise<IIrmaResult | undefined> => {
78-
const irma = new IrmaCore({
78+
const irma = new YiviCore({
7979
debugging: true,
8080
element: `#${HOLDER_ELEMENT_ID}`,
8181
callBackMapping,
@@ -99,8 +99,8 @@ const createIrmaVoteSession = async (
9999
}
100100
});
101101

102-
irma.use(Client);
103-
irma.use(Web);
102+
irma.use(YiviClient);
103+
irma.use(YiviWeb);
104104

105105
if (isMobile()) {
106106
irma.use(IrmaSkipMobileChoice);

client/src/types.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
declare module '@privacybydesign/irma-core';
2-
declare module '@privacybydesign/irma-web';
3-
declare module '@privacybydesign/irma-client';
1+
declare module '@privacybydesign/yivi-core';
2+
declare module '@privacybydesign/yivi-web';
3+
declare module '@privacybydesign/yivi-client';
44
declare module '@testing-library/jest-dom/matchers';
55
declare module 'unist-util-visit';
66
declare module 'mdast-util-to-string';

0 commit comments

Comments
 (0)