Skip to content

Commit

Permalink
Identity migration hotfix (#24)
Browse files Browse the repository at this point in the history
* add logs

* remove logs, bump version

* hotfix changelog

* hotfix snap types import
  • Loading branch information
lukachi authored Nov 29, 2023
1 parent 786e117 commit 4fa99f0
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 22 deletions.
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [1.0.0] - 2023-11-27
## [1.0.1] - 2023-11-29
### Fixed
- `@rarimo/rarime` - `identity` creation

## [1.0.0] - 2023-11-27
### Added
- `@rarimo/rarime` new dev dependencies:
- `@metamask/snaps-sdk`
Expand Down Expand Up @@ -117,7 +120,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Implemented `@rarimo/rarime-connector` and `@rarimo/rarime` packages

[Unreleased]: https://github.com/rarimo/rarime/compare/0.8.0...HEAD
[Unreleased]: https://github.com/rarimo/rarime/compare/1.0.1...HEAD
[1.0.1]: https://github.com/rarimo/rarime/compare/1.0.0...1.0.1
[1.0.0]: https://github.com/rarimo/rarime/compare/0.8.0...1.0.0
[0.8.0]: https://github.com/rarimo/rarime/compare/0.7.2...0.8.0
[0.7.2]: https://github.com/rarimo/rarime/compare/0.7.1...0.7.2
[0.7.1]: https://github.com/rarimo/rarime/compare/0.7.0...0.7.1
Expand Down
2 changes: 1 addition & 1 deletion packages/connector/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rarimo/rarime-connector",
"version": "1.0.0",
"version": "1.0.1",
"description": "Facilitates interaction between a DApp and RariMe MetaMask snap",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/connector/src/version.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "1.0.0"
"version": "1.0.1"
}
2 changes: 1 addition & 1 deletion packages/site/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "site",
"version": "1.0.0",
"version": "1.0.1",
"private": true,
"license": "(MIT-0 OR Apache-2.0)",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions packages/snap/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rarimo/rarime",
"version": "1.0.0",
"version": "1.0.1",
"description": "RariMe is a MetaMask Snap that safely holds any of your credentials and allows you to prove your identity without revealing any personal data. Powered by Rarimo Protocol and Zero-Knowledge Proof technology.",
"repository": {
"type": "git",
Expand Down Expand Up @@ -48,7 +48,7 @@
"@metamask/snaps-jest": "^4.0.0",
"@metamask/snaps-sdk": "^1.1.0",
"@metamask/snaps-utils": "^4.0.0",
"@rarimo/rarime-connector": "1.0.0",
"@rarimo/rarime-connector": "1.0.1",
"buffer": "6.0.3",
"dids": "4.0.4",
"ethers": "5.7.2",
Expand Down
4 changes: 2 additions & 2 deletions packages/snap/snap.manifest.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"version": "1.0.0",
"version": "1.0.1",
"description": "Securely store and manage all of your identity credentials. Use them across chains with ZK-protected privacy guarantees.",
"proposedName": "RariMe",
"repository": {
"type": "git",
"url": "https://github.com/rarimo/rarime.git"
},
"source": {
"shasum": "GZ36GgxHZWjfiaw8YRYo5VdzYaGa8VXv15la/1pSVCg=",
"shasum": "xmQkggEgEuYf4rN+OAmiJBYwMWS7Xy+SpIMkEsNU5e4=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
21 changes: 10 additions & 11 deletions packages/snap/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
// eslint-disable-next-line import/no-unassigned-import
import './polyfill';
import {
OnRpcRequestHandler,
copyable,
divider,
heading,
panel,
text,
} from '@metamask/snaps-sdk';
import { copyable, divider, heading, panel, text } from '@metamask/snaps-sdk';
import { RPCMethods } from '@rarimo/rarime-connector';
import { DID } from '@iden3/js-iden3-core';
import type { JsonRpcRequest } from '@metamask/utils';
import { Identity } from './identity';
import { getItemFromStore, setItemInStore } from './rpc';
import { CircuitId, StorageKeys } from './enums';
Expand Down Expand Up @@ -40,9 +34,12 @@ import {
import { GET_CREDENTIALS_SUPPORTED_HOSTNAMES } from './config';
import { getDecryptedCredentials } from './helpers/ceramic-helpers';

export const onRpcRequest: OnRpcRequestHandler = async ({
export const onRpcRequest = async ({
request,
origin,
}: {
request: JsonRpcRequest;
origin: string;
}) => {
if (request.method !== RPCMethods.CreateIdentity) {
await moveStoreVCtoCeramic();
Expand Down Expand Up @@ -93,7 +90,8 @@ export const onRpcRequest: OnRpcRequestHandler = async ({

case RPCMethods.CreateIdentity: {
const identityStorage = await getItemFromStore(StorageKeys.identity);
if (identityStorage) {

if (identityStorage?.did && identityStorage?.didBigInt) {
return {
identityIdString: identityStorage.did,
identityIdBigIntString: identityStorage.didBigInt,
Expand Down Expand Up @@ -123,13 +121,14 @@ export const onRpcRequest: OnRpcRequestHandler = async ({
: entropy;

const identity = await Identity.create(keyHex);

await setItemInStore(StorageKeys.identity, {
privateKeyHex: identity.privateKeyHex,
did: identity.didString,
didBigInt: identity.identityIdBigIntString,
});

snap.request({
await snap.request({
method: 'snap_dialog',
params: {
type: 'alert',
Expand Down
4 changes: 2 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6503,7 +6503,7 @@ __metadata:
languageName: node
linkType: hard

"@rarimo/[email protected].0, @rarimo/rarime-connector@workspace:^, @rarimo/rarime-connector@workspace:packages/connector":
"@rarimo/[email protected].1, @rarimo/rarime-connector@workspace:^, @rarimo/rarime-connector@workspace:packages/connector":
version: 0.0.0-use.local
resolution: "@rarimo/rarime-connector@workspace:packages/connector"
dependencies:
Expand Down Expand Up @@ -6540,7 +6540,7 @@ __metadata:
"@metamask/snaps-jest": ^4.0.0
"@metamask/snaps-sdk": ^1.1.0
"@metamask/snaps-utils": ^4.0.0
"@rarimo/rarime-connector": 1.0.0
"@rarimo/rarime-connector": 1.0.1
"@typechain/ethers-v5": 11.1.1
"@types/intl": 1.2.0
"@types/uuid": 9.0.2
Expand Down

0 comments on commit 4fa99f0

Please sign in to comment.