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

Update to latest jsonld, http-client, webcrypto. #553

Merged
merged 9 commits into from
Feb 20, 2024
Merged
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: 1 addition & 3 deletions .github/workflows/lint-project.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Lint
name: static-analysis

on:
push:
Expand All @@ -25,8 +25,6 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Clear npm cache
run: npm cache clean --force
- run: npm i --legacy-peer-deps
- run: npm run lint
- run: npm run test
9 changes: 8 additions & 1 deletion app.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,14 @@
"group.edu.mit.eduwallet"
]
},
"associatedDomains": ["applinks:lcw.app/mobile"]
"associatedDomains": ["applinks:lcw.app/mobile"],
"infoPlist": {
"CFBundleURLTypes": [
{
"CFBundleURLSchemes": ["dccrequest"]
}
]
}
},
"android": {
"adaptiveIcon": {
Expand Down
3 changes: 2 additions & 1 deletion app/lib/decode.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// import '@digitalcredentials/data-integrity-rn';
import { fromQrCode, toQrCode } from '@digitalcredentials/vpqr';
import qs from 'query-string';

Expand Down Expand Up @@ -109,7 +110,7 @@ async function credentialsFromJson(text: string): Promise<Credential[]> {

/**
* A method for decoding credentials from a variety text formats.
*
*
* @param text - A string containing a VPQR, URL, or JSON object.
* @returns {Promise<Credential[]>} - An array of credentials.
*/
Expand Down
3 changes: 2 additions & 1 deletion app/lib/did.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// import '@digitalcredentials/data-integrity-rn';
import * as DidMethodKey from '@digitalcredentials/did-method-key';
import { generateSecureRandom } from 'react-native-securerandom';
import { AddDidRecordParams } from '../model';
Expand All @@ -18,4 +19,4 @@ export async function mintDid(): Promise<AddDidRecordParams> {
]: DidKey[] = expandedMap.map(([, pair]): DidKey => pair);

return { didDocument, verificationKey, keyAgreementKey };
}
}
1 change: 1 addition & 0 deletions app/lib/didAuthRequest.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// import '@digitalcredentials/data-integrity-rn';
import { ProfileRecordRaw } from '../model';
import { makeSelectDidFromProfile, selectWithFactory } from '../store/selectorFactories';
import { Ed25519Signature2020 } from '@digitalcredentials/ed25519-signature-2020';
Expand Down
1 change: 1 addition & 0 deletions app/lib/exchanges.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import uuid from 'react-native-uuid';
// import '@digitalcredentials/data-integrity-rn';
import vc from '@digitalcredentials/vc';
import { Ed25519Signature2020 } from '@digitalcredentials/ed25519-signature-2020';
import { securityLoader } from '@digitalcredentials/security-document-loader';
Expand Down
1 change: 1 addition & 0 deletions app/lib/present.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import uuid from 'react-native-uuid';
// import '@digitalcredentials/data-integrity-rn';
import vc from '@digitalcredentials/vc';
import { Ed25519VerificationKey2020 } from '@digitalcredentials/ed25519-verification-key-2020';
import { Ed25519Signature2020 } from '@digitalcredentials/ed25519-signature-2020';
Expand Down
4 changes: 2 additions & 2 deletions app/lib/validate.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// import '@digitalcredentials/data-integrity-rn';
import { Ed25519Signature2020 } from '@digitalcredentials/ed25519-signature-2020';
import { purposes } from '@digitalcredentials/jsonld-signatures';
import { checkStatus } from '@digitalcredentials/vc-status-list';
Expand Down Expand Up @@ -89,8 +90,7 @@ export async function verifyCredential(credential: Credential, registries: Regis

return result;
} catch (err) {
console.warn(err);
console.log(JSON.stringify(err, removeStackReplacer, 2));
console.warn('verifyCredential', err, JSON.stringify(err, removeStackReplacer, 2));

throw new Error(CredentialError.CouldNotBeVerified);
}
Expand Down
8 changes: 3 additions & 5 deletions app/mock/credential.ts

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion app/screens/DeveloperScreen/DeveloperScreen.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { createDynamicStyleSheet } from '../../lib/dynamicStyles';

export default createDynamicStyleSheet(({ theme, mixins }) => ({
container: {
flex: 1,
padding: 16,
},
paragraph: {
Expand Down
6 changes: 3 additions & 3 deletions app/screens/DeveloperScreen/DeveloperScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { Linking, Text, View } from 'react-native';
import {Linking, ScrollView, Text, View} from 'react-native';
import { Button } from 'react-native-elements';
import { FileLogger } from 'react-native-file-logger';
import * as RNFS from 'react-native-fs';
Expand Down Expand Up @@ -88,7 +88,7 @@ export default function DeveloperScreen({ navigation }: DeveloperScreenProps): J
return (
<>
<NavHeader title="Developer Settings" goBack={navigation.goBack} />
<View style={styles.container}>
<ScrollView contentContainerStyle={styles.container}>
<Text style={styles.header}>General</Text>
<Button {...buttonStyleProps} title="View developer logs" onPress={viewLogs} />
<Button {...buttonStyleProps} title="Clear developer logs" onPress={clearLogs} />
Expand All @@ -100,7 +100,7 @@ export default function DeveloperScreen({ navigation }: DeveloperScreenProps): J
<Button {...buttonStyleProps} title="Receive credential through deep link" onPress={receiveCredentialThroughDeepLink} />
<Button {...buttonStyleProps} title="Credential share request with deep link" onPress={startShareRequest} />
<View style={styles.spacer} />
</View>
</ScrollView>
</>
);
}
Expand Down
3 changes: 2 additions & 1 deletion app/screens/ExchangeCredentials/ExchangeCredentials.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import { Text } from 'react-native-elements';
// import '@digitalcredentials/data-integrity-rn';
import { Ed25519Signature2020 } from '@digitalcredentials/ed25519-signature-2020';
import { Ed25519VerificationKey2020 } from '@digitalcredentials/ed25519-verification-key-2020';
import { ConfirmModal } from '../../components';
Expand Down Expand Up @@ -60,7 +61,7 @@ export default function ExchangeCredentials({ route }: ExchangeCredentialsProps)
const credential = credentialField[0];
await dispatch(stageCredentials([credential]));
await delay(500);
navigationRef.navigate('AcceptCredentialsNavigation', {
navigationRef.navigate('AcceptCredentialsNavigation', {
screen: 'ApproveCredentialsScreen',
params: {
rawProfileRecord
Expand Down
6 changes: 5 additions & 1 deletion app/store/slices/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,11 @@ const initialize = createAsyncThunk('walletState/initialize', async ({ passphras
throw err;
}
} else {
await dispatch(createProfile({ profileName: INITIAL_PROFILE_NAME }));
try {
await dispatch(createProfile({ profileName: INITIAL_PROFILE_NAME })).unwrap();
} catch(err) {
console.error('Profile creation failed:', err);
}
}

await dispatch(getAllRecords());
Expand Down
2 changes: 1 addition & 1 deletion app/types/digitalcredentials.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ declare module '@digitalcredentials/did-method-key';
declare module '@digitalcredentials/vc';
declare module '@digitalcredentials/vc-status-list';
declare module '@digitalcredentials/vpqr';
declare module '@digitalcredentials/http-client';
declare module '@digitalbazaar/http-client';
declare module '@digitalcredentials/jsonld-signatures';
declare module '@digitalcredentials/ed25519-signature-2020' {
export class Ed25519Signature2020 {
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import './shim.js';
import 'react-native-url-polyfill/auto';
import 'react-native-gesture-handler';
import 'react-native-get-random-values';
import { registerRootComponent } from 'expo';


import App from './App';

/**
Expand Down
Loading