Skip to content

Commit efaafd3

Browse files
authored
Merge pull request #5 from dfinity/alex/add-password-manager-with-metadata
feat: CRP-2673 implement password manager with metadata
2 parents 730f425 + 9214f08 commit efaafd3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+8661
-91
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Known failure: https://dfinity.atlassian.net/browse/EM-7
2+
name: examples-password-manager-with-metadata
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
paths:
9+
- examples/password_manager_with_metadata/**
10+
- .github/workflows/provision-darwin.sh
11+
- .github/workflows/provision-linux.sh
12+
- .github/workflows/examples-password-manager-with-metadata.yml
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: true
16+
jobs:
17+
key-manager-example-darwin:
18+
runs-on: macos-15
19+
steps:
20+
- uses: actions/checkout@v1
21+
- name: Provision Darwin
22+
run: |
23+
bash .github/workflows/provision-darwin.sh
24+
brew install llvm
25+
- name: Deploy Password Manager With Metadata Darwin
26+
run: |
27+
pushd examples/password_manager_with_metadata
28+
./deploy_locally.sh
29+
key-manager-example-linux:
30+
runs-on: ubuntu-20.04
31+
steps:
32+
- uses: actions/checkout@v1
33+
- name: Provision Linux
34+
run: bash .github/workflows/provision-linux.sh
35+
- name: Deploy Password Manager With Metadata Linux
36+
run: |
37+
pushd examples/password_manager_with_metadata
38+
./deploy_locally.sh

Cargo.lock

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

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ members = [
77
"cdk/test_utils",
88
"cdk/types",
99
"cdk/utils",
10+
"examples/password_manager_with_metadata/backend"
1011
]
1112
resolver = "2"
1213

@@ -29,6 +30,7 @@ ic-vetkd-utils = { version = "0.1.0", git = "https://github.com/dfinity/ic.git"
2930
lazy_static = "1.5.0"
3031
pocket-ic = "7.0.0"
3132
serde = "1.0.217"
33+
serde_cbor = "0.11.2"
3234
serde_json = "1.0.138"
3335

3436
[profile.release]

cdk/key_manager/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ ic-vetkd-cdk-types = { path = "../types" }
2020
ic-vetkd-utils = { workspace = true }
2121
lazy_static = "1.5.0"
2222
serde = { workspace = true }
23-
serde_cbor = "0.11.2"
23+
serde_cbor = { workspace = true }
2424
serde_bytes = "0.11.15"
2525
serde_with = "3.11.0"
2626
strum = "0.26.3"

examples/password_manager/deploy_locally.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
pushd ../../cdk/encrypted_maps_example
2-
make clean &&
2+
make clean &&
33
make mock &&
44
eval $(make export-cmd)
55
popd

examples/password_manager/frontend/src/components/Counter.svelte

Lines changed: 0 additions & 10 deletions
This file was deleted.

examples/password_manager/frontend/src/components/SharingEditor.svelte

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
) as HTMLSelectElement;
3333
const selectedIndex = selectElement.selectedIndex;
3434
const selectedValue = selectElement.options[selectedIndex].value;
35-
console.info("selected: " + selectedValue);
3635
3736
if (selectedValue === "Read") {
3837
} else if (selectedValue === "ReadWrite") {

examples/password_manager/frontend/src/components/VaultEditor.svelte.b

Lines changed: 0 additions & 68 deletions
This file was deleted.

examples/password_manager/frontend/src/lib/encrypted_maps.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ export async function createEncryptedMaps(agentOptions?: HttpAgentOptions): Prom
1010
: 'http://localhost:8000';
1111
const hostOptions = { host, };
1212

13-
// console.info("host: " + host);
14-
1513
if (!agentOptions) {
1614
agentOptions = hostOptions;
1715
} else {

examples/password_manager/frontend/src/store/vaults.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,19 +72,14 @@ export async function refreshVaults(
7272
const passwordNameString = new TextDecoder().decode(Uint8Array.from(passwordNameBytebuf.inner));
7373
const passwordContent = new TextDecoder().decode(Uint8Array.from(data.inner));
7474
const password = passwordFromContent(otherOwner, vaultName, passwordNameString, passwordContent);
75-
// console.info("refreshVaults for owner " + password.owner.toText() + " and vaultName " + password.parentVaultName + " found password: " + password.passwordName + " with content: " + password.content);
7675
passwords.push([passwordNameString, password]);
7776
}
7877

79-
// const x = passwords.values().map((password) => password[1].content).reduce((accumulator, currentValue) => accumulator + currentValue + ", ", "");
80-
// console.info("refreshVaults for owner " + owner.toText() + " and vaultName " + vaultName + " returned " + result.Ok.length + " passwords: " + x);
81-
8278
const usersResult = await encryptedMaps.get_shared_user_access_for_map(otherOwner, vaultName);
8379
if ("Err" in usersResult) {
8480
throw new Error(usersResult.Err);
8581
}
8682

87-
// TODO fetch the user rights as well
8883
vaults.push(vaultFromContent(otherOwner, vaultName, passwords, usersResult.Ok));
8984
}
9085

@@ -95,7 +90,6 @@ export async function addPassword(
9590
password: PasswordModel,
9691
encryptedMaps: EncryptedMaps
9792
) {
98-
// console.info("calling vaults.ts:addPassword with password: " + JSON.stringify(password));
9993
let result = await encryptedMaps.set_value(password.owner, password.parentVaultName, password.passwordName, new TextEncoder().encode(password.content));
10094
if ("Err" in result) {
10195
throw new Error(result.Err);
@@ -106,7 +100,6 @@ export async function removePassword(
106100
password: PasswordModel,
107101
encryptedMaps: EncryptedMaps
108102
) {
109-
// console.info("calling vaults.ts:addPassword with password: " + JSON.stringify(password));
110103
let result = await encryptedMaps.remove_encrypted_value(password.owner, password.parentVaultName, password.passwordName);
111104
if ("Err" in result) {
112105
throw new Error(result.Err);
@@ -117,7 +110,6 @@ export async function updatePassword(
117110
password: PasswordModel,
118111
encryptedMaps: EncryptedMaps
119112
) {
120-
// console.info("calling vaults.ts:updatePassword with password: " + JSON.stringify(password));
121113
let result = await encryptedMaps.set_value(password.owner, password.parentVaultName, password.passwordName, new TextEncoder().encode(password.content));
122114
if ("Err" in result) {
123115
throw new Error(result.Err);

0 commit comments

Comments
 (0)