Skip to content

Commit

Permalink
Merge pull request #257 from celo-org/soloseng/updated-docs
Browse files Browse the repository at this point in the history
Updated Docs
  • Loading branch information
soloseng authored Feb 9, 2024
2 parents 45a0f3b + 7363e69 commit e64f398
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 12 deletions.
2 changes: 2 additions & 0 deletions .changeset/nasty-elephants-juggle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/request_identifier.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ body:
- type: markdown
attributes:
value: |
In order to add support for the requested identifier, you can add support for the identifier [here](https://github.com/celo-org/celo-monorepo/blob/3c026a6a5d09e3ee5e2518547deba0fe77b40d53/packages/sdk/base/src/identifier.ts#L31) and open a PR.
In order to add support for the requested identifier, you can add support for the identifier [here](https://github.com/celo-org/social-connect/tree/main/packages/odis-identifiers/src/identifier.ts) and open a PR.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,9 @@ The following steps use the Celo [ContractKit](https://docs.celo.org/developer/c

| Type |
| :-------------------------------------------------------------------------------------------: |
| [ContractKit](examples/contractKit.ts) |
| [EthersJS (v5)](examples/ethers.ts) |
| [web3.js](examples/web3.ts) |
| [ContractKit](docs/examples/contractKit.ts) |
| [EthersJS (v5)](docs/examples/ethers.ts) |
| [web3.js](docs/examples/web3.ts) |
| [NextJS based web app (Phone Number)](https://github.com/celo-org/emisianto) |
| [NextJS based templated](https://github.com/celo-org/socialconnect-template) |
| [React Native App (Phone Number)](https://github.com/celo-org/SocialConnect-ReactNative-Demo) |
Expand Down Expand Up @@ -219,7 +219,7 @@ This where `prefix` comes into play, the `plainTextIdentifier alicecodes` can be

Moreover, it also helps in composability if dApps follow a standard and use prefix then the corresponding `obsfuscatedIdentifier` will be the same thus making it easier for dApps to lookup identifier verified by other issuers.

You can keep an eye on prefixes suggested by us [here](https://github.com/celo-org/celo-monorepo/blob/8505d060fef3db3b0ce0cadf2bb879512bb20534/packages/sdk/base/src/identifier.ts#L31).
You can keep an eye on prefixes suggested by us [here](https://github.com/celo-org/social-connect/tree/main/packages/odis-identifiers/src/identifier.ts#L25).

</details>

Expand Down
10 changes: 5 additions & 5 deletions docs/privacy.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Here is a concrete example:

Each identifier type has a corresponding prefix that is appended before the blinding and hashing. This prevents identifiers from different sources from having the same pepper (ie. if you have the same handle for twitter and instagram, the obfuscated identifier should be different for each).

These are the prefixes currently defined in the SDK. We are using [DID methods](https://w3c.github.io/did-spec-registries/#did-methods) as prefixes when they exist. We welcome PRs here and [in the SDK](https://github.com/celo-org/celo-monorepo/blob/master/packages/identity/src/odis/identifier.ts#L27-L34) if you'd like to add a new identifier type and prefix! You can also cast an arbitrary string as your prefix if you would like.
These are the prefixes currently defined in the SDK. We are using [DID methods](https://w3c.github.io/did-spec-registries/#did-methods) as prefixes when they exist. We welcome PRs here and [in the SDK](https://github.com/celo-org/social-connect/tree/main/packages/odis-identifiers/src/identifier.ts) if you'd like to add a new identifier type and prefix! You can also cast an arbitrary string as your prefix if you would like.

| Type | Prefix |
|---------|--------|
Expand Down Expand Up @@ -169,13 +169,13 @@ await OdisUtils.Identifier.getObfuscatedIdentifier(
// unblindedSignature: '9as8duf98as...df80u'
// }
```
*Source code for `getObfuscatedIdentifier` and other relevant functions [here](https://github.com/celo-org/celo-monorepo/blob/master/packages/identity/src/odis/identifier.ts)*
*Source code for `getObfuscatedIdentifier` and other relevant functions [here](https://github.com/celo-org/social-connect/tree/main/packages/identity/src/odis/identifier.ts)*

-------------

### Rate Limit

ODIS implements rate limiting on queries to prevent brute force attackers. Every account interacting with ODIS has a quota for the number of queries it can make.
ODIS implements rate limiting on queries to prevent brute force attackers. Every account interacting with ODIS has a quota for the number of queries it can make and each query decreases the quota by 1.

You can check how much quota is left on your account:

Expand All @@ -187,7 +187,7 @@ const { remainingQuota } = await OdisUtils.Quota.getPnpQuotaStatus(
);
```

You can increase the quota on your account by making a payment to the [`OdisPayments` contract](https://github.com/celo-org/celo-monorepo/blob/master/packages/protocol/contracts/identity/OdisPayments.sol). The cost per quota is 0.001 cUSD.
You can increase the quota on your account by making a payment to the [`OdisPayments` contract](https://github.com/celo-org/celo-monorepo/blob/master/packages/protocol/contracts/identity/OdisPayments.sol). The cost per query is 0.001 cUSD.

```ts
if (remainingQuota < 1) {
Expand Down Expand Up @@ -224,7 +224,7 @@ There are two authentication methods for your `AuthSigner` when interacting with
accountsContract.setAccountDataEncryptionKey(DEK_PUBLIC_KEY).send({from: issuerAddress})
```

Any key pair can be used as a DEK, but [this](https://github.com/celo-org/celo-monorepo/blob/0aea63826f8c7e7d2f3fe0c32eb314471e2c2f33/packages/sdk/cryptographic-utils/src/dataEncryptionKey.ts#L36-L54) or [this](https://github.com/celo-org/celo-monorepo/blob/0aea63826f8c7e7d2f3fe0c32eb314471e2c2f33/packages/sdk/cryptographic-utils/src/account.ts#L440-L459) function in [`@celo/cryptographic-utils`](https://www.npmjs.com/package/@celo/cryptographic-utils) can be used to generate the DEK. Or, using a private key, you can get the compressed public key using [ethers Signing Key](https://docs.ethers.org/v5/api/utils/signing-key/).
Any key pair can be used as a DEK, but [this](https://github.com/celo-org/developer-tooling/tree/master/packages/sdk/cryptographic-utils/src/dataEncryptionKey.ts#L36-L54) or [this](https://github.com/celo-org/developer-tooling/tree/master/packages/sdk/cryptographic-utils/src/account.ts#L444-L463) function in [`@celo/cryptographic-utils`](https://www.npmjs.com/package/@celo/cryptographic-utils) can be used to generate the DEK. Or, using a private key, you can get the compressed public key using [ethers Signing Key](https://docs.ethers.org/v5/api/utils/signing-key/).

The `EncryptionKeySigner` authentication method is preferred, since it doesn't require the user to access the wallet key that manages their funds. Also, when using the DEK for authentication, ODIS will also use the DEK as the blinding factor, so that ODIS identifies repeat queries and doesn’t charge additional quota. The tradeoff is that the extra computation when using the DEK can add a tiny bit of latency.

Expand Down
4 changes: 2 additions & 2 deletions packages/odis-identifiers/src/identifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ export const PEPPER_SEPARATOR = '__'
* these prefixes prevent the ODIS identifers from being the same.
*
* If you would like to use a prefix that isn't included, please put up a PR
* adding it to @celo/base (in celo-monorepo/packages/sdk/base/src/identifier.ts)
* adding it to @celo/odis-identifiers (https://github.com/celo-org/social-connect/tree/main/packages/odis-identifiers/src/identifier.ts)
* to ensure interoperability with other projects. When adding new prefixes,
* please use either the full platform name in all lowercase (e.g. 'facebook')
* or DID methods https://w3c.github.io/did-spec-registries/#did-methods.
* Make sure to add the expected value for the unit test case in
* `celo-monorepo/packages/sdk/base/src/identifier.test.ts`,
* `https://github.com/celo-org/social-connect/tree/main/packages/odis-identifiers/src/identifier.test.ts`,
* otherwise the test will fail.
*
* The NULL prefix is included to allow projects to use the sdk without selecting
Expand Down

0 comments on commit e64f398

Please sign in to comment.