Created
March 10, 2023 16:17
-
-
Save Jviejo/a0593a51e856b0c236bda6bb9b2fccc3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import '@hyperledger/aries-askar-nodejs' | |
import { ariesAskar, LogLevel, Store, StoreKeyMethod } from '@hyperledger/aries-askar-shared' | |
const getRawKey = () => "9Lgah8ykGoxDNLxoEBKRFxrdV9JCU98w6jXz4xp3Z7kP" || Store.generateRawKey(Buffer.from('00000000000000000000000000000My1')) | |
console.log(getRawKey()) | |
export const testStoreUri = 'postgres://postgres:postgres@localhost:5432/postgres' || 'sqlite://:memory:' | |
export const setupWallet = async () => { | |
const key = getRawKey() | |
return await Store.provision({ | |
recreate: true, | |
uri: testStoreUri, | |
keyMethod: StoreKeyMethod.Raw, | |
passKey: key, | |
}) | |
} | |
export const openWallet = async (profile) => { | |
const key = getRawKey() | |
return await Store.open({ | |
uri: testStoreUri, | |
keyMethod: StoreKeyMethod.Raw, | |
passKey: key, | |
profile: "profile2" | |
}) | |
} | |
(async () => { | |
const wallet = await openWallet("profile2"); | |
// wallet.createProfile("profile2") | |
const sesion = await wallet.openSession() | |
await sesion.insert({ | |
category: "category", | |
name: "name43", | |
value: "valor1", | |
tags: { | |
tag1: "tag1", | |
tag2: "tag1", | |
"~tag3": "tag311" | |
} | |
}) | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment