Skip to content

Commit

Permalink
feat(server-dapp-sdk): update namings
Browse files Browse the repository at this point in the history
  • Loading branch information
ditoglez committed Dec 6, 2024
1 parent 4b3305f commit 3ba21bd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
14 changes: 7 additions & 7 deletions packages/idos-sdk-server-dapp/src/idOS-grantee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const buildKwilSignerAndGrantee = (
};

interface idOSGranteeInitParams {
encryptionSecret: string;
encryptionPrivateKey: string;
nodeUrl?: string;
chainId?: string;
dbId?: string;
Expand All @@ -109,7 +109,7 @@ export class idOSGrantee {
grants?: GrantChild;

static async init(_: {
encryptionSecret: string;
encryptionPrivateKey: string;
nodeUrl?: string;
chainId?: string;
dbId?: string;
Expand All @@ -119,7 +119,7 @@ export class idOSGrantee {
}): Promise<idOSGrantee>;

static async init(_: {
encryptionSecret: string;
encryptionPrivateKey: string;
nodeUrl?: string;
chainId?: string;
dbId?: string;
Expand All @@ -129,7 +129,7 @@ export class idOSGrantee {
}): Promise<idOSGrantee>;

static async init({
encryptionSecret,
encryptionPrivateKey,
nodeUrl = KwilWrapper.defaults.kwilProvider,
chainId,
dbId,
Expand Down Expand Up @@ -173,7 +173,7 @@ export class idOSGrantee {
}

return new idOSGrantee(
NoncedBox.fromBase64SecretKey(encryptionSecret),
NoncedBox.fromBase64SecretKey(encryptionPrivateKey),
nodeKwil,
kwilSigner,
dbId,
Expand Down Expand Up @@ -250,8 +250,8 @@ export class idOSGrantee {
if (!this.grants) throw new Error("NEAR is not implemented yet");

return this.grants.list({
owner: address,
grantee: this.grantee,
ownerAddress: address,
granteeAddress: this.grantee,
});
}

Expand Down
12 changes: 6 additions & 6 deletions packages/idos-sdk-server-dapp/src/idOS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,28 @@ export class idOS {

static async init(
chainType: "EVM" | "NEAR",
privateKey: string,
encryptionSecretKey: string,
authnPrivateKey: string,
encryptionPrivateKey: string,
nodeUrl: string,
) {
let grantee: idOSGrantee;

switch (chainType) {
case "EVM": {
const signer = new ethers.Wallet(privateKey, new JsonRpcProvider(nodeUrl));
const signer = new ethers.Wallet(authnPrivateKey, new JsonRpcProvider(nodeUrl));
grantee = await idOSGrantee.init({
chainType,
granteeSigner: signer,
encryptionSecret: encryptionSecretKey,
encryptionPrivateKey,
});
return new idOS(grantee);
}
case "NEAR": {
const signer = KeyPair.fromString(privateKey);
const signer = KeyPair.fromString(authnPrivateKey);
grantee = await idOSGrantee.init({
chainType,
granteeSigner: signer,
encryptionSecret: privateKey,
encryptionPrivateKey: authnPrivateKey,
});
return new idOS(grantee);
}
Expand Down

0 comments on commit 3ba21bd

Please sign in to comment.