2.1.0 • Published 1 month ago

@rarimo/rarime v2.1.0

Weekly downloads
-
License
(MIT-0 OR Apache-...
Repository
github
Last release
1 month ago

RariMe

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.

Methods

Create an identity

To create an identity you need to call this method:

await window.ethereum.request({
  method: 'wallet_invokeSnap',
  params: {
  snapId: 'snapId',
    request: { method: 'create_identity' },
  },
});

Save Verifiable Credentials

To save Verifiable Credentials you need to call this method with params:

await window.ethereum.request({
  method: 'wallet_invokeSnap',
  params: {
    snapId: 'snapId',
    request: {
      method: 'save_credentials',
      params: {
        body: {
          credentials: [
            {
              description: 'Natural Person',
              id: '86531650-023c-4c6c-a437-a82e137ead68',
            },
          ],
          url: 'http://127.0.0.1:8000/integrations/issuer/v1/public/claims/offers/callback',
        },
        from: 'did:iden3:tJnRoZ1KqUPbsfVGrk8io51iqoRc5dGhj5LLMHSrD',
        id: '026035f6-42f6-4a2d-b516-0b11d2674850',
        thid: '348b7198-7cb1-46f4-bc0a-98a358f65539',
        to: 'did:iden3:tTxif8ahrSqRWavS8Qatrp4ZEJvPdu3ELSMgqTEQN',
        typ: 'application/iden3comm-plain-json',
        type: 'https://iden3-communication.io/credentials/1.0/offer',
      },
    },
  },
});

where:

  • id: request identifier
  • thid: ID of the message thread
  • from: identifier of the person from whom the offer was received
  • to: identifier of the person who received the offer
  • typ: media type of the message. In our case, it is the type of the protocol of the packed message application/iden3comm-plain-json
  • type: type of iden3comm protocol message
  • body - credentials0 - description: description of the schema - id: credential id - url: URL to which requested information is sent and response is received

Create a proof

Make sure you are on the correct network before creating a proof! Returns ZKProof for off-chain and updateStateTx, statesMerkleData, ZKProof for on-chain To create a proof you need to call this method with params:

await window.ethereum.request({
  method: 'wallet_invokeSnap',
  params: {
    snapId: 'snapId',
    request: {
      method: 'create_proof',
      params: {
        circuitId: 'credentialAtomicQuerySigV2OnChain',
        issuerDid: 'did:iden3:[...]',
        accountAddress: '0x......',
        challenge: '1251760352881625298994789945427452069454957821390', // BigInt string
        query: {
          allowedIssuers: ['*'],
          credentialSubject: {
            isNatural: {
              $eq: 1,
            },
          },
          type: 'IdentityProviders',
        },
      },
    },
  },
});

where:

  • circuitId: type of proof
  • accountAddress(optional): Metamask user address for onchain proofs
  • issuerDid: did of the issuer trusted by the verifier
  • challenge(optional): text that will be signed
  • query - allowedIssuers: types of issuers allowed - *: all types of Issuers are allowed - context: URL for getting the vocabulary for the credential - type: type of credentials allowed - credentialSubject: query request to a query circuit

Create a backup

To create a backup of keys and credentials:

await window.ethereum.request({
  method: 'wallet_invokeSnap',
  params: {
  snapId: 'snapId',
    request: { method: 'create_backup' },
  },
});

Recovery from a backup

Recovering the identity and credentials from a backup:

await window.ethereum.request({
  method: 'wallet_invokeSnap',
  params: {
  snapId: 'snapId',
    request: { method: 'recover_backup' },
  },
});

Check state contract

Returns true if the state contract on current chain need to be synced:

await window.ethereum.request({
  method: 'wallet_invokeSnap',
  params: {
  snapId: 'snapId',
    request: {
      method: 'check_state_contract_sync'
    },
  },
});

Get Verifiable Credentials

  • Only supported domains

Return a list of Verifiable Credentials:

await window.ethereum.request({
  method: 'wallet_invokeSnap',
  params: {
  snapId: 'snapId',
    request: {
      method: 'get_credentials'
    },
  },
});

Testing

The snap comes with some basic tests, to demonstrate how to write tests for snaps. To test the snap, run yarn test in this directory. This will use @metamask/snaps-jest to run the tests in src/index.test.ts.

Notes

  • Babel is used for transpiling TypeScript to JavaScript, so when building with the CLI, transpilationMode must be set to localOnly (default) or localAndDeps.
2.1.0

1 month ago

2.1.0-rc.25

1 month ago

2.1.0-rc.24

1 month ago

2.1.0-rc.18

1 month ago

2.1.0-rc.19

1 month ago

2.1.0-rc.21

1 month ago

2.1.0-rc.22

1 month ago

2.1.0-rc.20

1 month ago

2.1.0-rc.16

2 months ago

2.1.0-rc.17

2 months ago

2.1.0-rc.311

2 months ago

2.1.0-rc.14

2 months ago

2.1.0-rc.15

2 months ago

2.1.0-rc.77

2 months ago

2.1.0-rc.13

2 months ago

2.1.0-rc.12

2 months ago

2.1.0-rc.11

2 months ago

2.1.0-rc.10

2 months ago

2.1.0-rc.6

2 months ago

2.1.0-rc.5

2 months ago

2.1.0-rc.9

2 months ago

2.1.0-rc.8

2 months ago

2.1.0-rc.7

2 months ago

2.1.0-rc.4

2 months ago

2.1.0-rc.2

3 months ago

2.1.0-rc.1

3 months ago

2.1.0-rc.3

3 months ago

2.1.0-rc.0

3 months ago

2.0.3

3 months ago

2.0.3-rc.0

3 months ago

2.0.2

3 months ago

2.0.2-rc.0

3 months ago

2.0.2-x.0

4 months ago

2.0.1

4 months ago

2.0.0

4 months ago

2.0.0-rc.6

4 months ago

2.0.0-rc.7

4 months ago

2.0.0-rc.8

4 months ago

2.0.0-rc.5

4 months ago

2.0.0-rc.4

4 months ago

2.0.0-rc.2

4 months ago

2.0.0-rc.3

4 months ago

2.0.0-rc.1

4 months ago

2.0.0-rc.0

5 months ago

1.0.2

5 months ago

1.1.0-rc.0

5 months ago

1.0.1

5 months ago

1.0.1-rc.0

5 months ago

1.0.0

6 months ago

1.0.0-rc.7

6 months ago

1.0.0-rc.5

6 months ago

1.0.0-rc.4

6 months ago

1.0.0-rc.3

6 months ago

1.0.0-rc.2

6 months ago

1.0.0-rc.1

6 months ago

1.0.0-rc.0

6 months ago

0.8.1-rc.0

7 months ago

0.8.0

7 months ago

0.7.2

7 months ago

0.7.1

7 months ago

0.7.0

7 months ago

0.6.0

7 months ago

0.5.0

7 months ago

0.4.0

8 months ago

0.3.2

8 months ago

0.3.1

8 months ago

0.3.0

8 months ago

0.2.0

8 months ago

0.1.0

9 months ago