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

feat: Implementing Pluto Repositories #160

Merged
merged 29 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
cc74347
feat: StorableKey
curtis-h Nov 6, 2023
354a90e
feat: KeyRestoration Protocol
curtis-h Nov 2, 2023
1f7b8a7
feat(Pluto)!: refactor to Repository implementation
curtis-h Jan 19, 2024
5b9cdf0
feat(Pluto)!: storePrismDID remove unused arguments
curtis-h Jan 26, 2024
b22ef97
feat(Pluto)!: update CredentialMetadata fns
curtis-h Jan 26, 2024
57f9dc9
feat(Pluto)!: LinkSecret update to Domain class
curtis-h Jan 26, 2024
082018d
feat(Pluto)!: update to nulls
curtis-h Jan 29, 2024
bfdb21d
feat(Pluto)!: storeMediator to use Mediator parameter
curtis-h Jan 29, 2024
2fb4fd4
feat(Pluto)!: rename storePrivateKeys to storePrivateKey
curtis-h Jan 29, 2024
4ac4321
test: update Pluto tests to use new Pluto
curtis-h Jan 30, 2024
62afe66
feat(Pluto)!: PrismDIDs update to Domain class
curtis-h Jan 30, 2024
82be0ef
feat(Pluto)!: fixing AnonCredsCredentialProperties values and tests
curtis-h Feb 1, 2024
98f6fd2
feat(Pluto)! - required uuid and rxdbStore
curtis-h Feb 14, 2024
c2626fd
fix: package lost types after recent changes.
elribonazo Feb 21, 2024
777aee6
fix: add alias for RxStore and add missing demos.
elribonazo Feb 21, 2024
3a29f59
comments updates
curtis-h Feb 21, 2024
236a32d
Merge remote-tracking branch 'origin/master' into feature/ATL-6148-Re…
curtis-h Feb 21, 2024
3320081
linting
curtis-h Feb 21, 2024
49dc9ba
updating (unused) crypto-js dependency to non vulnerable version
curtis-h Feb 22, 2024
2707d2e
wip!!!
elribonazo Feb 22, 2024
765ffbc
fix: Improve tests.
elribonazo Feb 23, 2024
de008a7
fix: add fix for camelcase vs slash collectionames recently added.
elribonazo Feb 23, 2024
79286c1
fix: update demos to use latest peer did format with endpoint uri enc…
elribonazo Feb 23, 2024
99a2076
fix: restore testing on all files.
elribonazo Feb 23, 2024
ee01044
fix: only scan production flag.
elribonazo Feb 27, 2024
a1a47c8
fix: Adding delete message and revoke credential to pluto interface a…
elribonazo Feb 27, 2024
cfddb7e
Merge branch 'master' into feature/ATL-6148-Repositories
elribonazo Feb 27, 2024
bba4509
fix: restore ignored tests.
elribonazo Feb 27, 2024
a28c5ae
fix: Improve testing
elribonazo Feb 27, 2024
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
1,075 changes: 44 additions & 1,031 deletions demos/browser/package-lock.json

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions demos/browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"private": true,
"dependencies": {
"@atala/prism-wallet-sdk": "../..",
"@pluto-encrypted/database": "^1.2.14",
"@pluto-encrypted/inmemory": "^1.3.11",
"@pluto-encrypted/indexdb": "^1.12.2",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
Expand Down
35 changes: 14 additions & 21 deletions demos/browser/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
/* eslint-disable react-hooks/rules-of-hooks */
/* eslint-disable @typescript-eslint/no-non-null-assertion */
/**
* WARNING: This is an example using an encrypted inMemory storage.
* WARNING: This is an example using an encrypted indexDB storage.
* Checkout Community maintained NPM package @pluto-encrypted/database for more DB wrappers.
*/
import InMemory from "@pluto-encrypted/inmemory";
import { Database } from "@pluto-encrypted/database";
import React, { useCallback, useEffect, useMemo, useState } from "react";
import "./App.css";
import * as jose from "jose";
import { useAtom } from "jotai";
import SDK from "@atala/prism-wallet-sdk";
import IndexDB from "@pluto-encrypted/indexdb";

import "./App.css";
import { mnemonicsAtom } from "./state";
import { trimString } from "./utils";
import Spacer from "./Spacer";
Expand Down Expand Up @@ -362,7 +362,7 @@ const OOB: React.FC<{ agent: SDK.Agent, pluto: SDK.Domain.Pluto; }> = props => {
</>;
};

const Agent: React.FC<{ pluto: SDK.Domain.Pluto }> = props => {
const Agent: React.FC<{ pluto: SDK.Domain.Pluto; }> = props => {
const [mediatorDID, setMediatorDID] = useState<string>(defaultMediatorDID);

const sdk = useMemo(() => useSDK(SDK.Domain.DID.fromString(mediatorDID), props.pluto), [mediatorDID]);
Expand All @@ -388,8 +388,9 @@ const Agent: React.FC<{ pluto: SDK.Domain.Pluto }> = props => {
if (requestPresentations.length) {
for (const requestPresentation of requestPresentations) {
const lastCredentials = await pluto.getAllCredentials();
const lastCredential = lastCredentials.at(-1);
const lastCredential = lastCredentials.at(0);
const requestPresentationMessage = RequestPresentation.fromMessage(requestPresentation);

try {
if (lastCredential === undefined) throw new Error("last credential not found");

Expand Down Expand Up @@ -625,22 +626,14 @@ const Agent: React.FC<{ pluto: SDK.Domain.Pluto }> = props => {
};


function App() {
const [pluto, setPluto] = useState<SDK.Domain.Pluto>()

useEffect(() => {
if (!pluto) {
const defaultPassword = new Uint8Array(32).fill(1);
Database.createEncrypted(
{
name: `my-db`,
encryptionKey: defaultPassword,
storage: InMemory,
}
).then((db) => setPluto(db as any))
}
}, [pluto, setPluto])
const store = new SDK.Store({
name: "test",
storage: IndexDB,
password: Buffer.from("demoapp").toString("hex")
});
const pluto = new SDK.Pluto(store, apollo);

function App() {
return (
<div className="App">
<h1>Atala PRISM Wallet SDK Usage Examples</h1>
Expand Down
12 changes: 9 additions & 3 deletions demos/browser/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
Expand All @@ -17,5 +21,7 @@
"noEmit": true,
"jsx": "react-jsx"
},
"include": ["src"]
}
"include": [
"src"
]
}
Loading
Loading