Skip to content

Commit c185c3b

Browse files
glaubinixnaderman
andcommitted
Apply suggestions from code review
Co-authored-by: Nils Adermann <n.adermann@packagist.com>
1 parent 2c48566 commit c185c3b

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

docs/composer-authentication.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,26 @@ The token grants the user access to all organizations and subrepositories they a
1212

1313
### Organization authentication tokens
1414
Admins and owners of an organization can create additional tokens on the organization settings page.
15-
Organization authentication tokens are ideal for automated systems like your CI environment or deployments.
15+
Organization authentication tokens are ideal for automated systems like your CI environment or deployments. A token's access can be restricted to any set of packages which any of the organization's teams has access to.
1616

17-
If your organization uses subrepository then you can also create additional tokens in subrepositories.
17+
If your organization uses subrepositories then you can also create additional tokens in subrepositories.
1818
Tokens created in the organization settings do not grant you access to any of your subrepositories and tokens created in
1919
a subrepository only grant you access to the subrepository the token was created in.
2020

2121
#### Read-only vs update tokens
22-
There are two kinds of organization authentication tokens, read-only and update tokens.
23-
Read-only tokens aren't suitable to run `composer update` as they do not allow automatic mirroring for new packages.
24-
If you need to run `composer update` then either use a token with update access or your personal access token.
22+
There are two kinds of organization authentication tokens: read-only and update tokens.
23+
Read-only tokens are only meant to be used with an existing composer.lock file. So they are not suitable to run `composer update` and running `composer install` without a composr.lock file is the same as running `composer update`. They do not allow automatic mirroring of new packages and thus may prevent updating to latest versions if these add any new requirements.
24+
If you need to run `composer update`, then either use a token with update access or your personal access token.
2525
Please note that you will be charged for authentication tokens with update access as if they were user accounts.
2626

27-
### Private Packagist for Vendors customer tokens
27+
### Private Packagist vendor customer tokens
2828
Every Private Packagist for Vendors customer receives their own authentication token.
29-
The token can only be used to install packages for the matching customer URL.
29+
The token can only be used to install packages from the matching customer URL.
3030

3131
Please note that neither user tokens nor organization tokens can be used to install packages from a customer URL.
3232

3333
## Token format
34-
An authentication token consists of three parts: a prefix, a 60 hexadecimal character long random part, and an eight hexadecimal character long checksum.
34+
An authentication token consists of three parts: a prefix, a 60 hexadecimal character long random part, and an eight hexadecimal character long checksum. The prefix and checksum are designed to increase reliability of automatic scanning for secrets in your code base or leaked documents.
3535

3636
There are currently three different prefixes:
3737
* `packagist_ort_`: Organization tokens with read-only access
@@ -42,7 +42,6 @@ This format doesn't apply to authentication tokens generated for Private Packagi
4242
These tokens only consist of the 60 hexadecimal character random part.
4343

4444
### How to calculate the checksum
45-
To calculate the checksum of a token, calculate the CRC32 checksum using the prefix and random part, convert the number to hexadecimal
46-
and asserting that the checksum is exactly eight characters long.
45+
To calculate the checksum of a token, calculate the CRC32 checksum using the prefix and random part, and convert the number to hexadecimal while padding it to exactly 8 characters.
4746

4847
For example using PHP, you can use `substr(str_pad(dechex(crc32($prefix . $random)), 8, '0', STR_PAD_LEFT), 0, 8)`

0 commit comments

Comments
 (0)