{"id":15505474,"url":"https://github.com/aldavigdis/kennitala-gem","last_synced_at":"2026-01-28T16:03:48.987Z","repository":{"id":65751425,"uuid":"597062357","full_name":"aldavigdis/kennitala-gem","owner":"aldavigdis","description":"Process Icelandic kenntiala identification numbers in Ruby","archived":false,"fork":false,"pushed_at":"2024-10-28T18:30:38.000Z","size":42,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-04T08:39:30.460Z","etag":null,"topics":["gem","iceland","icelandic","kennitala","ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aldavigdis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"aldavigdis"}},"created_at":"2023-02-03T14:46:18.000Z","updated_at":"2024-07-18T11:54:48.000Z","dependencies_parsed_at":"2025-04-23T01:39:32.387Z","dependency_job_id":"370a2737-b9ca-42e8-97ac-8cab51374043","html_url":"https://github.com/aldavigdis/kennitala-gem","commit_stats":{"total_commits":9,"total_committers":1,"mean_commits":9.0,"dds":0.0,"last_synced_commit":"08c7ffc9a9475d15b912ae898f73262e9265877f"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/aldavigdis/kennitala-gem","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aldavigdis%2Fkennitala-gem","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aldavigdis%2Fkennitala-gem/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aldavigdis%2Fkennitala-gem/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aldavigdis%2Fkennitala-gem/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aldavigdis","download_url":"https://codeload.github.com/aldavigdis/kennitala-gem/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aldavigdis%2Fkennitala-gem/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28846767,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-28T15:15:36.453Z","status":"ssl_error","status_checked_at":"2026-01-28T15:15:13.020Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gem","iceland","icelandic","kennitala","ruby"],"created_at":"2024-10-02T09:23:38.643Z","updated_at":"2026-01-28T16:03:43.978Z","avatar_url":"https://github.com/aldavigdis.png","language":"Ruby","funding_links":["https://github.com/sponsors/aldavigdis"],"categories":[],"sub_categories":[],"readme":"# Kennitala\n\nProcess Icelandic kenntiala identification numbers.\n\nThe Gem provides a class to handle \"kennitala\" identifier codes and monkey patched the String class to that strings can be cast to Kennitala objects. The class can be used to sanitize the identifiers and read information like the date of birth (or date of registration in the case of companies and organization), age and the type of entity.\n\nThe class does not access external APIs or databases such as the National Registry or the Company Registry, so names and status (sex/gender, death, bankruptcy, credit rating etc.) cannot be accessed using the class. However, it can be used to sanitize and validate such data before being sent to external APIs, as such services are provided by private companies, which often charge a specific amount for each query.\n\n## Uses of kennitala\n\nUnlike the US Social Security number and equivalents, the kennitala is only used for identification of persons and companies (as well as other registered organizations) — and is often used internally by educational institutions, companies and other organization as a primary identifier for persons (e.g. school, employee, customer and frequent flyer ID). It is not to be used for authentication (i.e. a password) and is not considered a secret per se. While a kennitala can be kept unencrypted in a database, publishing a kennitala or a list of them is generally not considered good practice and might cause liability.\n\nA kennitala is assigned to every newborn person and foreign national residing in Iceland as well as organizations and companies operating there. It is statically assigned and can not be changed.\n\nArticle II, paragraph 10 of the 77/2000 Act on Data Protection (http://www.althingi.is/lagas/nuna/2000077.html) provides the legal framework regarding the use and processing of the kennitala in Iceland:\n\n\u003e The use of a kennitala is allowed if it has a an objective cause and is necessary to ensure reliable identification of persons. The Data Protection Authority may ban or order the use of kennitala.\n\n## Technicalities\n\nThe kennitala (`DDMMYY-RRCM`) is a 10-digit numeric string consisting on a date (date of birth for persons, date of registration for companies) in the form of `DDMMYY`, two random digits (`RR`) a check digit (`C`) and a century identifier (`M`). A hyphen or space is often added between the year and random values (Example: `010130-2989`).\n\nThe number 40 is added to the registration day of companies and organizations. Hence, a kennitala for a company registered at January 1 1990 starts with `410190` as opposed to `010190` for a person born that day.\n\nThe century identifier has 3 legal values. `8` for the 19th century, `9` for the 20th century and `0` for the 21st century.\n\n## Examples\n\n### Working with Kennitala objects\n\n```ruby\n# Initialize a Kennitala object.\n# The string provided may include spaces, hyphens and alphabetical characters,\n# which will then be erased from the resulting string.\nk = Kennitala.new(' 010130-2989')\n# =\u003e #\u003cKennitala:0x007fe35d041bc0 @value=\"0101302989\"\u003e\n\n# Invalid strings are rejected with an argument error\nf = Kennitala.new('010130-2979')\n# =\u003e ArgumentError: Kennitala is invalid\n\n# If no kennitala string is specified, a random one will be generated\nr = Kennitala.new\n# =\u003e #\u003cKennitala:0x007fc589339f18 @value=\"2009155509\"\u003e\n\n# Retrieve the kennitala as a string.\n# This is a sanitized string, without any non-numeric characters.\n# Pretty useful when storing it in a database.\nk.to_s\n# =\u003e \"0101302989\"\n\n# Pretty print the kennitala\n# Adds a space between the 6th and the 7th digits for readability\nk.pp\n# =\u003e \"010130 2989\"\n\n# You can also pass a string to .pp to use as a spacer\nk.pp('–')\n# =\u003e \"010130-2989\"\n\n# You can also pass a cat to the .pp method\nk.pp('🐈')\n# =\u003e \"010130🐈2989\"\n\n# Get the entity type (results in 'person' or 'company')\nk.entity_type\n# =\u003e \"person\"\n\n# It's also possible to use .company? and .person? to achieve the same thing\nk.company?\n# =\u003e false\n\nk.person?\n# =\u003e true\n\n# Cast the kennitala to a Date object\nk.to_date\n# =\u003e #\u003cDate: 1930-01-01 ((2425978j,0s,0n),+0s,2299161j)\u003e\n\n# Get the current age of the entity. Useful for age restrictions.\nk.age\n# =\u003e 86\n```\n\n### Casting strings\n\n```ruby\n# Casting a string to a Kennitala object\n'010130 2989'.to_kt\n# =\u003e #\u003cKennitala:0x007fc5893286a0 @value=\"0101302989\"\u003e\n\n# Get the current age based on a String\n'0101302989'.to_kt.age\n# =\u003e 86\n```\n\n## Installation\n\nInstall the gem and add to the application's Gemfile by executing:\n\n    $ bundle kennitala\n\nIf bundler is not being used to manage dependencies:\n\n    $ gem install kennitala\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/aldavigdis/kennitala-gem. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/aldavigdis/kennitala-gem/blob/master/CODE_OF_CONDUCT.md).\n\nDon't be afraid of using Rubocop for correcting your code and to make it conform to the standards defined in `.rubocop.yml`. You will want to run `bundle exec rubocop -A` to see if your code has any errors and correct them on the fly.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n## Code of Conduct\n\nEveryone interacting in the Kennitala project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/aldavigdis/kennitala-gem/blob/master/CODE_OF_CONDUCT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faldavigdis%2Fkennitala-gem","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faldavigdis%2Fkennitala-gem","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faldavigdis%2Fkennitala-gem/lists"}