Skip to content

Commit

Permalink
User interface changes (#420)
Browse files Browse the repository at this point in the history
* ci(restapi): 🎉 cut release to restapi-v1.0.0

* fix(component): dummy

* ci(restapi): 🎉 cut release to restapi-v1.0.0

* fix(component): dummy

* ci(restapi): 🎉 cut release to restapi-v1.0.1

* ci(restapi): 🎉 cut release to restapi-v1.0.1

* fix(component): dummy

* ci(restapi): 🎉 cut release to restapi-v1.0.2

* fix(component): dummy

* ci(restapi): 🎉 cut release to restapi-v1.0.2

* fix(component): dummy

* ci(restapi): 🎉 cut release to restapi-v1.0.3

* fix: success progressHook

* ci(restapi): 🎉 cut release to restapi-v1.0.4

* ci(restapi): 🎉 cut release to restapi-v1.1.0

* ci(restapi): 🎉 cut release to restapi-v1.2.0

* ci(restapi): 🎉 cut release to restapi-v1.2.0

* ci(restapi): 🎉 cut release to restapi-v1.0.0

* fix(component): dummy

* fix(component): dummy

* fix(component): dummy

* ci(restapi): 🎉 cut release to restapi-v1.0.2

* fix(component): dummy

* ci(restapi): 🎉 cut release to restapi-v1.0.3

* ci(restapi): 🎉 cut release to restapi-v1.0.4

* ci(restapi): 🎉 cut release to restapi-v1.2.1

* fix: local for local development (#295)

Co-Authored-By: aman035 <[email protected]>

* fix: version update

* ci(restapi): 🎉 cut release to restapi-v1.2.2

* ci(restapi): 🎉 cut release to restapi-v1.2.3

* ci(restapi): 🎉 cut release to restapi-v1.2.4

* ci(restapi): 🎉 cut release to restapi-v1.2.5

* ci(restapi): 🎉 cut release to restapi-v1.2.6

* ci(restapi): 🎉 cut release to restapi-v1.2.7

* ci(socket): 🎉 cut release to socket-v0.5.0

* fix: test commit

* ci(restapi): 🎉 cut release to restapi-v1.2.8

* ci(uiweb): 🎉 cut release to uiweb-v1.0.0

* ci(uiweb): 🎉 cut release to uiweb-v1.0.0

* ci(uiweb): 🎉 cut release to uiweb-v1.0.1

* fix: added ci-version-beta

* fix: added ci-version-beta

* ci(restapi): 🎉 cut beta release to restapi-v1.2.9

* fix: added releaseType

* ci(restapi): 🎉 cut beta release to restapi-v0.0.1-beta.0

* ci(restapi): 🎉 cut beta release to restapi-v0.0.1-beta.0

* ci(restapi): 🎉 cut release to restapi-v1.2.10

* ci(restapi): 🎉 cut release to restapi-v1.2.10

* ci(restapi): 🎉 cut beta release to restapi-v0.0.1-beta.1

* Add wallet to wallet video call methods (#309)

* feat(video): add create and request method

* feat(video): add simple-peer dependency

* feat(video): add acceptRequest method

* feat(video): add establish and end methods

* refactor(video): wrap video methods in a class

* feat(video): add video audio toggle functions

* fix(video): add pgp private key in send video call notification

* ci(restapi): 🎉 cut beta release to restapi-v0.0.1-beta.2

* ci(restapi): 🎉 cut beta release to restapi-v0.0.1-beta.2

* Alpha deployment (#357)

* ci(restapi): 🎉 cut release to restapi-v1.0.0

* fix(component): dummy

* ci(restapi): 🎉 cut release to restapi-v1.0.0

* fix(component): dummy

* ci(restapi): 🎉 cut release to restapi-v1.0.1

* ci(restapi): 🎉 cut release to restapi-v1.0.1

* fix(component): dummy

* ci(restapi): 🎉 cut release to restapi-v1.0.2

* fix(component): dummy

* ci(restapi): 🎉 cut release to restapi-v1.0.2

* fix(component): dummy

* ci(restapi): 🎉 cut release to restapi-v1.0.3

* fix: success progressHook

* ci(restapi): 🎉 cut release to restapi-v1.0.4

* ci(restapi): 🎉 cut release to restapi-v1.1.0

* ci(restapi): 🎉 cut release to restapi-v1.2.0

* ci(restapi): 🎉 cut release to restapi-v1.2.0

* ci(restapi): 🎉 cut release to restapi-v1.0.0

* fix(component): dummy

* fix(component): dummy

* fix(component): dummy

* ci(restapi): 🎉 cut release to restapi-v1.0.2

* fix(component): dummy

* ci(restapi): 🎉 cut release to restapi-v1.0.3

* ci(restapi): 🎉 cut release to restapi-v1.0.4

* ci(restapi): 🎉 cut release to restapi-v1.2.1

* fix: local for local development (#295)

Co-Authored-By: aman035 <[email protected]>

* fix: version update

* ci(restapi): 🎉 cut release to restapi-v1.2.2

* ci(restapi): 🎉 cut release to restapi-v1.2.3

* ci(restapi): 🎉 cut release to restapi-v1.2.4

* ci(restapi): 🎉 cut release to restapi-v1.2.5

* ci(restapi): 🎉 cut release to restapi-v1.2.6

* ci(restapi): 🎉 cut release to restapi-v1.2.7

* ci(socket): 🎉 cut release to socket-v0.5.0

* fix: test commit

* ci(restapi): 🎉 cut release to restapi-v1.2.8

* ci(uiweb): 🎉 cut release to uiweb-v1.0.0

* ci(uiweb): 🎉 cut release to uiweb-v1.0.0

* ci(uiweb): 🎉 cut release to uiweb-v1.0.1

* fix: added ci-version-beta

* fix: added ci-version-beta

* ci(restapi): 🎉 cut beta release to restapi-v1.2.9

* fix: added releaseType

* ci(restapi): 🎉 cut beta release to restapi-v0.0.1-beta.0

* ci(restapi): 🎉 cut beta release to restapi-v0.0.1-beta.0

* ci(restapi): 🎉 cut release to restapi-v1.2.10

* ci(restapi): 🎉 cut release to restapi-v1.2.10

* ci(restapi): 🎉 cut beta release to restapi-v0.0.1-beta.1

* ci(restapi): 🎉 cut beta release to restapi-v0.0.1-beta.2

* ci(restapi): 🎉 cut beta release to restapi-v0.0.1-beta.2

---------

Co-authored-by: aman035 <[email protected]>

* fix: added pagination and deprecation tag (#346)

* fix: eip191v2 signatures for create and auth.update (#353)

* fix: changed Definitions for auth.update and upgrade (#351)

* fix: changed Definitions for auth.update and upgrade

* fix: chnaged demoreact

* fix: revert code no

* ci(restapi): 🎉 cut beta release to restapi-v0.0.1-alpha.0

* fix: iuser changed

* fix: sendVideoNotification and end video call logic (#367)

* feat(video): add create and request method

* feat(video): add simple-peer dependency

* feat(video): add acceptRequest method

* feat(video): add establish and end methods

* refactor(video): wrap video methods in a class

* feat(video): add video audio toggle functions

* fix(video): add pgp private key in send video call notification

* fix(video): fix end call logic and remove hidden ppt from send video call notifications

* ci(restapi): 🎉 cut beta release to restapi-v0.0.1-alpha.1

* Modify video class (#379)

* feat(video): add create and request method

* feat(video): add simple-peer dependency

* feat(video): add acceptRequest method

* feat(video): add establish and end methods

* refactor(video): wrap video methods in a class

* feat(video): add video audio toggle functions

* fix(video): add pgp private key in send video call notification

* fix(video): fix end call logic and remove hidden ppt from send video call notifications

* refactor(video): combine all the states in the Video class to single state

* ci(restapi): 🎉 cut beta release to restapi-v0.0.1-alpha.2

* fix: Replace arrow functions with normal functions in the Video class (#380)

* feat(video): add create and request method

* feat(video): add simple-peer dependency

* feat(video): add acceptRequest method

* feat(video): add establish and end methods

* refactor(video): wrap video methods in a class

* feat(video): add video audio toggle functions

* fix(video): add pgp private key in send video call notification

* fix(video): fix end call logic and remove hidden ppt from send video call notifications

* refactor(video): combine all the states in the Video class to single state

* fix(video): replace arrow functions with normal functions

---------

Co-authored-by: Madhur Gupta <[email protected]>

* ci(restapi): 🎉 cut beta release to restapi-v0.0.1-alpha.3

* fix: changed route

* fix: change profilePicture to picture

* fix: fixed tests

* fix: fix nftOwner and readme

* fix(video): separate react state from video class instance variable data (#389)

Co-authored-by: Madhur Gupta <[email protected]>

* ci(restapi): 🎉 cut beta release to restapi-v0.0.1-alpha.4

* fix: url fix

* ci(restapi): 🎉 cut beta release to restapi-v0.0.1-alpha.5

* fix: add video call retry logic upon error & doc: add video call in restapi/readme  (#391)

* docs(video): add video calls in restapi readme

* fix(video): add video call retry logic upon error

---------

Co-authored-by: Madhur Gupta <[email protected]>

* ci(restapi): 🎉 cut beta release to restapi-v0.0.1-alpha.6

* fix(video): remove status change upon connect in request (#394)

Co-authored-by: Madhur Gupta <[email protected]>

* ci(restapi): 🎉 cut beta release to restapi-v0.0.1-alpha.7

* fix: iuser changes

* Deployment (#390)

* ci(restapi): 🎉 cut release to restapi-v1.0.0

* fix(component): dummy

* ci(restapi): 🎉 cut release to restapi-v1.0.0

* fix(component): dummy

* ci(restapi): 🎉 cut release to restapi-v1.0.1

* ci(restapi): 🎉 cut release to restapi-v1.0.1

* fix(component): dummy

* ci(restapi): 🎉 cut release to restapi-v1.0.2

* fix(component): dummy

* ci(restapi): 🎉 cut release to restapi-v1.0.2

* fix(component): dummy

* ci(restapi): 🎉 cut release to restapi-v1.0.3

* fix: success progressHook

* ci(restapi): 🎉 cut release to restapi-v1.0.4

* ci(restapi): 🎉 cut release to restapi-v1.1.0

* ci(restapi): 🎉 cut release to restapi-v1.2.0

* ci(restapi): 🎉 cut release to restapi-v1.2.0

* ci(restapi): 🎉 cut release to restapi-v1.0.0

* fix(component): dummy

* fix(component): dummy

* fix(component): dummy

* ci(restapi): 🎉 cut release to restapi-v1.0.2

* fix(component): dummy

* ci(restapi): 🎉 cut release to restapi-v1.0.3

* ci(restapi): 🎉 cut release to restapi-v1.0.4

* ci(restapi): 🎉 cut release to restapi-v1.2.1

* fix: local for local development (#295)

Co-Authored-By: aman035 <[email protected]>

* fix: version update

* ci(restapi): 🎉 cut release to restapi-v1.2.2

* ci(restapi): 🎉 cut release to restapi-v1.2.3

* ci(restapi): 🎉 cut release to restapi-v1.2.4

* ci(restapi): 🎉 cut release to restapi-v1.2.5

* ci(restapi): 🎉 cut release to restapi-v1.2.6

* ci(restapi): 🎉 cut release to restapi-v1.2.7

* ci(socket): 🎉 cut release to socket-v0.5.0

* fix: test commit

* ci(restapi): 🎉 cut release to restapi-v1.2.8

* ci(uiweb): 🎉 cut release to uiweb-v1.0.0

* ci(uiweb): 🎉 cut release to uiweb-v1.0.0

* ci(uiweb): 🎉 cut release to uiweb-v1.0.1

* fix: added ci-version-beta

* fix: added ci-version-beta

* ci(restapi): 🎉 cut beta release to restapi-v1.2.9

* fix: added releaseType

* ci(restapi): 🎉 cut beta release to restapi-v0.0.1-beta.0

* ci(restapi): 🎉 cut beta release to restapi-v0.0.1-beta.0

* ci(restapi): 🎉 cut release to restapi-v1.2.10

* ci(restapi): 🎉 cut release to restapi-v1.2.10

* ci(restapi): 🎉 cut beta release to restapi-v0.0.1-beta.1

* ci(restapi): 🎉 cut release to restapi-v1.2.11

* fix: linkedListHash test cases removed & CI version corrected

* fix: update name to beta

* ci(restapi): 🎉 cut release to restapi-v1.2.12

* ci(restapi): 🎉 cut release to restapi-v1.2.12

* ci(restapi): 🎉 cut release to restapi-v1.2.13

* ci(restapi): 🎉 cut release to restapi-v1.2.14

* ci(restapi): 🎉 cut release to restapi-v1.2.15

* fix: update package json

* fix: updated socket version

* ci(uiweb): 🎉 cut release to uiweb-v1.0.2

* fix: socket lib update

* ci(uiweb): 🎉 cut release to uiweb-v1.0.2

---------

Co-authored-by: aman035 <[email protected]>

* fix: add deprecated info to chat.chat (#392)

* fix: show hardcoded msg rather than throwing error (#388)

* docs: add push video backend example (#396)

* docs(video): add backend exmaple for push video

* fix(video): add backend compatibility to create function

---------

Co-authored-by: Madhur Gupta <[email protected]>

* fix(video): set trickle to true while creating peer instance (#397)

Co-authored-by: Madhur Gupta <[email protected]>

* ci(restapi): 🎉 cut beta release to restapi-v0.0.1-alpha.8

* docs: update

* fix: fix decprecated param and verification of keys

* fix(video): turn off trickle while creating peer instance (#398)

Co-authored-by: Madhur Gupta <[email protected]>

* ci(restapi): 🎉 cut beta release to restapi-v0.0.1-alpha.9

* fix: added deprecated info to history (#399)

* ci(restapi): 🎉 cut beta release to restapi-v0.0.1-alpha.10

* revert(getverificationproof): add wallet and env params to getVerificationProof (#403)

Co-authored-by: Madhur Gupta <[email protected]>

* fix(video): remove stop audio/video logic from create function (#404)

Co-authored-by: Madhur Gupta <[email protected]>

* fix: changed additionalMeta structure (#406)

* docs: update

* docs: update

* fix: changed additionalMeta strcuture

---------

Co-authored-by: strykerin <[email protected]>

* ci(restapi): 🎉 cut beta release to restapi-v0.0.1-alpha.11

* fix: added enums

* fix: fix versions

* fix(sendvideonotifications): modify additional meta acc to new std (#407)

* ci(restapi): 🎉 cut beta release to restapi-v0.0.1-alpha.12

* fix(types): remove bad import

* ci(restapi): 🎉 cut beta release to restapi-v0.0.1-alpha.11

* fix(video): fix enableAudio

* ci(restapi): 🎉 cut beta release to restapi-v0.0.1-alpha.12

* fix: backward compatiblity fix

* ci(restapi): 🎉 cut beta release to restapi-v0.0.1-alpha.13

* docs: Update the enableVideo/Audio methods

* fix: fix nft videocall (#411)

---------

Co-authored-by: Shoaib Mohammed <[email protected]>
Co-authored-by: Madhur Gupta <[email protected]>
Co-authored-by: Madhur Gupta <[email protected]>
Co-authored-by: strykerin <[email protected]>
  • Loading branch information
5 people authored May 30, 2023
1 parent 3fff974 commit 4c0164d
Show file tree
Hide file tree
Showing 19 changed files with 1,147 additions and 1,459 deletions.
2 changes: 1 addition & 1 deletion packages/demoreact/src/app/ChatTest/GetUser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ const GetUserTest = () => {
) : null}
</div>
</SectionItem>
{connectedUser && (connectedUser as IUser).nftOwner !== null && (
{connectedUser && (connectedUser as IUser).did.split(':')[0] === 'nft' && (
<SectionItem style={{ marginTop: 20 }}>
<div>
{connectedUser ? <CodeFormatter>{password}</CodeFormatter> : null}
Expand Down
819 changes: 316 additions & 503 deletions packages/restapi/CHANGELOG.md

Large diffs are not rendered by default.

1,439 changes: 650 additions & 789 deletions packages/restapi/README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/restapi/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pushprotocol/restapi",
"version": "1.3.2",
"version": "0.0.1-alpha.13",
"type": "commonjs",
"publishConfig": {
"registry": "https://registry.npmjs.org/"
Expand Down
3 changes: 0 additions & 3 deletions packages/restapi/src/lib/chat/helpers/crypto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,6 @@ export const getEncryptedRequest = async (
user: receiverAddress,
publicKey: '',
encryptedPrivateKey: '',
encryptionType: '',
signature: 'pgp',
sigType: 'pgp',
env,
});
// If the user is being created here, that means that user don't have a PGP keys. So this intent will be in plaintext
Expand Down
77 changes: 12 additions & 65 deletions packages/restapi/src/lib/chat/helpers/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,13 @@ import {
walletType,
} from '../../types';
import { getEip191Signature } from './crypto';
import { populateDeprecatedUser } from '../../utils/populateIUser';

type CreateUserOptionsType = {
user: string;
wallet?: walletType;
name?: string;
nftOwner?: string | null;
encryptedPassword?: string | null;
publicKey?: string;
encryptedPrivateKey?: string;
encryptionType?: string;
signature?: string;
sigType?: string;
env?: ENV;
};

Expand All @@ -34,16 +29,13 @@ export const createUserService = async (options: CreateUserOptionsType) => {
wallet,
publicKey = '',
encryptedPrivateKey = '',
encryptionType = '',
env = Constants.ENV.PROD,
encryptedPassword = null,
nftOwner = null,
} = options || {};
let { user } = options || {};

const API_BASE_URL = getAPIBaseUrls(env);

const requestUrl = `${API_BASE_URL}/v1/users/`;
const requestUrl = `${API_BASE_URL}/v2/users/`;

if (isValidCAIP10NFTAddress(user)) {
const epoch = Math.floor(Date.now() / 1000);
Expand All @@ -56,33 +48,14 @@ export const createUserService = async (options: CreateUserOptionsType) => {
did: walletToPCAIP10(user),
publicKey,
encryptedPrivateKey,

// DEPRECATED in eip191v2

// encryptionType,
// name: '',
// encryptedPassword: encryptedPassword,
// nftOwner: nftOwner ? nftOwner.toLowerCase() : nftOwner,
};

const hash = generateHash(data);

const signatureObj = await getEip191Signature(wallet!, hash, 'v2');

// NOTE - To be removed after backend route changes
const updatedData = {
caip10: walletToPCAIP10(user),
did: walletToPCAIP10(user),
publicKey,
encryptedPrivateKey,
encryptionType,
name: '',
encryptedPassword: encryptedPassword,
nftOwner: nftOwner ? nftOwner.toLowerCase() : nftOwner,
};

const body = {
...updatedData,
...data,
...signatureObj,
};

Expand All @@ -91,12 +64,11 @@ export const createUserService = async (options: CreateUserOptionsType) => {
.then((response) => {
if (response.data)
response.data.publicKey = verifyPGPPublicKey(
response.data.encryptionType,
response.data.encryptedPrivateKey,
response.data.publicKey,
response.data.did,
response.data.nftOwner
response.data.did
);
return response.data;
return populateDeprecatedUser(response.data);
})
.catch((err) => {
console.error(`[Push SDK] - API ${requestUrl}: `, err);
Expand All @@ -110,62 +82,37 @@ export const authUpdateUserService = async (options: CreateUserOptionsType) => {
wallet,
publicKey = '',
encryptedPrivateKey = '',
encryptionType = '',
name = '',
encryptedPassword = null,
nftOwner = null,
env = Constants.ENV.PROD,
} = options || {};

const API_BASE_URL = getAPIBaseUrls(env);

const requestUrl = `${API_BASE_URL}/v1/users/${walletToPCAIP10(user)}/auth`;
const requestUrl = `${API_BASE_URL}/v2/users/${walletToPCAIP10(user)}/auth`;

const data = {
caip10: walletToPCAIP10(user),
did: walletToPCAIP10(user),
publicKey,
encryptedPrivateKey,

// DEPRECATED in eip191v2

// encryptionType,
// name,
// encryptedPassword,
// nftOwner: nftOwner ? nftOwner.toLowerCase() : nftOwner,
};

const hash = generateHash(data);

const signatureObj = await getEip191Signature(wallet!, hash, 'v2');

// NOTE - To be removed after backend route changes
const updatedData = {
caip10: walletToPCAIP10(user),
publicKey,
encryptedPrivateKey,
encryptionType,
name,
encryptedPassword,
nftOwner: nftOwner ? nftOwner.toLowerCase() : nftOwner,
};

const body = {
...updatedData,
...signatureObj,
};
// Exclude the "did" property from the "body" object
const { did, ...body } = { ...data, ...signatureObj };

return axios
.put(requestUrl, body)
.then((response) => {
if (response.data)
response.data.publicKey = verifyPGPPublicKey(
response.data.encryptionType,
response.data.encryptedPrivateKey,
response.data.publicKey,
response.data.did,
response.data.nftOwner
response.data.did
);
return response.data;
return populateDeprecatedUser(response.data);
})
.catch((err) => {
console.error(`[Push SDK] - API ${requestUrl}: `, err);
Expand Down
8 changes: 2 additions & 6 deletions packages/restapi/src/lib/chat/helpers/signature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ export const getTypedData = (
export const verifyProfileSignature = (
verificationProof: string,
signedData: string,
address: string,
nftOwner: string
address: string
): boolean => {
const SIG_TYPE_V2 = 'eip712v2';
const SIG_TYPE_V3 = 'eip191';
Expand Down Expand Up @@ -138,10 +137,7 @@ export const verifyProfileSignature = (
hashMessage(signedData),
signature
);
if (
recoveredAddress.toLowerCase() === address.toLowerCase() ||
recoveredAddress.toLowerCase() === nftOwner.toLowerCase()
) {
if (recoveredAddress.toLowerCase() === address.toLowerCase()) {
return true;
} else return false;
}
Expand Down
51 changes: 30 additions & 21 deletions packages/restapi/src/lib/helpers/crypto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ import {
IMessageIPFS,
ProgressHookType,
} from '../types';
import { isValidETHAddress, pCAIP10ToWallet } from './address';
import {
isValidCAIP10NFTAddress,
isValidETHAddress,
pCAIP10ToWallet,
} from './address';
import { verifyProfileSignature } from '../chat/helpers/signature';
import { upgrade } from '../user/upgradeUser';

Expand Down Expand Up @@ -575,30 +579,35 @@ export const preparePGPPublicKey = async (
};

export const verifyPGPPublicKey = (
encryptionType: string,
encryptedPrivateKey: string,
publicKey: string,
did: string,
nftOwner: string
did: string
): string => {
if (encryptionType && encryptionType !== Constants.ENC_TYPE_V1) {
const { key, signature: verificationProof } = JSON.parse(publicKey);
publicKey = key;
let signedData: string;
if (encryptionType === Constants.ENC_TYPE_V2)
signedData = 'Create Push Chat Profile \n' + generateHash(key);
else signedData = 'Create Push Profile \n' + generateHash(key);
if (
verifyProfileSignature(
verificationProof,
signedData,
pCAIP10ToWallet(did),
nftOwner ? pCAIP10ToWallet(nftOwner) : nftOwner
try {
if (publicKey !== '' && publicKey.includes('signature')) {
const { key, signature: verificationProof } = JSON.parse(publicKey);
publicKey = key;
let signedData: string;
if (verificationProof.includes('eip712'))
signedData = 'Create Push Chat Profile \n' + generateHash(key);
else signedData = 'Create Push Profile \n' + generateHash(key);
if (
verifyProfileSignature(
verificationProof,
signedData,
isValidCAIP10NFTAddress(did)
? pCAIP10ToWallet(JSON.parse(encryptedPrivateKey).owner)
: pCAIP10ToWallet(did)
)
)
)
return publicKey;
else throw new Error('Cannot verify Encryption Keys for this user');
return publicKey;
else throw new Error('Cannot Verify this publicKey Owner!!!');
}
return publicKey;
} catch (err) {
console.warn('Cannot Verify this publicKey Owner!!!');
return publicKey;
}
return publicKey;
};

export const validatePssword = (password: string) => {
Expand Down
58 changes: 52 additions & 6 deletions packages/restapi/src/lib/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,21 +169,67 @@ export interface IFeeds {
deprecatedCode?: string; // scope only at sdk level
}
export interface IUser {
msgSent: number;
maxMsgPersisted: number;
did: string;
wallets: string;
profilePicture: string | null;
publicKey: string;
profile: {
name: string | null;
desc: string | null;
picture: string | null;
profileVerificationProof: string | null;
};
encryptedPrivateKey: string;
publicKey: string;
verificationProof: string;

/**
* @deprecated Use `profile.name` instead.
*/
name: string | null;
/**
* @deprecated Use `profile.desc` instead.
*/
about: string | null;
/**
* @deprecated Use `profile.picture` instead.
*/
profilePicture: string | null;
/**
* @deprecated Use `msgSent` instead.
*/
numMsg: number;
/**
* @deprecated Use `maxMsgPersisted` instead.
*/
allowedNumMsg: number;
/**
* @deprecated Use `encryptedPrivateKey.version` instead.
*/
encryptionType: string;
/**
* @deprecated Use `verificationProof` instead.
*/
signature: string;
/**
* @deprecated Use `verificationProof` instead.
*/
sigType: string;
about: string | null;
name: string | null;
/**
* @deprecated Use `encryptedPrivateKey.encryptedPassword` instead.
*/
encryptedPassword: string | null;
/**
* @deprecated
*/
nftOwner: string | null;
numMsg: number;
allowedNumMsg: number;
/**
* @deprecated Not recommended to be used anywhere
*/
linkedListHash?: string | null;
/**
* @deprecated Not recommended to be used anywhere
*/
nfts?: [] | null;
}

Expand Down
7 changes: 0 additions & 7 deletions packages/restapi/src/lib/user/auth.updateUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,8 @@ export const update = async (options: AuthUpdateProps): Promise<IUser> => {
const body = {
user: user.did,
wallet,
name: user.name ? user.name : '',
encryptedPassword: null,
nftOwner:
pgpEncryptionVersion === ENCRYPTION_TYPE.NFTPGP_V1
? walletToPCAIP10((await signer?.getAddress()) as string)
: null, // check for nft,
publicKey: signedPublicKey,
encryptedPrivateKey: JSON.stringify(encryptedPgpPrivateKey),
encryptionType: pgpEncryptionVersion,
env,
};

Expand Down
5 changes: 0 additions & 5 deletions packages/restapi/src/lib/user/createUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,7 @@ export const create = async (options: CreateUserProps): Promise<IUser> => {
wallet,
publicKey: publicKey,
encryptedPrivateKey: JSON.stringify(encryptedPrivateKey),
encryptionType: encryptionType,
env,
nftOwner:
encryptionType === Constants.ENC_TYPE_V4
? walletToPCAIP10((await signer?.getAddress()) as string)
: null, // check for nft
};

// Report Progress
Expand Down
Loading

0 comments on commit 4c0164d

Please sign in to comment.